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:='会计期间' else str_date_tongji:='进口日期'; str:='where '+open_data('0036','t_op_seai.操作员','t_op_seai.揽货人','t_op_seai.客服员','t_op_seai.报关操作','t_op_seai.报检操作'); 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.合计应付) from t_op_gain' +' where t_op_gain.编号 in (select t_op_seai.编号 from t_op_seai '+str_date+')),0) ' +'SELECT t_op_seai.委托单位,' +'sum(t_op_gain.毛利润) as 毛利润,' +'(case when isnull(sum(t_op_gain.合计应付),0)=0 then '+''''+'无法计算'+''''+' else ' +'ltrim(str(sum(t_op_gain.毛利润)/sum(t_op_gain.合计应付)*100,10,2))+'+''''+'%'+''''+' end) as 利润率, ' +'sum(t_op_gain.合计应付) as 资金占用量,' +'(case when @all_pay=0 then '+''''+'无法计算'+''''+' else ' +'(ltrim(str(sum(t_op_gain.合计应付)/@all_pay*100,10,2))+'+''''+'%'+''''+') end) as 资金占用率,isnull(sum(t_op_gain.合计应收),0) as 合计应收 ' +'INTO #bill ' +'FROM t_op_gain inner join t_op_seai on t_op_gain.编号 = t_op_seai.编号 ' +str +' group by t_op_seai.委托单位 ' +'SELECT t_op_seai.委托单位, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'<= 30 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 当月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期)<=60 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 二月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+',' +'t_ch_balance.结算日期)<=90 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 三月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 90 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 其他回收 ' +'INTO #fee ' +'FROM t_ch_fee_do inner JOIN t_op_seai on t_ch_fee_do.业务编号=t_op_seai.编号 inner JOIN ' +'t_ch_balance ON ' +'t_ch_fee_do.工作编号 = t_ch_balance.帐单编号 inner JOIN ' +'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID ' +str +' and t_ch_fee_do.类型='+''''+'3'+'''' +' group by t_op_seai.委托单位 ' +'SELECT t_op_seai.委托单位, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'<= 30 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 当月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期)<=60 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 二月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+',' +'t_ch_balance_truck.结算日期)<=90 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 三月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 90 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 其他回收 ' +'INTO #fee_truck ' +'FROM t_ch_fee_do_truck inner JOIN t_op_seai on t_ch_fee_do_truck.业务编号=t_op_seai.编号 inner JOIN ' +'t_ch_balance_truck ON ' +'t_ch_fee_do_truck.工作编号 = t_ch_balance_truck.帐单编号 ' +str +' and t_ch_fee_do_truck.类型='+''''+'1'+'''' +' group by t_op_seai.委托单位 ' +'select #bill.委托单位,#bill.毛利润,#bill.利润率,#bill.资金占用量,#bill.资金占用率, ' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.当月回收,0)+isnull(#fee_truck.当月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 当月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.二月回收,0)+isnull(#fee_truck.二月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 二月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.三月回收,0)+isnull(#fee_truck.三月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 三月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.其他回收,0)+isnull(#fee_truck.其他回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 其他回收率 ,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.其他回收,0)+isnull(#fee.当月回收,0)+isnull(#fee.二月回收,0)+isnull(#fee.三月回收,0)+' +'isnull(#fee_truck.其他回收,0)+isnull(#fee_truck.当月回收,0)+isnull(#fee_truck.二月回收,0)+isnull(#fee_truck.三月回收,0))'+ '/#bill.合计应收*100,10,2))+' +''''+'%'+''''+' end) as 合计回收率 ,#bill.合计应收 ' +'from #bill left join #fee on #bill.委托单位=#fee.委托单位 ' +'left join #fee_truck on #bill.委托单位=#fee_truck.委托单位 ' +'order by #bill.委托单位 '; 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.合计应付) from t_op_gain' +' where t_op_gain.编号 in (select t_op_seai.编号 from t_op_seai '+str_date+')),0) ' +'SELECT t_op_seai.揽货人,' +'sum(t_op_gain.毛利润) as 毛利润,' +'(case when isnull(sum(t_op_gain.合计应付),0)=0 then '+''''+'无法计算'+''''+' else ' +'ltrim(str(sum(t_op_gain.毛利润)/sum(t_op_gain.合计应付)*100,10,2))+'+''''+'%'+''''+' end) as 利润率, ' +'sum(t_op_gain.合计应付) as 资金占用量,' +'(case when @all_pay=0 then '+''''+'无法计算'+''''+' else ' +'(ltrim(str(sum(t_op_gain.合计应付)/@all_pay*100,10,2))+'+''''+'%'+''''+') end) as 资金占用率,isnull(sum(t_op_gain.合计应收),0) as 合计应收 ' +'INTO #bill ' +'FROM t_op_gain inner join t_op_seai on t_op_gain.编号 = t_op_seai.编号 ' +str +' group by t_op_seai.揽货人 ' +'SELECT t_op_seai.揽货人, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'<= 30 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 当月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期)<=60 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 二月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+',' +'t_ch_balance.结算日期)<=90 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 三月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 90 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 其他回收 ' +'INTO #fee ' +'FROM t_ch_fee_do inner JOIN t_op_seai on t_ch_fee_do.业务编号=t_op_seai.编号 inner JOIN ' +'t_ch_balance ON ' +'t_ch_fee_do.工作编号 = t_ch_balance.帐单编号 inner JOIN ' +'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID ' +str +' and t_ch_fee_do.类型='+''''+'3'+'''' +' group by t_op_seai.揽货人 ' +'SELECT t_op_seai.揽货人, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'<= 30 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 当月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期)<=60 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 二月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+',' +'t_ch_balance_truck.结算日期)<=90 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 三月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 90 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 其他回收 ' +'INTO #fee_truck ' +'FROM t_ch_fee_do_truck inner JOIN t_op_seai on t_ch_fee_do_truck.业务编号=t_op_seai.编号 inner JOIN ' +'t_ch_balance_truck ON ' +'t_ch_fee_do_truck.工作编号 = t_ch_balance_truck.帐单编号 ' +str +' and t_ch_fee_do_truck.类型='+''''+'1'+'''' +' group by t_op_seai.揽货人 ' +'select #bill.揽货人,#bill.毛利润,#bill.利润率,#bill.资金占用量,#bill.资金占用率, ' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.当月回收,0)+isnull(#fee_truck.当月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 当月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.二月回收,0)+isnull(#fee_truck.二月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 二月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.三月回收,0)+isnull(#fee_truck.三月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 三月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.其他回收,0)+isnull(#fee_truck.其他回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 其他回收率 ,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.其他回收,0)+isnull(#fee.当月回收,0)+isnull(#fee.二月回收,0)+isnull(#fee.三月回收,0)+' +'isnull(#fee_truck.其他回收,0)+isnull(#fee_truck.当月回收,0)+isnull(#fee_truck.二月回收,0)+isnull(#fee_truck.三月回收,0))'+ '/#bill.合计应收*100,10,2))+' +''''+'%'+''''+' end) as 合计回收率 ,#bill.合计应收 ' +'from #bill left join #fee on #bill.揽货人=#fee.揽货人 ' +'left join #fee_truck on #bill.揽货人=#fee_truck.揽货人 ' +'order by #bill.揽货人 '; 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.合计应付) from t_op_gain' +' where t_op_gain.编号 in (select t_op_seai.编号 from t_op_seai '+str_date+')),0) ' +'SELECT ' +'sum(t_op_gain.毛利润) as 毛利润,' +'(case when isnull(sum(t_op_gain.合计应付),0)=0 then '+''''+'无法计算'+''''+' else ' +'ltrim(str(sum(t_op_gain.毛利润)/sum(t_op_gain.合计应付)*100,10,2))+'+''''+'%'+''''+' end) as 利润率, ' +'sum(t_op_gain.合计应付) as 资金占用量,' +'(case when @all_pay=0 then '+''''+'无法计算'+''''+' else ' +'(ltrim(str(sum(t_op_gain.合计应付)/@all_pay*100,10,2))+'+''''+'%'+''''+') end) as 资金占用率,isnull(sum(t_op_gain.合计应收),0) as 合计应收 ' +'INTO #bill ' +'FROM t_op_gain inner join t_op_seai on t_op_gain.编号 = t_op_seai.编号 ' +str +' SELECT ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'<= 30 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 当月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期)<=60 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 二月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+',' +'t_ch_balance.结算日期)<=90 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 三月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance.结算日期) ' +'> 90 THEN t_ch_fee_do.原始金额 * t_ch_fee.汇率 ELSE 0 END) AS 其他回收 ' +'INTO #fee ' +'FROM t_ch_fee_do inner JOIN t_op_seai on t_ch_fee_do.业务编号=t_op_seai.编号 inner JOIN ' +'t_ch_balance ON ' +'t_ch_fee_do.工作编号 = t_ch_balance.帐单编号 inner JOIN ' +'t_ch_fee ON t_ch_fee_do.CH_ID = t_ch_fee.CH_ID ' +str +' and t_ch_fee_do.类型='+''''+'3'+'''' +'SELECT ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'<= 30 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 当月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 30 and DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期)<=60 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 二月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 60 and DATEDIFF([day], t_op_seai.'+str_date_tongji+',' +'t_ch_balance_truck.结算日期)<=90 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 三月回收, ' +'SUM(CASE WHEN DATEDIFF([day], t_op_seai.'+str_date_tongji+', ' +'t_ch_balance_truck.结算日期) ' +'> 90 THEN t_ch_fee_do_truck.原始金额 ELSE 0 END) AS 其他回收 ' +'INTO #fee_truck ' +'FROM t_ch_fee_do_truck inner JOIN t_op_seai on t_ch_fee_do_truck.业务编号=t_op_seai.编号 inner JOIN ' +'t_ch_balance_truck ON ' +'t_ch_fee_do_truck.工作编号 = t_ch_balance_truck.帐单编号 ' +str +' and t_ch_fee_do_truck.类型='+''''+'1'+'''' +'select #bill.毛利润,#bill.利润率,#bill.资金占用量,#bill.资金占用率, ' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.当月回收,0)+isnull(#fee_truck.当月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 当月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.二月回收,0)+isnull(#fee_truck.二月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 二月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.三月回收,0)+isnull(#fee_truck.三月回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 三月回收率,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.其他回收,0)+isnull(#fee_truck.其他回收,0))/#bill.合计应收*100,10,2))+'+''''+'%'+''''+' end) as 其他回收率 ,' +'(case when #bill.合计应收=0 then '+''''+'无法计算'+'''' +' else ltrim(str((isnull(#fee.其他回收,0)+isnull(#fee.当月回收,0)+isnull(#fee.二月回收,0)+isnull(#fee.三月回收,0)+' +'isnull(#fee_truck.其他回收,0)+isnull(#fee_truck.当月回收,0)+isnull(#fee_truck.二月回收,0)+isnull(#fee_truck.三月回收,0))'+ '/#bill.合计应收*100,10,2))+' +''''+'%'+''''+' end) as 合计回收率 ,#bill.合计应收 ' +'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('海运进口资金分析',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,'客户名称'); end; procedure Tfrm_rp_zj_seai.dxDBGrid2ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort_pro(Column,p_shen,'揽货人'); end; end.