|
|
unit u_crm_client_report;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, bsSkinCtrls, StdCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb,
|
|
|
ExtCtrls, wwdbdatetimepicker, dxExEdtr, dxCntner, dxTL, dxDBCtrl,
|
|
|
dxDBGrid, DB, ADODB, RxLookup;
|
|
|
|
|
|
type
|
|
|
Tfrm_crm_client_report = class(TForm)
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
p_client: TADOStoredProc;
|
|
|
p_client1: TDataSource;
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column2: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column5: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column8: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column9: TdxDBGridColumn;
|
|
|
dxDBGrid1Column10: TdxDBGridColumn;
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
Label14: TLabel;
|
|
|
Edit1: TEdit;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_crm_client_report: Tfrm_crm_client_report;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function, u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_crm_client_report.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_crm_client_report.Hide;
|
|
|
frm_crm_client_report.ManualFloat(frm_crm_client_report.BoundsRect );
|
|
|
frm_main.freeTabs('frm_crm_client_report');
|
|
|
action:=cafree;
|
|
|
frm_crm_client_report:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
str:widestring;
|
|
|
begin
|
|
|
if Edit1.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
if wwDBDateTimePicker1.text='' then
|
|
|
begin
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
try
|
|
|
strtoint(Edit1.text);
|
|
|
except
|
|
|
showmessage('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֣<EFBFBD><D6A3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
str:='having isnull(MAX(v_op_no.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>),'+''''+'2000-01-01'+''''
|
|
|
+')<='+''''+datetimetostr(wwDBDateTimePicker1.date-strtoint(Edit1.text))+'''';
|
|
|
if RxDBLookupCombo3.DisplayValue<>''then
|
|
|
str:=str+' and t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo3.DisplayValue+'''';
|
|
|
|
|
|
|
|
|
str:=str+' and '+open_data('8004','t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no');
|
|
|
|
|
|
p_client.close;
|
|
|
p_client.Parameters.ParamByName('SQLStr').value:=
|
|
|
'SELECT t_crm_client.<2E>ͻ<EFBFBD>״̬, t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD>ֵ, t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,'
|
|
|
+'t_crm_client.ͨѶ<CDA8><D1B6>ַ, t_crm_client.<2E><><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><>վ, t_crm_client.<2E>绰, t_crm_client.<2E><><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD>, t_crm_client.Ӫҵִ<D2B5><D6B4>,'
|
|
|
+'t_crm_client.<2E><>˰<EFBFBD>Ǽ<EFBFBD>, t_crm_client.<2E><>˰<EFBFBD>Ǽ<EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD,'
|
|
|
+'t_crm_client.<2E>ʺ<EFBFBD>USD, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB, t_crm_client.<2E>ʺ<EFBFBD>RMB,'
|
|
|
+'t_crm_client.<2E><>Ʊ̧ͷ, t_crm_client.<2E><>ҵ<EFBFBD><D2B5>ģ, t_crm_client.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>, t_crm_client.<2E>Ƿ<EFBFBD><C7B7>̼<EFBFBD>, t_crm_client.<2E>Ƿ<EFBFBD>Ѭ<EFBFBD><D1AC>,'
|
|
|
+'t_crm_client.<2E>Ƿ<C7B7>, t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.<2E>˼<EFBFBD>Ҫ<EFBFBD><D2AA>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.<2E><><EFBFBD>ѷ<EFBFBD>ʽ, t_crm_client.<2E><>ƱҪ<C6B1><D2AA>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD>˾Ҫ<CBBE><D2AA>, t_crm_client.<2E>ᵥҪ<E1B5A5><D2AA>, t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>,'
|
|
|
+'t_crm_client.<2E>ɳ<EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.ע<>ػ<EFBFBD><D8BB><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD>۷<EFBFBD><DBB7><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>, t_crm_client.¼<><C2BC><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, MAX(v_op_no.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) AS ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+'FROM t_crm_client INNER JOIN '
|
|
|
+'v_op_no ON t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> = v_op_no.ί<>е<EFBFBD>λ '
|
|
|
+'GROUP BY t_crm_client.<2E>ͻ<EFBFBD>״̬, t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD>ֵ,'
|
|
|
+'t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>, t_crm_client.ͨѶ<CDA8><D1B6>ַ, t_crm_client.<2E><><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD>, t_crm_client.<2E><>վ, t_crm_client.<2E>绰,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.Ӫҵִ<D2B5><D6B4>, t_crm_client.<2E><>˰<EFBFBD>Ǽ<EFBFBD>, t_crm_client.<2E><>˰<EFBFBD>Ǽ<EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD, t_crm_client.<2E>ʺ<EFBFBD>USD, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB,'
|
|
|
+'t_crm_client.<2E>ʺ<EFBFBD>RMB, t_crm_client.<2E><>Ʊ̧ͷ, t_crm_client.<2E><>ҵ<EFBFBD><D2B5>ģ,'
|
|
|
+'t_crm_client.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>, t_crm_client.<2E><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>, t_crm_client.<2E>Ƿ<EFBFBD><C7B7>̼<EFBFBD>,'
|
|
|
+'t_crm_client.<2E>Ƿ<EFBFBD>Ѭ<EFBFBD><D1AC>, t_crm_client.<2E>Ƿ<C7B7>, t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>,'
|
|
|
+'t_crm_client.<2E>˼<EFBFBD>Ҫ<EFBFBD><D2AA>, t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.<2E><><EFBFBD>ѷ<EFBFBD>ʽ,'
|
|
|
+'t_crm_client.<2E><>ƱҪ<C6B1><D2AA>, t_crm_client.<2E><><EFBFBD><EFBFBD>˾Ҫ<CBBE><D2AA>, t_crm_client.<2E>ᵥҪ<E1B5A5><D2AA>,'
|
|
|
+'t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.<2E>ɳ<EFBFBD>ϰ<EFBFBD><CFB0>, t_crm_client.<2E><><EFBFBD><EFBFBD>ϰ<EFBFBD><CFB0>,'
|
|
|
+'t_crm_client.ע<>ػ<EFBFBD><D8BB><EFBFBD>, t_crm_client.<2E><><EFBFBD>۷<EFBFBD><DBB7><EFBFBD>, t_crm_client.<2E><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>,'
|
|
|
+'t_crm_client.¼<><C2BC><EFBFBD><EFBFBD>, t_crm_client.¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '
|
|
|
+str
|
|
|
+' order by t_crm_client.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
p_client.open;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.bsSkinButton9Click(Sender: TObject);
|
|
|
begin
|
|
|
sys_print('<27><>ʧ<EFBFBD>ͻ<EFBFBD>ͳ<EFBFBD>ƴ<EFBFBD>ӡ',2,nil,nil,nil,nil,p_client1,nil,nil,nil,nil,nil,nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
frm_data_share.t_sys_employee.requery;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.Edit1KeyPress(Sender: TObject;
|
|
|
var Key: Char);
|
|
|
begin
|
|
|
key_RxDBLookupCombo(Key,RxDBLookupCombo3);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.RxDBLookupCombo3KeyPress(Sender: TObject;
|
|
|
var Key: Char);
|
|
|
begin
|
|
|
key_wwDBDateTimePicker(Key,wwDBDateTimePicker1);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.wwDBDateTimePicker1KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
if key=#13 then
|
|
|
begin
|
|
|
key:=#0;
|
|
|
frm_crm_client_report.bsSkinButton1Click(Sender);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort_pro(Column,p_client,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_report.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
grid_save_xls(dxdbgrid1);
|
|
|
end;
|
|
|
|
|
|
end.
|