unit u_rp_ch_balance_rate; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, DB, ADODB, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, Mask, wwdbedit, Wwdotdot, Wwdbcomb, StdCtrls, wwdbdatetimepicker, RxLookup, bsSkinCtrls, ComCtrls, bsSkinTabs; type Tfrm_rp_ch_balance_rate = class(TForm) bsSkinPanel1: TbsSkinPanel; Label9: TLabel; Label10: TLabel; Label4: TLabel; Label5: TLabel; Label1: TLabel; Label2: TLabel; bsSkinButton10: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton5: TbsSkinButton; RxDBLookupCombo2: TRxDBLookupCombo; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; RxDBLookupCombo4: TRxDBLookupCombo; wwDBComboBox2: TwwDBComboBox; wwDBComboBox1: TwwDBComboBox; bsSkinButton1: TbsSkinButton; p_detail: TADOStoredProc; p_detail1: TDataSource; p_sales: TADOStoredProc; p_sales1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridDateColumn; dxDBGrid1Column8: TdxDBGridDateColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; bsSkinTabSheet2: TbsSkinTabSheet; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridColumn; p_client: TADOStoredProc; p_client1: TDataSource; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; p_balance: TADOStoredProc; p_balance1: TDataSource; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridColumn; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_ch_balance_rate: Tfrm_rp_ch_balance_rate; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_rp_ch_balance_rate.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_ch_balance_rate.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption+'1'); frm_rp_ch_balance_rate.Hide; frm_rp_ch_balance_rate.ManualFloat(frm_rp_ch_balance_rate.BoundsRect ); frm_main.freeTabs('frm_rp_ch_balance_rate'); action:=cafree; frm_rp_ch_balance_rate:=nil; end; procedure Tfrm_rp_ch_balance_rate.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,false,caption+'1'); end; procedure Tfrm_rp_ch_balance_rate.bsSkinButton9Click(Sender: TObject); begin sys_print('结算利润差额',2,nil,nil,nil,nil,p_detail1,p_sales1,p_client1,p_balance1,nil,nil,nil); end; procedure Tfrm_rp_ch_balance_rate.bsSkinButton1Click(Sender: TObject); begin RxDBLookupCombo2.ClearValue; RxDBLookupCombo4.ClearValue; wwDBDateTimePicker1.text:=''; wwDBDateTimePicker2.text:=''; wwDBComboBox2.ItemIndex:=-1; wwDBComboBox1.ItemIndex:=-1; end; procedure Tfrm_rp_ch_balance_rate.bsSkinButton10Click(Sender: TObject); var str:widestring; begin str:=' where '+open_data('0039','揽货人','操作员','客服员','结算人','no'); if RxDBLookupCombo2.DisplayValue<>''then str:=str+' and 结算客户='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if RxDBLookupCombo4.DisplayValue<>''then str:=str+' and 揽货人='+''''+RxDBLookupCombo4.DisplayValues[0]+''''; if wwDBComboBox2.text<>''then str:=str+' and 业务种类='+''''+wwDBComboBox2.text+''''; if wwDBComboBox1.text<>''then str:=str+' and 结算类型='+''''+wwDBComboBox1.text+''''; if wwDBDateTimePicker1.Text<>''then str:=str+' and 结算日期>='+''''+wwDBDateTimePicker1.Text+''''; if wwDBDateTimePicker2.Text<>''then str:=str+' and 结算日期<='+''''+wwDBDateTimePicker2.Text+''''; p_detail.close; p_detail.Parameters.ParamByName('SQLStr').value:='select * from v_fee_rate_op '+str +' order by 结算类型,业务种类,揽货人,结算日期'; p_detail.open; p_sales.close; p_sales.Parameters.ParamByName('SQLStr').value:='select 揽货人,SUM(利润差额) AS 利润差额 from v_fee_rate_op '+str +' group by 揽货人 order by 揽货人'; p_sales.open; p_client.close; p_client.Parameters.ParamByName('SQLStr').value:='select 结算客户,SUM(利润差额) AS 利润差额 from v_fee_rate_op '+str +' group by 结算客户 order by 结算客户'; p_client.open; p_balance.close; p_balance.Parameters.ParamByName('SQLStr').value:='select 结算类型,SUM(利润差额) AS 利润差额 from v_fee_rate_op '+str +' group by 结算类型 order by 结算类型'; p_balance.open; end; end.