|
|
unit u_rp_bssource_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,
|
|
|
dxDBTLCl, dxGrClms, RxLookup, kbmMemTable;
|
|
|
|
|
|
type
|
|
|
TRecordVar = Record
|
|
|
S1,S2,S3,S4 :String;
|
|
|
d1,d2,d3 :Double;
|
|
|
end;
|
|
|
|
|
|
Tfrm_rp_bssource_total = class(TForm)
|
|
|
Panel1: TPanel;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
PopupMenu2: TPopupMenu;
|
|
|
N16: TMenuItem;
|
|
|
SaveDialog: TSaveDialog;
|
|
|
p_accept_bill: TADOStoredProc;
|
|
|
p_accept_bill1: TDataSource;
|
|
|
N1: TMenuItem;
|
|
|
N2: TMenuItem;
|
|
|
N3: TMenuItem;
|
|
|
N4: TMenuItem;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
Label41: TLabel;
|
|
|
RxDBLookupCombo16: TRxDBLookupCombo;
|
|
|
dxDBGrid5: TdxDBGrid;
|
|
|
dxDBGridMaskColumn95: TdxDBGridMaskColumn;
|
|
|
dxDBGridColumn19: TdxDBGridColumn;
|
|
|
dxDBGridColumn22: TdxDBGridColumn;
|
|
|
dxDBGridColumn25: TdxDBGridColumn;
|
|
|
dxDBGridColumn28: TdxDBGridColumn;
|
|
|
dxDBGridColumn31: TdxDBGridColumn;
|
|
|
dxDBGridColumn34: TdxDBGridColumn;
|
|
|
dxDBGridColumn35: TdxDBGridColumn;
|
|
|
dxDBGridColumn36: TdxDBGridColumn;
|
|
|
dxDBGridColumn37: TdxDBGridColumn;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
procedure bsSkinPanel2Resize(Sender: TObject);
|
|
|
procedure N16Click(Sender: TObject);
|
|
|
procedure p_accept_clientAfterOpen(DataSet: TDataSet);
|
|
|
procedure p_accept_clAfterOpen(DataSet: TDataSet);
|
|
|
procedure dxDBGrid1Column37GetText(Sender: TObject;
|
|
|
ANode: TdxTreeListNode; var AText: String);
|
|
|
procedure N1Click(Sender: TObject);
|
|
|
procedure N3Click(Sender: TObject);
|
|
|
procedure dxDBGrid5ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
private
|
|
|
str_accept,str_pay:widestring;
|
|
|
zl1,zl2,zl3,zl4,zl5,zl6,zl7:string;
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
function getzq(cust: string;etdate:string): TRecordVar;
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_rp_bssource_total: Tfrm_rp_bssource_total;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function, u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
function Tfrm_rp_bssource_total.getzq(cust: string;etdate:string): TRecordVar;
|
|
|
begin
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_rp_bssource_total.Hide;
|
|
|
frm_rp_bssource_total.ManualFloat(frm_rp_bssource_total.BoundsRect );
|
|
|
frm_main.freeTabs('frm_rp_bssource_total');
|
|
|
action:=cafree;
|
|
|
frm_rp_bssource_total:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.bsSkinButton9Click(Sender: TObject);
|
|
|
begin
|
|
|
sys_print('ҵ<><D2B5><EFBFBD><EFBFBD>Դ<EFBFBD>ۺϷ<DBBA><CFB7><EFBFBD>',2,nil,nil,nil,nil,p_accept_bill1,nil,nil,nil,nil,nil,nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.bsSkinPanel2Resize(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
i:=round((bsSkinPanel2.Width-bsSkinPanel1.Width)/7);
|
|
|
bsSkinCheckRadioBox2.Width:=i;
|
|
|
bsSkinCheckRadioBox1.Width:=i;
|
|
|
bsSkinButton10.Width:=i;
|
|
|
bsSkinButton9.Width:=i;
|
|
|
bsSkinButton5.Width:=i;
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.N16Click(Sender: TObject);
|
|
|
begin
|
|
|
with SaveDialog do
|
|
|
begin
|
|
|
DefaultExt :='xls';
|
|
|
Filter := '(*.xls)|*.xls';
|
|
|
if Execute then
|
|
|
begin
|
|
|
dxDBGrid5.SaveToXLS(FileName,true)
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.p_accept_clientAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.p_accept_clAfterOpen(DataSet: TDataSet);
|
|
|
begin
|
|
|
AdoFormatdxDBGrid(DataSet);
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.dxDBGrid1Column37GetText(Sender: TObject;
|
|
|
ANode: TdxTreeListNode; var AText: String);
|
|
|
begin
|
|
|
if AText='0.00' then AText:='';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.N1Click(Sender: TObject);
|
|
|
begin
|
|
|
update_grid_view_no(dxdbgrid5)
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.N3Click(Sender: TObject);
|
|
|
begin
|
|
|
update_grid_view_all(dxdbgrid5)
|
|
|
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.dxDBGrid5ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort_pro(Column,p_accept_bill,'ҵ<><D2B5><EFBFBD><EFBFBD>Դ');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_rp_bssource_total.bsSkinButton10Click(Sender: TObject);
|
|
|
var
|
|
|
str_date,str_bsdate:string;
|
|
|
begin
|
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
|
str_date:='ƾ֤<C6BE><D6A4><EFBFBD><EFBFBD>'
|
|
|
else
|
|
|
str_date:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
str_bsdate:='where t_ch_fee.<2E><><EFBFBD><EFBFBD><>t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';
|
|
|
if wwDBDateTimePicker1.Text<>''then
|
|
|
begin
|
|
|
str_bsdate:=str_bsdate+' and not v_op_bscard.'+str_date +' is null and v_op_bscard.'+str_date+'>='+''''+wwDBDateTimePicker1.Text+'''';
|
|
|
end;
|
|
|
if wwDBDateTimePicker2.Text<>''then
|
|
|
begin
|
|
|
str_bsdate:=str_bsdate+' and not v_op_bscard.'+str_date + ' is null and v_op_bscard.'+str_date+'<='+''''+wwDBDateTimePicker2.Text+'''';
|
|
|
end;
|
|
|
if RxDBLookupCombo16.DisplayValues[0]<>'' then begin
|
|
|
str_bsdate:=str_bsdate+' and v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD>Դ='+''''+RxDBLookupCombo16.DisplayValues[0]+'''';
|
|
|
end;
|
|
|
p_accept_bill.close;
|
|
|
p_accept_bill.Parameters.ParamByName('SQLStr').value:=
|
|
|
'SELECT v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD>Դ,'
|
|
|
{
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as Ӧ<><D3A6>USD,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as <20><><EFBFBD><EFBFBD>USD,'
|
|
|
}
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as δ<><CEB4>USD,'
|
|
|
{
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as Ӧ<><D3A6>RMB,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as <20><><EFBFBD><EFBFBD>RMB,'
|
|
|
}
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as δ<><CEB4>RMB,'
|
|
|
{
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as Ӧ<>պϼ<D5BA>,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as <20><><EFBFBD>պϼ<D5BA>,'
|
|
|
}
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' 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 δ<>պϼ<D5BA>,'
|
|
|
{
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as Ӧ<><D3A6>USD,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as <20>Ѹ<EFBFBD>USD,'
|
|
|
}
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as δ<><CEB4>USD,'
|
|
|
{
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as Ӧ<><D3A6>RMB,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as <20>Ѹ<EFBFBD>RMB,'
|
|
|
}
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as δ<><CEB4>RMB,'
|
|
|
{
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN t_ch_fee.<2E><><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as Ӧ<><D3A6><EFBFBD>ϼ<EFBFBD>,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*t_ch_fee.<2E><><EFBFBD><EFBFBD> ELSE 0 END) as <20>Ѹ<EFBFBD><D1B8>ϼ<EFBFBD>,'
|
|
|
}
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' 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>,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END'
|
|
|
+'-CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> else 0 end) ELSE 0 END) as <20><><EFBFBD><EFBFBD>USD,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END'
|
|
|
+'-CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (case t_ch_fee.<2E>ұ<EFBFBD> when '+''''+'USD'+''''
|
|
|
+' then 0 else (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*t_ch_fee.<2E><><EFBFBD><EFBFBD> end) ELSE 0 END) as <20><><EFBFBD><EFBFBD>RMB,'
|
|
|
+'SUM(CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' 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'
|
|
|
+'-CASE t_ch_fee.<2E><><EFBFBD><EFBFBD> WHEN '+''''+'<27><>'+''''
|
|
|
+' THEN (t_ch_fee.<2E><><EFBFBD><EFBFBD>-t_ch_fee.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)*<2A><><EFBFBD><EFBFBD> ELSE 0 END) as <20><><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD>'
|
|
|
+' FROM t_ch_fee inner join v_op_bscard on v_op_bscard.<2E><><EFBFBD><EFBFBD>=t_ch_fee.<2E><><EFBFBD><EFBFBD> '
|
|
|
+str_bsdate+' GROUP BY v_op_bscard.ҵ<><D2B5><EFBFBD><EFBFBD>Դ ';
|
|
|
p_accept_bill.Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end.
|