unit u_rp_ch_currency_change; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, wwdblook, RxLookup, wwdbdatetimepicker, StdCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms; type Tfrm_rp_ch_currency_change = class(TForm) bsSkinPanel1: TbsSkinPanel; Label10: TLabel; Label5: TLabel; Label8: TLabel; Label11: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinPanel2: TbsSkinPanel; dxDBGrid1: TdxDBGrid; p_accept_usdtormb: TADOStoredProc; p_accept_usdtormb1: TDataSource; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1USDTORMB: TdxDBGridColumn; p_accept_rmbtousd: TADOStoredProc; p_accept_rmbtousd1: TDataSource; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; p_pay_usdtormb: TADOStoredProc; p_pay_usdtormb1: TDataSource; p_pay_rmbtousd: TADOStoredProc; p_pay_rmbtousd1: TDataSource; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridColumn3: TdxDBGridColumn; procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton9Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_ch_currency_change: Tfrm_rp_ch_currency_change; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_rp_ch_currency_change.bsSkinButton1Click(Sender: TObject); var str:widestring; begin if wwDBDateTimePicker1.text<>'' then str:='where 业务日期>='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker2.text<>'' then begin if str=''then str:='where 业务日期<='+''''+wwDBDateTimePicker2.text+'''' else str:=str+' and 业务日期<='+''''+wwDBDateTimePicker2.text+''''; end; if wwDBDateTimePicker3.text<>'' then begin if str=''then str:='where 会计期间>='+''''+wwDBDateTimePicker3.text+'''' else str:=str+' and 会计期间>='+''''+wwDBDateTimePicker3.text+''''; end; if wwDBDateTimePicker4.text<>'' then begin if str=''then str:='where 会计期间<='+''''+wwDBDateTimePicker4.text+'''' else str:=str+' and 会计期间<='+''''+wwDBDateTimePicker4.text+''''; end; if str<>''then str:=' and t_ch_fee_do.业务编号 in (select 编号 from v_op_no '+str+')'; p_accept_usdtormb.close; p_accept_usdtormb.Parameters.ParamByName('SQLStr').Value:= 'SELECT t_ch_fee.客户名称, SUM(t_ch_fee_do.原始金额) AS USDTORMB '+ 'FROM t_ch_fee_do INNER JOIN '+ 't_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '+ 'WHERE (t_ch_fee_do.币别 = '+''''+'RMB'+''''+') AND (t_ch_fee.币别 = '+''''+'USD'+''''+') AND '+ '(t_ch_fee_do.类型 = '+''''+'3'+''''+') '+str+ ' GROUP BY t_ch_fee.客户名称'; p_accept_usdtormb.open; p_accept_rmbtousd.close; p_accept_rmbtousd.Parameters.ParamByName('SQLStr').Value:= 'SELECT t_ch_fee.客户名称, SUM(t_ch_fee_do.原始金额) AS RMBTOUSD '+ 'FROM t_ch_fee_do INNER JOIN '+ 't_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '+ 'WHERE (t_ch_fee_do.币别 = '+''''+'USD'+''''+') AND (t_ch_fee.币别 = '+''''+'RMB'+''''+') AND '+ '(t_ch_fee_do.类型 = '+''''+'3'+''''+') '+str+ ' GROUP BY t_ch_fee.客户名称'; p_accept_rmbtousd.open; p_pay_usdtormb.close; p_pay_usdtormb.Parameters.ParamByName('SQLStr').Value:= 'SELECT t_ch_fee.客户名称, SUM(t_ch_fee_do.原始金额) AS USDTORMB '+ 'FROM t_ch_fee_do INNER JOIN '+ 't_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '+ 'WHERE (t_ch_fee_do.币别 = '+''''+'RMB'+''''+') AND (t_ch_fee.币别 = '+''''+'USD'+''''+') AND '+ '(t_ch_fee_do.类型 = '+''''+'4'+''''+') '+str+ ' GROUP BY t_ch_fee.客户名称'; p_pay_usdtormb.open; p_pay_rmbtousd.close; p_pay_rmbtousd.Parameters.ParamByName('SQLStr').Value:= 'SELECT t_ch_fee.客户名称, SUM(t_ch_fee_do.原始金额) AS RMBTOUSD '+ 'FROM t_ch_fee_do INNER JOIN '+ 't_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '+ 'WHERE (t_ch_fee_do.币别 = '+''''+'USD'+''''+') AND (t_ch_fee.币别 = '+''''+'RMB'+''''+') AND '+ '(t_ch_fee_do.类型 = '+''''+'4'+''''+') '+str+ ' GROUP BY t_ch_fee.客户名称'; p_pay_rmbtousd.open; end; procedure Tfrm_rp_ch_currency_change.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_ch_currency_change.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_rp_ch_currency_change.Hide; frm_rp_ch_currency_change.ManualFloat(frm_rp_ch_currency_change.BoundsRect ); frm_main.freeTabs('frm_rp_ch_currency_change'); action:=cafree; frm_rp_ch_currency_change:=nil; end; procedure Tfrm_rp_ch_currency_change.bsSkinButton9Click(Sender: TObject); begin sys_print('币别折算统计',2,nil,nil,nil,nil,p_accept_usdtormb1,p_accept_rmbtousd1,p_pay_usdtormb1,p_pay_rmbtousd1,nil,nil,nil); end; end.