unit u_fee_history; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, BusinessSkinForm, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, RxLookup, StdCtrls, wwdbdatetimepicker, ExtCtrls; type Tfrm_fee_history = class(TForm) bsBusinessSkinForm1: TbsBusinessSkinForm; bsSkinPanel1: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinNotebook1: TbsSkinNotebook; dxDBGrid1: TdxDBGrid; t_ch_fee: TADOQuery; t_ch_fee1: TDataSource; bsSkinButton10: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; t_bill1: TDataSource; t_bill: TADOQuery; bsSkinPanel2: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; Edit1: TEdit; Edit2: TEdit; Label6: TLabel; Label1: TLabel; Label9: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label3: TLabel; Edit4: TEdit; Edit3: TEdit; Label2: TLabel; Label10: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridDateColumn; dxDBGrid1Column18: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridDateColumn; dxDBGrid1Column63: TdxDBGridMaskColumn; dxDBGrid1Column64: TdxDBGridMaskColumn; dxDBGrid1Column65: TdxDBGridDateColumn; dxDBGrid1Column66: TdxDBGridMaskColumn; dxDBGrid1Column67: TdxDBGridMaskColumn; bsSkinPanel4: TbsSkinPanel; bsSkinPanel5: TbsSkinPanel; Label4: TLabel; Label5: TLabel; Label7: TLabel; Label8: TLabel; Label11: TLabel; Label12: TLabel; Edit5: TEdit; Edit6: TEdit; RxDBLookupCombo1: TRxDBLookupCombo; Edit7: TEdit; Edit8: TEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGrid1Column62: TdxDBGridColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGridDateColumn2: TdxDBGridDateColumn; dxDBGridMaskColumn15: TdxDBGridMaskColumn; dxDBGridMaskColumn16: TdxDBGridMaskColumn; dxDBGridMaskColumn17: TdxDBGridMaskColumn; dxDBGridMaskColumn18: TdxDBGridMaskColumn; dxDBGrid1Column41: TdxDBGridMaskColumn; dxDBGrid1Column47: TdxDBGridMaskColumn; dxDBGrid1Column48: TdxDBGridDateColumn; bsSkinPanel6: TbsSkinPanel; bsSkinPanel7: TbsSkinPanel; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Label18: TLabel; Edit9: TEdit; Edit10: TEdit; RxDBLookupCombo3: TRxDBLookupCombo; Edit11: TEdit; Edit12: TEdit; wwDBDateTimePicker3: TwwDBDateTimePicker; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; dxDBGridMaskColumn19: TdxDBGridMaskColumn; dxDBGridMaskColumn20: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGridMaskColumn22: TdxDBGridMaskColumn; dxDBGridMaskColumn23: TdxDBGridMaskColumn; dxDBGridDateColumn3: TdxDBGridDateColumn; dxDBGrid1Column27: TdxDBGridMaskColumn; dxDBGrid1Column28: TdxDBGridMaskColumn; dxDBGrid1Column29: TdxDBGridMaskColumn; dxDBGrid1Column30: TdxDBGridDateColumn; bsSkinPanel8: TbsSkinPanel; bsSkinPanel9: TbsSkinPanel; Label19: TLabel; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label23: TLabel; Label24: TLabel; Edit13: TEdit; Edit14: TEdit; RxDBLookupCombo4: TRxDBLookupCombo; Edit15: TEdit; Edit16: TEdit; wwDBDateTimePicker4: TwwDBDateTimePicker; dxDBGrid5: TdxDBGrid; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGridDateColumn4: TdxDBGridDateColumn; dxDBGridMaskColumn24: TdxDBGridMaskColumn; dxDBGridMaskColumn25: TdxDBGridMaskColumn; dxDBGridMaskColumn26: TdxDBGridMaskColumn; dxDBGridMaskColumn30: TdxDBGridMaskColumn; dxDBGridMaskColumn31: TdxDBGridMaskColumn; dxDBGridMaskColumn32: TdxDBGridMaskColumn; dxDBGridDateColumn5: TdxDBGridDateColumn; dxDBGridMaskColumn36: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridDateColumn; op_type: TEdit; fee_type: TEdit; t_do_fee: TDataSource; dxDBGrid1Column1: TdxDBGridColumn; dxDBGrid1Column2: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridColumn; dxDBGrid1Column4: TdxDBGridColumn; dxDBGrid1Column5: TdxDBGridColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; t_bz_balance1: TDataSource; bsSkinRadioGroup1: TbsSkinRadioGroup; Panel1: TPanel; dxDBGrid6: TdxDBGrid; dxDBGrid2Column12: TdxDBGridColumn; dxDBGrid2Column14: TdxDBGridColumn; dxDBGrid2Column15: TdxDBGridColumn; dxDBGrid2Column1: TdxDBGridColumn; dxDBGrid2Column2: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; dxDBGrid2Column5: TdxDBGridColumn; dxDBGrid2Column6: TdxDBGridColumn; dxDBGrid2Column7: TdxDBGridColumn; dxDBGrid2Column8: TdxDBGridColumn; dxDBGrid2Column9: TdxDBGridColumn; dxDBGrid2Column10: TdxDBGridColumn; dxDBGrid2Column11: TdxDBGridColumn; dxDBGrid2Column13: TdxDBGridColumn; dxDBGrid2Column16: TdxDBGridColumn; dxDBGrid2Column17: TdxDBGridColumn; dxDBGrid2Column18: TdxDBGridColumn; dxDBGrid2Column19: TdxDBGridColumn; dxDBGrid2Column20: TdxDBGridColumn; dxDBGrid2Column21: TdxDBGridColumn; dxDBGrid2Column22: TdxDBGridColumn; dxDBGrid2Column23: TdxDBGridColumn; dxDBGrid2Column24: TdxDBGridColumn; dxDBGrid2Column25: TdxDBGridColumn; dxDBGrid2Column26: TdxDBGridColumn; dxDBGrid2Column27: TdxDBGridColumn; dxDBGrid2Column28: TdxDBGridColumn; dxDBGrid2Column29: TdxDBGridColumn; dxDBGrid2Column30: TdxDBGridColumn; dxDBGrid2Column31: TdxDBGridColumn; dxDBGrid2Column32: TdxDBGridColumn; dxDBGrid2Column33: TdxDBGridColumn; bsSkinPanel11: TbsSkinPanel; Label25: TLabel; Label26: TLabel; Label27: TLabel; Label28: TLabel; Label29: TLabel; Label30: TLabel; Edit17: TEdit; Edit18: TEdit; RxDBLookupCombo5: TRxDBLookupCombo; Edit19: TEdit; Edit20: TEdit; wwDBDateTimePicker5: TwwDBDateTimePicker; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; dxDBGrid1Column33: TdxDBGridColumn; dxDBGrid1Column34: TdxDBGridColumn; dxDBGrid1Column35: TdxDBGridColumn; dxDBGrid1Column36: TdxDBGridColumn; RxDBLookupCombo6: TRxDBLookupCombo; Label31: TLabel; Label32: TLabel; RxDBLookupCombo7: TRxDBLookupCombo; Label33: TLabel; RxDBLookupCombo8: TRxDBLookupCombo; bsSkinPanel10: TbsSkinPanel; Label34: TLabel; Label35: TLabel; Label36: TLabel; Label37: TLabel; Label39: TLabel; Edit21: TEdit; Edit22: TEdit; RxDBLookupCombo9: TRxDBLookupCombo; Edit23: TEdit; wwDBDateTimePicker6: TwwDBDateTimePicker; RxDBLookupCombo10: TRxDBLookupCombo; Label40: TLabel; bsSkinPanel12: TbsSkinPanel; dxDBGrid7: TdxDBGrid; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridMaskColumn21: TdxDBGridMaskColumn; dxDBGridMaskColumn28: TdxDBGridMaskColumn; dxDBGridMaskColumn29: TdxDBGridMaskColumn; dxDBGridMaskColumn35: TdxDBGridMaskColumn; dxDBGridMaskColumn37: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridMaskColumn38: TdxDBGridMaskColumn; dxDBGridMaskColumn39: TdxDBGridMaskColumn; dxDBGridMaskColumn41: TdxDBGridMaskColumn; dxDBGridDateColumn9: TdxDBGridDateColumn; dxDBGridMaskColumn42: TdxDBGridMaskColumn; dxDBGridMaskColumn43: TdxDBGridMaskColumn; procedure bsSkinButton5Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure Edit4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure Edit3KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); private function fee_get_client(str:string):string; function fee_get_num(Str: String): Double; function sqlfee(str:string):string; function GetCurrencyRate(aCurrency,BsType:string;Dataset1:TDataset):Double; { Private declarations } public { Public declarations } end; var frm_fee_history: Tfrm_fee_history; implementation uses u_main, my_sys_function, u_data_share; {$R *.dfm} function Tfrm_fee_history.GetCurrencyRate(aCurrency,BsType:string;Dataset1:TDataset):Double; begin if frm_data_share.t_code_currency.Locate('币别',Trim(aCurrency),[])THEN begin if Trim(aCurrency)<>'RMB' then begin if strtobool(get_parameters_value(145,'true')) then begin if BsType='1' then Result:=getUsdExRate(dataset1.fieldbyname('开船日期').asstring,aCurrency) else if BsType='2' then Result:=getUsdExRate(dataset1.fieldbyname('进口日期').asstring,aCurrency) else if BsType='3' then Result:=getUsdExRate(dataset1.fieldbyname('一程开航日期').asstring,aCurrency) else if BsType='4' then Result:=getUsdExRate(dataset1.fieldbyname('进口日期').asstring,aCurrency) else if BsType='6' then Result:=getUsdExRate(dataset1.fieldbyname('接单日期').asstring,aCurrency) else if BsType='9' then Result:=getUsdExRate(dataset1.fieldbyname('开船日期').asstring,aCurrency); end else begin Result:=getUsdExRate(dataset1.fieldbyname('会计期间').asstring,aCurrency) end; end else Result:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; function Tfrm_fee_history.sqlfee(str:string):string; begin if (if_open('293') or if_open('295')or if_open('297')or if_open('299') or if_open('353')) and (str='收') then begin if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) and '+open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end else begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and ' +open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end; end else begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; end; t_ch_fee.Parameters.ParamByName('类型').value:=str; t_ch_fee.Open; end; if (if_open('294') or if_open('296')or if_open('298')or if_open('300') or if_open('354')) and (str='付') then begin if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) and '+open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end else begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and ' +open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end; end else begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; end; t_ch_fee.Parameters.ParamByName('类型').value:=str; t_ch_fee.Open; end; end; procedure Tfrm_fee_history.bsSkinButton5Click(Sender: TObject); begin CLOSE; end; procedure Tfrm_fee_history.FormShow(Sender: TObject); begin bsSkinNotebook1.PageIndex:=strtoint(op_type.text); end; procedure Tfrm_fee_history.bsSkinButton10Click(Sender: TObject); begin Edit1.text:=''; Edit2.text:=''; Edit3.text:=''; Edit4.text:=''; Edit5.text:=''; Edit6.text:=''; Edit7.text:=''; Edit8.text:=''; Edit9.text:=''; Edit10.text:=''; Edit11.text:=''; Edit12.text:=''; Edit13.text:=''; Edit14.text:=''; Edit15.text:=''; Edit16.text:=''; RxDBLookupCombo1.ClearValue; RxDBLookupCombo2.ClearValue; RxDBLookupCombo3.ClearValue; RxDBLookupCombo4.ClearValue; wwDBDateTimePicker1.Text:=''; wwDBDateTimePicker2.Text:=''; wwDBDateTimePicker3.Text:=''; wwDBDateTimePicker4.Text:=''; end; function Tfrm_fee_history.fee_get_client(str:string):string; begin if str='' then result:='' else begin if (op_type.text='1')OR(op_type.text='2') then begin if str='委托单位'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('委托单位').asstring; if str='船公司'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('船公司').asstring; if str='场站'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('场站').asstring; if str='车队'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('承运车队').asstring; if str='报关行'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('报关行').asstring; if str='代理'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('代理').asstring; if str='货代'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('货代公司').asstring; if str='发货人'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('发货人').asstring; if str='收货人'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('收货人').asstring; if str='通知人'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('通知人').asstring; if str='第三方'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('第三方付费').asstring; end else if (op_type.text='9') then begin end else begin if str='委托单位'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('委托单位').asstring; if str='航空公司'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('航空公司').asstring; if str='报关行'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('报关行').asstring; if str='代理'then result:=t_do_fee.DataSet.DataSource.DataSet.fieldbyname('代理').asstring; end; end; end; function Tfrm_fee_history.fee_get_num(Str: String): Double; begin if not t_bz_balance1.DataSet.IsEmpty then if t_bz_balance1.DataSet.Locate('two',Str,[])then begin Result:=t_bz_balance1.DataSet.fieldbyname('three').asfloat; end; end; procedure Tfrm_fee_history.bsSkinButton2Click(Sender: TObject); var str:widestring; begin case bsSkinNotebook1.PageIndex of 1: begin if Edit1.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit4.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit4.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit4.text+'%'+''''; end; if Edit2.text<>''then begin if str=''then str:=' where 主提单号 like '+''''+'%'+Edit2.text+'%'+'''' else str:=str+' and 主提单号 like '+''''+'%'+Edit2.text+'%'+''''; end; if Edit3.text<>''then begin if str=''then str:=' where 分提单号 like '+''''+'%'+Edit3.text+'%'+'''' else str:=str+' and 分提单号 like '+''''+'%'+Edit3.text+'%'+''''; end; if RxDBLookupCombo2.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; end; if wwDBDateTimePicker1.text<>''then begin if str=''then str:=' where 开船日期='+''''+wwDBDateTimePicker1.text+'''' else str:=str+' and 开船日期='+''''+wwDBDateTimePicker1.text+''''; end; if RxDBLookupCombo6.DisplayValue<>''then begin if str=''then str:=' where 船公司='+''''+RxDBLookupCombo6.DisplayValues[1]+'''' else str:=str+' and 船公司='+''''+RxDBLookupCombo6.DisplayValues[1]+''''; end; if RxDBLookupCombo7.DisplayValue<>''then begin if str=''then str:=' where 承运车队='+''''+RxDBLookupCombo7.DisplayValues[1]+'''' else str:=str+' and 承运车队='+''''+RxDBLookupCombo7.DisplayValues[1]+''''; end; if RxDBLookupCombo8.DisplayValue<>''then begin if str=''then str:=' where 报关行='+''''+RxDBLookupCombo8.DisplayValues[1]+'''' else str:=str+' and 报关行='+''''+RxDBLookupCombo8.DisplayValues[1]+''''; end; if str<>'' then str:=str+' and '+open_data('0001','录入人','操作员','客服员','揽货人','no') else str:=str+' where '+open_data('0001','录入人','操作员','客服员','揽货人','no'); str:='select * from t_op_seae '+str+default_sort(53,'t_op_seae','','desc'); t_ch_fee.close; t_bill.close; t_bill.sql.clear; t_bill.sql.add(str); t_bill.open; { if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; t_ch_fee.Parameters.ParamByName('类型').value:=fee_type.text; t_ch_fee.open; } sqlfee(fee_type.text); end; 2: begin if Edit5.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit5.text+'%'+''''; if Edit7.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit7.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit7.text+'%'+''''; end; if Edit6.text<>''then begin if str=''then str:=' where 主提单号 like '+''''+'%'+Edit6.text+'%'+'''' else str:=str+' and 主提单号 like '+''''+'%'+Edit6.text+'%'+''''; end; if Edit8.text<>''then begin if str=''then str:=' where 分提单号 like '+''''+'%'+Edit8.text+'%'+'''' else str:=str+' and 分提单号 like '+''''+'%'+Edit8.text+'%'+''''; end; if RxDBLookupCombo1.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo1.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo1.DisplayValues[1]+''''; end; if wwDBDateTimePicker2.text<>''then begin if str=''then str:=' where 进口日期='+''''+wwDBDateTimePicker2.text+'''' else str:=str+' and 进口日期='+''''+wwDBDateTimePicker2.text+''''; end; if str<>'' then str:=str+' and '+open_data('0002','录入人','操作员','客服员','揽货人','no') else str:=str+' where '+open_data('0002','录入人','操作员','客服员','揽货人','no'); str:='select * from t_op_seai '+str+default_sort(54,'t_op_seai','','desc'); t_ch_fee.close; t_bill.close; t_bill.sql.clear; t_bill.sql.add(str); t_bill.open; { if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; t_ch_fee.Parameters.ParamByName('类型').value:=fee_type.text; t_ch_fee.open; } sqlfee(fee_type.text); end; 3: begin if Edit9.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit9.text+'%'+''''; if Edit11.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit11.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit11.text+'%'+''''; end; if Edit10.text<>''then begin if str=''then str:=' where 主运单号 like '+''''+'%'+Edit10.text+'%'+'''' else str:=str+' and 主运单号 like '+''''+'%'+Edit10.text+'%'+''''; end; if Edit12.text<>''then begin if str=''then str:=' where 分运单号 like '+''''+'%'+Edit12.text+'%'+'''' else str:=str+' and 分运单号 like '+''''+'%'+Edit12.text+'%'+''''; end; if RxDBLookupCombo3.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo3.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo3.DisplayValues[1]+''''; end; if wwDBDateTimePicker3.text<>''then begin if str=''then str:=' where 一程开航日期='+''''+wwDBDateTimePicker3.text+'''' else str:=str+' and 一程开航日期='+''''+wwDBDateTimePicker3.text+''''; end; if str<>'' then str:=str+' and '+open_data('0003','录入人','操作员','客服员','揽货人','no') else str:=str+' where '+open_data('0003','录入人','操作员','客服员','揽货人','no'); str:='select * from t_op_aire '+str+default_sort(55,'t_op_aire','','desc'); t_ch_fee.close; t_bill.close; t_bill.sql.clear; t_bill.sql.add(str); t_bill.open; { if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; t_ch_fee.Parameters.ParamByName('类型').value:=fee_type.text; t_ch_fee.open; } sqlfee(fee_type.text); end; 4: begin if Edit13.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit13.text+'%'+''''; if Edit15.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit15.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit15.text+'%'+''''; end; if Edit14.text<>''then begin if str=''then str:=' where 主提单号 like '+''''+'%'+Edit14.text+'%'+'''' else str:=str+' and 主提单号 like '+''''+'%'+Edit14.text+'%'+''''; end; if Edit16.text<>''then begin if str=''then str:=' where 分运单号 like '+''''+'%'+Edit16.text+'%'+'''' else str:=str+' and 分运单号 like '+''''+'%'+Edit16.text+'%'+''''; end; if RxDBLookupCombo4.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo4.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo4.DisplayValues[1]+''''; end; if wwDBDateTimePicker4.text<>''then begin if str=''then str:=' where 进口日期='+''''+wwDBDateTimePicker4.text+'''' else str:=str+' and 进口日期='+''''+wwDBDateTimePicker4.text+''''; end; if str<>'' then str:=str+' and '+open_data('0004','录入人','操作员','客服员','揽货人','no') else str:=str+' where '+open_data('0004','录入人','操作员','客服员','揽货人','no'); str:='select * from t_op_airi '+str+default_sort(56,'t_op_airi','','desc'); t_ch_fee.close; t_bill.close; t_bill.sql.clear; t_bill.sql.add(str); t_bill.open; { if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin t_ch_fee.close; t_ch_fee.SQL.Clear; t_ch_fee.SQL.Add('select * from t_ch_fee where 类型=:类型' +' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; t_ch_fee.Parameters.ParamByName('类型').value:=fee_type.text; t_ch_fee.open; } sqlfee(fee_type.text); end; 6: begin if Edit17.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit17.text+'%'+''''; if Edit19.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit19.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit19.text+'%'+''''; end; if Edit18.text<>''then begin if str=''then str:=' where 主运单号 like '+''''+'%'+Edit18.text+'%'+'''' else str:=str+' and 主运单号 like '+''''+'%'+Edit18.text+'%'+''''; end; if Edit20.text<>''then begin if str=''then str:=' where 箱号 like '+''''+'%'+Edit20.text+'%'+'''' else str:=str+' and 箱号 like '+''''+'%'+Edit20.text+'%'+''''; end; if RxDBLookupCombo5.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo5.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo5.DisplayValues[1]+''''; end; if wwDBDateTimePicker5.text<>''then begin if str=''then str:=' where 发车日期='+''''+wwDBDateTimePicker5.text+'''' else str:=str+' and 发车日期='+''''+wwDBDateTimePicker5.text+''''; end; str:='select * from t_op_railway '+str+' order by 业务编号'; t_ch_fee.close; t_bill.close; t_bill.sql.clear; t_bill.sql.add(str); t_bill.open; sqlfee(fee_type.text); end; 9: begin if Edit21.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit21.text+'%'+''''; if Edit23.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit23.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit23.text+'%'+''''; end; if Edit22.text<>''then begin if str=''then str:=' where 主提单号 like '+''''+'%'+Edit22.text+'%'+'''' else str:=str+' and 主提单号 like '+''''+'%'+Edit22.text+'%'+''''; end; if RxDBLookupCombo9.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo9.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo9.DisplayValues[1]+''''; end; if RxDBLookupCombo10.DisplayValue<>''then begin if str=''then str:=' where 船公司='+''''+RxDBLookupCombo10.DisplayValues[1]+'''' else str:=str+' and 船公司='+''''+RxDBLookupCombo10.DisplayValues[1]+''''; end; if wwDBDateTimePicker6.text<>''then begin if str=''then str:=' where 开船日期='+''''+wwDBDateTimePicker6.text+'''' else str:=str+' and 开船日期='+''''+wwDBDateTimePicker6.text+''''; end; str:='select * from t_op_sealocal '+str+' order by 业务编号'; t_ch_fee.close; t_bill.close; t_bill.sql.clear; t_bill.sql.add(str); t_bill.open; sqlfee(fee_type.text); end; end; end; procedure Tfrm_fee_history.bsSkinButton3Click(Sender: TObject); var i,k:integer; str:String; begin if t_ch_fee.IsEmpty then exit; try if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_ch_fee.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); t_do_fee.DataSet.append; t_do_fee.DataSet['费用状态']:='录入状态'; t_do_fee.DataSet['类型']:=fee_type.text; for k:= 0 to (t_ch_fee.fieldcount-1) do begin if t_do_fee.DataSet.Fields.FindField(t_ch_fee.fields[k].FieldName)<>nil then if (t_ch_fee.fields[k].FieldName<>'CH_ID') AND(t_ch_fee.fields[k].FieldName<>'编号') AND(t_ch_fee.fields[k].FieldName<>'费用状态') AND(t_ch_fee.fields[k].FieldName<>'结算金额') and (t_ch_fee.fields[k].DataType<>ftDateTime)then t_do_fee.DataSet[t_ch_fee.fields[k].FieldName]:=t_ch_fee[t_ch_fee.fields[k].FieldName]; end; t_do_fee.DataSet['费用状态']:='录入状态'; t_do_fee.DataSet['类型']:=fee_type.text; t_do_fee.DataSet['费用原因']:=null; t_do_fee.DataSet['标准']:=t_ch_fee.FieldByName('标准').AsString; t_do_fee.DataSet['数量']:=fee_get_num(t_do_fee.DataSet['标准']); if bsSkinRadioGroup1.ItemIndex=1 then begin str:=fee_get_client(t_ch_fee.fieldbyname('结算单位').asstring); if str<>'' then t_do_fee.DataSet['客户名称']:=str; end else begin end; if Trim(t_do_fee.DataSet.FieldByName('币别').AsString)<>'RMB' then begin t_do_fee.DataSet['汇率']:=GetCurrencyRate(Trim(t_do_fee.DataSet.FieldByName('币别').AsString),op_type.text,t_ch_fee.DataSource.DataSet); end; // t_do_fee.DataSet['不含税价']:=t_do_fee.DataSet.fieldbyname('不含税价').asfloat; t_do_fee.DataSet.FieldByName('金额').OnChange:=nil; t_do_fee.DataSet['金额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('单价').asfloat*t_do_fee.DataSet.fieldbyname('数量').asfloat); t_do_fee.DataSet['税额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('不含税价').asfloat*t_do_fee.DataSet.fieldbyname('税率').asfloat/100*t_do_fee.DataSet.fieldbyname('数量').asfloat); t_do_fee.DataSet['不含税金额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat-t_do_fee.DataSet.fieldbyname('税额').asfloat); t_do_fee.DataSet['财务税额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat/(1+t_do_fee.DataSet.fieldbyname('财务税率').asfloat/100)*t_do_fee.DataSet.fieldbyname('财务税率').asfloat/100); t_do_fee.DataSet['财务不含税价']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat-t_do_fee.DataSet.fieldbyname('财务税额').asfloat); t_do_fee.DataSet['结算金额']:=0; t_do_fee.DataSet['开票金额']:=0; t_do_fee.DataSet['冲抵金额']:=0; t_do_fee.DataSet['申请金额']:=0; t_do_fee.DataSet['申请开票']:=0; t_do_fee.DataSet['提交日期']:=null; t_do_fee.DataSet['审核人']:=null; t_do_fee.DataSet['审核日期']:=null; t_do_fee.DataSet['录入人']:=employee; t_do_fee.DataSet['录入日期']:=date; t_do_fee.DataSet['是否对帐']:=0; t_do_fee.DataSet['对帐编号']:=''; t_do_fee.DataSet['机密']:=0; t_do_fee.DataSet['预提成本']:=0; t_do_fee.DataSet['冲抵成本']:=0; t_do_fee.DataSet['不开发票']:=0; t_do_fee.DataSet.post; end; end else begin t_do_fee.DataSet.append; t_do_fee.DataSet['费用状态']:='录入状态'; t_do_fee.DataSet['类型']:=fee_type.text; for k:= 0 to (t_ch_fee.fieldcount-1) do begin { if t_do_fee.DataSet.Fields.FindField(t_ch_fee.fields[k].FieldName)<>nil then if (t_ch_fee.fields[k].FieldName<>'CH_ID')AND(t_ch_fee.fields[k].FieldName<>'编号') then t_do_fee.DataSet[t_ch_fee.fields[k].FieldName]:=t_ch_fee[t_ch_fee.fields[k].FieldName]; } if t_do_fee.DataSet.Fields.FindField(t_ch_fee.fields[k].FieldName)<>nil then if (t_ch_fee.fields[k].FieldName<>'CH_ID') AND(t_ch_fee.fields[k].FieldName<>'编号') AND(t_ch_fee.fields[k].FieldName<>'费用状态') AND(t_ch_fee.fields[k].FieldName<>'结算金额') and (t_ch_fee.fields[k].DataType<>ftDateTime)then t_do_fee.DataSet[t_ch_fee.fields[k].FieldName]:=t_ch_fee[t_ch_fee.fields[k].FieldName]; end; t_do_fee.DataSet['费用原因']:=null; t_do_fee.DataSet['标准']:=t_ch_fee.FieldByName('标准').AsString; t_do_fee.DataSet['数量']:=fee_get_num(t_do_fee.DataSet['标准']); if bsSkinRadioGroup1.ItemIndex=1 then begin str:=fee_get_client(t_ch_fee.fieldbyname('结算单位').asstring); if str<>'' then t_do_fee.DataSet['客户名称']:=str; end else begin end; if Trim(t_do_fee.DataSet.FieldByName('币别').AsString)<>'RMB' then begin t_do_fee.DataSet['汇率']:=GetCurrencyRate(Trim(t_do_fee.DataSet.FieldByName('币别').AsString),op_type.text,t_ch_fee.DataSource.DataSet); end; t_do_fee.DataSet.FieldByName('金额').OnChange:=nil; t_do_fee.DataSet['金额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('单价').asfloat*t_do_fee.DataSet.fieldbyname('数量').asfloat); t_do_fee.DataSet['税额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('不含税价').asfloat*t_do_fee.DataSet.fieldbyname('税率').asfloat/100*t_do_fee.DataSet.fieldbyname('数量').asfloat); t_do_fee.DataSet['不含税金额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat-t_do_fee.DataSet.fieldbyname('税额').asfloat); t_do_fee.DataSet['财务税额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat/(1+t_do_fee.DataSet.fieldbyname('财务税率').asfloat/100)*t_do_fee.DataSet.fieldbyname('财务税率').asfloat/100); t_do_fee.DataSet['财务不含税价']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat-t_do_fee.DataSet.fieldbyname('财务税额').asfloat); t_do_fee.DataSet['结算金额']:=0; t_do_fee.DataSet['开票金额']:=0; t_do_fee.DataSet['申请金额']:=0; t_do_fee.DataSet['申请开票']:=0; t_do_fee.DataSet['提交日期']:=null; t_do_fee.DataSet['审核人']:=null; t_do_fee.DataSet['审核日期']:=null; t_do_fee.DataSet['录入人']:=employee; t_do_fee.DataSet['录入日期']:=date; t_do_fee.DataSet['是否对帐']:=0; t_do_fee.DataSet['对帐编号']:=''; t_do_fee.DataSet['机密']:=0; t_do_fee.DataSet['预提成本']:=0; t_do_fee.DataSet['冲抵成本']:=0; t_do_fee.DataSet['不开发票']:=0; t_do_fee.DataSet.post; end; finally { t_do_fee.DataSet.FieldByName('客户名称').OnChange:=fra_fee.t_ch_acceptcrmcharge; t_do_fee.DataSet.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; t_do_fee.DataSet.FieldByName('税率').OnChange:=DatasetNOPricecharge; t_do_fee.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; t_do_fee.DataSet.FieldByName('财务税率').OnChange:=DatasetAmtcharge; t_do_fee.DataSet.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; t_do_fee.DataSet.FieldByName('数量').OnChange:=t_ch_acceptdjoncharge; t_do_fee.DataSet.FieldByName('佣金比例').OnChange:=t_ch_acceptdjoncharge; } close; end; end; procedure Tfrm_fee_history.bsSkinButton1Click(Sender: TObject); var k:integer; str:String; begin if t_ch_fee.IsEmpty then exit; t_ch_fee.first; while not t_ch_fee.eof do begin t_do_fee.DataSet.append; t_do_fee.DataSet['费用状态']:='录入状态'; t_do_fee.DataSet['类型']:=fee_type.text; for k:= 0 to (t_ch_fee.fieldcount-1) do begin if t_do_fee.DataSet.Fields.FindField(t_ch_fee.fields[k].FieldName)<>nil then if (t_ch_fee.fields[k].FieldName<>'CH_ID')AND(t_ch_fee.fields[k].FieldName<>'编号') AND(t_ch_fee.fields[k].FieldName<>'费用状态') AND(t_ch_fee.fields[k].FieldName<>'结算金额') and (t_ch_fee.fields[k].DataType<>ftDateTime) and (t_ch_fee.fields[k].DataType<>ftDate) then try t_do_fee.DataSet[t_ch_fee.fields[k].FieldName]:=t_ch_fee[t_ch_fee.fields[k].FieldName]; except on e :exception do begin showmessage(e.message); end; end end; t_do_fee.DataSet['费用状态']:='录入状态'; t_do_fee.DataSet['类型']:=fee_type.text; t_do_fee.DataSet['费用原因']:=null; t_do_fee.DataSet['标准']:=t_ch_fee.FieldByName('标准').AsString; t_do_fee.DataSet['数量']:=fee_get_num(t_do_fee.DataSet['标准']); if bsSkinRadioGroup1.ItemIndex=1 then begin str:=fee_get_client(t_ch_fee.fieldbyname('结算单位').asstring); if str<>'' then t_do_fee.DataSet['客户名称']:=str; end else begin end; if Trim(t_do_fee.DataSet.FieldByName('币别').AsString)<>'RMB' then begin t_do_fee.DataSet['汇率']:=GetCurrencyRate(Trim(t_do_fee.DataSet.FieldByName('币别').AsString),op_type.text,t_do_fee.DataSet.DataSource.DataSet); end; // t_do_fee.DataSet['不含税价']:=t_do_fee.DataSet.fieldbyname('单价').asfloat/(1+t_do_fee.DataSet.fieldbyname('税率').asfloat/100); t_do_fee.DataSet.FieldByName('金额').OnChange:=nil; t_do_fee.DataSet['金额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('单价').asfloat*t_do_fee.DataSet.fieldbyname('数量').asfloat); t_do_fee.DataSet['税额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('不含税价').asfloat*t_do_fee.DataSet.fieldbyname('税率').asfloat/100*t_do_fee.DataSet.fieldbyname('数量').asfloat); t_do_fee.DataSet['不含税金额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat-t_do_fee.DataSet.fieldbyname('税额').asfloat); t_do_fee.DataSet['财务税额']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat/(1+t_do_fee.DataSet.fieldbyname('财务税率').asfloat/100)*t_do_fee.DataSet.fieldbyname('财务税率').asfloat/100); t_do_fee.DataSet['财务不含税价']:=s_w(strtoint(apointnum),t_do_fee.DataSet.fieldbyname('金额').asfloat-t_do_fee.DataSet.fieldbyname('财务税额').asfloat); t_do_fee.DataSet['结算金额']:=0; t_do_fee.DataSet['开票金额']:=0; t_do_fee.DataSet['申请开票']:=0; t_do_fee.DataSet['冲抵金额']:=0; t_do_fee.DataSet['申请金额']:=0; t_do_fee.DataSet['提交日期']:=null; t_do_fee.DataSet['审核人']:=null; t_do_fee.DataSet['审核日期']:=null; t_do_fee.DataSet['录入人']:=employee; t_do_fee.DataSet['录入日期']:=date; t_do_fee.DataSet['是否对帐']:=0; t_do_fee.DataSet['对帐编号']:=''; t_do_fee.DataSet['顺序']:=t_do_fee.DataSet.RecordCount+1; t_do_fee.DataSet['机密']:=0; t_do_fee.DataSet['预提成本']:=0; t_do_fee.DataSet['冲抵成本']:=0; t_do_fee.DataSet['不开发票']:=0; t_do_fee.DataSet.post; t_ch_fee.next; end; close; end; procedure Tfrm_fee_history.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton2Click(Sender); end; end; procedure Tfrm_fee_history.Edit4KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton2Click(Sender); end; end; procedure Tfrm_fee_history.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton2Click(Sender); end; end; procedure Tfrm_fee_history.Edit2KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton2Click(Sender); end; end; procedure Tfrm_fee_history.Edit3KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton2Click(Sender); end; end; procedure Tfrm_fee_history.wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; bsSkinButton2Click(Sender); end; end; end.