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.

464 lines
20 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_zl_total;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, DB, ADODB, StdCtrls, wwdbdatetimepicker, bsSkinCtrls,
dxDBGrid, dxTL, dxDBCtrl, dxCntner, ComCtrls, bsSkinTabs, ExtCtrls, Menus;
type
Tfrm_rp_zl_total = class(TForm)
Panel1: TPanel;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinPageControl2: TbsSkinPageControl;
bsSkinTabSheet3: TbsSkinTabSheet;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
dxDBGrid1Column8: TdxDBGridColumn;
bsSkinTabSheet4: TbsSkinTabSheet;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinPageControl3: TbsSkinPageControl;
bsSkinTabSheet5: TbsSkinTabSheet;
dxDBGrid3: TdxDBGrid;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridColumn9: TdxDBGridColumn;
dxDBGridColumn10: TdxDBGridColumn;
dxDBGridColumn11: TdxDBGridColumn;
dxDBGridColumn12: TdxDBGridColumn;
dxDBGridColumn13: TdxDBGridColumn;
dxDBGridColumn14: TdxDBGridColumn;
bsSkinTabSheet6: TbsSkinTabSheet;
dxDBGrid4: TdxDBGrid;
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
dxDBGridColumn15: TdxDBGridColumn;
dxDBGridColumn16: TdxDBGridColumn;
dxDBGridColumn17: TdxDBGridColumn;
dxDBGridColumn18: TdxDBGridColumn;
dxDBGridColumn19: TdxDBGridColumn;
dxDBGridColumn20: TdxDBGridColumn;
dxDBGridColumn21: TdxDBGridColumn;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
bsSkinPanel1: TbsSkinPanel;
Label1: TLabel;
Label2: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
p_accept_client: TADOStoredProc;
p_accept_client1: TDataSource;
p_accept_sales: TADOStoredProc;
p_accept_sales1: TDataSource;
p_pay_client: TADOStoredProc;
p_pay_client1: TDataSource;
p_pay_sales: TADOStoredProc;
p_pay_sales1: TDataSource;
PopupMenu2: TPopupMenu;
N16: TMenuItem;
SaveDialog: TSaveDialog;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinPanel2Resize(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure dxDBGrid3ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure dxDBGrid4ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure FormShow(Sender: TObject);
procedure N16Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_rp_zl_total: Tfrm_rp_zl_total;
implementation
uses u_main, my_sys_function, u_data_share;
{$R *.dfm}
procedure Tfrm_rp_zl_total.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_zl_total.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_zl_total.Hide;
frm_rp_zl_total.ManualFloat(frm_rp_zl_total.BoundsRect );
frm_main.freeTabs('frm_rp_zl_total');
action:=cafree;
frm_rp_zl_total:=nil;
end;
procedure Tfrm_rp_zl_total.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD>ۺϷ<DBBA><CFB7><EFBFBD>',2,nil,nil,nil,nil,p_accept_client1,p_accept_sales1,p_pay_client1,p_pay_sales1,nil,nil,nil);
end;
procedure Tfrm_rp_zl_total.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round((bsSkinPanel2.Width-bsSkinPanel1.Width)/5);
bsSkinCheckRadioBox2.Width:=i;
bsSkinCheckRadioBox1.Width:=i;
bsSkinButton10.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton5.Width:=i;
end;
procedure Tfrm_rp_zl_total.bsSkinButton10Click(Sender: TObject);
var
str_accept,str_pay:widestring;
str_date:string;
begin
{
if bsSkinCheckRadioBox1.Checked then
str_date:='<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>'
else
str_date:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
str_accept:='where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
str_pay:='where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
if wwDBDateTimePicker1.Text<>''then
begin
str_accept:=str_accept+' and v_op_no.'+str_date+'>='+''''+wwDBDateTimePicker1.Text+'''';
str_pay:=str_pay+' and v_op_no.'+str_date+'>='+''''+wwDBDateTimePicker1.Text+'''';
end;
if wwDBDateTimePicker2.Text<>''then
begin
str_accept:=str_accept+' and v_op_no.'+str_date+'<='+''''+wwDBDateTimePicker2.Text+'''';
str_pay:=str_pay+' and v_op_no.'+str_date+'<='+''''+wwDBDateTimePicker2.Text+'''';
end;
str_accept:=str_accept+' and '+open_data('0034','v_op_no.'+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_no.'+'<27><><EFBFBD><EFBFBD>Ա','v_op_no.'+'<27>ͷ<EFBFBD>Ա','v_op_no.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
str_pay:=str_pay+' and '+open_data('0034','v_op_no.'+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_no.'+'<27><><EFBFBD><EFBFBD>Ա','v_op_no.'+'<27>ͷ<EFBFBD>Ա','v_op_no.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
p_accept_client.close;
p_accept_client.Parameters.ParamByName('SQLStr').value:=
'select t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>ն<EFBFBD><D5B6><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=90'
+' and datediff(day,v_op_no.'+str_date+',getdate())>60 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=180'
+' and datediff(day,v_op_no.'+str_date+',getdate())>90 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>հ<EFBFBD><D5B0><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=360'
+' and datediff(day,v_op_no.'+str_date+',getdate())>180 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>360 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_accept
+' group by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
p_accept_client.Open;
p_pay_client.close;
p_pay_client.Parameters.ParamByName('SQLStr').value:=
'select t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=90'
+' and datediff(day,v_op_no.'+str_date+',getdate())>60 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=180'
+' and datediff(day,v_op_no.'+str_date+',getdate())>90 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=360'
+' and datediff(day,v_op_no.'+str_date+',getdate())>180 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>360 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_pay
+' group by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
p_pay_client.Open;
p_accept_sales.close;
p_accept_sales.Parameters.ParamByName('SQLStr').value:=
'select v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>ն<EFBFBD><D5B6><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=90'
+' and datediff(day,v_op_no.'+str_date+',getdate())>60 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=180'
+' and datediff(day,v_op_no.'+str_date+',getdate())>90 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>հ<EFBFBD><D5B0><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=360'
+' and datediff(day,v_op_no.'+str_date+',getdate())>180 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>360 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_accept
+' group by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
p_accept_sales.Open;
p_pay_sales.close;
p_pay_sales.Parameters.ParamByName('SQLStr').value:=
'select v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=90'
+' and datediff(day,v_op_no.'+str_date+',getdate())>60 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=180'
+' and datediff(day,v_op_no.'+str_date+',getdate())>90 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=360'
+' and datediff(day,v_op_no.'+str_date+',getdate())>180 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>360 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_pay
+' group by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
p_pay_sales.Open;
}
if bsSkinCheckRadioBox1.Checked then
str_date:='<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>'
else
str_date:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
str_accept:='where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
str_pay:='where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> and t_ch_fee.<2E><><EFBFBD><EFBFBD>='+''''+'<27><>'+'''';
if wwDBDateTimePicker1.Text<>''then
begin
str_accept:=str_accept+' and v_op_no.'+str_date+'>='+''''+wwDBDateTimePicker1.Text+'''';
str_pay:=str_pay+' and v_op_no.'+str_date+'>='+''''+wwDBDateTimePicker1.Text+'''';
end;
if wwDBDateTimePicker2.Text<>''then
begin
str_accept:=str_accept+' and v_op_no.'+str_date+'<='+''''+wwDBDateTimePicker2.Text+'''';
str_pay:=str_pay+' and v_op_no.'+str_date+'<='+''''+wwDBDateTimePicker2.Text+'''';
end;
str_accept:=str_accept+' and '+open_data('0034','v_op_no.'+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_no.'+'<27><><EFBFBD><EFBFBD>Ա','v_op_no.'+'<27>ͷ<EFBFBD>Ա','v_op_no.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
str_pay:=str_pay+' and '+open_data('0034','v_op_no.'+'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','v_op_no.'+'<27><><EFBFBD><EFBFBD>Ա','v_op_no.'+'<27>ͷ<EFBFBD>Ա','v_op_no.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
p_accept_client.close;
p_accept_client.Parameters.ParamByName('SQLStr').value:=
'select t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=25'
+' and datediff(day,v_op_no.'+str_date+',getdate())>15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>ն<EFBFBD><D5B6><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30'
+' and datediff(day,v_op_no.'+str_date+',getdate())>25 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=45'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>հ<EFBFBD><D5B0><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>45 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>60 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_accept
+' group by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
p_accept_client.Open;
p_pay_client.close;
p_pay_client.Parameters.ParamByName('SQLStr').value:=
'select t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=25'
+' and datediff(day,v_op_no.'+str_date+',getdate())>15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30'
+' and datediff(day,v_op_no.'+str_date+',getdate())>25 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=45'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>45 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>60 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_pay
+' group by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by t_ch_fee.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
p_pay_client.Open;
p_accept_sales.close;
p_accept_sales.Parameters.ParamByName('SQLStr').value:=
'select v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=25'
+' and datediff(day,v_op_no.'+str_date+',getdate())>15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>ն<EFBFBD><D5B6><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30'
+' and datediff(day,v_op_no.'+str_date+',getdate())>25 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=45'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<>հ<EFBFBD><D5B0><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>45 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>60 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_accept
+' group by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
p_accept_sales.Open;
p_pay_sales.close;
p_pay_sales.Parameters.ParamByName('SQLStr').value:=
'select v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+'sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=25'
+' and datediff(day,v_op_no.'+str_date+',getdate())>15 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=30'
+' and datediff(day,v_op_no.'+str_date+',getdate())>25 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=45'
+' and datediff(day,v_op_no.'+str_date+',getdate())>30 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())<=60'
+' and datediff(day,v_op_no.'+str_date+',getdate())>45 then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as δ<><CEB4>һ<EFBFBD><D2BB>,'
+' sum(case when datediff(day,v_op_no.'+str_date+',getdate())>60 '
+' then (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>'
+' else 0 end) as һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
+' sum((t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD>) as <20><><EFBFBD><EFBFBD>δ<EFBFBD><CEB4>'
+' from t_ch_fee inner join v_op_no on t_ch_fee.<2E><><EFBFBD><EFBFBD>=v_op_no.<2E><><EFBFBD><EFBFBD> '
+str_pay
+' group by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> order by v_op_no.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
p_pay_sales.Open;
end;
procedure Tfrm_rp_zl_total.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_accept_client,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_zl_total.dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_accept_sales,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_zl_total.dxDBGrid3ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_pay_client,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_zl_total.dxDBGrid4ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_pay_sales,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_zl_total.FormShow(Sender: TObject);
begin
if frm_data_share.t_load_employee.FieldByName('Ӧ<><D3A6>').asboolean then
begin
bsSkinTabSheet1.TabVisible:=true;
end
else
begin
bsSkinTabSheet1.TabVisible:=false;
end;
if frm_data_share.t_load_employee.FieldByName('Ӧ<><D3A6>').asboolean then
begin
bsSkinTabSheet2.TabVisible:=true;
end
else
begin
bsSkinTabSheet2.TabVisible:=false;
end;
end;
procedure Tfrm_rp_zl_total.N16Click(Sender: TObject);
begin
with SaveDialog do
begin
DefaultExt :='xls';
Filter := '(*.xls)|*.xls';
if Execute then
begin
if bsSkinTabSheet3.Showing then
dxDBGrid1.SaveToXLS(FileName,true)
else if bsSkinTabSheet4.Showing then
dxDBGrid2.SaveToXLS(FileName,true)
else if bsSkinTabSheet5.Showing then
dxDBGrid3.SaveToXLS(FileName,true)
else if bsSkinTabSheet6.Showing then
dxDBGrid4.SaveToXLS(FileName,true);
end;
end;
end;
end.