|
|
unit u_rp_zj_seai;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, dxExEdtr, DB, ADODB, StdCtrls, wwdbdatetimepicker, bsSkinCtrls,
|
|
|
dxTL, dxDBCtrl, dxDBGrid, dxCntner, ComCtrls, bsSkinTabs, ExtCtrls;
|
|
|
|
|
|
type
|
|
|
Tfrm_rp_zj_seai = class(TForm)
|
|
|
Panel1: TPanel;
|
|
|
bsSkinPageControl1: TbsSkinPageControl;
|
|
|
bsSkinTabSheet1: TbsSkinTabSheet;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column1: TdxDBGridColumn;
|
|
|
dxDBGrid1Column2: TdxDBGridColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridColumn;
|
|
|
dxDBGrid1Column11: TdxDBGridColumn;
|
|
|
dxDBGrid1Column8: TdxDBGridColumn;
|
|
|
dxDBGrid1Column9: TdxDBGridColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridColumn;
|
|
|
dxDBGrid1Column5: TdxDBGridColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridColumn;
|
|
|
dxDBGrid1Column10: TdxDBGridColumn;
|
|
|
bsSkinTabSheet2: TbsSkinTabSheet;
|
|
|
dxDBGrid2: TdxDBGrid;
|
|
|
dxDBGridColumn1: TdxDBGridColumn;
|
|
|
dxDBGridColumn2: TdxDBGridColumn;
|
|
|
dxDBGridColumn3: TdxDBGridColumn;
|
|
|
dxDBGrid2Column11: TdxDBGridColumn;
|
|
|
dxDBGridColumn4: TdxDBGridColumn;
|
|
|
dxDBGridColumn5: TdxDBGridColumn;
|
|
|
dxDBGridColumn6: TdxDBGridColumn;
|
|
|
dxDBGridColumn7: TdxDBGridColumn;
|
|
|
dxDBGridColumn8: TdxDBGridColumn;
|
|
|
dxDBGridColumn9: TdxDBGridColumn;
|
|
|
dxDBGrid2Column10: TdxDBGridColumn;
|
|
|
p_client: TADOStoredProc;
|
|
|
p_client1: TDataSource;
|
|
|
p_shen: TADOStoredProc;
|
|
|
p_shen1: TDataSource;
|
|
|
p_total1: TDataSource;
|
|
|
p_total: TADOStoredProc;
|
|
|
dxDBGrid3: TdxDBGrid;
|
|
|
dxDBGridColumn11: TdxDBGridColumn;
|
|
|
dxDBGridColumn12: TdxDBGridColumn;
|
|
|
dxDBGridColumn13: TdxDBGridColumn;
|
|
|
dxDBGridColumn14: TdxDBGridColumn;
|
|
|
dxDBGridColumn15: TdxDBGridColumn;
|
|
|
dxDBGridColumn16: TdxDBGridColumn;
|
|
|
dxDBGridColumn17: TdxDBGridColumn;
|
|
|
dxDBGridColumn18: TdxDBGridColumn;
|
|
|
dxDBGridColumn19: TdxDBGridColumn;
|
|
|
dxDBGridColumn20: TdxDBGridColumn;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
procedure bsSkinPanel2Resize(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_zj_seai: Tfrm_rp_zj_seai;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_rp_zj_seai.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
str,str_date:widestring;
|
|
|
str_date_tongji:string;
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str_date_tongji:='<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>'
|
|
|
else
|
|
|
str_date_tongji:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
str:='where '+open_data('0036','t_op_seai.<2E><><EFBFBD><EFBFBD>Ա','t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','t_op_seai.<2E>ͷ<EFBFBD>Ա','t_op_seai.<2E><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>','t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
if wwDBDateTimePicker1.text<>''then
|
|
|
begin
|
|
|
str:=str+' and t_op_seai.'+str_date_tongji+'>='+''''+wwDBDateTimePicker1.text+'''';
|
|
|
str_date:=' where t_op_seai.'+str_date_tongji+'>='+''''+wwDBDateTimePicker1.text+'''';
|
|
|
end;
|
|
|
if wwDBDateTimePicker2.text<>''then
|
|
|
begin
|
|
|
str:=str+' and t_op_seai.'+str_date_tongji+'<='+''''+wwDBDateTimePicker2.text+'''';
|
|
|
|
|
|
if str_date='' then
|
|
|
str_date:=' where t_op_seai.'+str_date_tongji+'<='+''''+wwDBDateTimePicker2.text+''''
|
|
|
else
|
|
|
str_date:=str_date+' and t_op_seai.'+str_date_tongji+'<='+''''+wwDBDateTimePicker2.text+'''';
|
|
|
end;
|
|
|
|
|
|
p_client.close;
|
|
|
p_client.Parameters.ParamByName('SQLStr').value:=
|
|
|
'DECLARE @all_pay numeric '
|
|
|
+'select @all_pay=isnull((select sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) from t_op_gain'
|
|
|
+' where t_op_gain.<2E><><EFBFBD><EFBFBD> in (select t_op_seai.<2E><><EFBFBD><EFBFBD> from t_op_seai '+str_date+')),0) '
|
|
|
+'SELECT t_op_seai.ί<>е<EFBFBD>λ,'
|
|
|
+'sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) as ë<><C3AB><EFBFBD><EFBFBD>,'
|
|
|
+'(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>, '
|
|
|
+'sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) as <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,'
|
|
|
+'(case when @all_pay=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''+' else '
|
|
|
+'(ltrim(str(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>)/@all_pay*100,10,2))+'+''''+'%'+''''+') end) as <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,isnull(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>),0) as <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> '
|
|
|
+'INTO #bill '
|
|
|
+'FROM t_op_gain inner join t_op_seai on t_op_gain.<2E><><EFBFBD><EFBFBD> = t_op_seai.<2E><><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' group by t_op_seai.ί<>е<EFBFBD>λ '
|
|
|
+'SELECT t_op_seai.ί<>е<EFBFBD>λ, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'<= 30 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=60 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+','
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=90 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 90 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'INTO #fee '
|
|
|
+'FROM t_ch_fee_do inner JOIN t_op_seai on t_ch_fee_do.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_op_seai.<2E><><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_balance ON '
|
|
|
+'t_ch_fee_do.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = t_ch_balance.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '
|
|
|
+str
|
|
|
+' and t_ch_fee_do.<2E><><EFBFBD><EFBFBD>='+''''+'3'+''''
|
|
|
+' group by t_op_seai.ί<>е<EFBFBD>λ '
|
|
|
|
|
|
+'SELECT t_op_seai.ί<>е<EFBFBD>λ, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'<= 30 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=60 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+','
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=90 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 90 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'INTO #fee_truck '
|
|
|
+'FROM t_ch_fee_do_truck inner JOIN t_op_seai on t_ch_fee_do_truck.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_op_seai.<2E><><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_balance_truck ON '
|
|
|
+'t_ch_fee_do_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = t_ch_balance_truck.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' and t_ch_fee_do_truck.<2E><><EFBFBD><EFBFBD>='+''''+'1'+''''
|
|
|
+' group by t_op_seai.ί<>е<EFBFBD>λ '
|
|
|
|
|
|
+'select #bill.ί<>е<EFBFBD>λ,#bill.ë<><C3AB><EFBFBD><EFBFBD>,#bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,#bill.<2E>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,#bill.<2E>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>, '
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+'
|
|
|
+'isnull(#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))'+
|
|
|
'/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'
|
|
|
+''''+'%'+''''+' end) as <20>ϼƻ<CFBC><C6BB><EFBFBD><EFBFBD><EFBFBD> ,#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> '
|
|
|
+'from #bill left join #fee on #bill.ί<>е<EFBFBD>λ=#fee.ί<>е<EFBFBD>λ '
|
|
|
+'left join #fee_truck on #bill.ί<>е<EFBFBD>λ=#fee_truck.ί<>е<EFBFBD>λ '
|
|
|
+'order by #bill.ί<>е<EFBFBD>λ ';
|
|
|
p_client.open;
|
|
|
|
|
|
p_shen.close;
|
|
|
p_shen.Parameters.ParamByName('SQLStr').value:=
|
|
|
'DECLARE @all_pay numeric '
|
|
|
+'select @all_pay=isnull((select sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) from t_op_gain'
|
|
|
+' where t_op_gain.<2E><><EFBFBD><EFBFBD> in (select t_op_seai.<2E><><EFBFBD><EFBFBD> from t_op_seai '+str_date+')),0) '
|
|
|
+'SELECT t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) as ë<><C3AB><EFBFBD><EFBFBD>,'
|
|
|
+'(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>, '
|
|
|
+'sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) as <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,'
|
|
|
+'(case when @all_pay=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''+' else '
|
|
|
+'(ltrim(str(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>)/@all_pay*100,10,2))+'+''''+'%'+''''+') end) as <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,isnull(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>),0) as <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> '
|
|
|
+'INTO #bill '
|
|
|
+'FROM t_op_gain inner join t_op_seai on t_op_gain.<2E><><EFBFBD><EFBFBD> = t_op_seai.<2E><><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' group by t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'SELECT t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'<= 30 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=60 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+','
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=90 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 90 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'INTO #fee '
|
|
|
+'FROM t_ch_fee_do inner JOIN t_op_seai on t_ch_fee_do.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_op_seai.<2E><><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_balance ON '
|
|
|
+'t_ch_fee_do.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = t_ch_balance.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '
|
|
|
+str
|
|
|
+' and t_ch_fee_do.<2E><><EFBFBD><EFBFBD>='+''''+'3'+''''
|
|
|
+' group by t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
|
|
|
+'SELECT t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'<= 30 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=60 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+','
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=90 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 90 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'INTO #fee_truck '
|
|
|
+'FROM t_ch_fee_do_truck inner JOIN t_op_seai on t_ch_fee_do_truck.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_op_seai.<2E><><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_balance_truck ON '
|
|
|
+'t_ch_fee_do_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = t_ch_balance_truck.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' and t_ch_fee_do_truck.<2E><><EFBFBD><EFBFBD>='+''''+'1'+''''
|
|
|
+' group by t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
|
|
|
+'select #bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,#bill.ë<><C3AB><EFBFBD><EFBFBD>,#bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,#bill.<2E>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,#bill.<2E>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>, '
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+'
|
|
|
+'isnull(#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))'+
|
|
|
'/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'
|
|
|
+''''+'%'+''''+' end) as <20>ϼƻ<CFBC><C6BB><EFBFBD><EFBFBD><EFBFBD> ,#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> '
|
|
|
+'from #bill left join #fee on #bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'left join #fee_truck on #bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'order by #bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';
|
|
|
p_shen.open;
|
|
|
|
|
|
p_total.close;
|
|
|
p_total.Parameters.ParamByName('SQLStr').value:=
|
|
|
'DECLARE @all_pay numeric '
|
|
|
+'select @all_pay=isnull((select sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) from t_op_gain'
|
|
|
+' where t_op_gain.<2E><><EFBFBD><EFBFBD> in (select t_op_seai.<2E><><EFBFBD><EFBFBD> from t_op_seai '+str_date+')),0) '
|
|
|
+'SELECT '
|
|
|
+'sum(t_op_gain.ë<><C3AB><EFBFBD><EFBFBD>) as ë<><C3AB><EFBFBD><EFBFBD>,'
|
|
|
+'(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>, '
|
|
|
+'sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>) as <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,'
|
|
|
+'(case when @all_pay=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''+' else '
|
|
|
+'(ltrim(str(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>)/@all_pay*100,10,2))+'+''''+'%'+''''+') end) as <20>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,isnull(sum(t_op_gain.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>),0) as <20>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> '
|
|
|
+'INTO #bill '
|
|
|
+'FROM t_op_gain inner join t_op_seai on t_op_gain.<2E><><EFBFBD><EFBFBD> = t_op_seai.<2E><><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' SELECT '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'<= 30 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=60 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+','
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=90 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 90 THEN t_ch_fee_do.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> * t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'INTO #fee '
|
|
|
+'FROM t_ch_fee_do inner JOIN t_op_seai on t_ch_fee_do.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_op_seai.<2E><><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_balance ON '
|
|
|
+'t_ch_fee_do.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = t_ch_balance.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID '
|
|
|
+str
|
|
|
+' and t_ch_fee_do.<2E><><EFBFBD><EFBFBD>='+''''+'3'+''''
|
|
|
|
|
|
+'SELECT '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'<= 30 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=60 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+','
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)<=90 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>, '
|
|
|
+'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', '
|
|
|
+'t_ch_balance_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) '
|
|
|
+'> 90 THEN t_ch_fee_do_truck.ԭʼ<D4AD><CABC><EFBFBD><EFBFBD> ELSE 0 END) AS <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'INTO #fee_truck '
|
|
|
+'FROM t_ch_fee_do_truck inner JOIN t_op_seai on t_ch_fee_do_truck.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=t_op_seai.<2E><><EFBFBD><EFBFBD> inner JOIN '
|
|
|
+'t_ch_balance_truck ON '
|
|
|
+'t_ch_fee_do_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = t_ch_balance_truck.<2E>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' and t_ch_fee_do_truck.<2E><><EFBFBD><EFBFBD>='+''''+'1'+''''
|
|
|
|
|
|
+'select #bill.ë<><C3AB><EFBFBD><EFBFBD>,#bill.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,#bill.<2E>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>,#bill.<2E>ʽ<EFBFBD>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD>, '
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0))/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'+''''+'%'+''''+' end) as <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ,'
|
|
|
+'(case when #bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>=0 then '+''''+'<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>'+''''
|
|
|
+' else ltrim(str((isnull(#fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+'
|
|
|
+'isnull(#fee_truck.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0)+isnull(#fee_truck.<2E><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>,0))'+
|
|
|
'/#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6>*100,10,2))+'
|
|
|
+''''+'%'+''''+' end) as <20>ϼƻ<CFBC><C6BB><EFBFBD><EFBFBD><EFBFBD> ,#bill.<2E>ϼ<EFBFBD>Ӧ<EFBFBD><D3A6> '
|
|
|
+'from #bill CROSS JOIN #fee '
|
|
|
+'CROSS JOIN #fee_truck ';
|
|
|
p_total.open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zj_seai.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_rp_zj_seai.Hide;
|
|
|
frm_rp_zj_seai.ManualFloat(frm_rp_zj_seai.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_zj_seai');
|
|
|
action:=cafree;
|
|
|
frm_rp_zj_seai:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zj_seai.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zj_seai.bsSkinButton9Click(Sender: TObject);
|
|
|
begin
|
|
|
sys_print('<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD>',2,nil,nil,nil,nil,p_client1,p_shen1,nil,nil,nil,nil,nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zj_seai.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_zj_seai.dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort_pro(Column,p_client,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_zj_seai.dxDBGrid2ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort_pro(Column,p_shen,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
end.
|