You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

291 lines
8.4 KiB
Plaintext

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, Menus;
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;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
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);
procedure N14Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N16Click(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 ͳ<>Ʊ<EFBFBD>׼,'+''''+RadioGroup1.Items[RadioGroup1.ItemIndex]+''''
+' as base,<2C>ұ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
+',count(<28>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>'
+' from t_ch_balance '+frm_rp_ch_balance_pay_str
+' group by '+RadioGroup1.Items[RadioGroup1.ItemIndex]
+',<2C>ұ<EFBFBD>'
+' 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('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>',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('û<><C3BB><EFBFBD>ʵ<EFBFBD><CAB5><EFBFBD>Ϣ<EFBFBD><CFA2>');
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('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_seae.open;
v_fee_do_seai.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_seai.open;
v_fee_do_aire.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_aire.open;
v_fee_do_airi.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_airi.open;
v_fee_do_seae_sum.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_seae_sum.open;
v_fee_do_seai_sum.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_seai_sum.open;
v_fee_do_aire_sum.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').asstring;
v_fee_do_aire_sum.open;
v_fee_do_airi_sum.Parameters.ParamByName('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').value:=
p_detail.fieldbyname('<27>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD>').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;
procedure Tfrm_rp_ch_balance_pay.N14Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid_view_all(dxdbgrid1);
exit;
end;
if bsSkinTabSheet2.showing then
begin
update_grid_view_all(dxdbgrid2);
exit;
end;
if bsSkinTabSheet3.showing then
begin
update_grid_view_all(dxdbgrid4);
exit;
end;
end;
procedure Tfrm_rp_ch_balance_pay.N10Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid_view_no(dxdbgrid1);
exit;
end;
if bsSkinTabSheet2.showing then
begin
update_grid_view_no(dxdbgrid2);
exit;
end;
if bsSkinTabSheet3.showing then
begin
update_grid_view_no(dxdbgrid4);
exit;
end;
end;
procedure Tfrm_rp_ch_balance_pay.N16Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
grid_save_xls(dxdbgrid1);
exit;
end;
if bsSkinTabSheet2.showing then
begin
grid_save_xls(dxdbgrid2);
exit;
end;
if bsSkinTabSheet3.showing then
begin
grid_save_xls(dxdbgrid4);
exit;
end;
end;
end.