unit u_ch_check_shen; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, u_ch_add_do, u_ch_delete_do, StdCtrls, DBCtrls, wwdblook, ComCtrls, bsSkinTabs, RxLookup, bsSkinCtrls, bsdbctrls, Mask, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, Menus, XPMenu, wwdbdatetimepicker, wwdbedit, Wwdotdot, Wwdbcomb, kbmMemTable, bsSkinBoxCtrls, DBCtrlsEh; type Tfrm_ch_check_shen = class(TForm) bsSkinPanel2: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinNotebook1: TbsSkinNotebook; dxdbgrid1: TdxDBGrid; bsSkinPanel1: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; Label25: TLabel; Label17: TLabel; Label18: TLabel; Label12: TLabel; DBEdit14: TDBEdit; DBEdit1: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; fra_ch_add_do1: Tfra_ch_add_do; t_ch_check: TADOQuery; t_ch_check1: TDataSource; t_ch_fee_do: TADOQuery; dxdbgrid1Column1: TdxDBGridMaskColumn; dxdbgrid1Column2: TdxDBGridMaskColumn; dxdbgrid1Column3: TdxDBGridMaskColumn; dxdbgrid1Column4: TdxDBGridMaskColumn; dxdbgrid1Column5: TdxDBGridMaskColumn; dxdbgrid1Column9: TdxDBGridMaskColumn; dxdbgrid1Column10: TdxDBGridMaskColumn; dxdbgrid1Column11: TdxDBGridDateColumn; dxdbgrid1Column12: TdxDBGridMaskColumn; dxdbgrid1Column13: TdxDBGridDateColumn; dxdbgrid1Column14: TdxDBGridMaskColumn; dxdbgrid1Column15: TdxDBGridDateColumn; dxdbgrid1Column6: TdxDBGridColumn; dxdbgrid1Column7: TdxDBGridColumn; dxdbgrid1Column8: TdxDBGridColumn; Label2: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; DBEdit2: TDBEdit; Label4: TLabel; DBEdit4: TDBEdit; Label5: TLabel; Label3: TLabel; DBEdit6: TDBEdit; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; Label1: TLabel; DBEdit3: TDBEdit; Label10: TLabel; DBMemo1: TDBMemo; fra_ch_delete_do1: Tfra_ch_delete_do; Label6: TLabel; DBEdit7: TDBEdit; dxdbgrid1Column16: TdxDBGridColumn; Label7: TLabel; DBEdit8: TDBEdit; XPMenu1: TXPMenu; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; dxdbgrid1Column17: TdxDBGridColumn; wwDBDateTimePicker1: TwwDBDateTimePicker; Label8: TLabel; wwDBComboBox1: TwwDBComboBox; PopupMenu3: TPopupMenu; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N1: TMenuItem; N6: TMenuItem; N5: TMenuItem; N4: TMenuItem; bsSkinButton12: TbsSkinButton; bsSkinButton7: TbsSkinButton; dxdbgrid1Column18: TdxDBGridColumn; dxdbgrid1Column19: TdxDBGridColumn; bsSkinPanel4: TbsSkinPanel; Label9: TLabel; Label11: TLabel; Label13: TLabel; Label14: TLabel; Label16: TLabel; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label23: TLabel; Label24: TLabel; Label26: TLabel; DBEdit5: TDBEdit; DBEdit9: TDBEdit; RxDBLookupCombo3: TRxDBLookupCombo; DBEdit10: TDBEdit; DBEdit11: TDBEdit; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; DBEdit13: TDBEdit; DBMemo2: TDBMemo; DBEdit15: TDBEdit; DBEdit16: TDBEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBComboBox2: TwwDBComboBox; t_ch_checkDSDesigner: TStringField; t_ch_checkDSDesigner2: TStringField; t_ch_checkDSDesigner3: TStringField; t_ch_checkDSDesigner4: TStringField; t_ch_checkDSDesigner5: TStringField; t_ch_checkDSDesigner6: TBCDField; t_ch_checkDSDesigner7: TBCDField; t_ch_checkDSDesigner8: TBCDField; t_ch_checkDSDesigner9: TStringField; t_ch_checkDSDesigner10: TBooleanField; t_ch_checkDSDesigner11: TStringField; t_ch_checkDSDesigner12: TDateTimeField; t_ch_checkDSDesigner13: TStringField; t_ch_checkDSDesigner14: TDateTimeField; t_ch_checkDSDesigner15: TStringField; t_ch_checkDSDesigner16: TDateTimeField; t_ch_checkDSDesigner17: TStringField; t_ch_checkDSDesigner18: TStringField; t_ch_checkDSDesigner19: TStringField; t_ch_checkDSDesigner20: TStringField; t_ch_checkDSDesigner21: TDateTimeField; t_ch_checkDSDesigner22: TBCDField; t_ch_checkDSDesigner23: TBCDField; t_ch_checkField: TFloatField; t_ch_checkField2: TFloatField; dxdbgrid1Column20: TdxDBGridColumn; dxdbgrid1Column21: TdxDBGridColumn; dxdbgrid1Column22: TdxDBGridCheckColumn; memtblprint1: TDataSource; memtblprint: TkbmMemTable; t_ch_checkDSDesigner24: TBooleanField; bsSkinButton38: TbsSkinButton; dxdbgrid1Column23: TdxDBGridColumn; t_ch_checkDSDesigner25: TDateTimeField; DBEdit12: TDBEdit; dxdbgrid1Column24: TdxDBGridColumn; t_ch_checkDSDesigner26: TSmallintField; PopupMenu1: TPopupMenu; MenuItem4: TMenuItem; MenuItem5: TMenuItem; N21: TMenuItem; N22: TMenuItem; N20: TMenuItem; N2: TMenuItem; N3: TMenuItem; wwDBDateTimePicker3: TwwDBDateTimePicker; Label15: TLabel; DBEdit17: TDBEdit; Label19: TLabel; DBComboBoxEh1: TDBComboBoxEh; Label27: TLabel; t_ch_checkDSDesigner27: TDateTimeField; t_ch_checkDSDesigner28: TStringField; t_ch_checkDSDesigner29: TStringField; dxdbgrid1Column25: TdxDBGridColumn; dxdbgrid1Column26: TdxDBGridColumn; DBEdit18: TDBEdit; wwDBDateTimePicker4: TwwDBDateTimePicker; Label29: TLabel; Label28: TLabel; Label30: TLabel; DBComboBoxEh2: TDBComboBoxEh; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure t_ch_checkAfterInsert(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure t_ch_checkBeforePost(DataSet: TDataSet); procedure DBEdit4Enter(Sender: TObject); procedure t_ch_checkBeforeEdit(DataSet: TDataSet); procedure bsSkinButton6Click(Sender: TObject); procedure t_ch_checkAfterPost(DataSet: TDataSet); procedure RxDBLookupCombo1Enter(Sender: TObject); procedure dxdbgrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure DBEdit1Change(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure t_ch_checkAfterDelete(DataSet: TDataSet); procedure DBEdit14KeyPress(Sender: TObject; var Key: Char); procedure DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure bsSkinDBCheckRadioBox1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit4KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure DBEdit6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit8KeyPress(Sender: TObject; var Key: Char); procedure DBEdit3KeyPress(Sender: TObject; var Key: Char); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure dxdbgrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7KeyPress(Sender: TObject; var Key: Char); procedure bsSkinPanel2Resize(Sender: TObject); procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton12Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N6Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure RxDBLookupCombo3Enter(Sender: TObject); procedure DBEdit11Enter(Sender: TObject); procedure t_ch_checkCalcFields(DataSet: TDataSet); procedure bsSkinButton38Click(Sender: TObject); procedure DBEdit12Change(Sender: TObject); procedure N20Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure fra_ch_add_do1bsSkinButton1Click(Sender: TObject); procedure fra_ch_add_do1bsSkinButton10Click(Sender: TObject); procedure DBComboBoxEh1DropDown(Sender: TObject); procedure DBComboBoxEh2DropDown(Sender: TObject); procedure fra_ch_add_do1MenuItem1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var ch_check_shen_open:boolean; frm_ch_check_shen: Tfrm_ch_check_shen; implementation uses u_main, u_ch_shen_query, my_sys_function, u_data_share; {$R *.dfm} procedure Tfrm_ch_check_shen.FormClose(Sender: TObject; var Action: TCloseAction); begin ch_check_shen_open:=false; savereggrid(dxdbgrid1,caption); savereggrid(fra_ch_add_do1.dxDBGrid19,caption); frm_ch_check_shen.Hide; frm_ch_check_shen.ManualFloat(frm_ch_check_shen.BoundsRect ); frm_main.freeTabs('frm_ch_check_shen'); action:=cafree; frm_ch_check_shen:=nil; end; procedure Tfrm_ch_check_shen.FormShow(Sender: TObject); begin bsSkinNotebook1.PageIndex:=0; // dxdbgrid1.ShowGroupPanel:=true; t_ch_check.Close; t_ch_check.SQL.clear; t_ch_check.SQL.Add('select * from t_ch_check where 申请状态 not in ('+''''+'批准支付'+'''' +','+''''+'支付完毕'+''''+') and ' +open_data('1003','申请人','no','no','no','no') +'order by 申请编号 desc'); t_ch_check.open; ch_check_shen_open:=true; //多业务是否合并 if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.TabIndex:=0; // fra_ch_add_do1.bsSkinButton11.Caption:='付费申请'; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet5; end else begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.ActivePage:=fra_ch_add_do1.bsSkinTabSheet1; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=False; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=false; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet1; end; //多业务是否合并 费用明细数据集 if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard.sql.add('select * from v_fee_do_bscard ' +'where 工作编号=:申请编号 order by 编号,费用名称'); fra_ch_delete_do1.v_fee_do_bscard.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_bscard.Open; fra_ch_delete_do1.v_fee_do_bscard_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_bscard ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_bscard_sum.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_bscard_sum.Open; end else begin fra_ch_delete_do1.v_fee_do_seae.SQL.clear; fra_ch_delete_do1.v_fee_do_seae.sql.add('select * from v_fee_do_seae ' +'where 工作编号=:申请编号 order by 编号,费用名称'); fra_ch_delete_do1.v_fee_do_seae.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_seae.Open; fra_ch_delete_do1.v_fee_do_seai.SQL.clear; fra_ch_delete_do1.v_fee_do_seai.sql.add('select * from v_fee_do_seai ' +'where 工作编号=:申请编号 order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seai.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_seai.Open; fra_ch_delete_do1.v_fee_do_aire.SQL.clear; fra_ch_delete_do1.v_fee_do_aire.sql.add('select * from v_fee_do_aire ' +'where 工作编号=:申请编号 order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_aire.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_aire.Open; fra_ch_delete_do1.v_fee_do_airi.SQL.clear; fra_ch_delete_do1.v_fee_do_airi.sql.add('select * from v_fee_do_airi ' +'where 工作编号=:申请编号 order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_airi.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_airi.Open; fra_ch_delete_do1.v_fee_do_seae_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seae_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seae ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seae_sum.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_seae_sum.Open; fra_ch_delete_do1.v_fee_do_seai_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seai_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seai ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seai_sum.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_seai_sum.Open; fra_ch_delete_do1.v_fee_do_aire_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_aire_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_aire ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_aire_sum.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_aire_sum.Open; fra_ch_delete_do1.v_fee_do_airi_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_airi_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_airi ' +'where 工作编号=:申请编号 group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_airi_sum.DataSource:=t_ch_check1; fra_ch_delete_do1.v_fee_do_airi_sum.Open; end; fra_ch_add_do1.do_ban1.DataSet:=t_ch_check; fra_ch_add_do1.wwDBComboBox31.text:='付'; fra_ch_add_do1.bs_text.text:='2'; fra_ch_add_do1.t_ch_fee_do.open; fra_ch_delete_do1.bs_text.Text:='2'; fra_ch_delete_do1.do_ban1.DataSet:=t_ch_check; loadreggrid(dxdbgrid1,false,caption); loadreggrid(fra_ch_add_do1.dxDBGrid19,false,caption); //是否双币结算 if StrToBool(get_parameters_value(83,'false')) then begin dxdbgrid1.ColumnByFieldName('币别').Visible:=false; dxdbgrid1.ColumnByFieldName('申请金额').Visible:=False; dxdbgrid1.ColumnByFieldName('实际金额').Visible:=false; dxdbgrid1.ColumnByFieldName('虚开金额').Visible:=False; dxdbgrid1.ColumnByFieldName('美元申请金额').Visible:=false; dxdbgrid1.ColumnByFieldName('人民币申请金额').Visible:=false; dxdbgrid1.ColumnByFieldName('美元金额').Visible:=True; dxdbgrid1.ColumnByFieldName('人民币金额').Visible:=True; bsSkinPanel4.Visible:=true; fra_ch_add_do1.bsSkinPanel12.Visible:=true; end else begin dxdbgrid1.ColumnByFieldName('币别').Visible:=True; dxdbgrid1.ColumnByFieldName('申请金额').Visible:=true; dxdbgrid1.ColumnByFieldName('实际金额').Visible:=True; dxdbgrid1.ColumnByFieldName('虚开金额').Visible:=True; dxdbgrid1.ColumnByFieldName('美元申请金额').Visible:=True; dxdbgrid1.ColumnByFieldName('人民币申请金额').Visible:=True; dxdbgrid1.ColumnByFieldName('美元金额').Visible:=False; dxdbgrid1.ColumnByFieldName('人民币金额').Visible:=False; bsSkinPanel4.Visible:=False; fra_ch_add_do1.bsSkinPanel12.Visible:=false; end; if not if_open('343') then begin N2.Visible:=false; N3.Visible:=false; end; frm_data_share.t_crm_client_all.requery; frm_data_share.t_code_currency.requery; end; procedure Tfrm_ch_check_shen.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin if t_ch_check.IsEmpty then exit; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end else begin if (t_ch_check.State=dsinsert)or(t_ch_check.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_ch_check.post; end; if answer=mrNo then begin t_ch_check.cancel; end; if answer=mrCancel then begin exit; end; END; bsSkinNotebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_ch_check_shen.t_ch_checkAfterInsert(DataSet: TDataSet); begin t_ch_check['申请状态']:='申请支付'; t_ch_check['申请人']:=employee; t_ch_check['申请日期']:=now; t_ch_check['要求支付日期']:=now; t_ch_check['自动']:=1; t_ch_check['申请金额']:=0; t_ch_check['实际金额']:=0; t_ch_check['虚开金额']:=0; t_ch_check['人民币金额']:=0; t_ch_check['美元金额']:=0; t_ch_check['是否打印']:=0; t_ch_check['支付方式']:='支票'; // t_ch_check['申请编号']:=get_no(date,'CS'); end; procedure Tfrm_ch_check_shen.bsSkinButton1Click(Sender: TObject); begin t_ch_check.insert; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end; procedure Tfrm_ch_check_shen.bsSkinButton2Click(Sender: TObject); begin table_post(t_ch_check); end; procedure Tfrm_ch_check_shen.bsSkinButton4Click(Sender: TObject); begin if t_ch_check.IsEmpty then exit; if (t_ch_check.FieldByName('申请状态').asstring='批准支付')or (t_ch_check.FieldByName('申请状态').asstring='禁止修改')or (t_ch_check.FieldByName('申请状态').asstring='支付完毕')or (t_ch_check.FieldByName('申请状态').asstring='提交申请')or (t_ch_check.FieldByName('申请状态').asstring='申请修改')then begin showmessage('当前业务操作的状态不允许删除!!'); exit; end; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)=IDOK then begin bsSkinNotebook1.PageIndex:=0; t_ch_fee_do.open; while not t_ch_fee_do.eof do t_ch_fee_do.delete; t_ch_fee_do.close; t_ch_check.Delete; end; end; procedure Tfrm_ch_check_shen.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_ch_check); end; procedure Tfrm_ch_check_shen.t_ch_checkBeforePost(DataSet: TDataSet); begin table_before_post(t_ch_check,'客户名称'); if not StrToBool(get_parameters_value(83,'false')) then table_before_post(t_ch_check,'币别'); table_before_post(t_ch_check,'要求支付日期'); t_ch_check['申请金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_check['申请金额']); t_ch_check['实际金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_check['实际金额']); t_ch_check['虚开金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_check['虚开金额']); t_ch_check['美元金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_check['美元金额']); t_ch_check['人民币金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_check['人民币金额']); if (t_ch_check.state=dsinsert) and (trim(t_ch_check.FieldByName('申请编号').AsString)='') then begin t_ch_check['申请编号']:=get_no(date,'CS'); end; // t_ch_check['申请编号']:=get_no(date,'CS'); if t_ch_check.FieldByName('自动').asboolean then begin t_ch_check['申请金额']:=t_ch_check['实际金额']; end else begin { if t_ch_check['申请金额']'申请编号'then t_ch_check.fields[i].value := afield[i] ; end; t_ch_check['相关号码']:=''; t_ch_check['申请状态']:='申请支付'; t_ch_check['申请人']:=employee; t_ch_check['申请日期']:=now; t_ch_check['自动']:=1; t_ch_check['申请金额']:=0; t_ch_check['实际金额']:=0; t_ch_check['虚开金额']:=0; t_ch_check['审核人']:=''; t_ch_check['审核日期']:=null; t_ch_check['开出人']:=''; t_ch_check['开出日期']:=null; t_ch_check['支票抬头']:=''; t_ch_check['申请原因']:=''; t_ch_check['帐单编号']:=''; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; except if t_ch_check.state=dsinsert then t_ch_check.cancel; showmessage('复制添加失败!!'); end; end; procedure Tfrm_ch_check_shen.RxDBLookupCombo3Enter(Sender: TObject); begin if StrToBool(get_parameters_value(85,'false')) then begin if fra_ch_delete_do1.v_fee_do_bscard.IsEmpty then begin RxDBLookupCombo3.ReadOnly:=false; end else begin RxDBLookupCombo3.ReadOnly:=true; end; end else begin if fra_ch_delete_do1.v_fee_do_seae.IsEmpty and fra_ch_delete_do1.v_fee_do_seai.IsEmpty and fra_ch_delete_do1.v_fee_do_aire.IsEmpty and fra_ch_delete_do1.v_fee_do_airi.IsEmpty then begin RxDBLookupCombo3.ReadOnly:=false; end else begin RxDBLookupCombo3.ReadOnly:=true; end; end; end; procedure Tfrm_ch_check_shen.DBEdit11Enter(Sender: TObject); begin if bsSkinDBCheckRadioBox2.Checked then DBEdit11.ReadOnly:=true else DBEdit11.ReadOnly:=false; end; procedure Tfrm_ch_check_shen.t_ch_checkCalcFields(DataSet: TDataSet); begin //单币别时计算字段 if dataset.FieldByName('币别').AsString='USD' then begin dataset.FieldByName('美元申请金额').AsFloat:=dataset.fieldbyname('申请金额').AsFloat; dataset.FieldByName('人民币申请金额').AsFloat:=0; end else begin dataset.FieldByName('人民币申请金额').AsFloat:=dataset.fieldbyname('申请金额').AsFloat; dataset.FieldByName('美元申请金额').AsFloat:=0; end; end; procedure Tfrm_ch_check_shen.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin if t_ch_check.IsEmpty then exit; book1:=t_ch_check.GetBookmark; t_ch_check.Requery; t_ch_check.GotoBookmark(book1); end; procedure Tfrm_ch_check_shen.DBEdit12Change(Sender: TObject); begin bsSkinButton6.Caption:='提交审核'; if t_ch_check.State in [dsinsert] then exit; if t_ch_check.IsEmpty then exit; if t_ch_check.FieldByName('申请状态').AsString='提交申请' then begin bsSkinButton6.Caption:='撤销申请'; end else begin bsSkinButton6.Caption:='提交审核'; end; end; procedure Tfrm_ch_check_shen.N20Click(Sender: TObject); var aQuery:TAdoQuery; strbs,strwt,strmb:WideString; begin //打印付费申请 if t_ch_check.IsEmpty then exit; table_post(t_ch_check); if strtobool(get_parameters_value(120,'false')) and t_ch_check['是否打印'] then begin MessageDlg('此申请支付已经打印过,不能重复打印!',mtWarning,[mbOk],0); exit; end; if strtobool(get_parameters_value(123,'false')) then begin if t_ch_check['是否打印'] then begin MessageDlg('此申请支付已经打印过,不能重复打印!',mtWarning,[mbOk],0); exit; end; if (t_ch_check['申请状态']<>'批准支付') then begin MessageDlg('此状态不能打印!',mtWarning,[mbOk],0); exit; end; end; if strtobool(get_parameters_value(27,'false'))then begin if (t_ch_check.FieldByName('申请状态').asstring='提交申请')or (t_ch_check.FieldByName('申请状态').asstring='驳回申请')or (t_ch_check.FieldByName('申请状态').asstring='申请支付')or (t_ch_check.FieldByName('申请状态').asstring='批准修改')then begin if application.MessageBox('打印后你就不可以进行更改了,你确认打印吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try modify_all:=true; t_ch_check.Edit; t_ch_check['申请状态']:='批准支付'; t_ch_check['审核人']:=employee; t_ch_check['审核日期']:=now; t_ch_check['是否打印']:=1; t_ch_check.FieldByName('打印次数').AsInteger:=t_ch_check.FieldByName('打印次数').AsInteger+1; t_ch_check.post; finally modify_all:=false; end; end; end else begin if strtobool(get_parameters_value(120,'false')) then begin if MessageDlg('打印后你就不能进行修改和打印了,你确认打印吗',mtwarning,mbOKCancel,0)=mrOk then begin end else begin exit; end; end else begin end; end; try modify_all:=true; t_ch_check.Edit; t_ch_check['是否打印']:=1; t_ch_check.FieldByName('打印次数').AsInteger:=t_ch_check.FieldByName('打印次数').AsInteger+1; t_ch_check.post; finally modify_all:=false; end; //生成编号列表数据集 memtblprint.close; memtblprint.Open; aQuery:=CreateAdoQuery; try with aQuery do begin Close;SQL.Clear; sql.Add('select distinct 委托编号,业务编号,主提单号 from v_op_bscard where 编号 in (select 业务编号 from t_ch_fee_do where 工作编号='''+t_ch_check['申请编号']+''')'); Open; first; while not eof do begin if strwt='' then strwt:=fieldbyname('委托编号').AsString else strwt:=strwt+'/'+fieldbyname('委托编号').AsString; if strbs='' then strbs:=fieldbyname('业务编号').AsString else strbs:=strbs+'/'+fieldbyname('业务编号').AsString; if strmb='' then strmb:=fieldbyname('主提单号').AsString else strmb:=strmb+'/'+fieldbyname('主提单号').AsString; Next; end; memtblprint.Edit; memtblprint.fieldbyname('bsno').AsString:=strbs; memtblprint.fieldbyname('wtno').AsString:=strwt; memtblprint.fieldbyname('mblno').AsString:=strmb; memtblprint.post; end; finally FreeAndNil(aQuery); end; if StrToBool(get_parameters_value(85,'false')) then begin sys_print('业务支付申请',TMenuItem(Sender).tag,t_ch_check1,memtblprint1,nil,nil,fra_ch_delete_do1.v_fee_do_bscard1,nil,nil,nil,t_ch_check1,nil,nil); end else sys_print('业务支付申请',TMenuItem(Sender).tag,t_ch_check1,memtblprint1,nil,nil,fra_ch_delete_do1.v_fee_do_seae1,fra_ch_delete_do1.v_fee_do_seai1,fra_ch_delete_do1.v_fee_do_aire1,fra_ch_delete_do1.v_fee_do_airi1,t_ch_check1,nil,nil); end; procedure Tfrm_ch_check_shen.N3Click(Sender: TObject); begin //取消打印次数 try modify_all:=true; t_ch_check.Edit; t_ch_check['是否打印']:=0; t_ch_check.FieldByName('打印次数').AsInteger:=0; t_ch_check.post; finally modify_all:=false; end; end; procedure Tfrm_ch_check_shen.fra_ch_add_do1bsSkinButton1Click( Sender: TObject); begin fra_ch_add_do1.bsSkinButton1Click(Sender); end; procedure Tfrm_ch_check_shen.fra_ch_add_do1bsSkinButton10Click( Sender: TObject); begin fra_ch_add_do1.bsSkinButton10Click(Sender); end; procedure Tfrm_ch_check_shen.DBComboBoxEh1DropDown(Sender: TObject); var aQuery:TADOQuery; begin DBComboBoxEh1.Items.Clear; aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select distinct 发票抬头 from t_ch_check'); SQL.Add('where 发票抬头<>'''' '); SQL.Add('order by 发票抬头'); Open; First; while not Eof do begin DBComboBoxEh1.Items.Add(FieldByName('发票抬头').AsString); Next; end; finally Close; FreeAndNil(aQuery); end; end; procedure Tfrm_ch_check_shen.DBComboBoxEh2DropDown(Sender: TObject); var aQuery:TADOQuery; begin DBComboBoxEh2.Items.Clear; aQuery:=CreateAdoQuery; with aQuery do try Close;SQL.Clear; SQL.Add('select distinct 发票抬头 from t_ch_check'); SQL.Add('where 发票抬头<>'''' '); SQL.Add('order by 发票抬头'); Open; First; while not Eof do begin DBComboBoxEh2.Items.Add(FieldByName('发票抬头').AsString); Next; end; finally Close; FreeAndNil(aQuery); end; end; procedure Tfrm_ch_check_shen.fra_ch_add_do1MenuItem1Click(Sender: TObject); begin fra_ch_add_do1.MenuItem1Click(Sender); end; end.