unit u_rp_ch_balance_pay; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, bsSkinCtrls, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner, ComCtrls, bsSkinTabs, DB, ADODB; type Tfrm_rp_ch_balance_pay = class(TForm) p_detail: TADOStoredProc; p_detail1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridDateColumn; dxDBGrid1Column16: TdxDBGridMaskColumn; dxDBGrid1Column17: TdxDBGridDateColumn; bsSkinTabSheet2: TbsSkinTabSheet; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGrid2Column6: TdxDBGridColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; dxDBGridColumn3: TdxDBGridColumn; RadioGroup1: TbsSkinRadioGroup; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGrid3Column5: TdxDBGridColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGridColumn5: TdxDBGridColumn; dxDBGridColumn6: TdxDBGridColumn; bsSkinTabSheet3: TbsSkinTabSheet; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridColumn7: TdxDBGridColumn; dxDBGridColumn8: TdxDBGridColumn; dxDBGrid5: TdxDBGrid; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridColumn11: TdxDBGridColumn; dxDBGridColumn12: TdxDBGridColumn; dxDBGridColumn13: TdxDBGridColumn; dxDBGridColumn14: TdxDBGridColumn; p_total: TADOStoredProc; p_total1: TDataSource; p_currency: TADOStoredProc; p_currency1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinButton10: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton5: TbsSkinButton; p_sales: TADOStoredProc; p_sales1: TDataSource; bsSkinButton1: TbsSkinButton; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinPageControl1Resize(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinPageControl1Change(Sender: TObject); procedure RadioGroup1Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_ch_balance_pay: Tfrm_rp_ch_balance_pay; frm_rp_ch_balance_pay_open:boolean; frm_rp_ch_balance_pay_str:widestring; implementation uses u_ch_balance_query, my_sys_function, u_main, u_rp_ch_balance_view; {$R *.dfm} procedure Tfrm_rp_ch_balance_pay.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_ch_balance_pay.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_rp_ch_balance_pay_open:=false; frm_rp_ch_balance_pay.Hide; frm_rp_ch_balance_pay.ManualFloat(frm_rp_ch_balance_pay.BoundsRect ); frm_main.freeTabs('frm_rp_ch_balance_pay'); action:=cafree; frm_rp_ch_balance_pay:=nil; end; procedure Tfrm_rp_ch_balance_pay.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,false,caption); frm_rp_ch_balance_pay_open:=true; end; procedure Tfrm_rp_ch_balance_pay.bsSkinPageControl1Resize(Sender: TObject); begin bsSkinPanel1.Left:=bsSkinPageControl1.Width-bsSkinPanel1.Width-5; end; procedure Tfrm_rp_ch_balance_pay.bsSkinButton10Click(Sender: TObject); begin try frm_ch_balance_query:=tfrm_ch_balance_query.Create (self); balance_query_type:=7; frm_ch_balance_query.ShowModal; finally frm_ch_balance_query.Free; end; end; procedure Tfrm_rp_ch_balance_pay.bsSkinPageControl1Change(Sender: TObject); begin if frm_rp_ch_balance_pay_open then begin if bsSkinTabSheet2.Showing then frm_rp_ch_balance_pay.RadioGroup1Click(Sender); end; end; procedure Tfrm_rp_ch_balance_pay.RadioGroup1Click(Sender: TObject); var str:widestring; begin if p_detail.Active then begin str:='select '+RadioGroup1.Items[RadioGroup1.ItemIndex] +' as 统计标准,'+''''+RadioGroup1.Items[RadioGroup1.ItemIndex]+'''' +' as base,币别,sum(结算金额) as 结算金额,sum(实结金额) as 实结金额,sum(虚结金额) as 虚结金额' +',count(帐单编号) as 笔数' +' from t_ch_balance '+frm_rp_ch_balance_pay_str +' group by '+RadioGroup1.Items[RadioGroup1.ItemIndex] +',币别' +' order by '+RadioGroup1.Items[RadioGroup1.ItemIndex]; p_total.close; p_total.Parameters.ParamByName('SQLStr').value:=str; p_total.open; dxDBGridMaskColumn3.Caption:=RadioGroup1.Items[RadioGroup1.ItemIndex]; end; end; procedure Tfrm_rp_ch_balance_pay.bsSkinButton9Click(Sender: TObject); begin sys_print('应付结算统计',2,nil,nil,nil,nil,p_detail1,p_total1,p_sales1,p_currency1,nil,nil,nil); end; procedure Tfrm_rp_ch_balance_pay.bsSkinButton1Click(Sender: TObject); begin if (not p_detail.active)or(p_detail.IsEmpty)then begin showmessage('没有帐单信息!'); exit; end; try if not assigned(frm_rp_ch_balance_view) then frm_rp_ch_balance_view:=tfrm_rp_ch_balance_view.Create (self); with frm_rp_ch_balance_view do begin v_fee_do_seae.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_seae.open; v_fee_do_seai.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_seai.open; v_fee_do_aire.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_aire.open; v_fee_do_airi.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_airi.open; v_fee_do_seae_sum.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_seae_sum.open; v_fee_do_seai_sum.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_seai_sum.open; v_fee_do_aire_sum.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_aire_sum.open; v_fee_do_airi_sum.Parameters.ParamByName('帐单编号').value:= p_detail.fieldbyname('帐单编号').asstring; v_fee_do_airi_sum.open; end; frm_rp_ch_balance_view.ShowModal; finally frm_rp_ch_balance_view.free; frm_rp_ch_balance_view:=nil; end; end; end.