unit u_ch_fee_check_seae_match; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, bsSkinCtrls, wwdblook, RxLookup, bsSkinBoxCtrls, wwdbdatetimepicker, StdCtrls, DB, ADODB, dxExEdtr, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner, DBCtrls, Mask,u_lcxunit, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdMessageClient, IdSMTPBase, IdSMTP, IdMessage,IdAttachmentFile; type Tfrm_ch_fee_check_seae_match = class(TForm) Notebook1: TNotebook; bsSkinPanel1: TbsSkinPanel; t_op_seae1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridDateColumn; dxDBGrid1Column22: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton11: TbsSkinButton; Label130: TLabel; Label131: TLabel; Label210: TLabel; Label213: TLabel; Label217: TLabel; Label218: TLabel; Edit4: TEdit; Edit2: TEdit; bsSkinButton44: TbsSkinButton; wwDBDateTimePicker18: TwwDBDateTimePicker; wwDBDateTimePicker19: TwwDBDateTimePicker; RxDBLookupCombo57: TRxDBLookupCombo; wwDBLookupCombo26: TwwDBLookupCombo; Edit8: TEdit; bsSkinButton5: TbsSkinButton; t_op_seae: TADOStoredProc; t_ch_pay: TADOQuery; t_ch_accept: TADOQuery; t_ch_accept1: TDataSource; t_ch_pay1: TDataSource; bsSkinPanel2: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit4: TDBEdit; DBEdit5: TDBEdit; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; DBEdit6: TDBEdit; DBEdit7: TDBEdit; DBEdit8: TDBEdit; DBEdit10: TDBEdit; Label9: TLabel; Label10: TLabel; Label11: TLabel; DBEdit9: TDBEdit; DBEdit11: TDBEdit; DBEdit12: TDBEdit; Label12: TLabel; DBEdit13: TDBEdit; Label13: TLabel; DBEdit14: TDBEdit; bsSkinPanel3: TbsSkinPanel; bsSkinPanel4: TbsSkinPanel; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridColumn; dxDBGrid2Column2: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; dxDBGrid3: TdxDBGrid; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn3: TdxDBGridColumn; dxDBGridColumn4: TdxDBGridColumn; t_op_gain: TADOQuery; t_op_gain1: TDataSource; Label14: TLabel; DBEdit15: TDBEdit; Label15: TLabel; DBEdit16: TDBEdit; Label16: TLabel; DBEdit17: TDBEdit; Label17: TLabel; DBEdit18: TDBEdit; Label18: TLabel; DBEdit19: TDBEdit; Label19: TLabel; DBEdit20: TDBEdit; Label20: TLabel; DBEdit21: TDBEdit; Label21: TLabel; Label22: TLabel; DBEdit22: TDBEdit; t_op_gainDSDesigner: TStringField; t_op_gainUSD: TBCDField; t_op_gainUSD2: TBCDField; t_op_gainUSD3: TBCDField; t_op_gainUSD4: TBCDField; t_op_gainUSD5: TBCDField; t_op_gainRMB: TBCDField; t_op_gainRMB2: TBCDField; t_op_gainRMB3: TBCDField; t_op_gainRMB4: TBCDField; t_op_gainRMB5: TBCDField; t_op_gainDSDesigner2: TBCDField; t_op_gainDSDesigner3: TBCDField; t_op_gainDSDesigner4: TBCDField; t_op_gainDSDesigner5: TStringField; t_op_gainDSDesigner6: TBCDField; t_op_gainDSDesigner7: TBCDField; t_op_gainUSD6: TBCDField; t_op_gainUSD7: TBCDField; t_op_gainDSDesigner8: TBCDField; t_op_gainOT: TBCDField; t_op_gainOT2: TBCDField; t_op_gainOT3: TBCDField; t_op_gainOT4: TBCDField; t_op_gainOT5: TBCDField; t_op_gainUSD8: TBCDField; t_op_gainUSD9: TBCDField; t_op_gainUSD10: TBCDField; t_op_gainRMB6: TBCDField; t_op_gainRMB7: TBCDField; t_op_gainRMB8: TBCDField; t_op_gainDSDesigner9: TBCDField; t_op_gainDSDesigner10: TBCDField; t_op_gainDSDesigner11: TBCDField; t_op_gainDSDesigner12: TStringField; t_op_gainOT6: TBCDField; t_op_gainOT7: TBCDField; t_op_gainOT8: TBCDField; t_op_gainDSDesigner13: TBCDField; t_op_gainUSD11: TBCDField; t_op_gainUSD12: TBCDField; t_op_gainRMB9: TBCDField; t_op_gainRMB10: TBCDField; t_op_gainDSDesigner14: TBCDField; t_op_gainDSDesigner15: TBCDField; t_op_gainUSD13: TBCDField; t_op_gainUSD14: TBCDField; t_op_gainUSD15: TBCDField; t_op_gainRMB11: TBCDField; t_op_gainRMB12: TBCDField; t_op_gainRMB13: TBCDField; t_op_gainDSDesigner16: TBCDField; t_op_gainDSDesigner17: TBCDField; t_op_gainDSDesigner18: TBCDField; t_op_gainDSDesigner19: TStringField; t_op_gainOT9: TBCDField; t_op_gainOT10: TBCDField; t_op_gainOT11: TBCDField; t_op_gainDSDesigner20: TBCDField; t_op_gainUSD16: TBCDField; t_op_gainUSD17: TBCDField; t_op_gainRMB14: TBCDField; t_op_gainRMB15: TBCDField; t_op_gainDSDesigner21: TBCDField; t_op_gainDSDesigner22: TBCDField; t_op_gainField: TFloatField; t_op_gainField2: TFloatField; bsSkinButton8: TbsSkinButton; Label23: TLabel; DBEdit23: TDBEdit; Label24: TLabel; DBEdit24: TDBEdit; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; t_op_seae_all: TADOQuery; t_op_seae_all1: TDataSource; dxDBGrid4: TdxDBGrid; dxDBGrid4Column1: TdxDBGridColumn; dxDBGrid4Column2: TdxDBGridColumn; t_op_seae_allDSDesigner: TStringField; t_op_seae_allDSDesigner2: TStringField; t_op_seae_allDSDesigner3: TDateTimeField; t_op_seae_allDSDesigner4: TStringField; t_op_seae_allRMB: TBCDField; t_op_seae_allUSD: TBCDField; t_op_seae_allField: TFloatField; t_op_seae_allField2: TFloatField; t_op_seae_allDSDesigner5: TStringField; dxDBGrid4Column3: TdxDBGridColumn; Label25: TLabel; Label26: TLabel; DBEdit25: TDBEdit; dxDBGrid2Column5: TdxDBGridColumn; dxDBGrid3Column5: TdxDBGridColumn; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton38: TbsSkinButton; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; bsSkinButton4: TbsSkinButton; bsSkinButton9: TbsSkinButton; Label27: TLabel; Edit1: TEdit; Label28: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; Label29: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; Label30: TLabel; Edit3: TEdit; bsSkinButton10: TbsSkinButton; SMTP1: TIdSMTP; IdMsg: TIdMessage; dxDBGrid2Column6: TdxDBGridColumn; dxDBGrid3Column6: TdxDBGridColumn; dxDBGrid2Column7: TdxDBGridColumn; dxDBGrid3Column7: TdxDBGridColumn; Label31: TLabel; DBEdit26: TDBEdit; bsSkinButton21: TbsSkinButton; dxDBGrid3Column8: TdxDBGridColumn; Label32: TLabel; DBEdit27: TDBEdit; dxDBGrid2Column8: TdxDBGridColumn; dxDBGrid2Column9: TdxDBGridColumn; dxDBGrid3Column9: TdxDBGridColumn; dxDBGrid3Column10: TdxDBGridColumn; DBMemo24: TDBMemo; Label184: TLabel; bsSkinCheckRadioBox4: TbsSkinCheckRadioBox; wwDBDateTimePicker5: TwwDBDateTimePicker; procedure dxDBGrid1DblClick(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure t_op_gainCalcFields(DataSet: TDataSet); procedure bsSkinButton44Click(Sender: TObject); procedure Edit4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo57KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo26KeyPress(Sender: TObject; var Key: Char); procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker18KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker19KeyPress(Sender: TObject; var Key: Char); procedure Edit8KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton8Click(Sender: TObject); procedure dxDBGrid4DblClick(Sender: TObject); procedure t_op_seae_allCalcFields(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure dxDBGrid2Column5CustomDraw(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 dxDBGrid3Column5CustomDraw(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 bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton21Click(Sender: TObject); procedure DBEdit8Change(Sender: TObject); private { Private declarations } public { Public declarations } procedure checkconditionSql(checks:string); procedure SendEmailMessage(CheckType,reasons:string); end; var frm_ch_fee_check_seae_match: Tfrm_ch_fee_check_seae_match; implementation uses u_main, my_sys_function, u_data_share; {$R *.dfm} procedure Tfrm_ch_fee_check_seae_match.dxDBGrid1DblClick(Sender: TObject); begin if bsSkinButton11.Caption='查看明细' then begin bsSkinButton11.Caption:='返回列表'; Notebook1.PageIndex:=1; exit; end; if bsSkinButton11.Caption='返回列表' then begin bsSkinButton11.Caption:='查看明细'; Notebook1.PageIndex:=0; exit; end; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton11Click( Sender: TObject); begin if bsSkinButton11.Caption='查看明细' then begin bsSkinButton11.Caption:='返回列表'; Notebook1.PageIndex:=1; exit; end; if bsSkinButton11.Caption='返回列表' then begin bsSkinButton11.Caption:='查看明细'; Notebook1.PageIndex:=0; exit; end; end; procedure Tfrm_ch_fee_check_seae_match.FormShow(Sender: TObject); var s_SqlSea:string; begin edit1.text:=employee; edit3.text:=employee; if if_open('266') then begin bsSkinButton8.Visible:=true; bsSkinButton2.Visible:=true; end else begin bsSkinButton8.Visible:=false; bsSkinButton2.Visible:=false; end; if if_open('248') then begin bsSkinButton1.Visible:=true; bsSkinButton3.Visible:=true; end else begin bsSkinButton1.Visible:=false; bsSkinButton3.Visible:=false; end; Notebook1.PageIndex:=0; loadreggrid(dxdbgrid1,true,caption); if (if_open('266') and if_open('248')) then begin s_SqlSea:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''提交复核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else if if_open('266') then begin s_SqlSea:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else if if_open('248') then begin s_SqlSea:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交复核'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end; ///showmessage(s_SqlSea); t_op_seae.Close; t_op_seae.Parameters.ParamByName('SQLStr').value:=s_SqlSea; t_op_seae.open; t_ch_accept.Close; t_ch_accept.open; t_ch_pay.Close; t_ch_pay.open; t_op_gain.Close; t_op_gain.open; t_op_seae_all.Close; t_op_seae_all.open; end; procedure Tfrm_ch_fee_check_seae_match.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_ch_fee_check_seae_match.Hide; frm_ch_fee_check_seae_match.ManualFloat(frm_ch_fee_check_seae_match.BoundsRect ); frm_main.freeTabs('frm_ch_fee_check_seae_match'); action:=cafree; frm_ch_fee_check_seae_match:=nil; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton7Click(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if not t_op_seae1.DataSet.Bof then t_op_seae1.DataSet.Prior; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton6Click(Sender: TObject); begin if t_op_seae1.DataSet=nil then exit; if not t_op_seae1.DataSet.eof then t_op_seae1.DataSet.next; end; procedure Tfrm_ch_fee_check_seae_match.t_op_gainCalcFields( DataSet: TDataSet); begin t_op_gain.FieldByName('汇率').AsFloat:=getUsdExRate(t_op_seae.fieldbyname('会计期间').asstring,'USD'); t_op_gain.FieldByName('实际毛利润').AsFloat:= t_op_gain.FieldByName('汇率').AsFloat*t_op_gain.FieldByName('利润USD').AsFloat+t_op_gain.FieldByName('利润RMB').AsFloat; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton44Click(Sender: TObject); var str:widestring; begin str:=' and 1=1 '; str:=query_tiaojian(1,str,'委托编号','模糊',Edit4.text); str:=query_tiaojian(1,str,'主提单号','模糊',Edit2.text); str:=query_tiaojian(1,str,'委托单位','等于',RxDBLookupCombo57.DisplayValues[1]); str:=query_tiaojian(1,str,'船名','模糊',wwDBLookupCombo26.text); str:=query_tiaojian(1,str,'航次','模糊',Edit8.text); str:=query_tiaojian(1,str,'审核人','模糊',Edit1.text); str:=query_tiaojian(1,str,'复核人','模糊',Edit3.text); str:=query_tiaojian(1,str,'开船日期','大于',wwDBDateTimePicker18.text); str:=query_tiaojian(1,str,'开船日期','小于',wwDBDateTimePicker19.text); str:=query_tiaojian(1,str,'审核日期','大于',wwDBDateTimePicker1.text); str:=query_tiaojian(1,str,'审核日期','小于',wwDBDateTimePicker2.text); str:=query_tiaojian(1,str,'复核日期','大于',wwDBDateTimePicker3.text); str:=query_tiaojian(1,str,'复核日期','小于',wwDBDateTimePicker4.text); if (if_open('266') and if_open('248')) then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') // +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''提交复核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else if if_open('266') then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') // +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else if if_open('248') then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') // +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交复核'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end; { str:='select * from t_op_seae where 主编号=编号 and 费用状态=''提交财务'' and 编号 in (select 主编号 from t_op_seae ' +str+')'+default_sort(53,'t_op_seae','','desc'); } //showmessage(str); t_op_seae.Close; t_op_seae.Parameters.ParamByName('SQLStr').value:=str; t_op_seae.open; end; procedure Tfrm_ch_fee_check_seae_match.Edit4KeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.RxDBLookupCombo57KeyPress( Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.wwDBLookupCombo26KeyPress( Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.Edit2KeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.wwDBDateTimePicker18KeyPress( Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.wwDBDateTimePicker19KeyPress( Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.Edit8KeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then bsSkinButton44.OnClick(Sender); end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton8Click(Sender: TObject); begin if not if_open('266') then begin showmessage('对不起你没审核的权限!'); exit; end; if application.MessageBox('您确定要审核数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try fee_check_all('',t_ch_accept,get_parameters_value(101,'FALSE'),'海运出口'); fee_check_all('',t_ch_pay,get_parameters_value(105,'FALSE'),'海运出口'); finally showmessage('审核完成'); end; end; procedure Tfrm_ch_fee_check_seae_match.dxDBGrid4DblClick(Sender: TObject); begin fee_view(t_op_seae_all.fieldbyname('编号').asstring); end; procedure Tfrm_ch_fee_check_seae_match.t_op_seae_allCalcFields( DataSet: TDataSet); begin t_op_seae_all.FieldByName('汇率').AsFloat:=getUsdExRate(t_op_seae_all.fieldbyname('会计期间').asstring,'USD'); t_op_seae_all.FieldByName('实际毛利润').AsFloat:= t_op_seae_all.FieldByName('汇率').AsFloat*t_op_seae_all.FieldByName('利润USD').AsFloat+t_op_seae_all.FieldByName('利润RMB').AsFloat; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton1Click(Sender: TObject); var aAdoQuery:TAdoQuery; begin aAdoQuery:=CreateAdoQuery; if not if_open('248') then begin showmessage('对不起你没复核的权限!'); exit; end; with aAdoQuery do begin Close;Sql.Clear; Sql.Add('select 编号,复核人,复核日期,业务状态,费用状态,费用封帐日期,会计期间 from t_op_seae'); Sql.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=t_op_seae1.DataSet.FieldByName('编号').AsString; open; end; if application.MessageBox('您确定要复核数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try fee_Recheck_all('',t_ch_accept,get_parameters_value(101,'FALSE'),'海运出口'); fee_Recheck_all('',t_ch_pay,get_parameters_value(105,'FALSE'),'海运出口'); aAdoQuery.Edit; if aAdoQuery.FieldByName('复核人').AsString='' then begin aAdoQuery.FieldByName('复核人').AsString:=employee; aAdoQuery.FieldByName('复核日期').AsDateTime:=now; end; { aAdoQuery.FieldByName('业务状态').AsString:='业务封帐'; aAdoQuery.FieldByName('费用状态').AsString:='费用封帐'; aAdoQuery['费用封帐日期']:=Now; if bsSkinCheckRadioBox4.Checked then aAdoQuery['会计期间']:=wwDBDateTimePicker5.date; } aAdoQuery.Post; finally showmessage('复核完成'); aAdoQuery.Free; t_op_seae.Refresh; end; end; procedure Tfrm_ch_fee_check_seae_match.dxDBGrid2Column5CustomDraw( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid2Column5.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_seae_match.dxDBGrid3Column5CustomDraw( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid3Column5.Index]); AFont.Color:=clblack; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton2Click(Sender: TObject); var str:string; begin if not if_open('267') then begin showmessage('对不起你没驳回的权限!'); exit; end; str:=trim(InputBox('请输入驳回原因', '驳回原因:', '')); if str=''then begin showmessage('驳回原因不能为空,驳回失败!!'); exit; end else if str=''then begin exit; end; if application.MessageBox('您确定要驳回数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try with t_ch_accept do try DisableControls; First; while not eof do begin if (FieldByName('费用状态').AsString='提交审核') or (FieldByName('费用状态').AsString='复核驳回') then begin Edit; FieldByName('费用状态').AsString:='驳回提交'; FieldByName('审核人').AsString:=employee; FieldByName('审核日期').AsDateTime:=now; FieldByName('费用原因').AsString:=str; post; end; Next; end; finally EnableControls; end; with t_ch_pay do try DisableControls; First; while not eof do begin if (FieldByName('费用状态').AsString='提交审核') or (FieldByName('费用状态').AsString='复核驳回') then begin Edit; FieldByName('费用状态').AsString:='驳回提交'; FieldByName('审核人').AsString:=employee; FieldByName('审核日期').AsDateTime:=now; FieldByName('费用原因').AsString:=str; post; end; Next; end; finally EnableControls; end; SendEmailMessage('驳回提交',str); finally showmessage('驳回完成'); end; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton3Click(Sender: TObject); var str:string; begin if not if_open('267') then begin showmessage('对不起你没驳回的权限!'); exit; end; str:=trim(InputBox('请输入驳回原因', '驳回原因:', '')); if str=''then begin showmessage('驳回原因不能为空,驳回失败!!'); exit; end else if str=''then begin exit; end; if application.MessageBox('您确定要驳回数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; try with t_ch_accept do try DisableControls; First; while not eof do begin if FieldByName('费用状态').AsString='提交复核' then begin Edit; FieldByName('费用状态').AsString:='复核驳回'; FieldByName('审核人').AsString:=employee; FieldByName('审核日期').AsDateTime:=now; FieldByName('费用原因').AsString:=str; post; end; Next; end; finally EnableControls; end; with t_ch_pay do try DisableControls; First; while not eof do begin if FieldByName('费用状态').AsString='提交复核' then begin Edit; FieldByName('费用状态').AsString:='复核驳回'; FieldByName('审核人').AsString:=employee; FieldByName('审核日期').AsDateTime:=now; FieldByName('费用原因').AsString:=str; post; end; Next; end; finally EnableControls; end; SendEmailMessage('复核驳回',str); finally showmessage('驳回完成'); end; end; procedure Tfrm_ch_fee_check_seae_match.SendEmailMessage(CheckType,reasons:string); var str:widestring; str_file:widestring; str_memo:Tmemo; begin str_memo:=Tmemo.create(application); str_memo.visible:=false; str_memo.Parent:=frm_ch_fee_check_seae_match; str_memo.Clear; str_memo.Lines.Clear; str_memo.Lines.Add('主提单号:'+t_op_seae1.DataSet.FieldByName('主提单号').AsString); str_memo.Lines.Add('驳回类型:'+CheckType); str_memo.Lines.Add('驳回人:'+Employee); str_memo.Lines.Add('驳回时间:'+FormatDateTime('YYYY-MM-DD hh:mm:sss',Now)); str_memo.Lines.Add('驳回原因:'+reasons); str_memo.Lines.Add(''); str_memo.Lines.Add(''); str_memo.Lines.Add('请在24小时内重新提交,避免和客户对账遗漏收费!'); try if Trim(str_memo.lines.Text)<>'' then begin SMTP1.AuthType := satDefault; //(satNone, satDefault, satSASL); SMTP1.username:=get_parameters_value(179,''); SMTP1.Password :=get_parameters_value(180,''); SMTP1.Host :=get_parameters_value(181,''); SMTP1.Port :=25; try SMTP1.Connect; except on e : Exception do begin ShowMessage('连接邮箱出错:'+E.Message); end; end; if not SMTP1.Connected then begin Sleep(1000); SMTP1.Connect; end; try with IdMsg do begin body.Clear; Body.Text :=str_memo.lines.Text; From.address :=get_parameters_value(179,''); if frm_data_share.t_sys_employee.locate('姓名',t_op_seae1.DataSet.FieldByName('操作员').AsString,[]) then Recipients.EMailAddresses :=frm_data_share.t_sys_employee.FieldByName('邮箱').AsString+';qiqi@qdsunstar.com'; if frm_data_share.t_sys_employee.locate('姓名',t_op_seae1.DataSet.FieldByName('揽货人').AsString,[]) then Recipients.EMailAddresses :=Recipients.EMailAddresses+';'+frm_data_share.t_sys_employee.FieldByName('邮箱').AsString; if CheckType='复核驳回' then begin if frm_data_share.t_sys_employee.locate('姓名',t_op_seae1.DataSet.FieldByName('审核人').AsString,[]) then CCList.EMailAddresses :=frm_data_share.t_sys_employee.FieldByName('邮箱').AsString; end; Subject:=CheckType+' '+t_op_seae1.DataSet.FieldByName('主提单号').AsString+' '+FormatDateTime('YYYY-MM-DD hh:mm:sss',Now); Body.SaveToFile(ExtractFilePath(Application.ExeName)+'Content.txt'); TIdAttachmentFile.Create(MessageParts,ExtractFilePath(Application.ExeName)+'Content.txt'); end; if not SMTP1.Connected then begin Sleep(1000); SMTP1.Connect; end; SMTP1.Send(IdMsg); finally SMTP1.Disconnect; end; end; except end; str_memo.free; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton38Click( Sender: TObject); var book1:Tbookmark; begin if Notebook1.PageIndex=1 then begin if t_op_seae=nil then exit; book1:=t_op_seae.GetBookmark; t_op_seae.Refresh; t_op_seae.GotoBookmark(book1); end else begin book1:=t_op_seae.GetBookmark; t_op_seae.Requery; t_op_seae.GotoBookmark(book1); end end; procedure Tfrm_ch_fee_check_seae_match.checkconditionSql(checks:string); var str:widestring; begin str:=' and 1=1 '; str:=query_tiaojian(1,str,'委托编号','模糊',Edit4.text); str:=query_tiaojian(1,str,'主提单号','模糊',Edit2.text); str:=query_tiaojian(1,str,'委托单位','等于',RxDBLookupCombo57.DisplayValues[1]); str:=query_tiaojian(1,str,'船名','模糊',wwDBLookupCombo26.text); str:=query_tiaojian(1,str,'航次','模糊',Edit8.text); str:=query_tiaojian(1,str,'开船日期','大于',wwDBDateTimePicker18.text); str:=query_tiaojian(1,str,'开船日期','小于',wwDBDateTimePicker19.text); if (if_open('266') and if_open('248')) then begin //and ('+checks+'='''' or '+checks+' is null) if checks='审核人' then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else if checks='复核人' then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交复核'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''提交复核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end; end else if if_open('266') then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交审核'',''复核驳回'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end else if if_open('248') then begin str:='select top 100 * from t_op_seae t1 where 主编号=编号 and 费用状态=''提交财务'' '+ str +' and ' +open_data('0011','揽货人','操作员','客服员','报关操作','报检操作') +' and EXISTS (select ''X'' from t_op_seae t2,t_ch_fee f where f.费用状态 in (''提交复核'') and f.编号=t2.编号 and t2.编号=t1.编号)' +default_sort(53,'t1','','desc'); end; t_op_seae.Close; t_op_seae.Parameters.ParamByName('SQLStr').value:=str; t_op_seae.open; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton4Click(Sender: TObject); begin checkconditionSql('审核人'); end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton9Click(Sender: TObject); begin checkconditionSql('复核人'); end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton10Click( Sender: TObject); begin Edit1.text:=''; Edit2.text:=''; Edit3.text:=''; Edit4.text:=''; Edit8.text:=''; wwDBDateTimePicker1.Clear; wwDBDateTimePicker2.Clear; wwDBDateTimePicker3.Clear; wwDBDateTimePicker4.Clear; wwDBDateTimePicker18.Clear; wwDBDateTimePicker19.Clear; RxDBLookupCombo57.ClearValue; wwDBLookupCombo26.Text:=''; end; procedure Tfrm_ch_fee_check_seae_match.bsSkinButton21Click( Sender: TObject); begin frm_main.view_momo(t_op_seae1,'辅助字段一',true); end; procedure Tfrm_ch_fee_check_seae_match.DBEdit8Change(Sender: TObject); var adate,bdate:TDate; begin if (DBEdit8.Text='') then begin end else begin adate:=StrToDate(DBEdit8.Text); bdate:=StrToDate('2017-03-06'); if adate>=bdate then begin dxDBGrid3Column8.Visible:=true; end else begin dxDBGrid3Column8.Visible:=false; end; end; end; end.