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.

296 lines
8.6 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_rp_aire;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, RxMemDS, DB, ADODB, Menus, XPMenu, bsSkinCtrls,
dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, ComCtrls,
bsSkinTabs, ExtCtrls;
type
Tfrm_rp_rp_aire = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
p_detail: TADOStoredProc;
p_detail1: TDataSource;
t_sum1: TDataSource;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinTabSheet3: TbsSkinTabSheet;
bsSkinTabSheet4: TbsSkinTabSheet;
bsSkinTabSheet5: TbsSkinTabSheet;
bsSkinTabSheet6: TbsSkinTabSheet;
bsSkinTabSheet7: TbsSkinTabSheet;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column5: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column6: TdxDBGridDateColumn;
dxDBGrid1Column7: TdxDBGridMaskColumn;
dxDBGrid1Column8: TdxDBGridMaskColumn;
dxDBGrid1Column9: TdxDBGridMaskColumn;
dxDBGrid1Column11: TdxDBGridMaskColumn;
dxDBGrid1Column21: TdxDBGridMaskColumn;
dxDBGrid1Column24: TdxDBGridMaskColumn;
dxDBGrid1Column26: TdxDBGridDateColumn;
dxDBGrid1Column29: TdxDBGridMaskColumn;
dxDBGrid1Column31: TdxDBGridMaskColumn;
dxDBGrid1Column51: TdxDBGridMaskColumn;
dxDBGrid1Column54: TdxDBGridMaskColumn;
dxDBGrid1Column56: TdxDBGridColumn;
dxDBGrid1Column89: TdxDBGridMaskColumn;
dxDBGrid1Column92: TdxDBGridMaskColumn;
dxDBGrid1Column83: TdxDBGridMaskColumn;
dxDBGrid1Column84: TdxDBGridDateColumn;
dxDBGrid1Column85: TdxDBGridMaskColumn;
dxDBGrid1Column87: TdxDBGridMaskColumn;
dxDBGrid1Column86: TdxDBGridMaskColumn;
dxDBGrid1USD: TdxDBGridColumn;
dxDBGrid1RMB: TdxDBGridColumn;
dxDBGrid1Column102: TdxDBGridColumn;
dxDBGrid1Column105: TdxDBGridColumn;
dxDBGrid1Column108: TdxDBGridColumn;
dxDBGrid1Column111: TdxDBGridColumn;
dxDBGrid1Column114: TdxDBGridColumn;
dxDBGrid1Column115: TdxDBGridColumn;
dxDBGrid1Column116: TdxDBGridColumn;
dxDBGrid1Column117: TdxDBGridMaskColumn;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column1: TdxDBGridMaskColumn;
dxDBGrid2Column2: TdxDBGridMaskColumn;
dxDBGrid2Column26: TdxDBGridColumn;
dxDBGrid2USD: TdxDBGridColumn;
dxDBGrid2Column29: TdxDBGridColumn;
dxDBGrid2Column30: TdxDBGridColumn;
dxDBGrid2RMB: TdxDBGridColumn;
dxDBGrid2Column32: TdxDBGridColumn;
dxDBGrid2Column33: TdxDBGridColumn;
dxDBGrid2Column34: TdxDBGridColumn;
dxDBGrid2Column35: TdxDBGridColumn;
dxDBGrid2Column36: TdxDBGridColumn;
dxDBGrid2Column37: TdxDBGridColumn;
dxDBGrid1Column34: TdxDBGridColumn;
dxDBGrid1Column35: TdxDBGridColumn;
dxDBGrid1Column36: TdxDBGridColumn;
p_sum: TADOStoredProc;
PopupMenu2: TPopupMenu;
N10: TMenuItem;
N11: TMenuItem;
N14: TMenuItem;
N13: TMenuItem;
N12: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
XPMenu2: TXPMenu;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Panel1Resize(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinPageControl1Change(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure N10Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N12Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_rp_aire: Tfrm_rp_rp_aire;
rp_rp_aire_open:boolean;
implementation
uses u_main,my_sys_function, u_data_share;
{$R *.dfm}
procedure Tfrm_rp_rp_aire.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_rp_aire.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savereggrid(dxdbgrid1,caption+'11');
savereggrid(dxdbgrid2,caption+'12');
rp_rp_aire_open:=false;
frm_rp_rp_aire.Hide;
frm_rp_rp_aire.ManualFloat(frm_rp_rp_aire.BoundsRect );
frm_main.freeTabs('frm_rp_rp_aire');
action:=cafree;
frm_rp_rp_aire:=nil;
end;
procedure Tfrm_rp_rp_aire.Panel1Resize(Sender: TObject);
begin
bsSkinPanel2.Left:=Panel1.Width-bsSkinPanel2.Width;
end;
procedure Tfrm_rp_rp_aire.bsSkinButton10Click(Sender: TObject);
begin
bsSkinTabSheet1.show;
query_aire(6,'0037');
end;
procedure Tfrm_rp_rp_aire.FormShow(Sender: TObject);
begin
loadreggrid(dxdbgrid1,false,caption+'11');
loadreggrid(dxdbgrid2,false,caption+'12');
rp_rp_aire_open:=true;
if frm_data_share.t_load_employee.FieldByName('Ӧ<><D3A6>').asboolean then
begin
dxDBGrid1.Bands[2].Visible:=true;
dxDBGrid2.Bands[2].Visible:=true;
end
else
begin
dxDBGrid1.Bands[2].Visible:=false;
dxDBGrid2.Bands[2].Visible:=false;
end;
if frm_data_share.t_load_employee.FieldByName('Ӧ<><D3A6>').asboolean then
begin
dxDBGrid1.Bands[3].Visible:=true;
dxDBGrid2.Bands[3].Visible:=true;
end
else
begin
dxDBGrid1.Bands[3].Visible:=false;
dxDBGrid2.Bands[3].Visible:=false;
end;
if frm_data_share.t_load_employee.FieldByName('<27><><EFBFBD><EFBFBD>').asboolean then
begin
dxDBGrid1.Bands[4].Visible:=true;
dxDBGrid2.Bands[4].Visible:=true;
end
else
begin
dxDBGrid1.Bands[4].Visible:=false;
dxDBGrid2.Bands[4].Visible:=false;
end;
end;
procedure Tfrm_rp_rp_aire.bsSkinPageControl1Change(Sender: TObject);
var
str:widestring;
begin
if not rp_rp_aire_open then
exit;
IF bsSkinTabSheet1.Showing then
exit;
dxDBGrid2.Parent:=bsSkinPageControl1.ActivePage;
dxDBGrid2Column1.Caption:=bsSkinPageControl1.ActivePage.Caption;
try
if not p_detail.Active then
exit;
if p_detail.IsEmpty then
exit;
IF bsSkinTabSheet1.Showing then
exit;
str:=new_query(p_detail);
if str<>'no'then
begin
p_sum.close;
p_sum.Parameters.ParamByName('SQLStr').Value:=
'SELECT COUNT(t_op_aire.<2E><><EFBFBD><EFBFBD>) as Ʊ<><C6B1>, sum(t_op_aire.<2E>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>) as <20>Ƽ<EFBFBD><C6BC><EFBFBD><EFBFBD><EFBFBD>'
+', sum(t_op_gain.<2E><><EFBFBD><EFBFBD>USD) as <20><><EFBFBD><EFBFBD>USD'
+', sum(t_op_gain.Ӧ<><D3A6>USD) as Ӧ<><D3A6>USD, sum( t_op_gain.Ӧ<><D3A6>USD) as Ӧ<><D3A6>USD, sum(t_op_gain.<2E><><EFBFBD><EFBFBD>RMB) as <20><><EFBFBD><EFBFBD>RMB'
+', sum(t_op_gain.Ӧ<><D3A6>RMB) as Ӧ<><D3A6>RMB, sum( t_op_gain.Ӧ<><D3A6>RMB) as Ӧ<><D3A6>RMB, sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) as ë<><C3AB><EFBFBD><EFBFBD>'
+', sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) as <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>, sum( t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) as <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>'
+',(case when isnull(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>),0)=0 then '+''''+'<27>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''+' else '
+'ltrim(str(sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>)/sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>)*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
+',t_op_aire.'+bsSkinPageControl1.ActivePage.Caption+' as base'
+','+''''+bsSkinPageControl1.ActivePage.Caption+''''+' as ͳ<>Ʊ<EFBFBD>׼'
+' FROM t_op_aire LEFT JOIN'
+' t_op_gain ON t_op_aire.<2E><><EFBFBD><EFBFBD> = t_op_gain.<2E><><EFBFBD><EFBFBD> '
+str+' group by '+'t_op_aire.'+bsSkinPageControl1.ActivePage.Caption
+' order by '+'t_op_aire.'+bsSkinPageControl1.ActivePage.Caption;
p_sum.open;
end;
except
;
end;
end;
procedure Tfrm_rp_rp_aire.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>ҵ<EFBFBD><D2B5>ͳ<EFBFBD><CDB3>',2,nil,nil,nil,nil,p_detail1,t_sum1,nil,nil,nil,nil,nil);
end;
procedure Tfrm_rp_rp_aire.N10Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid_view_no(dxdbgrid1);
end
else
begin
update_grid_view_no(dxdbgrid2);
end;
end;
procedure Tfrm_rp_rp_aire.N14Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid_view_all(dxdbgrid1);
end
else
begin
update_grid_view_all(dxdbgrid2);
end;
end;
procedure Tfrm_rp_rp_aire.N12Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
update_grid(dxdbgrid1,73);
end
else
begin
update_grid(dxdbgrid2,74);
end;
end;
procedure Tfrm_rp_rp_aire.N16Click(Sender: TObject);
begin
if bsSkinTabSheet1.showing then
begin
grid_save_xls(dxdbgrid1);
end
else
begin
grid_save_xls(dxdbgrid2);
end;
end;
procedure Tfrm_rp_rp_aire.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_detail,'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_rp_aire.dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_sum,'base');
end;
end.