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

📄 zmdj.pas

📁 销售帐目管理
💻 PAS
📖 第 1 页 / 共 3 页
字号:
          Caption := suiForm1.Caption ;
          Text := '数据错误无法保存:'+E.Message ;
          ShowModal ;
        end;
      end;
    end;
  end;
  SetReadOnly2(pnl9, True, suiForm1.Color);
end;

//===========增加附加开票情况
procedure TFrmZmDj.suiButton22Click(Sender: TObject);
begin
  with DataModule1.tbl_Fjkpqkb do Append ;
  SetReadOnly2(pnl11,False ,clWhite);
  suiDBLookupComboBox4.SetFocus ;
end;

//===========编辑附加开票情况
procedure TFrmZmDj.suiButton23Click(Sender: TObject);
begin
  with DataModule1.tbl_Fjkpqkb do Edit ;
  SetReadOnly2(pnl11,False ,clWhite);
  suiDBLookupComboBox4.SetFocus ;
end;

//===========删除附加开票情况
procedure TFrmZmDj.suiButton24Click(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_Fjkpqkb.Delete ;
  SetReadOnly2(pnl11, True, suiForm1.Color);
end;

//========撤销附加开票情况
procedure TFrmZmDj.suiButton25Click(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_Fjkpqkb.Cancel ;
  SetReadOnly2(pnl11, True, suiForm1.Color);
end;

//===========保存附加开票情况
procedure TFrmZmDj.suiButton26Click(Sender: TObject);
begin
  with DataModule1 do
  begin
    tbl_Fjkpqkb.Next ;
    if not tbl_Fjkpqkb.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_Fjkpqkb.CancelUpdates ;
        Exit ;
      end;
    end;
    try
      db1.StartTransaction ;
      tbl_Fjkpqkb.ApplyUpdates ;
      tbl_Fjkpqkb.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(pnl11, True, suiForm1.Color);
end;

//=========缩回检测附加开票情况的数据变动
procedure TFrmZmDj.suiSideChannel1Push(Sender: TObject);
begin
  suiButton26.OnClick(Self);//保存附加开票情况
end;

//=========伸出来检测附加开票情况的变动
procedure TFrmZmDj.suiSideChannel1Pop(Sender: TObject);
begin
  suiSideChannel1.Width := pnl9.Width ;
  suiButton21.OnClick(Self);//保存开票情况
end;

//=========增加收款情况
procedure TFrmZmDj.suiButton27Click(Sender: TObject);
begin
  with DataModule1.tbl_Skqkb do Append ;
  SetReadOnly2(pnl13,False ,clWhite);
  suiDBEdit15.SetFocus ;
end;

//=========编辑收款情况
procedure TFrmZmDj.suiButton28Click(Sender: TObject);
begin
  with DataModule1.tbl_Skqkb do Edit ;
  SetReadOnly2(pnl13,False ,clWhite);
  suiDBEdit15.SetFocus ;
end;

//=========删除收款情况
procedure TFrmZmDj.suiButton29Click(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_Skqkb.Delete ;
  SetReadOnly2(pnl13, True, suiForm1.Color);
end;

//=========撤销收款情况
procedure TFrmZmDj.suiButton30Click(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_Skqkb.Cancel ;
  SetReadOnly2(pnl13, True, suiForm1.Color);
end;

//==========保存收款情况
procedure TFrmZmDj.suiButton31Click(Sender: TObject);
begin
  with DataModule1 do
  begin
    tbl_Skqkb.Next ;
    if not tbl_Skqkb.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_Skqkb.CancelUpdates ;
        Exit ;
      end;
    end;
    try
      db1.StartTransaction ;
      tbl_Skqkb.ApplyUpdates ;
      tbl_Skqkb.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(pnl13, True, suiForm1.Color);
end;

procedure TFrmZmDj.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose := CheckDataChg() ;
end;

//============当选择的省份改变时改变合同编号
procedure TFrmZmDj.suiDBLookupComboBox5CloseUp(Sender: TObject);
var Str,tmpSf,BmStr,tmpstr,sss : String;
    PosPrefix,PosSpace,i : Integer ;
begin
  if suiDBEdit1.ReadOnly then Exit ;
  Str := Trim(DataModule1.qry_Jbhtqkb.FieldByName('省级名称').AsString) ;
  if Str = '' then Exit ;
  tmpSf := Copy(Str,1,P_BmDigSf);//有新的省份
  BmStr := Trim(suiDBEdit1.Field.AsString);
  if BmStr = '' then//如果编码为空
  begin
    Inc(P_Xlh);
    tmpstr := '';
    for i := 1 to P_BmDigXlh do tmpstr := tmpstr + '0';
    suiDBEdit1.Field.AsString := P_BmPrefix + tmpSf + P_BmSpace +
                                 P_BmYear + P_BmMonth +
                                 FormatFloat(tmpstr,P_Xlh);
  end
  else
  begin
    PosPrefix := AnsiPos(P_BmPrefix,BmStr);
    PosSpace  := AnsiPos(P_BmSpace+P_BmYear,BmStr);
    if ((PosPrefix <= 0) or (PosSpace <= 0)) then
    begin
      with suiMessageDialog1 do
      begin
        ButtonCount := 1;
        Button1Caption := '确定';
        IconType := suiStop ;
        Caption := suiForm1.Caption ;
        Text := '无效的合同编号!' ;
        ShowModal ;
      end;
      suiDBEdit1.SetFocus ;
      Abort ;
    end;
    sss := Copy(BmStr,Length(P_BmPrefix)+1,PosSpace - Length(P_BmPrefix) - 1);
    if sss <> tmpSf then
    begin
      BmStr := P_BmPrefix + tmpSf + Copy(BmStr,PosSpace , Length(BmStr)-PosSpace+1);
      suiDBEdit1.Field.AsString := BmStr ;
    end;
  end;
end;

//========判断基本合同情况表日期合法性
procedure TFrmZmDj.suiDBEdit4Exit(Sender: TObject);
var Str : String;
begin
  Str := Trim(suiDBEdit4.Text);
  if Str = '' then Exit ;
  try
    StrToDate(Str);
  except
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '无效的时间格式,正确格式为‘YYYY-MM-DD’!' ;
      ShowModal ;
    end;
    suiDBEdit4.SetFocus ;
  end;
end;

//===========发货情况日期合法性检测
procedure TFrmZmDj.suiDBEdit9Exit(Sender: TObject);
var Str : String;
begin
  Str := Trim(suiDBEdit9.Text);
  if Str = '' then Exit ;
  try
    StrToDate(Str);
  except
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '无效的时间格式,正确格式为‘YYYY-MM-DD’!' ;
      ShowModal ;
    end;
    suiDBEdit9.SetFocus ;
  end;
end;

//===========开票日期合法性检测
procedure TFrmZmDj.suiDBEdit12Exit(Sender: TObject);
var Str : String;
begin
  Str := Trim(suiDBEdit12.Text);
  if Str = '' then Exit ;
  try
    StrToDate(Str);
  except
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '无效的时间格式,正确格式为‘YYYY-MM-DD’!' ;
      ShowModal ;
    end;
    suiDBEdit12.SetFocus ;
  end;
end;

//===========收款日期合法性检测
procedure TFrmZmDj.suiDBEdit15Exit(Sender: TObject);
var Str : String;
begin
  Str := Trim(suiDBEdit4.Text);
  if Str = '' then Exit ;
  try
    StrToDate(Str);
  except
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '无效的时间格式,正确格式为‘YYYY-MM-DD’!' ;
      ShowModal ;
    end;
    suiDBEdit4.SetFocus ;
  end;
end;

procedure TFrmZmDj.suiBtnNextClick(Sender: TObject);
var Str : String;
    SavePlace : TBookmark ;
begin
  try
    SavePlace := DataModule1.qry_Jbhtqkb.GetBookmark ;
    if not CheckDataChg then Exit ;
{    if DataModule1.qry_jbhtqkb.UpdatesPending then
    begin
       with suiMessageDialog1 do
       begin
         ButtonCount := 1 ;
         Button1Caption := '确定';
         Button2Caption := '否';
         Button1ModalResult := mrOk ;
         IconType := suiWarning ;
         Caption := suiForm1.Caption ;
         Text := '请您保存所编辑的数据!';
         ShowModal ;
         DataModule1.qry_Jbhtqkb.GotoBookmark(SavePlace);
         DataModule1.qry_Jbhtqkb.FreeBookmark(SavePlace);
         Exit ;
       end;
    end;}
    DataModule1.qry_Jbhtqkb.GotoBookmark(SavePlace);
  finally
    DataModule1.qry_Jbhtqkb.FreeBookmark(SavePlace);
  end;
  suiDBGrid1.Enabled := True ;
  pnl_Search.Enabled := True ;
  SetReadOnly2(pnl3, True ,suiForm1.Color);
  Str := Trim(DataModule1.qry_Jbhtqkb.FieldByName('合同编号').AsString) ;
  if Str = '' then
  begin
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '请您选择一份合同后再进行下一步操作!' ;
      ShowModal ;
    end;
  end;
  nb1.PageIndex := 1 ;
  suiPageControl1.ActivePageIndex := 0 ;
end;

procedure TFrmZmDj.suiBtnPriorClick(Sender: TObject);
var SavePlace : TBookmark ;
begin
  try
    SavePlace := DataModule1.qry_Jbhtqkb.GetBookmark ;
    if not CheckDataChg() then Exit ;
    DataModule1.qry_Jbhtqkb.GotoBookmark(SavePlace);
  finally
    DataModule1.qry_Jbhtqkb.FreeBookmark(SavePlace);
  end;
  nb1.PageIndex := 0 ;
end;

procedure TFrmZmDj.suiCheckBox1Click(Sender: TObject);
begin
  suiEdit1.Enabled := suiCheckBox1.Checked ;
  if suiCheckBox1.Checked then suiEdit1.SetFocus ;
end;

//========自动计算收款时间
procedure TFrmZmDj.suiDBComboBox1Exit(Sender: TObject);
var tmpDate1,tmpdate2 : TDate ;
    Str1,Str2,sjdw : string ;
    Year,Month,Day : Word ;
    yxq : Integer ;
begin
  if suiDBComboBox1.ReadOnly then Exit ;
  Str1 := Trim(suiDBEdit18.Text);
  try
    yxq := suiDBEdit3.Field.AsInteger ;
  except
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '无效的有效期,请正确填写!' ;
      ShowModal ;
      Exit ;
    end;
  end;
  sjdw := Trim(suiDBComboBox1.Text);
  if Str1 = '' then Exit ;
  try
    tmpDate1 := StrToDate(Str1);
  except
    with suiMessageDialog1 do
    begin
      ButtonCount := 1;
      Button1Caption := '确定';
      IconType := suiStop ;
      Caption := suiForm1.Caption ;
      Text := '无效的时间格式,正确格式为‘YYYY-MM-DD’!' ;
      ShowModal ;
    end;
    suiDBEdit18.SetFocus ;
    Exit ;
  end;
  if sjdw = '年' then
     tmpdate2 := IncYear(tmpDate1,yxq)
  else if sjdw = '月' then
     tmpdate2 := IncMonth(tmpDate1,yxq)
  else if sjdw = '日' then
     tmpdate2 := IncDay(tmpDate1,yxq)
  else tmpdate2 := tmpDate1 ;
  suiDBEdit4.Field.AsString := FormatDateTime('YYYY-MM-DD',tmpdate2);
end;

end.

⌨️ 快捷键说明

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