⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zmdj.pas

📁 销售帐目管理
💻 PAS
📖 第 1 页 / 共 3 页
字号:
procedure TFrmZmDj.suiComboBox2Change(Sender: TObject);
var Str : String;
    Pos : Integer ;
begin
  Str := Trim(suiComboBox2.Text);
  Pos := AnsiPos('-',Str);
  if Pos <= 0 then
  begin
    P_SelectDwNo := -1 ;
    P_SelectDwMc := '未选择';
  end
  else
  begin
    P_SelectDwNo := StrToInt(Copy(Str,1,Pos-1));
    P_SelectDwMc := Copy(Str,Pos+1,Length(Str)-Pos);
  end;
end;

procedure TFrmZmDj.suiBtnSearchClick(Sender: TObject);
var SQLSyx : String;
begin
  if not CheckDataChg() then Abort ;
  SQLSyx := 'Select * from 基本合同信息表';
  if P_SelectSfNo > 0 then
     if AnsiPos('Where',SQLSyx) > 0 then
        SQLSyx := SQLSyx + ' And 省级编号 = ' +  IntToStr(P_SelectSfNo)
     else
        SQLSyx := SQLSyx + ' Where 省级编号 = ' + IntToStr(P_SelectSfNo);
  if P_SelectDwNo > 0 then
     if AnsiPos('Where',SQLSyx) > 0 then
        SQLSyx := SQLSyx + ' And 单位编号 = ' + IntToStr(P_SelectDwNo)
     else
        SQLSyx := SQLSyx + ' Where 单位编号 = ' + IntToStr(P_SelectDwNo);
  if suiCheckBox1.Checked then
     if AnsiPos('Where',SQLSyx) > 0 then
        SQLSyx := SQLSyx + ' And 签订日期 like ''' + Trim(suiEdit1.Text) + '%'''
     else
        SQLSyx := SQLSyx + ' Where 签订日期 like ''' + Trim(suiEdit1.Text)+'%''';
  SQLSyx := SQLSyx + ' Order By 合同编号';
  Label_SqlSyx.Caption := SQLSyx ;
  with DataModule1.qry_Jbhtqkb do
  begin
    Close ;
    SQL.Clear ;
    SQL.Add(SQLSyx);
    try
      Open ;
    except
      on E : Exception do
      begin
        with suiMessageDialog1 do
        begin
          ButtonCount := 1;
          Button1Caption := '确定';
          Caption := suiForm1.Caption ;
          Text := '查询错误:'+E.Message + Chr(10)+Chr(13)+'错误语法:'+SQLSyx ;
          IconType := suiStop ;
          ShowModal ;
        end;
      end;
    end;
  end;
end;

//==========增加合同
procedure TFrmZmDj.suiButton2Click(Sender: TObject);
begin
  suiDBGrid1.Enabled := False ;
  pnl_Search.Enabled := False ;
  with DataModule1.qry_Jbhtqkb do Append ;
  SetReadOnly2(pnl3,False ,clWhite);
  suiDBEdit18.SetFocus ;
end;

//==========修改基本合同
procedure TFrmZmDj.suiButton3Click(Sender: TObject);
begin
  suiDBGrid1.Enabled := False ;
  pnl_Search.Enabled := False ;
  with DataModule1.qry_Jbhtqkb do Edit ;
  SetReadOnly2(pnl3,False ,clWhite);
  suiDBEdit18.SetFocus ;
end;

//==========删除基本合同
procedure TFrmZmDj.suiButton4Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '所对应的所有其它信息[收款情况、附加合同、发货情况、开票情况]将全部被删除,是否继续?';
    if ShowModal = MrNo then Exit ;
  end;
  with DataModule1.qry_Jbhtqkb do
  begin
    Delete ;
    Next ;
    suiDBGrid1.Enabled := not UpdatesPending ;
    pnl_Search.Enabled := not UpdatesPending ;
  end;
  SetReadOnly2(pnl3, True, suiForm1.Color);
end;

//=========撤销基本合同编辑
procedure TFrmZmDj.suiButton5Click(Sender: TObject);
begin
  suiDBGrid1.Enabled := False ;
  pnl_Search.Enabled := False ;
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否撤销基本合同信息的编辑?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.qry_Jbhtqkb.CancelUpdates ;
  SetReadOnly2(pnl3, True, suiForm1.Color);
{  DBGridEh1.Enabled := True ;
  pnl_Search.Enabled := True ;}
end;

