unit u_fee_zhu; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, StdCtrls, Mask, bsSkinBoxCtrls, bsdbctrls, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, Menus, XPMenu, ComCtrls, bsSkinTabs, RxMemDS; type Tfra_fee_zhu = class(TFrame) t_ch_accept: TADOStoredProc; t_ch_pay: TADOStoredProc; t_op_gain: TADOStoredProc; t_ch_accept1: TDataSource; t_op_gain1: TDataSource; t_ch_pay1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; bsSkinStdLabel1: TbsSkinStdLabel; bsSkinStdLabel2: TbsSkinStdLabel; bsSkinStdLabel3: TbsSkinStdLabel; bsSkinStdLabel4: TbsSkinStdLabel; bsSkinStdLabel5: TbsSkinStdLabel; bsSkinStdLabel6: TbsSkinStdLabel; bsSkinStdLabel7: TbsSkinStdLabel; bsSkinStdLabel8: TbsSkinStdLabel; bsSkinStdLabel9: TbsSkinStdLabel; bsSkinStdLabel10: TbsSkinStdLabel; bsSkinDBEdit1: TbsSkinDBEdit; bsSkinDBEdit2: TbsSkinDBEdit; bsSkinDBEdit3: TbsSkinDBEdit; bsSkinDBEdit4: TbsSkinDBEdit; bsSkinDBEdit5: TbsSkinDBEdit; bsSkinDBEdit6: TbsSkinDBEdit; bsSkinDBEdit7: TbsSkinDBEdit; bsSkinDBEdit8: TbsSkinDBEdit; bsSkinDBEdit9: TbsSkinDBEdit; PopupMenu3: TPopupMenu; N10: TMenuItem; N29: TMenuItem; N30: TMenuItem; N31: TMenuItem; N19: TMenuItem; N14: TMenuItem; N41: TMenuItem; N42: TMenuItem; N43: TMenuItem; N24: TMenuItem; N18: TMenuItem; N53: TMenuItem; N54: TMenuItem; N55: TMenuItem; zhupiao1: TDataSource; XPMenu1: TXPMenu; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; bsSkinDBEdit10: TbsSkinDBEdit; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N11: TMenuItem; N12: TMenuItem; N13: TMenuItem; N15: TMenuItem; N16: TMenuItem; N17: TMenuItem; N20: TMenuItem; N21: TMenuItem; N22: TMenuItem; N23: TMenuItem; N25: TMenuItem; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinPanel3: TbsSkinPanel; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridColumn; dxDBGrid1Column13: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; dxDBGrid1Column14: TdxDBGridColumn; dxDBGrid1Column15: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; bsSkinPanel4: TbsSkinPanel; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridCurrencyColumn1: TdxDBGridColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridCurrencyColumn2: TdxDBGridColumn; dxDBGrid2Column15: TdxDBGridColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn3: TdxDBGridColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGridColumn5: TdxDBGridColumn; t_op_gain_fen: TADOStoredProc; t_op_gain_fen1: TDataSource; dxDBGrid3: TdxDBGrid; dxDBGrid3Column1: TdxDBGridColumn; dxDBGrid3Column2: TdxDBGridColumn; dxDBGrid3Column3: TdxDBGridColumn; dxDBGrid3Column4: TdxDBGridColumn; dxDBGrid3Column5: TdxDBGridColumn; dxDBGrid3Column9: TdxDBGridColumn; dxDBGrid3Column10: TdxDBGridColumn; dxDBGrid3Column11: TdxDBGridColumn; dxDBGrid3Column12: TdxDBGridColumn; dxDBGrid3Column13: TdxDBGridColumn; dxDBGrid3Column14: TdxDBGridColumn; dxDBGrid3Column15: TdxDBGridColumn; N26: TMenuItem; N27: TMenuItem; N28: TMenuItem; N32: TMenuItem; N33: TMenuItem; N34: TMenuItem; N35: TMenuItem; bsSkinButton9: TbsSkinButton; t_client_sum: TRxMemoryData; t_client_sum1: TDataSource; N36: TMenuItem; N37: TMenuItem; N38: TMenuItem; N39: TMenuItem; N40: TMenuItem; N44: TMenuItem; N45: TMenuItem; t_sum: TRxMemoryData; t_sum1: TDataSource; fenpiao1: TDataSource; procedure bsSkinButton9Click(Sender: TObject); procedure N29Click(Sender: TObject); procedure N31Click(Sender: TObject); procedure N41Click(Sender: TObject); procedure N43Click(Sender: TObject); procedure N53Click(Sender: TObject); procedure N55Click(Sender: TObject); procedure bsSkinPanel2Resize(Sender: TObject); procedure N1Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure N13Click(Sender: TObject); procedure N11Click(Sender: TObject); procedure N8Click(Sender: TObject); procedure N23Click(Sender: TObject); procedure N21Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N28Click(Sender: TObject); procedure N33Click(Sender: TObject); procedure N35Click(Sender: TObject); procedure N38Click(Sender: TObject); procedure N40Click(Sender: TObject); procedure N45Click(Sender: TObject); private { Private declarations } public { Public declarations } end; implementation uses u_main, my_sys_function, u_data_share; {$R *.dfm} procedure Tfra_fee_zhu.bsSkinButton9Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfra_fee_zhu.N29Click(Sender: TObject); begin sys_print('海运出口拼箱应收费用',1,zhupiao1,t_op_gain1,nil,nil,t_ch_accept1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N31Click(Sender: TObject); begin sys_print('海运出口拼箱应收费用',2,zhupiao1,t_op_gain1,nil,nil,t_ch_accept1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N41Click(Sender: TObject); begin sys_print('海运出口拼箱应付费用',1,zhupiao1,t_op_gain1,nil,nil,t_ch_pay1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N43Click(Sender: TObject); begin sys_print('海运出口拼箱应付费用',2,zhupiao1,t_op_gain1,nil,nil,t_ch_pay1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N53Click(Sender: TObject); begin sys_print('海运出口拼箱利润单',1,zhupiao1,t_op_gain1,nil,nil,t_ch_accept1,t_ch_pay1,nil,nil,nil,nil,nil); if strtobool(get_parameters_value(63,'false'))then begin fenpiao1.DataSet.First; while not fenpiao1.DataSet.eof do begin if fenpiao1.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then begin fenpiao1.DataSet.edit; fenpiao1.DataSet['费用状态']:='费用封帐'; fenpiao1.DataSet.post; end; fenpiao1.DataSet.next; end; if zhupiao1.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then begin zhupiao1.DataSet.edit; zhupiao1.DataSet['费用状态']:='费用封帐'; zhupiao1.DataSet.post; end; end; end; procedure Tfra_fee_zhu.N55Click(Sender: TObject); begin sys_print('海运出口拼箱利润单',2,zhupiao1,t_op_gain1,nil,nil,t_ch_accept1,t_ch_pay1,nil,nil,nil,nil,nil); if strtobool(get_parameters_value(63,'false'))then begin fenpiao1.DataSet.First; while not fenpiao1.DataSet.eof do begin if fenpiao1.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then begin fenpiao1.DataSet.edit; fenpiao1.DataSet['费用状态']:='费用封帐'; fenpiao1.DataSet.post; end; fenpiao1.DataSet.next; end; if zhupiao1.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then begin zhupiao1.DataSet.edit; zhupiao1.DataSet['费用状态']:='费用封帐'; zhupiao1.DataSet.post; end; end; end; procedure Tfra_fee_zhu.bsSkinPanel2Resize(Sender: TObject); var i:integer; begin i:=round((bsSkinPanel2.Width-196)/10); bsSkinPanel3.Height:=round(bsSkinTabSheet2.Height/2); bsSkinDBEdit1.Width:=i; bsSkinDBEdit2.Width:=i; bsSkinDBEdit3.Width:=i; bsSkinDBEdit4.Width:=i; bsSkinDBEdit5.Width:=i; bsSkinDBEdit6.Width:=i; bsSkinDBEdit7.Width:=i; bsSkinDBEdit8.Width:=i; bsSkinDBEdit9.Width:=i; end; procedure Tfra_fee_zhu.N1Click(Sender: TObject); begin sys_print('海运出口拼箱应收费用',3,zhupiao1,t_op_gain1,nil,nil,t_ch_accept1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N3Click(Sender: TObject); begin sys_print('海运出口拼箱应付费用',3,zhupiao1,t_op_gain1,nil,nil,t_ch_pay1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N5Click(Sender: TObject); begin sys_print('海运出口拼箱利润单',3,zhupiao1,t_op_gain1,nil,nil,t_ch_accept1,t_ch_pay1,nil,nil,nil,nil,nil); if strtobool(get_parameters_value(63,'false'))then begin fenpiao1.DataSet.First; while not fenpiao1.DataSet.eof do begin if fenpiao1.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then begin fenpiao1.DataSet.edit; fenpiao1.DataSet['费用状态']:='费用封帐'; fenpiao1.DataSet.post; end; fenpiao1.DataSet.next; end; if zhupiao1.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then begin zhupiao1.DataSet.edit; zhupiao1.DataSet['费用状态']:='费用封帐'; zhupiao1.DataSet.post; end; end; end; procedure Tfra_fee_zhu.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort_pro(Column,t_ch_accept,'业务编号'); end; procedure Tfra_fee_zhu.dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort_pro(Column,t_ch_pay,'业务编号'); end; procedure Tfra_fee_zhu.N13Click(Sender: TObject); var str:string; begin try str:=t_ch_accept.fieldbyname('客户名称').asstring; t_ch_accept.DisableControls; t_ch_accept.Filtered:=false; t_ch_accept.Filter:='客户名称='+''''+str+''''; t_ch_accept.Filtered:=true; t_sum.close; t_sum.open; t_ch_accept.first; while not t_ch_accept.eof do begin if t_sum.locate('币别',t_ch_accept.fieldbyname('币别').asstring,[]) then begin t_sum.edit; t_sum['金额']:=t_sum['金额']+t_ch_accept.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_sum['折合RMB']+t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_sum.post; end else begin t_sum.insert; t_sum['币别']:=t_ch_accept.fieldbyname('币别').asstring; t_sum['金额']:=t_ch_accept.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_sum.post; end; t_ch_accept.next; end; sys_print('海运出口拼箱应收客户',1,zhupiao1,nil,nil,nil,t_ch_accept1,t_sum1,nil,nil,nil,nil,nil); finally t_ch_accept.Filtered:=false; t_ch_accept.EnableControls; end; end; procedure Tfra_fee_zhu.N11Click(Sender: TObject); var str:string; begin try str:=t_ch_accept.fieldbyname('客户名称').asstring; t_ch_accept.DisableControls; t_ch_accept.Filtered:=false; t_ch_accept.Filter:='客户名称='+''''+str+''''; t_ch_accept.Filtered:=true; t_sum.close; t_sum.open; t_ch_accept.first; while not t_ch_accept.eof do begin if t_sum.locate('币别',t_ch_accept.fieldbyname('币别').asstring,[]) then begin t_sum.edit; t_sum['金额']:=t_sum['金额']+t_ch_accept.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_sum['折合RMB']+t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_sum.post; end else begin t_sum.insert; t_sum['币别']:=t_ch_accept.fieldbyname('币别').asstring; t_sum['金额']:=t_ch_accept.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_sum.post; end; t_ch_accept.next; end; sys_print('海运出口拼箱应收客户',3,zhupiao1,nil,nil,nil,t_ch_accept1,t_sum1,nil,nil,nil,nil,nil); finally t_ch_accept.Filtered:=false; t_ch_accept.EnableControls; end; end; procedure Tfra_fee_zhu.N8Click(Sender: TObject); var str:string; begin try str:=t_ch_accept.fieldbyname('客户名称').asstring; t_ch_accept.DisableControls; t_ch_accept.Filtered:=false; t_ch_accept.Filter:='客户名称='+''''+str+''''; t_ch_accept.Filtered:=true; t_sum.close; t_sum.open; t_ch_accept.first; while not t_ch_accept.eof do begin if t_sum.locate('币别',t_ch_accept.fieldbyname('币别').asstring,[]) then begin t_sum.edit; t_sum['金额']:=t_sum['金额']+t_ch_accept.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_sum['折合RMB']+t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_sum.post; end else begin t_sum.insert; t_sum['币别']:=t_ch_accept.fieldbyname('币别').asstring; t_sum['金额']:=t_ch_accept.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_sum.post; end; t_ch_accept.next; end; sys_print('海运出口拼箱应收客户',2,zhupiao1,nil,nil,nil,t_ch_accept1,t_sum1,nil,nil,nil,nil,nil); finally t_ch_accept.Filtered:=false; t_ch_accept.EnableControls; end; end; procedure Tfra_fee_zhu.N23Click(Sender: TObject); var str:string; begin try str:=t_ch_pay.fieldbyname('客户名称').asstring; t_ch_pay.DisableControls; t_ch_pay.Filtered:=false; t_ch_pay.Filter:='客户名称='+''''+str+''''; t_ch_pay.Filtered:=true; t_sum.close; t_sum.open; t_ch_pay.first; while not t_ch_pay.eof do begin if t_sum.locate('币别',t_ch_pay.fieldbyname('币别').asstring,[]) then begin t_sum.edit; t_sum['金额']:=t_sum['金额']+t_ch_pay.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_sum['折合RMB']+t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_sum.post; end else begin t_sum.insert; t_sum['币别']:=t_ch_pay.fieldbyname('币别').asstring; t_sum['金额']:=t_ch_pay.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_sum.post; end; t_ch_pay.next; end; sys_print('海运出口拼箱应付客户',1,zhupiao1,nil,nil,nil,t_ch_pay1,t_sum1,nil,nil,nil,nil,nil); finally t_ch_pay.Filtered:=false; t_ch_pay.EnableControls; end; end; procedure Tfra_fee_zhu.N21Click(Sender: TObject); var str:string; begin try str:=t_ch_pay.fieldbyname('客户名称').asstring; t_ch_pay.DisableControls; t_ch_pay.Filtered:=false; t_ch_pay.Filter:='客户名称='+''''+str+''''; t_ch_pay.Filtered:=true; t_sum.close; t_sum.open; t_ch_pay.first; while not t_ch_pay.eof do begin if t_sum.locate('币别',t_ch_pay.fieldbyname('币别').asstring,[]) then begin t_sum.edit; t_sum['金额']:=t_sum['金额']+t_ch_pay.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_sum['折合RMB']+t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_sum.post; end else begin t_sum.insert; t_sum['币别']:=t_ch_pay.fieldbyname('币别').asstring; t_sum['金额']:=t_ch_pay.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_sum.post; end; t_ch_pay.next; end; sys_print('海运出口拼箱应付客户',3,zhupiao1,nil,nil,nil,t_ch_pay1,t_sum1,nil,nil,nil,nil,nil); finally t_ch_pay.Filtered:=false; t_ch_pay.EnableControls; end; end; procedure Tfra_fee_zhu.N17Click(Sender: TObject); var str:string; begin try str:=t_ch_pay.fieldbyname('客户名称').asstring; t_ch_pay.DisableControls; t_ch_pay.Filtered:=false; t_ch_pay.Filter:='客户名称='+''''+str+''''; t_ch_pay.Filtered:=true; t_sum.close; t_sum.open; t_ch_pay.first; while not t_ch_pay.eof do begin if t_sum.locate('币别',t_ch_pay.fieldbyname('币别').asstring,[]) then begin t_sum.edit; t_sum['金额']:=t_sum['金额']+t_ch_pay.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_sum['折合RMB']+t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_sum.post; end else begin t_sum.insert; t_sum['币别']:=t_ch_pay.fieldbyname('币别').asstring; t_sum['金额']:=t_ch_pay.fieldbyname('金额').asfloat; t_sum['折合RMB']:=t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_sum.post; end; t_ch_pay.next; end; sys_print('海运出口拼箱应付客户',2,zhupiao1,nil,nil,nil,t_ch_pay1,t_sum1,nil,nil,nil,nil,nil); finally t_ch_pay.Filtered:=false; t_ch_pay.EnableControls; end; end; procedure Tfra_fee_zhu.N28Click(Sender: TObject); begin sys_print('海运出口拼箱分票利润',1,zhupiao1,t_op_gain1,nil,nil,t_op_gain_fen1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N33Click(Sender: TObject); begin sys_print('海运出口拼箱分票利润',3,zhupiao1,t_op_gain1,nil,nil,t_op_gain_fen1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N35Click(Sender: TObject); begin sys_print('海运出口拼箱分票利润',2,zhupiao1,t_op_gain1,nil,nil,t_op_gain_fen1,nil,nil,nil,nil,nil,nil); end; procedure Tfra_fee_zhu.N38Click(Sender: TObject); var str:string; begin try str:=t_ch_accept.fieldbyname('客户名称').asstring; t_ch_accept.DisableControls; t_ch_accept.Filtered:=false; t_ch_accept.Filter:='客户名称='+''''+str+''''; t_ch_accept.Filtered:=true; t_ch_pay.DisableControls; t_ch_pay.Filtered:=false; t_ch_pay.Filter:='客户名称='+''''+str+''''; t_ch_pay.Filtered:=true; t_client_sum.close; t_client_sum.open; t_ch_accept.first; while not t_ch_accept.eof do begin if t_client_sum.locate('币别',t_ch_accept.fieldbyname('币别').asstring,[]) then begin t_client_sum.edit; t_client_sum['应收金额']:=t_client_sum['应收金额']+t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['余额']:=t_client_sum['余额']+t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_client_sum['折合RMB余额']+t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_client_sum.post; end else begin t_client_sum.insert; t_client_sum['币别']:=t_ch_accept.fieldbyname('币别').asstring; t_client_sum['应收金额']:=t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['应付金额']:=0; t_client_sum['余额']:=t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_client_sum.post; end; t_ch_accept.next; end; t_ch_pay.first; while not t_ch_pay.eof do begin if t_client_sum.locate('币别',t_ch_pay.fieldbyname('币别').asstring,[]) then begin t_client_sum.edit; t_client_sum['应付金额']:=t_client_sum['应付金额']+t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['余额']:=t_client_sum['余额']-t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_client_sum['折合RMB余额']-t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_client_sum.post; end else begin t_client_sum.insert; t_client_sum['币别']:=t_ch_pay.fieldbyname('币别').asstring; t_client_sum['应付金额']:=t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['应收金额']:=0; t_client_sum['余额']:=t_ch_pay.fieldbyname('金额').asfloat*-1; t_client_sum['折合RMB余额']:=t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat*-1; t_client_sum.post; end; t_ch_pay.next; end; sys_print('海运出口拼箱客户收付',1,zhupiao1,nil,nil,nil,t_ch_accept1,t_ch_pay1,t_client_sum1,nil,nil,nil,nil); finally t_ch_accept.Filtered:=false; t_ch_accept.EnableControls; t_ch_pay.Filtered:=false; t_ch_pay.EnableControls; end; end; procedure Tfra_fee_zhu.N40Click(Sender: TObject); var str:string; begin try str:=t_ch_accept.fieldbyname('客户名称').asstring; t_ch_accept.DisableControls; t_ch_accept.Filtered:=false; t_ch_accept.Filter:='客户名称='+''''+str+''''; t_ch_accept.Filtered:=true; t_ch_pay.DisableControls; t_ch_pay.Filtered:=false; t_ch_pay.Filter:='客户名称='+''''+str+''''; t_ch_pay.Filtered:=true; t_client_sum.close; t_client_sum.open; t_ch_accept.first; while not t_ch_accept.eof do begin if t_client_sum.locate('币别',t_ch_accept.fieldbyname('币别').asstring,[]) then begin t_client_sum.edit; t_client_sum['应收金额']:=t_client_sum['应收金额']+t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['余额']:=t_client_sum['余额']+t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_client_sum['折合RMB余额']+t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_client_sum.post; end else begin t_client_sum.insert; t_client_sum['币别']:=t_ch_accept.fieldbyname('币别').asstring; t_client_sum['应收金额']:=t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['应付金额']:=0; t_client_sum['余额']:=t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_client_sum.post; end; t_ch_accept.next; end; t_ch_pay.first; while not t_ch_pay.eof do begin if t_client_sum.locate('币别',t_ch_pay.fieldbyname('币别').asstring,[]) then begin t_client_sum.edit; t_client_sum['应付金额']:=t_client_sum['应付金额']+t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['余额']:=t_client_sum['余额']-t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_client_sum['折合RMB余额']-t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_client_sum.post; end else begin t_client_sum.insert; t_client_sum['币别']:=t_ch_pay.fieldbyname('币别').asstring; t_client_sum['应付金额']:=t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['应收金额']:=0; t_client_sum['余额']:=t_ch_pay.fieldbyname('金额').asfloat*-1; t_client_sum['折合RMB余额']:=t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat*-1; t_client_sum.post; end; t_ch_pay.next; end; sys_print('海运出口拼箱客户收付',3,zhupiao1,nil,nil,nil,t_ch_accept1,t_ch_pay1,t_client_sum1,nil,nil,nil,nil); finally t_ch_accept.Filtered:=false; t_ch_accept.EnableControls; t_ch_pay.Filtered:=false; t_ch_pay.EnableControls; end; end; procedure Tfra_fee_zhu.N45Click(Sender: TObject); var str:string; begin try str:=t_ch_accept.fieldbyname('客户名称').asstring; t_ch_accept.DisableControls; t_ch_accept.Filtered:=false; t_ch_accept.Filter:='客户名称='+''''+str+''''; t_ch_accept.Filtered:=true; t_ch_pay.DisableControls; t_ch_pay.Filtered:=false; t_ch_pay.Filter:='客户名称='+''''+str+''''; t_ch_pay.Filtered:=true; t_client_sum.close; t_client_sum.open; t_ch_accept.first; while not t_ch_accept.eof do begin if t_client_sum.locate('币别',t_ch_accept.fieldbyname('币别').asstring,[]) then begin t_client_sum.edit; t_client_sum['应收金额']:=t_client_sum['应收金额']+t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['余额']:=t_client_sum['余额']+t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_client_sum['折合RMB余额']+t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_client_sum.post; end else begin t_client_sum.insert; t_client_sum['币别']:=t_ch_accept.fieldbyname('币别').asstring; t_client_sum['应收金额']:=t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['应付金额']:=0; t_client_sum['余额']:=t_ch_accept.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_ch_accept.fieldbyname('金额').asfloat *t_ch_accept.fieldbyname('汇率').asfloat; t_client_sum.post; end; t_ch_accept.next; end; t_ch_pay.first; while not t_ch_pay.eof do begin if t_client_sum.locate('币别',t_ch_pay.fieldbyname('币别').asstring,[]) then begin t_client_sum.edit; t_client_sum['应付金额']:=t_client_sum['应付金额']+t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['余额']:=t_client_sum['余额']-t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['折合RMB余额']:=t_client_sum['折合RMB余额']-t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat; t_client_sum.post; end else begin t_client_sum.insert; t_client_sum['币别']:=t_ch_pay.fieldbyname('币别').asstring; t_client_sum['应付金额']:=t_ch_pay.fieldbyname('金额').asfloat; t_client_sum['应收金额']:=0; t_client_sum['余额']:=t_ch_pay.fieldbyname('金额').asfloat*-1; t_client_sum['折合RMB余额']:=t_ch_pay.fieldbyname('金额').asfloat *t_ch_pay.fieldbyname('汇率').asfloat*-1; t_client_sum.post; end; t_ch_pay.next; end; sys_print('海运出口拼箱客户收付',2,zhupiao1,nil,nil,nil,t_ch_accept1,t_ch_pay1,t_client_sum1,nil,nil,nil,nil); finally t_ch_accept.Filtered:=false; t_ch_accept.EnableControls; t_ch_pay.Filtered:=false; t_ch_pay.EnableControls; end; end; end.