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.

337 lines
11 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_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;
bsSkinGroupBox3: TbsSkinGroupBox;
Label27: TLabel;
wwDBComboBox30: TwwDBComboBox;
RxDBLookupCombo6: TRxDBLookupCombo;
wwDBComboBox31: TwwDBComboBox;
Label28: TLabel;
wwDBComboBox32: TwwDBComboBox;
Label29: TLabel;
wwDBComboBox33: TwwDBComboBox;
wwDBDateTimePicker5: TwwDBDateTimePicker;
Label30: TLabel;
wwDBComboBox34: TwwDBComboBox;
wwDBDateTimePicker6: TwwDBDateTimePicker;
Label31: TLabel;
wwDBComboBox35: TwwDBComboBox;
wwDBComboBox36: TwwDBComboBox;
Label32: TLabel;
wwDBComboBox37: TwwDBComboBox;
Edit13: TEdit;
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>';
wwDBComboBox31.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox30.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox33.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox34.text:='С<><D0A1>';
wwDBComboBox35.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox37.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:='';
wwDBDateTimePicker5.text:='';
wwDBDateTimePicker6.text:='';
RxDBLookupCombo6.ClearValue;
Edit13.text:='';
wwDBComboBox32.text:='';
wwDBComboBox36.text:='';
end;
procedure Tfrm_crm_client_query.bsSkinButton1Click(Sender: TObject);
var
str,str_linkman,str_link,str_zhangqi,str_sale:widestring;
begin
str:='where (((<28>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+'ϵͳ'+''''+' OR ί<>е<EFBFBD>λ=1 OR <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='+''''+'Ŀ<><C4BF>'+''''+')';
if client_query_limited<>'no'then
begin
str:=str+' and '+open_data(client_query_limited,'¼<><C2BC><EFBFBD><EFBFBD>','<27>ͷ<EFBFBD>Ա','no','no','no')+') or <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where '+open_data('0008','<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','no','no','no','no')+' )) ';
end else begin
str:=str+'))'
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);
if (client_query_bs=1) then begin
str_zhangqi:=query_tiaojian(1,str_zhangqi,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox30.text,RxDBLookupCombo6.DisplayValue);
end else begin
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox14.text,RxDBLookupCombo3.DisplayValue);
end;
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);
str_zhangqi:=query_tiaojian(1,str_zhangqi,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox30.text,RxDBLookupCombo6.DisplayValue);
str_zhangqi:=query_tiaojian(1,str_zhangqi,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox31.text,wwDBComboBox32.text);
str_zhangqi:=query_tiaojian(1,str_zhangqi,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox33.text,wwDBDateTimePicker5.text);
str_zhangqi:=query_tiaojian(1,str_zhangqi,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox34.text,wwDBDateTimePicker6.text);
str_zhangqi:=query_tiaojian(1,str_zhangqi,'״̬',wwDBComboBox35.text,wwDBComboBox36.text);
str_zhangqi:=query_tiaojian(2,str_zhangqi,'<27><><EFBFBD>ѽ<EFBFBD><D1BD><EFBFBD>',wwDBComboBox37.text,Edit13.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;
if str_zhangqi<>''then
begin
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> in (select <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales '+str_zhangqi+')';
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);
rp_crm_client_str:=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.