//========保存基本合同
procedure TFrmZmDj.suiButton6Click(Sender: TObject);
begin
  with DataModule1 do
  begin
    qry_Jbhtqkb.Next ;
    if not qry_Jbhtqkb.UpdatesPending then
    begin
      suiDBGrid1.Enabled := True ;
      pnl_Search.Enabled := True ;
      Exit ;
    end;
    with suiMessageDialog1 do
    begin
      ButtonCount := 2 ;
      Button1Caption := '是';
      Button1ModalResult := mrYes ;
      Button2Caption := '否';
      Button2ModalResult := mrNo ;
      IconType := suiHelp ;
      Caption := suiForm1.Caption ;
      Text := '是否保存基本合同信息的编辑?';
      if ShowModal = MrNo then
      begin
        qry_Jbhtqkb.CancelUpdates ;
        pnl_Search.Enabled := True ;
        suiDBGrid1.Enabled := True ;
        suiBtnNext.Enabled := qry_Jbhtqkb.RecordCount > 0 ;
        Exit ;
      end;
    end;
    try
      db1.StartTransaction ;
      qry_Jbhtqkb.ApplyUpdates ;
      qry_Jbhtqkb.CommitUpdates ;
      db1.Commit ;
      qry_jbhtqkb.Close ;
      qry_jbhtqkb.Open ;
      qry_jbhtqkb.Last ;
      suiBtnNext.Enabled := qry_Jbhtqkb.RecordCount > 0 ;
    except
      on E : Exception do
      begin
        with suiMessageDialog1 do
        begin
          ButtonCount := 1;
          Button1Caption := '确定';
          IconType := suiStop ;
          Caption := suiForm1.Caption ;
          Text := '数据错误无法保存:'+E.Message ;
          ShowModal ;
          Abort ;
        end;
      end;
    end;
  end;
  suiDBGrid1.Enabled := True ;
  pnl_Search.Enabled := True ;
  SetReadOnly2(pnl3, True, suiForm1.Color);
end;

//========增加附加合同信息
procedure TFrmZmDj.suiButton7Click(Sender: TObject);
begin
  with DataModule1.tbl_Fjhtqkb do Append ;
  SetReadOnly2(pnl5,False ,clWhite);
  suiDBLookupComboBox2.SetFocus ;
end;

//========修改附加合同
procedure TFrmZmDj.suiButton8Click(Sender: TObject);
begin
  with DataModule1.tbl_Fjhtqkb do Edit ;
  SetReadOnly2(pnl5,False ,clWhite);
  suiDBLookupComboBox2.SetFocus ;
end;

//========删除附加合同信息
procedure TFrmZmDj.suiButton9Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否删除附加合同信息?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.tbl_Fjhtqkb.Delete ;
  SetReadOnly2(pnl5, True, suiForm1.Color);
end;

//=========撤销附加合同变更
procedure TFrmZmDj.suiButton10Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否撤销附加合同信息的编辑?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.tbl_Fjhtqkb.Cancel ;
  SetReadOnly2(pnl5, True, suiForm1.Color);
end;

//=========是否保存附加合同变更
procedure TFrmZmDj.suiButton11Click(Sender: TObject);
begin
  with DataModule1 do
  begin
    tbl_Fjhtqkb.Next ;
    if not tbl_Fjhtqkb.UpdatesPending then Exit ;
    with suiMessageDialog1 do
    begin
      ButtonCount := 2 ;
      Button1Caption := '是';
      Button1ModalResult := mrYes ;
      Button2Caption := '否';
      Button2ModalResult := mrNo ;
      IconType := suiHelp ;
      Caption := suiForm1.Caption ;
      Text := '是否保存附加合同信息的编辑?';
      if ShowModal = MrNo then
      begin
        tbl_Fjhtqkb.CancelUpdates ;
        Exit ;
      end;
    end;
    try
      db1.StartTransaction ;
      tbl_Fjhtqkb.ApplyUpdates ;
      tbl_Fjhtqkb.CommitUpdates ;
      db1.Commit ;
    except
      on E : Exception do
      begin
        with suiMessageDialog1 do
        begin
          ButtonCount := 1;
          Button1Caption := '确定';
          IconType := suiStop ;
          Caption := suiForm1.Caption ;
          Text := '数据错误无法保存:'+E.Message ;
          ShowModal ;
        end;
      end;
    end;
  end;
  SetReadOnly2(pnl5, True, suiForm1.Color);
end;

//========增加发货情况
procedure TFrmZmDj.suiButton12Click(Sender: TObject);
begin
  with DataModule1.tbl_Fhqkb do Append ;
  SetReadOnly2(pnl7,False ,clWhite);
  suiDBLookupComboBox3.SetFocus ;
end;

