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.

253 lines
8.3 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_in_ch;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, ADODB, DB, bsSkinCtrls, dxDBTLCl, dxGrClms, dxDBGrid,
dxTL, dxDBCtrl, dxCntner, ComCtrls, bsSkinTabs, ExtCtrls, RxLookup,
wwdbdatetimepicker, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb;
type
Tfrm_rp_in_ch = class(TForm)
Panel1: TPanel;
bsSkinPanel2: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
p_detail: TADOStoredProc;
p_client: TADOStoredProc;
p_client1: TDataSource;
p_shen: TADOStoredProc;
p_shen1: TDataSource;
p_detail1: TDataSource;
Label10: TLabel;
wwDBDateTimePicker1: TwwDBDateTimePicker;
Label5: TLabel;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label9: TLabel;
RxDBLookupCombo2: TRxDBLookupCombo;
Label14: TLabel;
RxDBLookupCombo3: TRxDBLookupCombo;
Label16: TLabel;
RxDBLookupCombo6: TRxDBLookupCombo;
Label7: TLabel;
wwDBComboBox1: TwwDBComboBox;
Label1: TLabel;
wwDBComboBox3: TwwDBComboBox;
Label2: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
Label3: TLabel;
RxDBLookupCombo4: TRxDBLookupCombo;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinTabSheet3: TbsSkinTabSheet;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridMaskColumn;
dxDBGrid1Column10: TdxDBGridDateColumn;
dxDBGrid1Column22: TdxDBGridMaskColumn;
dxDBGrid1Column19: TdxDBGridColumn;
dxDBGrid1Column20: TdxDBGridColumn;
dxDBGrid1Column21: TdxDBGridColumn;
dxDBGrid1Column28: TdxDBGridMaskColumn;
dxDBGrid1Column32: TdxDBGridCheckColumn;
dxDBGrid1Column29: TdxDBGridCheckColumn;
dxDBGrid1Column35: TdxDBGridMaskColumn;
dxDBGrid1Column36: TdxDBGridDateColumn;
dxDBGrid1Column33: TdxDBGridMaskColumn;
dxDBGrid1Column34: TdxDBGridDateColumn;
dxDBGrid6: TdxDBGrid;
dxDBGrid6Column1: TdxDBGridMaskColumn;
dxDBGrid6Column2: TdxDBGridColumn;
dxDBGrid6USD: TdxDBGridColumn;
dxDBGrid6RMB: TdxDBGridColumn;
dxDBGrid6Column5: TdxDBGridColumn;
dxDBGrid6Column6: TdxDBGridColumn;
dxDBGrid6Column7: TdxDBGridColumn;
dxDBGrid6Column8: TdxDBGridColumn;
dxDBGrid6Column9: TdxDBGridColumn;
dxDBGrid6Column10: TdxDBGridColumn;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridColumn9: TdxDBGridColumn;
Edit1: TEdit;
Label4: TLabel;
Edit2: TEdit;
Label6: TLabel;
Label8: TLabel;
Edit3: TEdit;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure dxDBGrid6ColumnSorting(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_in_ch: Tfrm_rp_in_ch;
implementation
uses u_main, my_sys_function;
{$R *.dfm}
procedure Tfrm_rp_in_ch.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_rp_in_ch.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_rp_in_ch.Hide;
frm_rp_in_ch.ManualFloat(frm_rp_in_ch.BoundsRect );
frm_main.freeTabs('frm_rp_in_ch');
action:=cafree;
frm_rp_in_ch:=nil;
end;
procedure Tfrm_rp_in_ch.bsSkinButton10Click(Sender: TObject);
var
str:widestring;
begin
str:='where '+open_data('0035','<27>Ƶ<EFBFBD><C6B5><EFBFBD>','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no');
if wwDBDateTimePicker1.TEXT<>''then
begin
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>>='+''''+wwDBDateTimePicker1.TEXT+'''';
end;
if wwDBDateTimePicker2.TEXT<>''then
begin
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><='+''''+wwDBDateTimePicker2.TEXT+'''';
end;
if (Edit1.TEXT<>'')and(Edit2.TEXT<>'')then
begin
str:=str+' and (<28><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> between '+''''+Edit1.TEXT+''''
+' and '+''''+Edit2.TEXT+''''+')';
end
else
begin
if Edit1.TEXT<>''then
begin
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> like '+''''+'%'+Edit1.TEXT+'%'+'''';
end;
if Edit2.TEXT<>''then
begin
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD> like '+''''+'%'+Edit2.TEXT+'%'+'''';
end;
end;
if RxDBLookupCombo2.DisplayValues[1]<>''then
begin
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValues[1]+'''';
end;
if wwDBComboBox1.text<>''then
begin
str:=str+' and <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>='+''''+wwDBComboBox1.text+'''';
end;
if RxDBLookupCombo3.DisplayValues[0]<>''then
begin
str:=str+' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValues[0]+'''';
end;
if RxDBLookupCombo4.DisplayValues[0]<>''then
begin
str:=str+' and <20>ϳ<EFBFBD><CFB3><EFBFBD>='+''''+RxDBLookupCombo4.DisplayValues[0]+'''';
end;
if RxDBLookupCombo6.DisplayValues[0]<>''then
begin
str:=str+' and <20>Ƶ<EFBFBD><C6B5><EFBFBD>='+''''+RxDBLookupCombo6.DisplayValues[0]+'''';
end;
if RxDBLookupCombo1.DisplayValues[0]<>''then
begin
str:=str+' and <20>ұ<EFBFBD>='+''''+RxDBLookupCombo1.DisplayValues[0]+'''';
end;
if wwDBComboBox3.ItemIndex<>-1 then
begin
str:=str+' and <20>Ƿ<EFBFBD><C7B7>ϳ<EFBFBD>='+inttostr(wwDBComboBox3.ItemIndex);
end;
if Edit3.TEXT<>''then
begin
str:=str+' and <20>ϼƽ<CFBC><C6BD><EFBFBD>='+Edit3.TEXT;
end;
p_detail.close;
p_detail.Parameters.ParamByName('SQLStr').value:=
'select * from t_ch_invoice '+str+' order by <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>';
p_detail.open;
p_client.close;
p_client.Parameters.ParamByName('SQLStr').value:=
'select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,count(<28><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>) as <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 1 ELSE 0 END) AS USD<53><44><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE 1 END) AS RMB<4D><42><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN <20>ϼƽ<CFBC><C6BD><EFBFBD> ELSE 0 END) AS USD<53><44>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN ʵ<>ʽ<EFBFBD><CABD><EFBFBD> ELSE 0 END) AS USDʵ<44>ʽ<EFBFBD><CABD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN <20><EFBFBD><E9BFAA><EFBFBD><EFBFBD> ELSE 0 END) AS USD<53><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE <20>ϼƽ<CFBC><C6BD><EFBFBD> END) AS RMB<4D><42>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE ʵ<>ʽ<EFBFBD><CABD><EFBFBD> END) AS RMBʵ<42>ʽ<EFBFBD><CABD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE <20><EFBFBD><E9BFAA><EFBFBD><EFBFBD> END) AS RMB<4D><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'
+' FROM T_CH_INVOICE '+str+' GROUP BY <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ORDER BY <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> ';
p_client.open;
p_shen.close;
p_shen.Parameters.ParamByName('SQLStr').value:=
'select <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,count(<28><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>) as <20><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 1 ELSE 0 END) AS USD<53><44><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE 1 END) AS RMB<4D><42><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN <20>ϼƽ<CFBC><C6BD><EFBFBD> ELSE 0 END) AS USD<53><44>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN ʵ<>ʽ<EFBFBD><CABD><EFBFBD> ELSE 0 END) AS USDʵ<44>ʽ<EFBFBD><CABD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN <20><EFBFBD><E9BFAA><EFBFBD><EFBFBD> ELSE 0 END) AS USD<53><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE <20>ϼƽ<CFBC><C6BD><EFBFBD> END) AS RMB<4D><42>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE ʵ<>ʽ<EFBFBD><CABD><EFBFBD> END) AS RMBʵ<42>ʽ<EFBFBD><CABD><EFBFBD>'
+',sum(case <20>ұ<EFBFBD> when '+''''+'USD'+''''+' THEN 0 ELSE <20><EFBFBD><E9BFAA><EFBFBD><EFBFBD> END) AS RMB<4D><EFBFBD><E9BFAA><EFBFBD><EFBFBD>'
+' FROM T_CH_INVOICE '+str+' GROUP BY <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ORDER BY <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ';
p_shen.open;
end;
procedure Tfrm_rp_in_ch.bsSkinButton9Click(Sender: TObject);
begin
sys_print('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʊͳ<C6B1><CDB3>',2,nil,nil,nil,nil,p_detail1,p_client1,p_shen1,nil,nil,nil,nil);
end;
procedure Tfrm_rp_in_ch.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_detail,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_in_ch.dxDBGrid6ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_client,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_rp_in_ch.dxDBGrid2ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort_pro(Column,p_shen,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end.