|
|
unit u_crm_client_contract;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, DB, ADODB, bsSkinCtrls, ExtCtrls, dxExEdtr, dxCntner, dxTL,
|
|
|
dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, RxLookup, StdCtrls,
|
|
|
wwdbdatetimepicker, Mask, DBCtrls, ComCtrls;
|
|
|
|
|
|
type
|
|
|
Tfrm_crm_client_contract = class(TForm)
|
|
|
t_crm_client_contract: TADOQuery;
|
|
|
t_crm_client_contract1: TDataSource;
|
|
|
Notebook1: TNotebook;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column2: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column5: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridCheckColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column8: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column9: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column10: TdxDBGridDateColumn;
|
|
|
bsSkinPanel2: TbsSkinPanel;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
bsSkinButton8: TbsSkinButton;
|
|
|
bsSkinButton9: TbsSkinButton;
|
|
|
bsSkinButton11: TbsSkinButton;
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
bsSkinButton12: TbsSkinButton;
|
|
|
bsSkinPanel3: TbsSkinPanel;
|
|
|
dxDBGrid1Column11: TdxDBGridColumn;
|
|
|
dxDBGrid1Column12: TdxDBGridColumn;
|
|
|
bsSkinPanel1: TbsSkinPanel;
|
|
|
Label1: TLabel;
|
|
|
DBEdit1: TDBEdit;
|
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
|
Label10: TLabel;
|
|
|
Label14: TLabel;
|
|
|
RxDBLookupCombo3: TRxDBLookupCombo;
|
|
|
Label2: TLabel;
|
|
|
wwDBDateTimePicker2: TwwDBDateTimePicker;
|
|
|
Label12: TLabel;
|
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
|
Label3: TLabel;
|
|
|
wwDBDateTimePicker3: TwwDBDateTimePicker;
|
|
|
Label5: TLabel;
|
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
|
bsSkinGroupBox1: TbsSkinGroupBox;
|
|
|
DBRichEdit1: TDBRichEdit;
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
procedure bsSkinButton12Click(Sender: TObject);
|
|
|
procedure bsSkinButton9Click(Sender: TObject);
|
|
|
procedure bsSkinButton11Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
procedure bsSkinButton8Click(Sender: TObject);
|
|
|
procedure t_crm_client_contractBeforeEdit(DataSet: TDataSet);
|
|
|
procedure t_crm_client_contractAfterInsert(DataSet: TDataSet);
|
|
|
procedure t_crm_client_contractBeforePost(DataSet: TDataSet);
|
|
|
procedure bsSkinPanel2Resize(Sender: TObject);
|
|
|
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure RxDBLookupCombo3KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure wwDBDateTimePicker3KeyPress(Sender: TObject; var Key: Char);
|
|
|
procedure dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
frm_crm_client_contract: Tfrm_crm_client_contract;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, my_sys_function, u_data_share;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.FormClose(Sender: TObject;
|
|
|
var Action: TCloseAction);
|
|
|
begin
|
|
|
frm_crm_client_contract.Hide;
|
|
|
frm_crm_client_contract.ManualFloat(frm_crm_client_contract.BoundsRect );
|
|
|
frm_main.freeTabs('frm_crm_client_contract');
|
|
|
action:=cafree;
|
|
|
frm_crm_client_contract:=nil;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.FormShow(Sender: TObject);
|
|
|
begin
|
|
|
t_crm_client_contract.close;
|
|
|
t_crm_client_contract.sql.clear;
|
|
|
t_crm_client_contract.sql.Add('select * from t_crm_client_contract');
|
|
|
t_crm_client_contract.sql.Add('where '+open_data('3003','¼<><C2BC><EFBFBD><EFBFBD>','no','no','no','no'));
|
|
|
t_crm_client_contract.sql.Add('order by ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
t_crm_client_contract.open;
|
|
|
|
|
|
frm_data_share.t_code_contract.requery;
|
|
|
frm_data_share.t_crm_client_all.requery;
|
|
|
frm_data_share.t_sys_employee.requery;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton7Click(Sender: TObject);
|
|
|
begin
|
|
|
table_Prior(t_crm_client_contract);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton12Click(Sender: TObject);
|
|
|
begin
|
|
|
table_next(t_crm_client_contract);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton9Click(Sender: TObject);
|
|
|
begin
|
|
|
sys_print('<27>ͻ<EFBFBD><CDBB><EFBFBD>ͬЭ<CDAC><D0AD>',2,t_crm_client_contract1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton11Click(Sender: TObject);
|
|
|
var
|
|
|
answer:TModalResult;
|
|
|
begin
|
|
|
if bsSkinButton11.Caption='<27>༭<EFBFBD><EFBFBD>' then
|
|
|
begin
|
|
|
Notebook1.PageIndex:=1;
|
|
|
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
if (t_crm_client_contract.State=dsinsert)or(t_crm_client_contract.State=dsedit) then
|
|
|
BEGIN
|
|
|
answer:=messagedlg( '<27><><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><D1BE>ģ<DEB8><C4A3>Ƿ棿',mtWarning,mbYesNoCancel,0);
|
|
|
if answer=mrYes then
|
|
|
begin
|
|
|
t_crm_client_contract.post;
|
|
|
end;
|
|
|
if answer=mrNo then
|
|
|
begin
|
|
|
t_crm_client_contract.cancel;
|
|
|
end;
|
|
|
if answer=mrCancel then
|
|
|
begin
|
|
|
exit;
|
|
|
end;
|
|
|
END;
|
|
|
Notebook1.PageIndex:=0;
|
|
|
bsSkinButton11.Caption:='<27>༭<EFBFBD><EFBFBD>';
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
table_post(t_crm_client_contract);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton4Click(Sender: TObject);
|
|
|
begin
|
|
|
table_delete(t_crm_client_contract);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton3Click(Sender: TObject);
|
|
|
begin
|
|
|
table_cancel(t_crm_client_contract);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton1Click(Sender: TObject);
|
|
|
begin
|
|
|
t_crm_client_contract.insert;
|
|
|
Notebook1.PageIndex:=1;
|
|
|
bsSkinButton11.Caption:='<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>';
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton6Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_crm_client_contract.IsEmpty then
|
|
|
exit;
|
|
|
|
|
|
if not if_open('095') then
|
|
|
begin
|
|
|
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if t_crm_client_contract.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
begin
|
|
|
showmessage('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
try
|
|
|
modify_all:=true;
|
|
|
t_crm_client_contract.edit;
|
|
|
t_crm_client_contract['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
|
|
|
t_crm_client_contract['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_crm_client_contract['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
|
|
|
t_crm_client_contract.post;
|
|
|
modify_all:=false;
|
|
|
except
|
|
|
modify_all:=false;
|
|
|
showmessage('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinButton8Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_crm_client_contract.IsEmpty then
|
|
|
exit;
|
|
|
|
|
|
if not if_open('095') then
|
|
|
begin
|
|
|
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
if not t_crm_client_contract.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
begin
|
|
|
showmessage('û<>б<EFBFBD>Ҫȡ<D2AA><C8A1><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>');
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
try
|
|
|
modify_all:=true;
|
|
|
t_crm_client_contract.edit;
|
|
|
t_crm_client_contract['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_crm_client_contract['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:='';
|
|
|
t_crm_client_contract['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
|
|
|
t_crm_client_contract.post;
|
|
|
modify_all:=false;
|
|
|
except
|
|
|
modify_all:=false;
|
|
|
showmessage('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>');
|
|
|
end;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.t_crm_client_contractBeforeEdit(
|
|
|
DataSet: TDataSet);
|
|
|
begin
|
|
|
if not modify_all then
|
|
|
begin
|
|
|
if t_crm_client_contract.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
begin
|
|
|
showmessage('<27><>ǰҵ<C7B0><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
if do_data('3003',t_crm_client_contract.fieldbyname('¼<><C2BC><EFBFBD><EFBFBD>').asstring,'','','','','')=false then
|
|
|
begin
|
|
|
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>Ĵ<DEB8><C4B4><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.t_crm_client_contractAfterInsert(
|
|
|
DataSet: TDataSet);
|
|
|
begin
|
|
|
t_crm_client_contract['ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
|
|
|
t_crm_client_contract['ǩ<><C7A9><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_crm_client_contract['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_crm_client_contract['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.t_crm_client_contractBeforePost(
|
|
|
DataSet: TDataSet);
|
|
|
begin
|
|
|
table_before_post(t_crm_client_contract,'<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
table_before_post(t_crm_client_contract,'<27><>ͬЭ<CDAC><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
table_before_post(t_crm_client_contract,'ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
table_before_post(t_crm_client_contract,'<27><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>');
|
|
|
table_before_post(t_crm_client_contract,'ǩ<><C7A9><EFBFBD><EFBFBD>');
|
|
|
table_before_post(t_crm_client_contract,'<27><>ͬЭ<CDAC><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.bsSkinPanel2Resize(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
i:=round(bsSkinPanel2.Width/11);
|
|
|
bsSkinButton7.Width:=i;
|
|
|
bsSkinButton12.Width:=i;
|
|
|
bsSkinButton9.Width:=i;
|
|
|
bsSkinButton1.Width:=i;
|
|
|
bsSkinButton2.Width:=i;
|
|
|
bsSkinButton4.Width:=i;
|
|
|
bsSkinButton3.Width:=i;
|
|
|
bsSkinButton11.Width:=i;
|
|
|
bsSkinButton6.Width:=i;
|
|
|
bsSkinButton8.Width:=i;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.DBEdit1KeyPress(Sender: TObject;
|
|
|
var Key: Char);
|
|
|
begin
|
|
|
key_RxDBLookupCombo(Key,RxDBLookupCombo2);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.RxDBLookupCombo2KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
key_RxDBLookupCombo(Key,RxDBLookupCombo1);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.RxDBLookupCombo1KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
key_wwDBDateTimePicker(Key,wwDBDateTimePicker1);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.wwDBDateTimePicker1KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
key_RxDBLookupCombo(Key,RxDBLookupCombo3);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.RxDBLookupCombo3KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
key_wwDBDateTimePicker(Key,wwDBDateTimePicker2);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.wwDBDateTimePicker2KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
key_wwDBDateTimePicker(Key,wwDBDateTimePicker3);
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.wwDBDateTimePicker3KeyPress(
|
|
|
Sender: TObject; var Key: Char);
|
|
|
begin
|
|
|
if key=#13 then
|
|
|
begin
|
|
|
key:=#0;
|
|
|
DBRichEdit1.SetFocus;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfrm_crm_client_contract.dxDBGrid1ColumnSorting(Sender: TObject;
|
|
|
Column: TdxDBTreeListColumn; var Allow: Boolean);
|
|
|
begin
|
|
|
Column_sort(Column,t_crm_client_contract,'<27><>ͬЭ<CDAC><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
end;
|
|
|
|
|
|
end.
|