unit u_info_leaveword_manage; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, dxExEdtr, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, StdCtrls, ComCtrls, DBCtrls, bsSkinCtrls, bsdbctrls, Mask, ExtCtrls, RxLookup; type Tfrm_info_leaveword_manage = class(TForm) t_info_leaveword: TADOQuery; t_info_leaveword1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label4: TLabel; DBEdit1: TDBEdit; DBEdit4: TDBEdit; DBRichEdit1: TDBRichEdit; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridCheckColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridDateColumn; Panel1: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton11: TbsSkinButton; RxDBLookupCombo5: TRxDBLookupCombo; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; Label3: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure Panel1Resize(Sender: TObject); procedure t_info_leavewordAfterPost(DataSet: TDataSet); procedure FormShow(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton3Click(Sender: TObject); procedure t_info_leavewordBeforeEdit(DataSet: TDataSet); procedure t_info_leavewordAfterInsert(DataSet: TDataSet); procedure t_info_leavewordBeforePost(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure bsSkinDBCheckRadioBox1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit4KeyPress(Sender: TObject; var Key: Char); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); private { Private declarations } public { Public declarations } end; var frm_info_leaveword_manage: Tfrm_info_leaveword_manage; implementation uses u_main, u_info_leaveword_query, my_sys_function, my_sys_chat; {$R *.dfm} procedure Tfrm_info_leaveword_manage.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_info_leaveword); end; procedure Tfrm_info_leaveword_manage.bsSkinButton6Click(Sender: TObject); begin table_next(t_info_leaveword); end; procedure Tfrm_info_leaveword_manage.bsSkinButton11Click(Sender: TObject); begin table_post(t_info_leaveword); end; procedure Tfrm_info_leaveword_manage.bsSkinButton4Click(Sender: TObject); begin table_delete(t_info_leaveword); end; procedure Tfrm_info_leaveword_manage.bsSkinButton8Click(Sender: TObject); begin table_cancel(t_info_leaveword); end; procedure Tfrm_info_leaveword_manage.bsSkinButton2Click(Sender: TObject); begin t_info_leaveword.insert; end; procedure Tfrm_info_leaveword_manage.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=close_query(t_info_leaveword); end; procedure Tfrm_info_leaveword_manage.Panel1Resize(Sender: TObject); var i:integer; begin i:=round(panel1.Width/9); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton11.Width:=i; bsSkinButton1.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton8.Width:=i; end; procedure Tfrm_info_leaveword_manage.t_info_leavewordAfterPost( DataSet: TDataSet); begin frm_main.t_info_leaveword.Requery(); //SendMsg_liuyan(t_info_leaveword.fieldbyname('接受人').asstring,t_info_leaveword.fieldbyname('留言题目').asstring); end; procedure Tfrm_info_leaveword_manage.FormShow(Sender: TObject); begin t_info_leaveword.Parameters[0].Value:=employee; t_info_leaveword.Parameters[1].Value:=employee; t_info_leaveword.open; end; procedure Tfrm_info_leaveword_manage.bsSkinButton9Click(Sender: TObject); begin close; end; procedure Tfrm_info_leaveword_manage.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_info_leaveword_manage.Hide; frm_info_leaveword_manage.ManualFloat(frm_info_leaveword_manage.BoundsRect ); frm_main.freeTabs('frm_info_leaveword_manage'); action:=cafree; frm_info_leaveword_manage:=nil; end; procedure Tfrm_info_leaveword_manage.bsSkinButton3Click(Sender: TObject); begin if t_info_leaveword.IsEmpty then exit; if t_info_leaveword.fieldbyname('是否知道').asboolean then exit; if t_info_leaveword.fieldbyname('接受人').asstring=employee then begin try modify_all:=true; t_info_leaveword.Edit; t_info_leaveword['是否知道']:=1; t_info_leaveword.post; finally modify_all:=false; end; end; end; procedure Tfrm_info_leaveword_manage.t_info_leavewordBeforeEdit( DataSet: TDataSet); begin if modify_all=false then begin if t_info_leaveword.fieldbyname('接受人').asstring=t_info_leaveword.fieldbyname('留言人').asstring then begin if t_info_leaveword.fieldbyname('是否知道').asboolean then begin showmessage('留言已经确认知道,不能更改!!'); abort; end; end else begin if t_info_leaveword.fieldbyname('留言人').asstring=employee then begin if t_info_leaveword.fieldbyname('是否知道').asboolean then begin showmessage('留言已经确认知道,不能更改!!'); abort; end; end; if t_info_leaveword.fieldbyname('接受人').asstring=employee then begin showmessage('这是别人给你的留言,不能更改!!'); abort; end; end; end; end; procedure Tfrm_info_leaveword_manage.t_info_leavewordAfterInsert( DataSet: TDataSet); begin t_info_leaveword['留言人']:=employee; t_info_leaveword['留言日期']:=date; t_info_leaveword['是否知道']:=0; end; procedure Tfrm_info_leaveword_manage.t_info_leavewordBeforePost( DataSet: TDataSet); begin table_before_post(t_info_leaveword,'接受人'); table_before_post(t_info_leaveword,'留言题目'); end; procedure Tfrm_info_leaveword_manage.bsSkinButton1Click(Sender: TObject); begin try frm_info_leaveword_query:=tfrm_info_leaveword_query.Create (self); frm_info_leaveword_query.ShowModal; finally frm_info_leaveword_query.Free; end; end; procedure Tfrm_info_leaveword_manage.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo5); end; procedure Tfrm_info_leaveword_manage.RxDBLookupCombo5KeyPress( Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo1); end; procedure Tfrm_info_leaveword_manage.RxDBLookupCombo1KeyPress( Sender: TObject; var Key: Char); begin key_bsSkinDBCheckRadioBox(Key,bsSkinDBCheckRadioBox1); end; procedure Tfrm_info_leaveword_manage.bsSkinDBCheckRadioBox1KeyPress( Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_info_leaveword_manage.DBEdit4KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; DBRichEdit1.SetFocus; end; end; procedure Tfrm_info_leaveword_manage.dxDBGrid1ColumnSorting( Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_info_leaveword,'留言题目'); end; end.