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.

343 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, RxDBComb;
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;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
wwDBComboBox30: TwwDBComboBox;
wwDBComboBox31: TwwDBComboBox;
wwDBComboBox32: TwwDBComboBox;
wwDBComboBox33: TwwDBComboBox;
wwDBComboBox34: TwwDBComboBox;
wwDBComboBox35: TwwDBComboBox;
wwDBComboBox36: TwwDBComboBox;
Edit13: TEdit;
Edit16: TEdit;
Edit17: TEdit;
Edit18: TEdit;
wwDBComboBox37: TwwDBComboBox;
wwDBComboBox38: TwwDBComboBox;
wwDBComboBox39: TwwDBComboBox;
procedure bsSkinButton5Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure wwDBComboBox15KeyPress(Sender: TObject; var Key: Char);
procedure wwDBComboBox38Enter(Sender: TObject);
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>';
wwDBComboBox30.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox31.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox34.text:='<27><><EFBFBD><EFBFBD>';
wwDBComboBox32.text:='ģ<><C4A3>';
wwDBComboBox33.text:='ģ<><C4A3>';
wwDBComboBox35.text:='ģ<><C4A3>';
wwDBComboBox36.text:='ģ<><C4A3>';
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);
//2018-7-24
str:=query_tiaojian(1,str,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox30.text,wwDBComboBox37.Text);
str:=query_tiaojian(1,str,'<27><>ҵ<EFBFBD><D2B5>ģ',wwDBComboBox34.text,wwDBComboBox38.Text);
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox31.text,wwDBComboBox39.Text);
str:=query_tiaojian(1,str,'<27><>Ӫ<EFBFBD><D3AA>Ʒ',wwDBComboBox35.text,Edit17.Text);
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox32.text,Edit13.Text);
str:=query_tiaojian(1,str,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',wwDBComboBox36.text,Edit18.Text);
str:=query_tiaojian(1,str,'<27><>ע',wwDBComboBox33.text,Edit16.Text);
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><EFBFBD><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,<2C>ͻ<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><EFBFBD><EFBFBD><EFBFBD>,<2C>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>,<2C>ͻ<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;
procedure Tfrm_crm_client_query.wwDBComboBox38Enter(Sender: TObject);
begin
case wwDBComboBox37.ItemIndex of
-1:
begin
wwDBComboBox38.Items.Clear;
ShowMessage('<27><>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Exit;
end;
0,1:
begin
wwDBComboBox38.Items.Clear;
wwDBComboBox38.Items.Add('С<><D0A1>(200<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)') ;
wwDBComboBox38.Items.Add('<27><><EFBFBD><EFBFBD>(200-800<30><30>)') ;
wwDBComboBox38.Items.Add('<27><><EFBFBD><EFBFBD>(800<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)') ;
end;
2,3:
begin
wwDBComboBox38.Items.Clear;
wwDBComboBox38.Items.Add('С<><D0A1>(500<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)') ;
wwDBComboBox38.Items.Add('<27><><EFBFBD><EFBFBD>(500-1500<30><30>)') ;
wwDBComboBox38.Items.Add('<27><><EFBFBD><EFBFBD>(1500<30><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)') ;
end;
end;
end;
end.