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.

373 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_special;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, BusinessSkinForm, bsSkinCtrls, DB, ADODB, StdCtrls, Mask,
DBCtrls, Grids, DBGrids, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,
RxLookup, ComCtrls, bsSkinTabs;
type
Tfrm_crm_client_special = class(TForm)
bsBusinessSkinForm1: TbsBusinessSkinForm;
bsSkinPanel1: TbsSkinPanel;
t_crm_client: TADOQuery;
t_crm_client1: TDataSource;
v_all_client: TADOQuery;
t_crm_client_yanzheng: TADOQuery;
p_update_client: TADOStoredProc;
t_crm_client_wrong: TADOQuery;
t_crm_client_wrong1: TDataSource;
t_crm_client_ti: TADOQuery;
t_crm_client_ti1: TDataSource;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinTabSheet3: TbsSkinTabSheet;
bsSkinGroupBox1: TbsSkinGroupBox;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
bsSkinButton8: TbsSkinButton;
bsSkinGroupBox5: TbsSkinGroupBox;
Label8: TLabel;
Label14: TLabel;
Label18: TLabel;
Edit6: TEdit;
Edit7: TEdit;
bsSkinButton5: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
RxDBLookupCombo1: TRxDBLookupCombo;
bsSkinGroupBox4: TbsSkinGroupBox;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
DBEdit1: TDBEdit;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinButton3: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinPanel2: TbsSkinPanel;
bsSkinGroupBox3: TbsSkinGroupBox;
Label1: TLabel;
Label3: TLabel;
Edit4: TEdit;
Edit5: TEdit;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinGroupBox2: TbsSkinGroupBox;
Label4: TLabel;
Label5: TLabel;
Label2: TLabel;
Label6: TLabel;
Label7: TLabel;
DBEdit4: TDBEdit;
DBEdit5: TDBEdit;
DBEdit2: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGrid2Column2: TdxDBGridColumn;
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure update_client(oldName,NewName:string);
end;
var
frm_crm_client_special: Tfrm_crm_client_special;
implementation
uses u_main, u_data_share, my_sys_chat,my_sys_function;
{$R *.dfm}
procedure Tfrm_crm_client_special.update_client(oldName,NewName:string);
var aAdoQuerySelect,aAdoQueryUpdate:TAdoQuery;
begin
aAdoQuerySelect:=CreateAdoQuery;
aAdoQueryUpdate:=CreateAdoQuery;
with aAdoQueryUpdate do
begin
Close;sql.Clear;
sql.Add('Update t_ch_fee set <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:NewName');
sql.Add('where ch_id=:ch_id and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:oldName');
Parameters.ParamByName('NewName').Value:='';
Parameters.ParamByName('oldName').Value:='';
Parameters.ParamByName('ch_id').Value:=0;
end;
with aAdoQuerySelect do
try
Close;SQL.Clear;
SQL.Add('select * from t_ch_fee');
SQL.Add('Where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=oldName;
Open;First;
while not eof do
begin
aAdoQueryUpdate.Close;
aAdoQueryUpdate.Parameters.ParamByName('NewName').Value:=NewName;
aAdoQueryUpdate.Parameters.ParamByName('oldName').Value:=oldName;
aAdoQueryUpdate.Parameters.ParamByName('ch_id').Value:=FieldByName('ch_id').AsInteger;
aAdoQueryUpdate.ExecSQL;
Next;
end;
finally
Free;
aAdoQueryUpdate.Free;
end;
end;
procedure Tfrm_crm_client_special.bsSkinButton8Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>'+''''+'Ŀ<><C4BF>'+'''';
if Edit1.text<>''then
begin
str:=str+' and <20><><EFBFBD><EFBFBD> like '+''''+'%'+Edit1.text+'%'+'''';
end;
if Edit2.text<>''then
begin
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit2.text+'%'+'''';
end;
if Edit3.text<>''then
begin
str:=str+' and <20>ͻ<EFBFBD>ȫ<EFBFBD><C8AB> like '+''''+'%'+Edit3.text+'%'+'''';
end;
t_crm_client.close;
t_crm_client.sql.clear;
t_crm_client.sql.add('select * from t_crm_client '+str+' order by <20><><EFBFBD><EFBFBD>');
t_crm_client.open;
if t_crm_client.RecordCount>1 then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>پ<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>ң<EFBFBD><D2A3><EFBFBD>');
t_crm_client.close;
exit;
end;
if t_crm_client.IsEmpty then
exit;
bsSkinButton1.Enabled:=true;
end;
procedure Tfrm_crm_client_special.bsSkinButton1Click(Sender: TObject);
begin
if (trim(Edit4.text)='') or (trim(Edit5.text)='') then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĴ<C2B5><C4B4><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>ƣ<EFBFBD><C6A3><EFBFBD>');
exit;
end;
t_crm_client_yanzheng.close;
t_crm_client_yanzheng.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').value:=DBEdit4.text;
t_crm_client_yanzheng.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').value:=DBEdit5.text;
t_crm_client_yanzheng.Parameters.ParamByName('new<65><77><EFBFBD><EFBFBD>').value:=trim(Edit4.text);
t_crm_client_yanzheng.Parameters.ParamByName('new<65>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').value:=trim(Edit5.text);
t_crm_client_yanzheng.open;
if t_crm_client_yanzheng.IsEmpty then
begin
bsSkinButton2.Enabled:=true;
showmessage('<27><>֤ͨ<D6A4><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end
else
begin
showmessage('<27><>֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD>󣡣<EFBFBD>');
end;
end;
procedure Tfrm_crm_client_special.bsSkinButton2Click(Sender: TObject);
VAR
old_name,old_code:STRING;
begin
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD>Ŀͻ<C4BF><CDBB><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
exit;
v_all_client.close;
v_all_client.open;
old_name:=DBEdit5.text;
old_code:=DBEdit4.text;
if v_all_client.IsEmpty then
begin
try
t_crm_client.edit;
t_crm_client['<27><><EFBFBD><EFBFBD>']:=trim(Edit4.text);
t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=trim(Edit5.text);
t_crm_client.post;
except
t_crm_client.Cancel;
t_crm_client.Refresh;
bsSkinButton2.Enabled:=false;
showmessage('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
end;
end
else
begin
try
t_crm_client.edit;
t_crm_client['<27><><EFBFBD><EFBFBD>']:=trim(Edit4.text);
t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=trim(Edit5.text);
t_crm_client.post;
update_client(old_name,trim(Edit5.text));
p_update_client.Parameters.ParamByName('old_name').value:=old_name;
p_update_client.Parameters.ParamByName('new_name').value:=trim(Edit5.text);
p_update_client.ExecProc;
except
t_crm_client.Cancel;
t_crm_client.Refresh;
bsSkinButton2.Enabled:=false;
end;
end;
frm_main.t_sys_message_no.insert;
frm_main.t_sys_message_no['<27><><EFBFBD><EFBFBD>']:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
frm_main.t_sys_message_no['<27><><EFBFBD>ͷ<EFBFBD>']:=employee;
frm_main.t_sys_message_no['<27><><EFBFBD>͵<EFBFBD>ַ']:=LocalIP;
frm_main.t_sys_message_no['<27>Ƿ<EFBFBD>֪<EFBFBD><D6AA>']:=1;
frm_main.t_sys_message_no['ʱ<><CAB1>']:=now;
frm_main.t_sys_message_no['<27>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>']:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>ǰ:'+old_code+','+old_name
+';<3B><><EFBFBD>ĺ<EFBFBD>:'+Edit4.text+','+Edit5.text;
frm_main.t_sys_message_no.post;
SendMsg_gonggao('51','<27><><EFBFBD><EFBFBD>ǰ:'+old_code+','+old_name
+';<3B><><EFBFBD>ĺ<EFBFBD>:'+Edit4.text+','+Edit5.text);
showmessage('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ijɹ<C4B3><C9B9><EFBFBD><EFBFBD><EFBFBD>');
bsSkinButton1.Enabled:=false;
bsSkinButton2.Enabled:=false;
Edit4.text:='';
Edit5.text:='';
v_all_client.close;
end;
procedure Tfrm_crm_client_special.bsSkinButton4Click(Sender: TObject);
begin
t_crm_client_wrong.close;
t_crm_client_wrong.open;
end;
procedure Tfrm_crm_client_special.bsSkinButton3Click(Sender: TObject);
var
old_name:string;
begin
if t_crm_client_wrong.IsEmpty then
exit;
if RxDBLookupCombo2.DisplayValue=''then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ɵĿͻ<C4BF><CDBB><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
old_name:=t_crm_client_wrong.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
exit;
try
update_client(old_name,trim(RxDBLookupCombo2.DisplayValues[1]));
p_update_client.Parameters.ParamByName('old_name').value:=t_crm_client_wrong.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
p_update_client.Parameters.ParamByName('new_name').value:=RxDBLookupCombo2.DisplayValues[1];
p_update_client.ExecProc;
except
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>');
t_crm_client_wrong.requery;
frm_main.t_sys_message_no.insert;
frm_main.t_sys_message_no['<27><><EFBFBD><EFBFBD>']:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>';
frm_main.t_sys_message_no['<27><><EFBFBD>ͷ<EFBFBD>']:=employee;
frm_main.t_sys_message_no['<27><><EFBFBD>͵<EFBFBD>ַ']:=LocalIP;
frm_main.t_sys_message_no['<27>Ƿ<EFBFBD>֪<EFBFBD><D6AA>']:=1;
frm_main.t_sys_message_no['ʱ<><CAB1>']:=now;
frm_main.t_sys_message_no['<27>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>']:='<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:<3A><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>ʹ<EFBFBD>õĿͻ<C4BF><CDBB><EFBFBD><EFBFBD><EFBFBD>('+old_name
+')<29><><EFBFBD><EFBFBD>Ϊ('+RxDBLookupCombo2.DisplayValues[1]+')';
frm_main.t_sys_message_no.post;
end;
procedure Tfrm_crm_client_special.bsSkinButton5Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>'+''''+'Ŀ<><C4BF>'+'''';
if Edit6.text<>''then
begin
str:=str+' and <20><><EFBFBD><EFBFBD> like '+''''+'%'+Edit6.text+'%'+'''';
end;
if Edit7.text<>''then
begin
str:=str+' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> like '+''''+'%'+Edit7.text+'%'+'''';
end;
t_crm_client_ti.close;
t_crm_client_ti.sql.clear;
t_crm_client_ti.sql.add('select * from t_crm_client '+str+' order by <20><><EFBFBD><EFBFBD>');
t_crm_client_ti.open;
end;
procedure Tfrm_crm_client_special.bsSkinButton6Click(Sender: TObject);
var
old_name:string;
str_tell:string;
begin
if t_crm_client_ti.IsEmpty then
exit;
if RxDBLookupCombo1.DisplayValue=''then
begin
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ϲ<EFBFBD><CFB2>ɵĿͻ<C4BF><CDBB><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
old_name:=t_crm_client_ti.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
str_tell:='<27><>ȷ<EFBFBD><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>'+old_name+'<27><><EFBFBD>ϲ<EFBFBD><CFB2>ɡ<EFBFBD>'+RxDBLookupCombo1.DisplayValues[1]+'<27><><EFBFBD><EFBFBD>?';
if old_name=RxDBLookupCombo1.DisplayValues[1]then
begin
showmessage('ԭ<><D4AD><EFBFBD>Ŀͻ<C4BF><CDBB><EFBFBD>Ҫ<EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD>ͬ,<2C><><EFBFBD><EFBFBD>Ҫ<EFBFBD>ϲ<EFBFBD>');
exit;
end;
if application.MessageBox(pchar(str_tell),'<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
exit;
try
update_client(old_name,trim(RxDBLookupCombo1.DisplayValues[1]));
p_update_client.Parameters.ParamByName('old_name').value:=t_crm_client_ti.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring;
p_update_client.Parameters.ParamByName('new_name').value:=RxDBLookupCombo1.DisplayValues[1];
p_update_client.ExecProc;
t_crm_client_ti.Delete;
except
showmessage('<27>ϲ<EFBFBD><CFB2>ͻ<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
exit;
end;
showmessage('<27>ϲ<EFBFBD><CFB2>ͻ<EFBFBD><CDBB>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>');
t_crm_client_ti.requery;
frm_main.t_sys_message_no.insert;
frm_main.t_sys_message_no['<27><><EFBFBD><EFBFBD>']:='<27>ͻ<EFBFBD><CDBB>ϲ<EFBFBD>';
frm_main.t_sys_message_no['<27><><EFBFBD>ͷ<EFBFBD>']:=employee;
frm_main.t_sys_message_no['<27><><EFBFBD>͵<EFBFBD>ַ']:=LocalIP;
frm_main.t_sys_message_no['<27>Ƿ<EFBFBD>֪<EFBFBD><D6AA>']:=1;
frm_main.t_sys_message_no['ʱ<><CAB1>']:=now;
frm_main.t_sys_message_no['<27>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>']:='<27>ͻ<EFBFBD><CDBB>ϲ<EFBFBD>:<3A><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>ʹ<EFBFBD>õĿͻ<C4BF><CDBB><EFBFBD><EFBFBD><EFBFBD>('+old_name
+')<29>ϲ<EFBFBD>Ϊ('+RxDBLookupCombo1.DisplayValues[1]+')';
frm_main.t_sys_message_no.post;
SendMsg_gonggao('51','<27>ϲ<EFBFBD>ǰ:'+old_name
+';<3B>ϲ<EFBFBD><CFB2><EFBFBD>:'+RxDBLookupCombo1.DisplayValues[1]);
end;
end.