//=========修改发货情况
procedure TFrmZmDj.suiButton13Click(Sender: TObject);
begin
  with DataModule1.tbl_Fhqkb do Edit ;
  SetReadOnly2(pnl7,False ,clWhite);
  suiDBLookupComboBox3.SetFocus ;
end;

//========删除发货情况
procedure TFrmZmDj.suiButton14Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否删除附加发货信息?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.tbl_Fhqkb.Delete ;
  SetReadOnly2(pnl7, True, suiForm1.Color);
end;

//========撤销发货情况编辑
procedure TFrmZmDj.suiButton15Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否撤销发货信息的编辑?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.tbl_Fhqkb.Cancel ;
  SetReadOnly2(pnl7, True, suiForm1.Color);
end;

//========保存发货情况编辑
procedure TFrmZmDj.suiButton16Click(Sender: TObject);
begin
  with DataModule1 do
  begin
    tbl_Fhqkb.Next ;
    if not tbl_Fhqkb.UpdatesPending then Exit ;
    with suiMessageDialog1 do
    begin
      ButtonCount := 2 ;
      Button1Caption := '是';
      Button1ModalResult := mrYes ;
      Button2Caption := '否';
      Button2ModalResult := mrNo ;
      IconType := suiHelp ;
      Caption := suiForm1.Caption ;
      Text := '是否保存发货情况信息的编辑?';
      if ShowModal = MrNo then
      begin
        tbl_Fhqkb.CancelUpdates ;
        Exit ;
      end;
    end;
    try
      db1.StartTransaction ;
      tbl_Fhqkb.ApplyUpdates ;
      tbl_Fhqkb.CommitUpdates ;
      db1.Commit ;
    except
      on E : Exception do
      begin
        with suiMessageDialog1 do
        begin
          ButtonCount := 1;
          Button1Caption := '确定';
          IconType := suiStop ;
          Caption := suiForm1.Caption ;
          Text := '数据错误无法保存:'+E.Message ;
          ShowModal ;
        end;
      end;
    end;
  end;
  SetReadOnly2(pnl7, True, suiForm1.Color);
end;

//==========增加开票信息
procedure TFrmZmDj.suiButton17Click(Sender: TObject);
begin
  with DataModule1.tbl_Kpqkb do Append ;
  SetReadOnly2(pnl9,False ,clWhite);
  suiDBEdit10.SetFocus ;
end;

//==========修改开票情况
procedure TFrmZmDj.suiButton18Click(Sender: TObject);
begin
  with DataModule1.tbl_Kpqkb do Edit ;
  SetReadOnly2(pnl9,False ,clWhite);
  suiDBEdit10.SetFocus ;
end;

//==========删除开票情况
procedure TFrmZmDj.suiButton19Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否删除开票信息?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.tbl_Kpqkb.Delete ;
  SetReadOnly2(pnl9, True, suiForm1.Color);
end;

//==========撤销开票情况
procedure TFrmZmDj.suiButton20Click(Sender: TObject);
begin
  with suiMessageDialog1 do
  begin
    ButtonCount := 2 ;
    Button1Caption := '是';
    Button1ModalResult := mrYes ;
    Button2Caption := '否';
    Button2ModalResult := mrNo ;
    IconType := suiHelp ;
    Caption := suiForm1.Caption ;
    Text := '是否撤销开票信息的编辑?';
    if ShowModal = MrNo then Exit ;
  end;
  DataModule1.tbl_Kpqkb.Cancel ;
  SetReadOnly2(pnl9, True, suiForm1.Color);
end;

//============保存开票情况
procedure TFrmZmDj.suiButton21Click(Sender: TObject);
begin
  with DataModule1 do
  begin
    tbl_Kpqkb.Next ;
    if not tbl_Kpqkb.UpdatesPending then Exit ;
    with suiMessageDialog1 do
    begin
      ButtonCount := 2 ;
      Button1Caption := '是';
      Button1ModalResult := mrYes ;
      Button2Caption := '否';
      Button2ModalResult := mrNo ;
      IconType := suiHelp ;
      Caption := suiForm1.Caption ;
      Text := '是否保存开票情况信息的编辑?';
      if ShowModal = MrNo then
      begin
        tbl_Kpqkb.CancelUpdates ;
        Exit ;
      end;
    end;
    try
      db1.StartTransaction ;
      tbl_Kpqkb.ApplyUpdates ;
      tbl_Kpqkb.CommitUpdates ;
      db1.Commit ;
    except
      on E : Exception do
      begin
        with suiMessageDialog1 do
        begin
          ButtonCount := 1;
          Button1Caption := '确定';
          IconType := suiStop ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -