|
|
unit u_crm_client_query;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, BusinessSkinForm, bsSkinCtrls, wwdbdatetimepicker, Mask,
|
|
|
wwdbedit, Wwdotdot, Wwdbcomb, RxLookup, StdCtrls;
|
|
|
|
|
|
type
|
|
|
Tfrm_crm_client_query = class(TForm)
|
|
|
Label10: TLabel;
|
|
|
Label14: TLabel;
|
|
|
Label6: TLabel;
|
|
|
Label7: TLabel;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
Label3: TLabel;
|
|
|
Label4: TLabel;
|
|
|
Label5: TLabel;
|
|
|
Label13: TLabel;
|
|
|
Edit1: TEdit;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
Edit2: TEdit;
|
|
|
Edit3: TEdit;
|
|
|
Edit4: TEdit;
|
|
|
wwDBComboBox1: TwwDBComboBox;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
RxDBLookupCombo5: TRxDBLookupCombo;
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
wwDBComboBox4: TwwDBComboBox;
|
|
|
wwDBComboBox5: TwwDBComboBox;
|
|
|
wwDBComboBox6: TwwDBComboBox;
|
|
|
wwDBComboBox7: TwwDBComboBox;
|
|
|
wwDBComboBox13: TwwDBComboBox;
|
|
|
wwDBComboBox14: TwwDBComboBox;
|
|
|
wwDBComboBox15: TwwDBComboBox;
|
|
|
wwDBComboBox16: TwwDBComboBox;
|
|
|
wwDBComboBox17: TwwDBComboBox;
|
|
|
wwDBComboBox18: TwwDBComboBox;
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
Label8: TLabel;
|
|
|
wwDBComboBox2: TwwDBComboBox;
|
|
|
Edit5: TEdit;
|
|
|
Label9: TLabel;
|
|
|
wwDBComboBox3: TwwDBComboBox;
|
|
|
Edit6: TEdit;
|
|
|
Edit7: TEdit;
|
|
|
wwDBComboBox8: TwwDBComboBox;
|
|
|
Label11: TLabel;
|
|
|
Edit8: TEdit;
|
|
|
wwDBComboBox9: TwwDBComboBox;
|
|
|
Label12: TLabel;
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
Label15: TLabel;
|
|
|
wwDBComboBox10: TwwDBComboBox;
|
|
|
Edit9: TEdit;
|
|
|
Label16: TLabel;
|
|
|
wwDBComboBox11: TwwDBComboBox;
|
|
|
Edit10: TEdit;
|
|
|
Label17: TLabel;
|
|
|
wwDBComboBox12: TwwDBComboBox;
|
|
|
Edit11: TEdit;
|
|
|
Label18: TLabel;
|
|
|
wwDBComboBox19: TwwDBComboBox;
|
|
|
Edit12: TEdit;
|
|
|
bsSkinGroupBox2: TbsSkinGroupBox;
|
|
|
Label19: TLabel;
|
|
|
Label20: TLabel;
|
|
|
Label21: TLabel;
|
|
|
Label22: TLabel;
|
|
|
wwDBComboBox20: TwwDBComboBox;
|
|
|
wwDBComboBox21: TwwDBComboBox;
|
|
|
Edit14: TEdit;
|
|
|
wwDBComboBox22: TwwDBComboBox;
|
|
|
Edit15: TEdit;
|
|
|
wwDBComboBox23: TwwDBComboBox;
|
|
|
Label23: TLabel;
|
|
|
wwDBComboBox24: TwwDBComboBox;
|
|
|
Label24: TLabel;
|
|
|
wwDBComboBox25: TwwDBComboBox;
|
|
|
Label25: TLabel;
|
|
|
wwDBComboBox26: TwwDBComboBox;
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
Label26: TLabel;
|
|
|
wwDBComboBox27: TwwDBComboBox;
|
|
|
wwDBDateTimePicker4: TwwDBDateTimePicker;
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
RxDBLookupCombo4: TRxDBLookupCombo;
|
|
|
wwDBComboBox28: TwwDBComboBox;
|
|
|
wwDBComboBox29: TwwDBComboBox;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure wwDBComboBox15KeyPress(Sender: TObject; var Key: Char);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_crm_client_query: Tfrm_crm_client_query;
|
|
|
client_query_bs:integer;
|
|
|
client_query_limited:string;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_data_share, u_main, u_crm_client_sales, my_sys_function,
|
|
|
u_crm_client_check;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_crm_client_query.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_query.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
wwDBComboBox15.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox16.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox4.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox5.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox2.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox3.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox8.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox9.text:='ģ<><C4A3>';
|
|
|
|
|
|
wwDBComboBox17.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox7.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox18.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox6.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox13.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox14.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
wwDBComboBox10.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox11.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox12.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox19.text:='ģ<><C4A3>';
|
|
|
|
|
|
wwDBComboBox20.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox21.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox22.text:='ģ<><C4A3>';
|
|
|
wwDBComboBox23.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox24.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox25.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox26.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
wwDBComboBox27.text:='<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
frm_data_share.t_sys_employee.requery;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_query.bsSkinButton10Click(Sender: TObject);
|
|
|
begin
|
|
|
Edit1.text:='';
|
|
|
Edit2.text:='';
|
|
|
Edit5.text:='';
|
|
|
Edit8.text:='';
|
|
|
wwDBComboBox1.text:='';
|
|
|
wwDBDateTimePicker1.text:='';
|
|
|
RxDBLookupCombo5.ClearValue;
|
|
|
Edit4.text:='';
|
|
|
Edit3.text:='';
|
|
|
Edit6.text:='';
|
|
|
Edit7.text:='';
|
|
|
RxDBLookupCombo1.ClearValue;
|
|
|
wwDBDateTimePicker2.text:='';
|
|
|
RxDBLookupCombo3.ClearValue;
|
|
|
Edit9.text:='';
|
|
|
Edit11.text:='';
|
|
|
Edit10.text:='';
|
|
|
Edit12.text:='';
|
|
|
wwDBComboBox29.text:='';
|
|
|
Edit14.text:='';
|
|
|
Edit15.text:='';
|
|
|
wwDBComboBox28.text:='';
|
|
|
RxDBLookupCombo4.ClearValue;
|
|
|
RxDBLookupCombo2.ClearValue;
|
|
|
wwDBDateTimePicker3.text:='';
|
|
|
wwDBDateTimePicker4.text:='';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_query.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
str,str_linkman,str_link:widestring;
|
|
|
begin
|
|
|
str:='where (<28>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+'ϵͳ'+''''+' OR ί<>е<EFBFBD>λ=1)';
|
|
|
if client_query_limited<>'no'then
|
|
|
begin
|
|
|
str:=str+' and '+open_data(client_query_limited,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no');
|
|
|
end;
|
|
|
str:=query_tiaojian(1,str,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox15.text,Edit1.text);
|
|
|
str:=query_tiaojian(1,str,'ͨѶ<CDA8><D1B6>ַ',wwDBComboBox16.text,Edit2.text);
|
|
|
str:=query_tiaojian(1,str,'<27><>ҵ<EFBFBD><D2B5>ģ',wwDBComboBox2.text,Edit5.text);
|
|
|
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox9.text,Edit8.text);
|
|
|
str:=query_tiaojian(1,str,'<27>ͻ<EFBFBD>״̬',wwDBComboBox17.text,wwDBComboBox1.text);
|
|
|
str:=query_tiaojian(1,str,'¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox18.text,wwDBDateTimePicker1.text);
|
|
|
str:=query_tiaojian(1,str,'¼<><C2BC><EFBFBD><EFBFBD>',wwDBComboBox13.text,RxDBLookupCombo5.DisplayValue);
|
|
|
str:=query_tiaojian(1,str,'<27>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>',wwDBComboBox4.text,Edit4.text);
|
|
|
str:=query_tiaojian(1,str,'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox5.text,Edit3.text);
|
|
|
str:=query_tiaojian(1,str,'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox3.text,Edit6.text);
|
|
|
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox8.text,Edit7.text);
|
|
|
str:=query_tiaojian(1,str,'<27>ͻ<EFBFBD><CDBB><EFBFBD>ֵ',wwDBComboBox7.text,RxDBLookupCombo1.DisplayValue);
|
|
|
str:=query_tiaojian(1,str,'¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox6.text,wwDBDateTimePicker2.text);
|
|
|
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox14.text,RxDBLookupCombo3.DisplayValue);
|
|
|
|
|
|
str_linkman:=query_tiaojian(1,str_linkman,'<27><><EFBFBD><EFBFBD>',wwDBComboBox10.text,Edit9.text);
|
|
|
str_linkman:=query_tiaojian(1,str_linkman,'<27>칫<EFBFBD>绰',wwDBComboBox11.text,Edit10.text);
|
|
|
str_linkman:=query_tiaojian(1,str_linkman,'<27><>ͥ<EFBFBD>绰',wwDBComboBox12.text,Edit11.text);
|
|
|
str_linkman:=query_tiaojian(1,str_linkman,'<27>ֻ<EFBFBD>',wwDBComboBox19.text,Edit12.text);
|
|
|
|
|
|
str_link:=query_tiaojian(1,str_link,'<27>Ӵ<EFBFBD><D3B4><EFBFBD>ʽ',wwDBComboBox20.text,wwDBComboBox29.text);
|
|
|
str_link:=query_tiaojian(1,str_link,'<27>Ӵ<EFBFBD>Ŀ<EFBFBD><C4BF>',wwDBComboBox21.text,Edit14.text);
|
|
|
str_link:=query_tiaojian(1,str_link,'<27>ͻ<EFBFBD><CDBB><EFBFBD>Ա',wwDBComboBox22.text,Edit15.text);
|
|
|
str_link:=query_tiaojian(1,str_link,'ҵ<><D2B5>Ч<EFBFBD><D0A7>',wwDBComboBox23.text,wwDBComboBox28.text);
|
|
|
str_link:=query_tiaojian(1,str_link,'<27>Ӵ<EFBFBD><D3B4><EFBFBD>',wwDBComboBox24.text,RxDBLookupCombo4.DisplayValue);
|
|
|
str_link:=query_tiaojian(1,str_link,'¼<><C2BC><EFBFBD><EFBFBD>',wwDBComboBox25.text,RxDBLookupCombo2.DisplayValue);
|
|
|
str_link:=query_tiaojian(1,str_link,'¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox26.text,wwDBDateTimePicker3.text);
|
|
|
str_link:=query_tiaojian(1,str_link,'¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox27.text,wwDBDateTimePicker4.text);
|
|
|
|
|
|
if str_linkman<>''then
|
|
|
begin
|
|
|
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_linkman '+str_linkman+')';
|
|
|
end;
|
|
|
if str_link<>''then
|
|
|
begin
|
|
|
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_link '+str_link+')';
|
|
|
end;
|
|
|
case client_query_bs of
|
|
|
1:
|
|
|
begin
|
|
|
frm_crm_client_sales.t_crm_client.close;
|
|
|
frm_crm_client_sales.t_crm_client.sql.clear;
|
|
|
frm_crm_client_sales.t_crm_client.sql.add('select * from t_crm_client');
|
|
|
frm_crm_client_sales.t_crm_client.sql.add(str);
|
|
|
frm_crm_client_sales.t_crm_client.sql.add('order by <20>ͻ<EFBFBD>״̬,<2C>ͻ<EFBFBD><CDBB><EFBFBD>ֵ,<2C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
frm_crm_client_sales.t_crm_client.open;
|
|
|
if frm_crm_client_sales.t_crm_client.IsEmpty then
|
|
|
begin
|
|
|
showmessage('û<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
2:
|
|
|
begin
|
|
|
frm_crm_client_check.t_crm_client.close;
|
|
|
frm_crm_client_check.t_crm_client.sql.clear;
|
|
|
frm_crm_client_check.t_crm_client.sql.add('select * from t_crm_client');
|
|
|
frm_crm_client_check.t_crm_client.sql.add(str);
|
|
|
frm_crm_client_check.t_crm_client.sql.add('order by <20>ͻ<EFBFBD>״̬,<2C>ͻ<EFBFBD><CDBB><EFBFBD>ֵ,<2C>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
frm_crm_client_check.t_crm_client.open;
|
|
|
if frm_crm_client_check.t_crm_client.IsEmpty then
|
|
|
begin
|
|
|
showmessage('û<>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_query.wwDBComboBox15KeyPress(Sender: TObject;
|
|
|
var Key: Char);
|
|
|
begin
|
|
|
if key=#13 then
|
|
|
begin
|
|
|
key:=#0;
|
|
|
frm_crm_client_query.bsSkinButton1Click(Sender);
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|