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.

832 lines
24 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_op_letter;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl,
dxDBGrid, StdCtrls, Mask, DBCtrls, Menus, wwdbdatetimepicker, Grids,
DBGrids, XPMenu, RxLookup, bsdbctrls;
type
Tfrm_op_letter = class(TForm)
t_op_letter1: TDataSource;
t_op_letter_cq: TADOQuery;
t_op_letter_cq1: TDataSource;
t_op_letter_cz: TADOQuery;
t_op_letter_cz1: TDataSource;
t_op_letter_df: TADOQuery;
t_op_letter_df1: TDataSource;
t_op_letter_dq: TADOQuery;
t_op_letter_dq1: TDataSource;
t_op_letter_gg: TADOQuery;
t_op_letter_gg1: TDataSource;
t_op_letter_hc: TADOQuery;
t_op_letter_hc1: TDataSource;
t_op_letter_pc: TADOQuery;
t_op_letter_pc1: TDataSource;
t_op_letter_rh: TADOQuery;
t_op_letter_rh1: TDataSource;
t_op_letter_yj1: TDataSource;
t_op_letter_yj: TADOQuery;
bsSkinPanel2: TbsSkinPanel;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1HEAD_TO: TdxDBGridMaskColumn;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
bsSkinButton9: TbsSkinButton;
bsSkinPanel3: TbsSkinPanel;
Label1: TLabel;
DBEdit1: TDBEdit;
Label2: TLabel;
DBEdit2: TDBEdit;
PopupMenu1: TPopupMenu;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
DBEdit3: TDBEdit;
DataSource1: TDataSource;
PopupMenu2: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N20: TMenuItem;
t_op_letter: TADOQuery;
XPMenu1: TXPMenu;
N21: TMenuItem;
N22: TMenuItem;
t_op_letter_hd: TADOQuery;
t_op_letter_hd1: TDataSource;
Button5: TButton;
bsSkinNotebook1: TbsSkinNotebook;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
DBMemo9: TDBMemo;
DBMemo10: TDBMemo;
DBMemo11: TDBMemo;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
DBEdit9: TDBEdit;
DBEdit10: TDBEdit;
DBEdit12: TDBEdit;
DBEdit13: TDBEdit;
DBEdit15: TDBEdit;
DBEdit16: TDBEdit;
DBMemo12: TDBMemo;
wwDBDateTimePicker1: TwwDBDateTimePicker;
wwDBDateTimePicker2: TwwDBDateTimePicker;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label28: TLabel;
Label34: TLabel;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label49: TLabel;
Label50: TLabel;
DBEdit14: TDBEdit;
DBEdit17: TDBEdit;
DBEdit18: TDBEdit;
DBEdit19: TDBEdit;
DBEdit20: TDBEdit;
DBEdit11: TDBEdit;
DBEdit21: TDBEdit;
DBEdit22: TDBEdit;
DBEdit23: TDBEdit;
DBEdit24: TDBEdit;
DBEdit25: TDBEdit;
DBMemo13: TDBMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
DBEdit31: TDBEdit;
DBEdit32: TDBEdit;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
Label44: TLabel;
Label51: TLabel;
DBEdit26: TDBEdit;
DBEdit27: TDBEdit;
DBEdit29: TDBEdit;
DBMemo14: TDBMemo;
Button4: TButton;
DBEdit33: TDBEdit;
DBComboBox1: TDBComboBox;
Label52: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
t_crm_client_cd: TADOQuery;
t_crm_client_cd1: TDataSource;
DBEdit28: TDBEdit;
Label53: TLabel;
Label55: TLabel;
DBEdit35: TDBEdit;
DBEdit36: TDBEdit;
DBMemo18: TDBMemo;
DBMemo19: TDBMemo;
DBEdit37: TDBEdit;
DBMemo20: TDBMemo;
DBMemo21: TDBMemo;
t_op_letter_bgmx: TADOQuery;
t_op_letter_bgmx1: TDataSource;
N3: TMenuItem;
N4: TMenuItem;
procedure bsSkinButton1Click(Sender: TObject);
procedure DBEdit3Change(Sender: TObject);
procedure t_op_letterAfterInsert(DataSet: TDataSet);
procedure N7Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N9Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure t_op_letter_yjBeforeInsert(DataSet: TDataSet);
procedure t_op_letter_cqAfterInsert(DataSet: TDataSet);
procedure t_op_letter_czAfterInsert(DataSet: TDataSet);
procedure t_op_letter_dfAfterInsert(DataSet: TDataSet);
procedure t_op_letter_dqAfterInsert(DataSet: TDataSet);
procedure t_op_letter_ggAfterInsert(DataSet: TDataSet);
procedure t_op_letter_hcAfterInsert(DataSet: TDataSet);
procedure t_op_letter_pcAfterInsert(DataSet: TDataSet);
procedure t_op_letter_rhAfterInsert(DataSet: TDataSet);
procedure t_op_letter_yjAfterInsert(DataSet: TDataSet);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure t_op_letterBeforeInsert(DataSet: TDataSet);
procedure N20Click(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinPanel1Resize(Sender: TObject);
procedure bsSkinPanel3Resize(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure t_op_letter_hdAfterInsert(DataSet: TDataSet);
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit9KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit10KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit12KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit13KeyPress(Sender: TObject; var Key: Char);
procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char);
procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit15KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit16KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit14KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit17KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit18KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit19KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit20KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit11KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit21KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit22KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit23KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit24KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit25KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit26KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit27KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit28KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit29KeyPress(Sender: TObject; var Key: Char);
procedure Button5Click(Sender: TObject);
procedure DBEdit31KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit32KeyPress(Sender: TObject; var Key: Char);
procedure dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
procedure N26Click(Sender: TObject);
procedure t_op_letterBeforeEdit(DataSet: TDataSet);
procedure DBComboBox1Change(Sender: TObject);
procedure DBComboBox1KeyPress(Sender: TObject; var Key: Char);
procedure DBEdit33KeyPress(Sender: TObject; var Key: Char);
procedure t_op_letter_bgmxAfterInsert(DataSet: TDataSet);
procedure N4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_op_letter: Tfrm_op_letter;
frm_op_letter_insert:boolean;
implementation
uses u_main, my_sys_function, u_data_share,
u_code_send_head, u_op_letter_his;
{$R *.dfm}
procedure Tfrm_op_letter.bsSkinButton1Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height));
PopupMenu1.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_letter.DBEdit3Change(Sender: TObject);
begin
DataSource1.Enabled:=false;
if t_op_letter.IsEmpty then
begin
bsSkinNotebook1.PageIndex:=4;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=0;
DataSource1.DataSet:=t_op_letter_gg;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=1;
DataSource1.DataSet:=t_op_letter_hc;
end
else if DBEdit3.Text='<27>ɳ<EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=2;
DataSource1.DataSet:=t_op_letter_pc;
end
else if DBEdit3.Text='<27><><EFBFBD><EFBFBD>֪ͨ' then
begin
bsSkinNotebook1.PageIndex:=3;
DataSource1.DataSet:=t_op_letter_rh;
end;
DataSource1.Enabled:=true;
end;
procedure Tfrm_op_letter.t_op_letterAfterInsert(DataSet: TDataSet);
begin
t_op_letter['<27><><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_letter['ǩ<><C7A9><EFBFBD><EFBFBD>']:=employee;
t_op_letter['ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
frm_op_letter_insert:=false;
end;
procedure Tfrm_op_letter.N7Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N7.Caption;
t_op_letter.Post;
t_op_letter_rh.insert;
end;
procedure Tfrm_op_letter.N5Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N5.Caption;
t_op_letter.Post;
t_op_letter_hc.insert;
end;
procedure Tfrm_op_letter.N9Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N9.Caption;
t_op_letter.Post;
t_op_letter_gg.insert;
end;
procedure Tfrm_op_letter.bsSkinButton2Click(Sender: TObject);
begin
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if DataSource1.DataSet=nil then
exit;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
end;
procedure Tfrm_op_letter.bsSkinButton3Click(Sender: TObject);
begin
if DataSource1.DataSet=nil then
exit;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.cancel;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.cancel;
end;
procedure Tfrm_op_letter.bsSkinButton4Click(Sender: TObject);
begin
if t_op_letter.IsEmpty then
exit;
if DataSource1.DataSet=nil then
exit;
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)=IDOK then
begin
if not DataSource1.DataSet.IsEmpty then
DataSource1.DataSet.Delete;
t_op_letter.delete;
end;
end;
procedure Tfrm_op_letter.t_op_letter_yjBeforeInsert(DataSet: TDataSet);
begin
if (t_op_letter.DataSource.DataSet.FieldByName('ҵ<><D2B5>״̬').AsString='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('ҵ<><D2B5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
end;
procedure Tfrm_op_letter.t_op_letter_cqAfterInsert(DataSet: TDataSet);
begin
t_op_letter_cq['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_czAfterInsert(DataSet: TDataSet);
begin
t_op_letter_cz['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_dfAfterInsert(DataSet: TDataSet);
begin
t_op_letter_df['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_dqAfterInsert(DataSet: TDataSet);
begin
t_op_letter_dq['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_ggAfterInsert(DataSet: TDataSet);
begin
t_op_letter_gg['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.t_op_letter_hcAfterInsert(DataSet: TDataSet);
begin
t_op_letter_hc['LE_ID']:=t_op_letter['LE_ID'];
t_op_letter_hc['ԭ<><D4AD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_letter_hc['ԭ<><D4AD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
t_op_letter_hc['ԭ<><D4AD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_op_letter_hc['ԭ<><EFBFBD><E1B5A5>']:=t_op_letter.DataSource.DataSet['<27><><EFBFBD><EFBFBD><E1B5A5>'];
end;
procedure Tfrm_op_letter.t_op_letter_pcAfterInsert(DataSet: TDataSet);
begin
t_op_letter_pc['LE_ID']:=t_op_letter['LE_ID'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>װ<EFBFBD><D7B0>').asstring;
if frm_data_share.t_code_truck_client.Locate('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('ί<>е<EFBFBD>λ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>ҵ<EFBFBD>ַ']:=frm_data_share.t_code_truck_client['<27><><EFBFBD>ҵ<EFBFBD>ַ'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_code_truck_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_code_truck_client['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰'];
end;
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring;
if frm_data_share.t_code_truck_changzhan.Locate('<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring,[])then
begin
t_op_letter_pc['<27><><EFBFBD>䳡վ']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>'];
t_op_letter_pc['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><>վ<EFBFBD>绰']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD>绰'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE><EFBFBD><EFBFBD>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5>']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>'];
t_op_letter_pc['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD>绰']:=frm_data_share.t_code_truck_changzhan['<27><>վ<EFBFBD>绰'];
end;
end;
procedure Tfrm_op_letter.t_op_letter_rhAfterInsert(DataSet: TDataSet);
var
aQuery:TADOQuery;
begin
t_op_letter_rh['LE_ID']:=t_op_letter['LE_ID'];
t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>վ']:=t_op_letter.DataSource.DataSet['<27><>վ'];
if t_op_letter.DataSource.DataSet['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>']<>null then begin
t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=datetimetostr(t_op_letter.DataSource.DataSet['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>']);
t_op_letter_rh['<27>ص<EFBFBD>ʱ<EFBFBD><CAB1>']:=datetimetostr(t_op_letter.DataSource.DataSet['<27>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>']);
end else
t_op_letter_rh['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=datetostr(now);
DBComboBox1.Items.Clear;
if frm_data_share.t_crm_client_changzhan.Locate('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>',t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring,[])then
begin
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ַ']:=frm_data_share.t_crm_client_changzhan['ͨѶ<CDA8><D1B6>ַ'];
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD>绰']:=frm_data_share.t_crm_client_changzhan['<27>绰'];
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>绰 from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring+'''');
Open;
if not IsEmpty then begin
while not Eof do begin
DBComboBox1.Items.Add(FieldByName('<27><><EFBFBD><EFBFBD>').AsString);
Next;
end;
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD><CFB5>']:=FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD>绰']:=FieldByName('<27><EFBFBD>绰').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
end;
procedure Tfrm_op_letter.t_op_letter_yjAfterInsert(DataSet: TDataSet);
begin
t_op_letter_yj['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
frm_op_letter.Hide;
frm_op_letter.ManualFloat(frm_op_letter.BoundsRect );
action:=cafree;
frm_op_letter:=nil;
end;
procedure Tfrm_op_letter.FormShow(Sender: TObject);
begin
t_op_letter.Open;
t_op_letter_gg.Open;
t_op_letter_hc.Open;
t_op_letter_pc.Open;
t_op_letter_rh.Open;
bsSkinButton1.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton2.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton3.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton4.Width:=round(bsSkinPanel1.Width/5);
DBEdit1.Width:=bsSkinPanel3.Width-DBEdit1.Left-6;
DBEdit2.Width:=bsSkinPanel3.Width-DBEdit1.Left-6;
end;
procedure Tfrm_op_letter.t_op_letterBeforeInsert(DataSet: TDataSet);
begin
if (t_op_letter.DataSource.DataSet.FieldByName('ҵ<><D2B5>״̬').AsString='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('ҵ<><D2B5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
if t_op_letter.DataSource.DataSet.State=dsinsert then
t_op_letter.DataSource.DataSet.post;
if not frm_op_letter_insert then
abort;
end;
procedure Tfrm_op_letter.N20Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_letter.IsEmpty then
exit;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
try
t_op_letter.DataSource.DataSet.DisableControls;
book1:=t_op_letter.GetBookmark;
t_op_letter.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,2,t_op_letter.DataSource,t_op_letter1,DataSource1,nil,nil,nil,nil,nil,nil,nil,nil);
finally
t_op_letter.DataSource.DataSet.EnableControls;
t_op_letter.GotoBookmark(book1);
t_op_letter.EnableControls;
end;
end;
procedure Tfrm_op_letter.N1Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_letter.IsEmpty then
exit;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
try
book1:=t_op_letter.GetBookmark;
t_op_letter.DisableControls;
t_op_letter.DataSource.DataSet.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,1,t_op_letter.DataSource,t_op_letter1,DataSource1,nil,nil,nil,nil,nil,nil,nil,nil);
finally
t_op_letter.DataSource.DataSet.EnableControls;
t_op_letter.GotoBookmark(book1);
t_op_letter.EnableControls;
end;
end;
procedure Tfrm_op_letter.bsSkinButton9Click(Sender: TObject);
var
Pnt:Tpoint;
begin
Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height));
PopupMenu2.Popup(Pnt.x,Pnt.y);
end;
procedure Tfrm_op_letter.bsSkinPanel1Resize(Sender: TObject);
begin
bsSkinButton1.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton2.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton3.Width:=round(bsSkinPanel1.Width/5);
bsSkinButton4.Width:=round(bsSkinPanel1.Width/5);
end;
procedure Tfrm_op_letter.bsSkinPanel3Resize(Sender: TObject);
begin
DBEdit1.Width:=bsSkinPanel3.Width-DBEdit1.Left-6;
DBEdit2.Width:=bsSkinPanel3.Width-DBEdit1.Left-6-Button5.Width;
Button5.left:=DBEdit2.left+DBEdit2.Width;
end;
procedure Tfrm_op_letter.N21Click(Sender: TObject);
var
book1:Tbookmark;
begin
if t_op_letter.IsEmpty then
exit;
if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then
t_op_letter.post;
if (DataSource1.DataSet.State=dsinsert)or(DataSource1.DataSet.State=dsedit) then
DataSource1.DataSet.post;
try
book1:=t_op_letter.GetBookmark;
t_op_letter.DataSource.DataSet.DisableControls;
t_op_letter.DisableControls;
sys_print('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+DBEdit3.Text,3,t_op_letter.DataSource,t_op_letter1,DataSource1,nil,nil,nil,nil,nil,nil,nil,nil);
finally
t_op_letter.DataSource.DataSet.EnableControls;
t_op_letter.GotoBookmark(book1);
t_op_letter.EnableControls;
end;
end;
procedure Tfrm_op_letter.t_op_letter_hdAfterInsert(DataSet: TDataSet);
begin
t_op_letter_hd['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.DBEdit1KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit2);
end;
procedure Tfrm_op_letter.DBEdit2KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
bsSkinNotebook1.SetFocus;
end;
end;
procedure Tfrm_op_letter.DBEdit9KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit10);
end;
procedure Tfrm_op_letter.DBEdit10KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit12);
end;
procedure Tfrm_op_letter.DBEdit12KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit13);
end;
procedure Tfrm_op_letter.DBEdit13KeyPress(Sender: TObject; var Key: Char);
begin
key_wwDBDateTimePicker(Key,wwDBDateTimePicker1);
end;
procedure Tfrm_op_letter.wwDBDateTimePicker1KeyPress(Sender: TObject;
var Key: Char);
begin
key_wwDBDateTimePicker(Key,wwDBDateTimePicker2);
end;
procedure Tfrm_op_letter.wwDBDateTimePicker2KeyPress(Sender: TObject;
var Key: Char);
begin
key_DBEdit(Key,DBEdit15);
end;
procedure Tfrm_op_letter.DBEdit15KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit16);
end;
procedure Tfrm_op_letter.DBEdit16KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo12);
end;
procedure Tfrm_op_letter.DBEdit14KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit31);
end;
procedure Tfrm_op_letter.DBEdit17KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit18);
end;
procedure Tfrm_op_letter.DBEdit18KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit19);
end;
procedure Tfrm_op_letter.DBEdit19KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit20);
end;
procedure Tfrm_op_letter.DBEdit20KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit11);
end;
procedure Tfrm_op_letter.DBEdit11KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit21);
end;
procedure Tfrm_op_letter.DBEdit21KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit22);
end;
procedure Tfrm_op_letter.DBEdit22KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit23);
end;
procedure Tfrm_op_letter.DBEdit23KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit24);
end;
procedure Tfrm_op_letter.DBEdit24KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit25);
end;
procedure Tfrm_op_letter.DBEdit25KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo13);
end;
procedure Tfrm_op_letter.DBEdit26KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit27);
end;
procedure Tfrm_op_letter.DBEdit27KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit28);
end;
procedure Tfrm_op_letter.DBEdit28KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
DBComboBox1.SetFocus;
end;
end;
procedure Tfrm_op_letter.DBEdit29KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit33);
end;
procedure Tfrm_op_letter.Button5Click(Sender: TObject);
begin
if t_op_letter.isempty then
exit;
if not if_open('144') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>д<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>Ȩ<EFBFBD>ޣ<EFBFBD>');
exit;
end;
try
frm_code_send_head:=tfrm_code_send_head.Create (self);
code_send_head_num:=1;
frm_code_send_head.ShowModal;
finally
frm_code_send_head.Free;
frm_code_send_head:=nil;
end;
end;
procedure Tfrm_op_letter.DBEdit31KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit32);
end;
procedure Tfrm_op_letter.DBEdit32KeyPress(Sender: TObject; var Key: Char);
begin
key_DBEdit(Key,DBEdit17);
end;
procedure Tfrm_op_letter.dxDBGrid1ColumnSorting(Sender: TObject;
Column: TdxDBTreeListColumn; var Allow: Boolean);
begin
Column_sort(Column,t_op_letter,'LF');
end;
procedure Tfrm_op_letter.N26Click(Sender: TObject);
begin
try
if not assigned(frm_op_letter_his) then
frm_op_letter_his:=tfrm_op_letter_his.Create (self);
frm_op_letter_his.ShowModal;
finally
frm_op_letter_his.free;
frm_op_letter_his:=nil;
end;
end;
procedure Tfrm_op_letter.t_op_letterBeforeEdit(DataSet: TDataSet);
begin
if (t_op_letter.DataSource.DataSet.FieldByName('ҵ<><D2B5>״̬').AsString='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
begin
showmessage('ҵ<><D2B5><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
if not do_data('0001',t_op_letter.FieldByName('ǩ<><C7A9><EFBFBD><EFBFBD>').asstring,'','','','','') then
begin
showmessage('<27>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD>˺<EFBFBD><CBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޸ģ<DEB8><C4A3><EFBFBD>');
abort;
end;
end;
procedure Tfrm_op_letter.DBComboBox1Change(Sender: TObject);
var
aQuery:TADOQuery;
begin
aQuery:=CreateAdoQuery;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('Select <20><><EFBFBD><EFBFBD>,<2C><EFBFBD>绰 from t_crm_client_linkman where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>='''+t_op_letter.DataSource.DataSet.fieldbyname('<27><>վ').asstring+''' AND <20><><EFBFBD><EFBFBD>='''+DBComboBox1.Text+'''');
Open;
if not IsEmpty then begin
t_op_letter_rh['<27><>վ<EFBFBD><D5BE>ϵ<EFBFBD>绰']:=FieldByName('<27><EFBFBD>绰').AsString;
end;
end;
finally
FreeAndNil(aQuery);
end;
end;
procedure Tfrm_op_letter.DBComboBox1KeyPress(Sender: TObject;
var Key: Char);
begin
key_DBEdit(Key,DBEdit29);
end;
procedure Tfrm_op_letter.DBEdit33KeyPress(Sender: TObject; var Key: Char);
begin
key_DBMemo(Key,DBMemo14);
end;
procedure Tfrm_op_letter.t_op_letter_bgmxAfterInsert(DataSet: TDataSet);
begin
t_op_letter_bgmx['LE_ID']:=t_op_letter['LE_ID'];
end;
procedure Tfrm_op_letter.N4Click(Sender: TObject);
begin
frm_op_letter_insert:=true;
t_op_letter.Insert;
t_op_letter['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=N4.Caption;
t_op_letter.Post;
t_op_letter_pc.insert;
end;
end.