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.

287 lines
9.4 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_rp_wl_total;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, ExtCtrls, ComCtrls, bsSkinTabs, DB, ADODB,DateUtils,
dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner,
kbmMemTable, kbmMemBinaryStreamFormat, Menus, StdCtrls,
wwdbdatetimepicker, Grids, DBGridEh, Mask, wwdbedit, Wwdotdot, Wwdbcomb,
RxLookup, DBGrids;
type
Tfrm_rp_wl_total = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
SaveDialog: TSaveDialog;
bsSkinPanel1: TbsSkinPanel;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinRadioGroup1: TbsSkinRadioGroup;
Label2: TLabel;
cbmonth: TwwDBComboBox;
Label1: TLabel;
cbYear: TwwDBComboBox;
t_ch_custbalance: TADOQuery;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
dxDBGrid1Column9: TdxDBGridColumn;
dxDBGrid1Column10: TdxDBGridColumn;
bsSkinPanel3: TbsSkinPanel;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
t_ch_custbalance1: TDataSource;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
dxDBGrid1Column12: TdxDBGridColumn;
dxDBGrid1Column13: TdxDBGridColumn;
dxDBGrid1Column14: TdxDBGridColumn;
dxDBGrid1Column15: TdxDBGridColumn;
dxDBGrid1Column16: TdxDBGridColumn;
dxDBGrid1Column17: TdxDBGridColumn;
dxDBGrid1Column18: TdxDBGridColumn;
dxDBGrid1Column19: TdxDBGridColumn;
dxDBGrid1Column20: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
dxDBGrid1Column22: TdxDBGridColumn;
dxDBGrid1Column23: TdxDBGridColumn;
dxDBGrid1Column24: TdxDBGridColumn;
dxDBGrid1Column25: TdxDBGridColumn;
dxDBGrid1Column26: TdxDBGridColumn;
dxDBGrid1Column27: TdxDBGridColumn;
dxDBGrid1Column28: TdxDBGridColumn;
dxDBGrid1Column29: TdxDBGridColumn;
dxDBGrid1Column30: TdxDBGridColumn;
RxDBLookupCombo12: TRxDBLookupCombo;
Label22: TLabel;
Label14: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
Label40: TLabel;
RxDBLookupCombo15: TRxDBLookupCombo;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Panel1Resize(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinCheckRadioBox3Click(Sender: TObject);
procedure bsSkinRadioGroup1Checked(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_wl_total: Tfrm_rp_wl_total;
FmDate,ToDate:String;
sqlstr:WideString;
implementation
uses u_main, my_sys_function,u_sys_progress, u_data_share;
{$R *.dfm}
procedure Tfrm_rp_wl_total.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_wl_total.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_wl_total.Hide;
frm_rp_wl_total.ManualFloat(frm_rp_wl_total.BoundsRect );
frm_main.freeTabs('frm_rp_wl_total');
action:=cafree;
frm_rp_wl_total:=nil;
end;
procedure Tfrm_rp_wl_total.Panel1Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/7);
bsSkinButton10.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton1.Width:=i;
end;
procedure Tfrm_rp_wl_total.bsSkinButton10Click(Sender: TObject);
var
objname:string;
begin
if cbyear.Text='' then begin
MessageDlg('ͳ<><CDB3><EFBFBD><EFBFBD><EAB2BB>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
if cbmonth.Text='' then begin
MessageDlg('ͳ<><CDB3><EFBFBD>·ݲ<C2B7><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!',mtWarning,[mbOk],0);
exit;
end;
with t_ch_custbalance,sql do begin
close;sql.Clear;
objname:=bsSkinRadioGroup1.Items.Strings[bsSkinRadioGroup1.ItemIndex];
dxDBGrid1Column6.Caption:=objname;
Add('select <20><>,<2C><>,'+objname+' as <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>USD,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD>USD');
Add(',sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD>USD,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD>USD,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Add(',sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD');
Add(',sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ϼ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD>ϼ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD><EFBFBD>ϼ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ϼ<EFBFBD>');
Add(',sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>,sum(<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>) as <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>');
Add(' from t_ch_custbalance where <20><>='+cbyear.text+' and <20><>='+cbmonth.text);
if bsSkinCheckRadioBox3.Checked then
Add(' and (<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ϼ<EFBFBD><>0 or <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ս<EFBFBD><D5BD><EFBFBD><EFBFBD>ϼ<EFBFBD><>0 or <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>շ<EFBFBD><D5B7><EFBFBD><EFBFBD>ϼ<EFBFBD><>0 or <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>պ<EFBFBD><D5BA><EFBFBD><EFBFBD>ϼ<EFBFBD><>0)');
if bsSkinCheckRadioBox2.Checked then
Add(' and (<28><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><>0 or <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><>0 or <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><>0 or <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><>0)');
if RxDBLookupCombo12.DisplayValue<>'' then
Add(' and <20><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>='''+RxDBLookupCombo12.DisplayValue+'''');
if RxDBLookupCombo3.DisplayValue<>'' then
Add(' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo3.DisplayValue+'''');
if RxDBLookupCombo15.DisplayValue<>'' then
Add(' and <20>ֲ<EFBFBD><D6B2><EFBFBD><EFBFBD><EFBFBD>='''+RxDBLookupCombo15.DisplayValue+'''');
Add(' group by <20><>,<2C><>,'+objname);
open;
end;
t_ch_custbalance.open;
end;
procedure Tfrm_rp_wl_total.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>',2,t_ch_custbalance1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
end;
procedure Tfrm_rp_wl_total.FormShow(Sender: TObject);
begin
cbYear.ItemIndex:=cbYear.Items.IndexOf(inttostr(Logininfo.offyear));
cbmonth.ItemIndex:=cbmonth.Items.IndexOf(inttostr(Logininfo.offmonth));
bsSkinCheckRadioBox3.OnClick(sender);
end;
procedure Tfrm_rp_wl_total.bsSkinButton1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_rp_wl_total.bsSkinCheckRadioBox3Click(Sender: TObject);
begin
if bsSkinCheckRadioBox3.Checked then begin
dxDBGrid1Column8.Visible:=true;
dxDBGrid1Column9.Visible:=true;
dxDBGrid1Column10.Visible:=true;
dxDBGrid1Column7.Visible:=false;
dxDBGrid1Column11.Visible:=false;
dxDBGrid1Column12.Visible:=false;
dxDBGrid1Column13.Visible:=true;
dxDBGrid1Column14.Visible:=true;
dxDBGrid1Column15.Visible:=true;
dxDBGrid1Column16.Visible:=false;
dxDBGrid1Column17.Visible:=false;
dxDBGrid1Column18.Visible:=false;
dxDBGrid1Column19.Visible:=true;
dxDBGrid1Column20.Visible:=true;
dxDBGrid1Column21.Visible:=true;
dxDBGrid1Column22.Visible:=false;
dxDBGrid1Column23.Visible:=false;
dxDBGrid1Column24.Visible:=false;
dxDBGrid1Column25.Visible:=true;
dxDBGrid1Column26.Visible:=true;
dxDBGrid1Column27.Visible:=true;
dxDBGrid1Column28.Visible:=false;
dxDBGrid1Column29.Visible:=false;
dxDBGrid1Column30.Visible:=false;
end;
if bsSkinCheckRadioBox2.Checked then begin
dxDBGrid1Column8.Visible:=false;
dxDBGrid1Column9.Visible:=false;
dxDBGrid1Column10.Visible:=false;
dxDBGrid1Column7.Visible:=true;
dxDBGrid1Column11.Visible:=true;
dxDBGrid1Column12.Visible:=true;
dxDBGrid1Column13.Visible:=false;
dxDBGrid1Column14.Visible:=false;
dxDBGrid1Column15.Visible:=false;
dxDBGrid1Column16.Visible:=true;
dxDBGrid1Column17.Visible:=true;
dxDBGrid1Column18.Visible:=true;
dxDBGrid1Column19.Visible:=false;
dxDBGrid1Column20.Visible:=false;
dxDBGrid1Column21.Visible:=false;
dxDBGrid1Column22.Visible:=true;
dxDBGrid1Column23.Visible:=true;
dxDBGrid1Column24.Visible:=true;
dxDBGrid1Column25.Visible:=false;
dxDBGrid1Column26.Visible:=false;
dxDBGrid1Column27.Visible:=false;
dxDBGrid1Column28.Visible:=true;
dxDBGrid1Column29.Visible:=true;
dxDBGrid1Column30.Visible:=true;
end;
if bsSkinCheckRadioBox1.Checked then begin
dxDBGrid1Column8.Visible:=true;
dxDBGrid1Column9.Visible:=true;
dxDBGrid1Column10.Visible:=true;
dxDBGrid1Column7.Visible:=true;
dxDBGrid1Column11.Visible:=true;
dxDBGrid1Column12.Visible:=true;
dxDBGrid1Column13.Visible:=true;
dxDBGrid1Column14.Visible:=true;
dxDBGrid1Column15.Visible:=true;
dxDBGrid1Column16.Visible:=true;
dxDBGrid1Column17.Visible:=true;
dxDBGrid1Column18.Visible:=true;
dxDBGrid1Column19.Visible:=true;
dxDBGrid1Column20.Visible:=true;
dxDBGrid1Column21.Visible:=true;
dxDBGrid1Column22.Visible:=true;
dxDBGrid1Column23.Visible:=true;
dxDBGrid1Column24.Visible:=true;
dxDBGrid1Column25.Visible:=true;
dxDBGrid1Column26.Visible:=true;
dxDBGrid1Column27.Visible:=true;
dxDBGrid1Column28.Visible:=true;
dxDBGrid1Column29.Visible:=true;
dxDBGrid1Column30.Visible:=true;
end;
end;
procedure Tfrm_rp_wl_total.bsSkinRadioGroup1Checked(Sender: TObject);
begin
bsSkinButton10.OnClick(sender);
end;
end.