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.

1224 lines
37 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;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid,
dxDBTLCl, dxGrClms, StdCtrls, DBCtrls, wwdblook, Mask, RxLookup,
bsdbctrls, BusinessSkinForm, DB, ADODB, ComCtrls, bsSkinTabs, ExtCtrls,
wwdbedit, Wwdotdot, Wwdbcomb, wwdbdatetimepicker, Menus;
type
Tfrm_crm_client = class(TForm)
bsSkinPanel2: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsSkinPanel1: TbsSkinPanel;
t_crm_client1: TDataSource;
t_crm_client: TADOQuery;
v_all_client: TADOQuery;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridMaskColumn;
t_crm_client_limited: TADOQuery;
t_crm_client_limited1: TDataSource;
bsSkinButton8: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
bsSkinGroupBox1: TbsSkinGroupBox;
Label14: TLabel;
wwDBComboBox1: TwwDBComboBox;
Label15: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label16: TLabel;
Label17: TLabel;
Edit3: TEdit;
Label18: TLabel;
RxDBLookupCombo2: TRxDBLookupCombo;
t_crm_client_linkman1: TDataSource;
t_crm_client_linkman: TADOQuery;
bsSkinPageControl1: TbsSkinPageControl;
bskntbsht1: TbsSkinTabSheet;
bskntbsht2: TbsSkinTabSheet;
bsSkinPanel3: TbsSkinPanel;
Label4: TLabel;
Label12: TLabel;
Label5: TLabel;
Label2: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label10: TLabel;
Label11: TLabel;
Label3: TLabel;
Label13: TLabel;
DBEdit4: TDBEdit;
DBEdit1: TDBEdit;
DBEdit5: TDBEdit;
DBEdit2: TDBEdit;
DBEdit6: TDBEdit;
DBEdit7: TDBEdit;
DBEdit8: TDBEdit;
DBEdit10: TDBEdit;
DBEdit9: TDBEdit;
RxDBLookupCombo14: TRxDBLookupCombo;
RxDBLookupCombo1: TRxDBLookupCombo;
bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox4: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox11: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox9: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox8: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox7: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox6: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox5: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox12: TbsSkinDBCheckRadioBox;
bsSkinDBCheckRadioBox10: TbsSkinDBCheckRadioBox;
bsSkinPageControl2: TbsSkinPageControl;
bsSkinTabSheet1: TbsSkinTabSheet;
Label1: TLabel;
Label9: TLabel;
DBMemo2: TDBMemo;
DBMemo1: TDBMemo;
bsSkinTabSheet2: TbsSkinTabSheet;
bsSkinPanel4: TbsSkinPanel;
dxDBGrid2: TdxDBGrid;
dxDBGrid2Column1: TdxDBGridMaskColumn;
bsSkinPanel5: TbsSkinPanel;
bsSkinButton10: TbsSkinButton;
bsSkinButton11: TbsSkinButton;
bsSkinButton6: TbsSkinButton;
dxDBGrid3: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
bsSkinDBCheckRadioBox13: TbsSkinDBCheckRadioBox;
bsSkinPanel6: TbsSkinPanel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label40: TLabel;
Label39: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
Label44: TLabel;
Label47: TLabel;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Label52: TLabel;
Label51: TLabel;
Label53: TLabel;
dxDBGrid4: TdxDBGrid;
dxDBGridMaskColumn2: TdxDBGridMaskColumn;
dxDBGrid2Column2: TdxDBGridMaskColumn;
dxDBGrid4Column4: TdxDBGridColumn;
dxDBGrid2Column3: TdxDBGridMaskColumn;
bsSkinButton7: TbsSkinButton;
bsSkinButton12: TbsSkinButton;
bsSkinButton13: TbsSkinButton;
bsSkinButton14: TbsSkinButton;
DBEdit35: TDBEdit;
wwDBComboBox2: TwwDBComboBox;
DBEdit37: TDBEdit;
DBEdit39: TDBEdit;
DBEdit38: TDBEdit;
DBEdit36: TDBEdit;
DBEdit40: TDBEdit;
DBEdit41: TDBEdit;
DBEdit42: TDBEdit;
DBEdit43: TDBEdit;
DBEdit44: TDBEdit;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
wwDBDateTimePicker4: TwwDBDateTimePicker;
wwDBDateTimePicker3: TwwDBDateTimePicker;
DBMemo3: TDBMemo;
Label19: TLabel;
Edit4: TEdit;
Label20: TLabel;
Edit5: TEdit;
Label21: TLabel;
DBEdit3: TDBEdit;
bsSkinGroupBox2: TbsSkinGroupBox;
lbl1: TLabel;
lbl2: TLabel;
lbl3: TLabel;
lbl4: TLabel;
lbl5: TLabel;
lbl6: TLabel;
dbedt1: TDBEdit;
dbedt2: TDBEdit;
dbedt3: TDBEdit;
dbedt4: TDBEdit;
dbedt5: TDBEdit;
dbedt6: TDBEdit;
DBEdit11: TDBEdit;
Label22: TLabel;
Label23: TLabel;
DBEdit12: TDBEdit;
Label24: TLabel;
DBEdit13: TDBEdit;
Label25: TLabel;
DBEdit14: TDBEdit;
bsSkinDBCheckRadioBox14: TbsSkinDBCheckRadioBox;
bsSkinButton15: TbsSkinButton;
dxDBGrid1Column4: TdxDBGridColumn;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
Label26: TLabel;
DBEdit15: TDBEdit;
bsSkinButton16: TbsSkinButton;
Label27: TLabel;
DBEdit16: TDBEdit;
Label28: TLabel;
DBEdit17: TDBEdit;
Label29: TLabel;
DBEdit18: TDBEdit;
Label30: TLabel;
DBEdit19: TDBEdit;
Label31: TLabel;
DBEdit20: TDBEdit;
Label63: TLabel;
DBEdit78: TDBEdit;
Label32: TLabel;
bsSkinButton65: TbsSkinButton;
bsSkinButton17: TbsSkinButton;
DBEdit21: TDBEdit;
Label33: TLabel;
DBEdit22: TDBEdit;
DBEdit23: TDBEdit;
Label34: TLabel;
bsSkinButton93: TbsSkinButton;
bsSkinTabSheet3: TbsSkinTabSheet;
dxDBGrid5: TdxDBGrid;
dxDBGridMaskColumn3: TdxDBGridMaskColumn;
dxDBGridMaskColumn4: TdxDBGridMaskColumn;
dxDBGridColumn1: TdxDBGridColumn;
dxDBGridMaskColumn5: TdxDBGridMaskColumn;
CustAccount1: TDataSource;
CustAccount: TADOQuery;
dxDBGrid5Column5: TdxDBGridColumn;
dxDBGrid5Column6: TdxDBGridColumn;
dxDBGrid5Column7: TdxDBGridColumn;
dxDBGrid5Column8: TdxDBGridColumn;
CustInvoice: TADOQuery;
CustInvoice1: TDataSource;
bsSkinTabSheet4: TbsSkinTabSheet;
dxDBGrid6: TdxDBGrid;
dxDBGridMaskColumn6: TdxDBGridMaskColumn;
dxDBGridMaskColumn7: TdxDBGridMaskColumn;
dxDBGridColumn2: TdxDBGridColumn;
dxDBGridMaskColumn8: TdxDBGridMaskColumn;
dxDBGridColumn5: TdxDBGridColumn;
dxDBGridColumn6: TdxDBGridColumn;
CustContact1: TDataSource;
CustContact: TADOQuery;
bsSkinTabSheet5: TbsSkinTabSheet;
dxDBGrid7: TdxDBGrid;
dxDBGridMaskColumn9: TdxDBGridMaskColumn;
dxDBGridMaskColumn10: TdxDBGridMaskColumn;
dxDBGridColumn3: TdxDBGridColumn;
dxDBGridMaskColumn11: TdxDBGridMaskColumn;
dxDBGridColumn4: TdxDBGridColumn;
dxDBGridColumn7: TdxDBGridColumn;
dxDBGrid7Column7: TdxDBGridColumn;
dxDBGrid7Column8: TdxDBGridColumn;
dxDBGrid7Column9: TdxDBGridColumn;
dxDBGrid7Column10: TdxDBGridColumn;
dxDBGrid7Column11: TdxDBGridColumn;
dxDBGrid7Column12: TdxDBGridColumn;
Label35: TLabel;
DBEdit24: TDBEdit;
Label45: TLabel;
wwDBComboBox4: TwwDBComboBox;
bsSkinButton18: TbsSkinButton;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column6: TdxDBGridColumn;
dxDBGrid1Column7: TdxDBGridColumn;
bsSkinSplitter1: TbsSkinSplitter;
bsSkinTabSheet6: TbsSkinTabSheet;
dxDBGrid8: TdxDBGrid;
dxDBGridMaskColumn12: TdxDBGridMaskColumn;
dxDBGridMaskColumn13: TdxDBGridMaskColumn;
dxDBGridColumn8: TdxDBGridColumn;
dxDBGridMaskColumn14: TdxDBGridMaskColumn;
dxDBGridColumn9: TdxDBGridColumn;
dxDBGridColumn10: TdxDBGridColumn;
dxDBGridColumn11: TdxDBGridColumn;
dxDBGridColumn12: TdxDBGridColumn;
dxDBGridColumn13: TdxDBGridColumn;
t_crm_client_sales: TADOQuery;
ds_crm_client_sales1: TDataSource;
Label46: TLabel;
DBEdit25: TDBEdit;
bsSkinDBCheckRadioBox15: TbsSkinDBCheckRadioBox;
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure client_filtered(str:string);
procedure bsSkinCheckRadioBox2Click(Sender: TObject);
procedure OnShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure t_crm_clientAfterInsert(DataSet: TDataSet);
procedure t_crm_clientBeforePost(DataSet: TDataSet);
procedure DBEdit4KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit5KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit6KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit7KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit8KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit10KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit9KeyPress(Sender: TObject; var Key: Char);
procedure RxDBLookupCombo14KeyPress(Sender: TObject; var Key: Char);
procedure bsSkinDBCheckRadioBox1KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox2KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox3KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox4KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox11KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox9KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox8KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox7KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox6KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox5KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox12KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinDBCheckRadioBox10KeyPress(Sender: TObject;
var Key: Char);
procedure t_crm_clientDeleteError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
procedure t_crm_clientPostError(DataSet: TDataSet; E: EDatabaseError;
var Action: TDataAction);
procedure t_crm_clientAfterScroll(DataSet: TDataSet);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure t_crm_clientBeforeDelete(DataSet: TDataSet);
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure bsSkinButton11Click(Sender: TObject);
procedure bsSkinPanel2Resize(Sender: TObject);
procedure t_crm_client_limitedAfterInsert(DataSet: TDataSet);
procedure t_crm_client_limitedBeforeInsert(DataSet: TDataSet);
procedure bsSkinDBCheckRadioBox13KeyPress(Sender: TObject;
var Key: Char);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure wwDBComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure t_crm_clientAfterPost(DataSet: TDataSet);
procedure t_crm_clientBeforeCancel(DataSet: TDataSet);
procedure t_crm_clientBeforeEdit(DataSet: TDataSet);
procedure t_crm_clientBeforeInsert(DataSet: TDataSet);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton12Click(Sender: TObject);
procedure bsSkinButton13Click(Sender: TObject);
procedure bsSkinButton14Click(Sender: TObject);
procedure bsSkinButton15Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure bsSkinButton16Click(Sender: TObject);
procedure bsSkinButton17Click(Sender: TObject);
procedure bsSkinButton65Click(Sender: TObject);
procedure DBEdit21Change(Sender: TObject);
procedure bsSkinButton93Click(Sender: TObject);
procedure bsSkinButton18Click(Sender: TObject);
private
function CreateNewDjyCustStr():string;
{ Private declarations }
public
{ Public declarations }
end;
var
frm_crm_client: Tfrm_crm_client;
frm_crm_client_num:integer;
implementation
uses u_main, my_sys_function, u_data_share, my_sys_chat, u_crm_import;
{$R *.dfm}
procedure Tfrm_crm_client.client_filtered(str:string);
begin
t_crm_client.Filtered:=false;
t_crm_client.Filter:=str+'=1';
t_crm_client.Filtered:=true;
end;
procedure Tfrm_crm_client.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_crm_client.bsSkinButton1Click(Sender: TObject);
begin
t_crm_client.Insert;
end;
procedure Tfrm_crm_client.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_crm_client);
end;
procedure Tfrm_crm_client.bsSkinButton4Click(Sender: TObject);
begin
t_crm_client.Edit;
t_crm_client.FieldByName('isdelete').AsString:='1';
t_crm_client.Post;
InsertSysLog('<27>ͻ<EFBFBD>ɾ<EFBFBD><C9BE>',t_crm_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring);
table_delete(t_crm_client);
end;
procedure Tfrm_crm_client.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_crm_client);
end;
procedure Tfrm_crm_client.bsSkinCheckRadioBox2Click(Sender: TObject);
begin
t_crm_client.Filtered:=false;
end;
procedure Tfrm_crm_client.OnShow(Sender: TObject);
begin
t_crm_client.open;
// v_all_client.open;
t_crm_client_linkman.Open;
CustAccount.Open;
CustInvoice.Open;
CustContact.Open;
t_crm_client_sales.Open;
if employee='<27>¹<EFBFBD><C2B9><EFBFBD>' then
bsSkinButton16.Visible:=true
else bsSkinButton16.Visible:=false;
frm_data_share.t_sys_employee.Requery();
frm_data_share.t_sys_department.Requery();
if not strtobool(get_parameters_value(4,'false')) then
begin
bsSkinTabSheet2.TabVisible:=false;
end
else
begin
bsSkinTabSheet2.TabVisible:=true;
t_crm_client_limited.open;
end;
if if_open('511') then begin
bsSkinButton17.Enabled:=True;
bsSkinButton65.Enabled:=True;
end else begin
bsSkinButton17.Enabled:=false;
bsSkinButton65.Enabled:=false;
end;
end;
procedure Tfrm_crm_client.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
with frm_data_share do
begin
t_crm_client.requery;
t_crm_client_all.requery;
t_crm_client_ship.requery;
t_crm_client_changzhan.requery;
t_crm_client_truck.requery;
t_crm_client_hangkong.requery;
t_crm_client_baoguan.requery;
t_crm_client_weituo.requery;
t_crm_client_daili.requery;
t_crm_client_huodai.requery;
t_crm_client_shiper.requery;
t_crm_client_shouhuo.requery;
t_crm_client_tongzhi.requery;
t_crm_client_other.requery;
end;
frm_crm_client.Hide;
frm_crm_client.ManualFloat(frm_crm_client.BoundsRect );
frm_main.freeTabs('frm_crm_client');
action:=cafree;
frm_crm_client:=nil;
end;
procedure Tfrm_crm_client.t_crm_clientAfterInsert(DataSet: TDataSet);
begin
t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:='<27><><EFBFBD><EFBFBD>';
frm_crm_client_num:=1;
t_crm_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='Լ<><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
end;
procedure Tfrm_crm_client.t_crm_clientBeforePost(DataSet: TDataSet);
var
aQuery:TADOQuery;
begin
table_before_post(t_crm_client,'<27><><EFBFBD><EFBFBD>');
table_before_post(t_crm_client,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
table_before_post(t_crm_client,'<27>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>');
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('select * from t_crm_client where (<28>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_crm_client.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+''') and clientid<>'''+t_crm_client.fieldbyname('CLIENTID').AsString+'''');
Open;
if not IsEmpty then begin
ShowMessage('ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڴ˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>룺'+fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+';<3B><><EFBFBD>ƣ<EFBFBD>'+fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>');
abort;
end;
Close;SQL.Clear;
SQL.Add('select * from t_crm_client where (<28><><EFBFBD><EFBFBD>='''+t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+''') and clientid<>'''+t_crm_client.fieldbyname('CLIENTID').AsString+'''');
Open;
if not IsEmpty then begin
ShowMessage('ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڴ˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EBA3AC><EFBFBD>룺'+fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+';<3B><><EFBFBD>ƣ<EFBFBD>'+fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString+',<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>');
abort;
end;
end;
finally
FreeAndNil(aQuery);
end;
if pos(' ',t_crm_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString)>0 then
begin
showmessage('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD><EFBFBD>пո񣬲<D5B8><F1A3ACB2>ܱ<EFBFBD><DCB1>棡');
abort;
end;
t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=trim(t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']);
if (t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>˾').asboolean=false)and
(t_crm_client.fieldbyname('<27><>վ').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('ί<>е<EFBFBD>λ').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('<27>ջ<EFBFBD><D5BB><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('֪ͨ<CDA8><D6AA>').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD>չ<EFBFBD>˾').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD><EFBFBD>').asboolean=false)and
(t_crm_client.fieldbyname('<27><><EFBFBD>ݹ<EFBFBD>˾').asboolean=false)then
begin
showmessage('<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>վ<EFBFBD><D5BE><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ί<EFBFBD>е<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB>ˡ<EFBFBD><CBA1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>֪ͨ<CDA8>ˡ<EFBFBD><CBA1><EFBFBD><EFBFBD>չ<EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>');
abort;
end;
if t_crm_client.State=dsedit then
begin
if t_crm_client.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').OldValue<>t_crm_client.fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString then
begin
frm_crm_client_num:=2;
end
else
frm_crm_client_num:=0;
end;
end;
procedure Tfrm_crm_client.DBEdit4KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit1);
end;
procedure Tfrm_crm_client.DBEdit5KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit2);
end;
procedure Tfrm_crm_client.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit6);
end;
procedure Tfrm_crm_client.DBEdit6KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit7);
end;
procedure Tfrm_crm_client.DBEdit7KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit8);
end;
procedure Tfrm_crm_client.DBEdit8KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit10);
end;
procedure Tfrm_crm_client.DBEdit10KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit9);
end;
procedure Tfrm_crm_client.DBEdit9KeyPress(Sender: TObject; var Key: Char);
begin
key_RxDBLookupCombo(Key,RxDBLookupCombo14);
end;
procedure Tfrm_crm_client.RxDBLookupCombo14KeyPress(Sender: TObject;
var Key: Char);
begin
key_RxDBLookupCombo(Key,RxDBLookupCombo1);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox1KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox2);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox2KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox3);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox3KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox4);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox4KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox11);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox11KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox9);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox9KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox8);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox8KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox7);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox7KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox6);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox6KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox5);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox5KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox12);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox12KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox10);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox10KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox13);
end;
procedure Tfrm_crm_client.t_crm_clientDeleteError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
begin
showmessage('<27>ͻ<EFBFBD><CDBB>Ѿ<EFBFBD>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_crm_client.t_crm_clientPostError(DataSet: TDataSet;
E: EDatabaseError; var Action: TDataAction);
var
aQuery:TAdoQuery;
begin
{
if (pos('<27><><EFBFBD><EFBFBD>',UpperCase(E.Message))<>0) then
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('select * from t_crm_client where <20><><EFBFBD><EFBFBD>='''+t_crm_client['<27><><EFBFBD><EFBFBD>']+''' OR <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']+'''');
Open;
if not IsEmpty then begin
ShowMessage('ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڴ˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>룺'+fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+';<3B><><EFBFBD>ƣ<EFBFBD>'+fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
end;
finally
FreeAndNil(aQuery);
end;
abort;
end;
if (pos('PRIMARY KEY',UpperCase(E.Message))<>0) then
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('select * from t_crm_client where <20><><EFBFBD><EFBFBD>='''+t_crm_client['<27><><EFBFBD><EFBFBD>']+''' OR <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']+'''');
Open;
if not IsEmpty then begin
ShowMessage('ϵͳ<CFB5><CDB3><EFBFBD>Ѵ<EFBFBD><D1B4>ڴ˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>룺'+fieldbyname('<27><><EFBFBD><EFBFBD>').AsString+';<3B><><EFBFBD>ƣ<EFBFBD>'+fieldbyname('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').AsString);
end;
end;
finally
FreeAndNil(aQuery);
end;
abort;
end;
}
end;
procedure Tfrm_crm_client.t_crm_clientAfterScroll(DataSet: TDataSet);
begin
if v_all_client.IsEmpty then
begin
DBEdit4.ReadOnly:=false;
DBEdit5.ReadOnly:=false;
end
else
begin
DBEdit4.ReadOnly:=true;
DBEdit5.ReadOnly:=true;
end;
end;
procedure Tfrm_crm_client.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,t_crm_client,'<27><><EFBFBD><EFBFBD>');
end;
procedure Tfrm_crm_client.t_crm_clientBeforeDelete(DataSet: TDataSet);
begin
if not if_open('202') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
abort;
end;
if not v_all_client.IsEmpty then
begin
showmessage('<27><>ǰ<EFBFBD>ͻ<EFBFBD><CDBB>Ѿ<EFBFBD>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
abort;
end;
{
if t_crm_client.State<>dsinsert then
SendMsg_gonggao('54','');
}
end;
procedure Tfrm_crm_client.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit5);
end;
procedure Tfrm_crm_client.RxDBLookupCombo1KeyPress(Sender: TObject;
var Key: Char);
begin
key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox1);
end;
procedure Tfrm_crm_client.bsSkinButton6Click(Sender: TObject);
begin
table_post(t_crm_client);
IF t_crm_client.IsEmpty then
exit;
frm_data_share.t_sys_department.first;
while not frm_data_share.t_sys_department.eof do
begin
if not t_crm_client_limited.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',frm_data_share.t_sys_department.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,[])then
begin
t_crm_client_limited.insert;
t_crm_client_limited['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_data_share.t_sys_department.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_crm_client_limited.post;
end;
frm_data_share.t_sys_department.next;
end;
end;
procedure Tfrm_crm_client.bsSkinButton10Click(Sender: TObject);
begin
table_post(t_crm_client);
IF t_crm_client.IsEmpty then
exit;
if not t_crm_client_limited.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',frm_data_share.t_sys_department.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,[])then
begin
t_crm_client_limited.insert;
t_crm_client_limited['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=frm_data_share.t_sys_department.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring;
t_crm_client_limited.post;
end;
end;
procedure Tfrm_crm_client.bsSkinButton11Click(Sender: TObject);
begin
if t_crm_client_limited.IsEmpty then
exit;
t_crm_client_limited.Delete;
end;
procedure Tfrm_crm_client.bsSkinPanel2Resize(Sender: TObject);
var
i:integer;
begin
i:=round(bsSkinPanel2.Width/11);
bsSkinButton1.Width:=i;
bsSkinButton2.Width:=i;
bsSkinButton4.Width:=i;
bsSkinButton3.Width:=i;
bsSkinButton8.Width:=i;
bsSkinButton9.Width:=i;
bsSkinButton15.Width:=i;
bsSkinButton17.Width:=i;
bsSkinButton65.Width:=i;
end;
procedure Tfrm_crm_client.t_crm_client_limitedAfterInsert(
DataSet: TDataSet);
begin
t_crm_client_limited['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']:=t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>'];
end;
procedure Tfrm_crm_client.t_crm_client_limitedBeforeInsert(
DataSet: TDataSet);
begin
table_post(t_crm_client);
end;
procedure Tfrm_crm_client.bsSkinDBCheckRadioBox13KeyPress(Sender: TObject;
var Key: Char);
begin
key_DBMemo(Key,DBMemo1);
end;
procedure Tfrm_crm_client.bsSkinButton9Click(Sender: TObject);
begin
wwDBComboBox1.text:='';
Edit1.text:='';
Edit2.text:='';
Edit3.text:='';
RxDBLookupCombo2.ClearValue;
end;
procedure Tfrm_crm_client.bsSkinButton8Click(Sender: TObject);
var
str:widestring;
begin
str:='where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><>'+''''+'Ŀ<><C4BF>'+'''';
if wwDBComboBox1.text<>'' then
begin
str:=str+' and '+wwDBComboBox1.text+'=1';
end;
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;
if Edit4.text<>''then
begin
str:=str+' and <20>绰 like '+''''+'%'+Edit4.text+'%'+'''';
end;
if Edit5.text<>''then
begin
str:=str+' and <20><><EFBFBD><EFBFBD> like '+''''+'%'+Edit5.text+'%'+'''';
end;
if RxDBLookupCombo2.DisplayValue<>''then
begin
str:=str+' and EXISTS (select 1 from t_crm_client_sales WHERE t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client_sales.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and t_crm_client_sales.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+RxDBLookupCombo2.DisplayValue+''')';
end;
t_crm_client.close;
t_crm_client.sql.clear;
t_crm_client.sql.add('select *,(select TOP 1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>+''_''+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=t_crm_client.<2E>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> order by <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> desc) SALE from t_crm_client '+str+' order by <20><><EFBFBD><EFBFBD>');
t_crm_client.open;
end;
procedure Tfrm_crm_client.wwDBComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
IF key=#13 then
begin
key:=#0;
frm_crm_client.bsSkinButton8Click(Sender);
end;
end;
procedure Tfrm_crm_client.t_crm_clientAfterPost(DataSet: TDataSet);
begin
{
if frm_crm_client_num=1 then
SendMsg_gonggao('53','<27>¿ͻ<C2BF>:'+t_crm_client['<27><><EFBFBD><EFBFBD>']+','+t_crm_client['<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>']);
if frm_crm_client_num=2 then
SendMsg_gonggao('54','');
}
frm_crm_client_num:=0;
end;
procedure Tfrm_crm_client.t_crm_clientBeforeCancel(DataSet: TDataSet);
begin
frm_crm_client_num:=0;
end;
procedure Tfrm_crm_client.t_crm_clientBeforeEdit(DataSet: TDataSet);
begin
if not if_open('202') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
abort;
end;
end;
procedure Tfrm_crm_client.t_crm_clientBeforeInsert(DataSet: TDataSet);
begin
if not if_open('202') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
abort;
end;
end;
procedure Tfrm_crm_client.bsSkinButton7Click(Sender: TObject);
begin
t_crm_client_linkman.insert;
end;
procedure Tfrm_crm_client.bsSkinButton12Click(Sender: TObject);
begin
table_post(t_crm_client_linkman);
end;
procedure Tfrm_crm_client.bsSkinButton13Click(Sender: TObject);
begin
table_delete(t_crm_client_linkman);
end;
procedure Tfrm_crm_client.bsSkinButton14Click(Sender: TObject);
begin
table_cancel(t_crm_client_linkman);
end;
procedure Tfrm_crm_client.bsSkinButton15Click(Sender: TObject);
begin
try
frm_crm_Import:=tfrm_crm_Import.Create (self);
frm_crm_Import.ShowModal;
finally
frm_crm_Import.Free;
end;
end;
procedure Tfrm_crm_client.N1Click(Sender: TObject);
begin
grid_save_xls(dxdbgrid1);
end;
procedure Tfrm_crm_client.bsSkinButton16Click(Sender: TObject);
var Protocolrec:TProtocolrec;
aAdoQuery,aAdoQueryUpdate:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
aAdoQueryUpdate:=CreateAdoQuery;
with aAdoQueryUpdate do
begin
close;sql.Clear;
sql.Add('update t_op_seae ');
sql.Add('set <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=:Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ');
sql.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
end;
with aAdoQuery do
try
close;sql.Clear;
sql.Add('select * from t_op_seae');
sql.Add('where <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=''2015-5-1'' and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><=''2017-1-1''');
sql.Add('Order by ί<>е<EFBFBD>λ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
Open;First;
WriteLog(sql.Text);
while not eof do
begin
Protocolrec:=getProtocol(fieldbyname('ί<>е<EFBFBD>λ').asstring,fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring,fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime);
if trim(Protocolrec.protocolType)<>'' then
begin
WriteLog(fieldbyname('ί<>е<EFBFBD>λ').asstring+' '+fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+'ʵ<>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '+FormatDateTime('YYYY-MM-DD',fieldbyname('Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime)+ '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '+Protocolrec.protocolType+'Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD> '+FormatDateTime('YYYY-MM-DD',Protocolrec.protocolDate));
if (Protocolrec.protocolDate<>null) and (Protocolrec.protocolDate<>0) then
begin
aAdoQueryUpdate.Close;
aAdoQueryUpdate.Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
aAdoQueryUpdate.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=Protocolrec.protocolType;
aAdoQueryUpdate.Parameters.ParamByName('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=Protocolrec.protocolDate;
WriteLog(aAdoQueryUpdate.sql.Text+' '+ fieldbyname('<27><><EFBFBD><EFBFBD>').asstring+ ' '+Protocolrec.protocolType+' '+FormatDateTime('YYYY-MM-DD',Protocolrec.protocolDate));
aAdoQueryUpdate.ExecSQL;
end;
end;
Next;
end;
finally
Free;
aAdoQueryUpdate.Free;
end;
end;
procedure Tfrm_crm_client.bsSkinButton17Click(Sender: TObject);
begin
if not (t_crm_client.State in [dsedit,dsinsert]) then t_crm_client.Edit;
t_crm_client.FieldByName('<27>۵<EFBFBD>״̬').AsString:='<27>۵<EFBFBD>';
t_crm_client.Post;
end;
procedure Tfrm_crm_client.bsSkinButton65Click(Sender: TObject);
begin
if not (t_crm_client.State in [dsedit,dsinsert]) then t_crm_client.Edit;
t_crm_client.FieldByName('<27>۵<EFBFBD>״̬').AsString:='<27>ŵ<EFBFBD>';
t_crm_client.Post;
end;
procedure Tfrm_crm_client.DBEdit21Change(Sender: TObject);
begin
if (DBEdit21.Text='<27>۵<EFBFBD>') then
DBEdit21.Color:=clred
else DBEdit21.Color:=clWhite;
end;
function Tfrm_crm_client.CreateNewDjyCustStr(): string;
var
str,str2,codetype,codestr,strsql,typestr,propstr:string;
aAdoQuery:TAdoQuery;
isfirst:Boolean;
TempStr:TStringlist;
begin
if t_crm_client.FieldByName('ί<>е<EFBFBD>λ').AsBoolean then
propstr:=propstr+'[consignor]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean then
propstr:=propstr+'[fleet]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsBoolean then
propstr:=propstr+'[customs_broker]';
if t_crm_client.FieldByName('<27><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD>').AsBoolean then
propstr:=propstr+'[booking_agent]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean then
propstr:=propstr+'[out_agent]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>˾').AsBoolean then
propstr:=propstr+'[carrier]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean then
propstr:=propstr+'[forwarder]';
if t_crm_client.FieldByName('<27><>վ').AsBoolean then
propstr:=propstr+'[yard]';
if t_crm_client.FieldByName('<27>ջ<EFBFBD><D5BB><EFBFBD>').AsBoolean then
propstr:=propstr+'[shipper]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsBoolean then
propstr:=propstr+'[consignee]';
if t_crm_client.FieldByName('֪ͨ<CDA8><D6AA>').AsBoolean then
propstr:=propstr+'[notifyparty]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').AsBoolean then
propstr:=propstr+'[shipagency]';
if t_crm_client.FieldByName('<27><><EFBFBD>ݹ<EFBFBD>˾').AsBoolean then
propstr:=propstr+'[courier]';
if t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD>').AsBoolean then
propstr:=propstr+'[othercustomers]';
aAdoQuery:=CreateAdoQuery;
str:=str+'{';
TempStr:=TStringList.Create;
try
str:=str+'"codeName":"'+ t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
str:=str+',"shortName":"'+t_crm_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+'"';
str:=str+',"fullName":"'+ t_crm_client.FieldByName('<27>ͻ<EFBFBD>ȫ<EFBFBD><C8AB>').asstring+'"';
str:=str+',"chief":"'+ t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
str:=str+',"tel":"'+ t_crm_client.FieldByName('<27>绰').asstring+'"';
str:=str+',"email":"'+ t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
str:=str+',"qq":""';
str:=str+',"webUrl":"'+ t_crm_client.FieldByName('<27><>վ').asstring+'"';
str:=str+',"city":"'+ t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
str:=str+',"addr":"'+ t_crm_client.FieldByName('ͨѶ<CDA8><D1B6>ַ').asstring+'"';
str:=str+',"fullNameEN":"'+ t_crm_client.FieldByName('Ӣ<><D3A2>ȫ<EFBFBD><C8AB>').asstring+'"';
str:=str+',"addrEN":""';
str:=str+',"propString":"'+propstr+'"';
str:=str+',"invTitle":"'+ t_crm_client.FieldByName('<27><>Ʊ̧ͷ').asstring+'"';
str:=str+',"taxNO":""';
str:=str+',"invAddrTel":""';
str:=str+',"rmbBank":"'+ t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RMB').asstring+'"';
str:=str+',"rmbAccount":"'+ t_crm_client.FieldByName('<27>ʺ<EFBFBD>RMB').asstring+'"';
str:=str+',"usdBank":"'+ t_crm_client.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>USD').asstring+'"';
str:=str+',"usdAccount":"'+ t_crm_client.FieldByName('<27>ʺ<EFBFBD>USD').asstring+'"';
str:=str+',"CUSTSERVICE":"'+ t_crm_client.FieldByName('<27>ͷ<EFBFBD>Ա').asstring+'"';
str:=str+',"remark":"'+ t_crm_client.FieldByName('<27><>ע').asstring+'"';
strsql:='select * from t_crm_client_sales where ״̬=''<27><><EFBFBD><EFBFBD>'' and <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><=cast(GETDATE()as date) and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=cast(GETDATE()as date) and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='
+#39+t_crm_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+#39;
aAdoQuery.Close;
aAdoQuery.SQL.Text:=strsql;
aAdoQuery.Open;
if (not aAdoQuery.IsEmpty) then
str:=str+',"sale":"'+ aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring+'"';
strsql:='select * from t_crm_client_class where <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><=cast(GETDATE()as date) and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>>=cast(GETDATE()as date) and <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='
+#39+t_crm_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+#39;
aAdoQuery.Close;
aAdoQuery.SQL.Text:=strsql;
aAdoQuery.Open;
if (not aAdoQuery.IsEmpty) then
str:=str+',"level":"'+ aAdoQuery.FieldByName('<27>ͻ<EFBFBD><CDBB>ȼ<EFBFBD>').asstring+'"';
str:=str+',"contactList":[';
strsql:='select * from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='
+#39+t_crm_client.FieldByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').asstring+#39;
aAdoQuery.Close;
aAdoQuery.SQL.Text:=strsql;
aAdoQuery.Open;
aAdoQuery.First;
isfirst:=true;
while not aAdoQuery.Eof do begin
if (isfirst) then str:=str+'{' else str:=str+',{';
str:=str+'"name":"'+StringReplace(aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring,'''','',[])+'"';
str:=str+',"tel":'+aAdoQuery.FieldByName('<27><EFBFBD>绰').asstring;
str:=str+',"email":"'+aAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>').asstring+'"';
// str:=str+',"qq":"'+aAdoQuery.FieldByName('QQ').asstring+'"';
str:=str+',"remark":"'+aAdoQuery.FieldByName('<27><>ע').asstring+'"';
str:=str+'}';
isfirst:=false;
aAdoQuery.Next;
end;
str:=str+']';
str:=str+'}';
finally
FreeAndNil(aAdoQuery);
FreeAndNil(TempStr);
end;
Result:=str;
end;
procedure Tfrm_crm_client.bsSkinButton93Click(Sender: TObject);
var
i:Integer;
str:string;
dsstr,PostUrl,custstr,ScriptPath,filenamestr:string;
sl:TStringList;
begin
if strtobool(get_parameters_value(3309,'false'))then exit;
if t_crm_client.IsEmpty then
exit;
if dxDBGrid1.SelectedCount<1 then
begin
showmessage('<27><>ѡ<EFBFBD><D1A1>Ҫ<EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ݵ<EFBFBD>ҵ<EFBFBD>񣡣<EFBFBD>');
exit;
end;
sl:=TStringList.Create;
str:=str+'[';
for i:=0 to dxDBGrid1.SelectedCount-1 do
begin
t_crm_client.GotoBookmark(pointer(dxDBGrid1.selectedrows[i]));
if (i<>0) then str:=str+',';
dsstr:=CreateNewDjyCustStr;
str:=str+dsstr;
end;
str:=str+']';
sl.Add(str);
ScriptPath:=ExtractFilePath(ParamStr(0))+'JSON\';
if not DirectoryExists(ScriptPath) then
CreateDir(ScriptPath);
filenamestr:=ScriptPath
+FormatDateTime('yyyy',now)
+FormatDateTime('mm',now)
+FormatDateTime('dd',now)
+FormatDateTime('hh',now)
+FormatDateTime('nn',now)+'.txt';
sl.SaveToFile(filenamestr);
PostUrl:=get_parameters_value(3203,'http://60.209.125.238:25805/DataSync/SyncCustomerList');
// PostUrl:='http://60.209.125.238:25805/DataSync/SyncCustomerList';
TDsDjyThread.create(PostUrl,str,'','2b7957046d234d82a1b0a144324c466a','25d31b3b667fa77c875fd75153bf8debf93eb92433995136d7f3092ff10c51288962734153d8b63a');
ShowMessage('<27>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>ɣ<EFBFBD>');
end;
procedure Tfrm_crm_client.bsSkinButton18Click(Sender: TObject);
var
afield : variant;
i:Integer;
begin
afield := vararraycreate([0,t_crm_client.fieldcount-1],varvariant);
for i := 0 to (t_crm_client.fieldcount-1) do
begin
afield[i] :=t_crm_client.fields[i].value ;
end;
t_crm_client.append;
for i := 0 to (t_crm_client.fieldcount-1) do
begin
if (t_crm_client.fields[i].FieldName<>'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>') AND (t_crm_client.fields[i].FieldName<>'CLIENTID') then
t_crm_client.fields[i].value := afield[i] ;
end;
end;
end.