|
|
unit u_op_sate;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
Dialogs, bsSkinCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB,
|
|
|
ADODB, dxDBTLCl, dxGrClms, bsdbctrls,
|
|
|
RxLookup, StdCtrls, Mask, DBCtrls, wwdbedit, Wwdotdot, Wwdbcomb, Menus,
|
|
|
XPMenu, ExtCtrls;
|
|
|
|
|
|
type
|
|
|
Tfra_op_state = class(TFrame)
|
|
|
t_op_state1: TDataSource;
|
|
|
t_op_state: TADOQuery;
|
|
|
Panel1: TPanel;
|
|
|
bsSkinButton1: TbsSkinButton;
|
|
|
bsSkinButton2: TbsSkinButton;
|
|
|
bsSkinButton4: TbsSkinButton;
|
|
|
bsSkinButton3: TbsSkinButton;
|
|
|
edit_state: TEdit;
|
|
|
PopupMenu1: TPopupMenu;
|
|
|
bsSkinButton11: TbsSkinButton;
|
|
|
N1: TMenuItem;
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
dxDBGrid1: TdxDBGrid;
|
|
|
dxDBGrid1Column1: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column2: TdxDBGridCheckColumn;
|
|
|
dxDBGrid1Column3: TdxDBGridDateColumn;
|
|
|
dxDBGrid1Column4: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column5: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column6: TdxDBGridMaskColumn;
|
|
|
dxDBGrid1Column7: TdxDBGridDateColumn;
|
|
|
bsSkinButton6: TbsSkinButton;
|
|
|
bsSkinButton7: TbsSkinButton;
|
|
|
dxDBGrid1Column8: TdxDBGridColumn;
|
|
|
procedure t_op_stateAfterInsert(DataSet: TDataSet);
|
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
|
procedure bsSkinButton2Click(Sender: TObject);
|
|
|
procedure bsSkinButton3Click(Sender: TObject);
|
|
|
procedure t_op_stateBeforePost(DataSet: TDataSet);
|
|
|
procedure Panel1Resize(Sender: TObject);
|
|
|
procedure t_op_stateBeforeDelete(DataSet: TDataSet);
|
|
|
procedure add_state_menu(n1:TPopupMenu);
|
|
|
procedure add_state(Sender:TObject);
|
|
|
procedure t_op_stateBeforeInsert(DataSet: TDataSet);
|
|
|
procedure FrameEnter(Sender: TObject);
|
|
|
procedure add_all(Sender:TObject);
|
|
|
procedure bsSkinButton11Click(Sender: TObject);
|
|
|
procedure bsSkinButton7Click(Sender: TObject);
|
|
|
procedure bsSkinButton6Click(Sender: TObject);
|
|
|
procedure dxDBGrid1Column1CustomDraw(Sender: TObject; ACanvas: TCanvas;
|
|
|
ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn;
|
|
|
const AText: String; AFont: TFont; var AColor: TColor; ASelected,
|
|
|
AFocused: Boolean; var ADone: Boolean);
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
procedure bsSkinButton4Click(Sender: TObject);
|
|
|
procedure t_op_stateBeforeEdit(DataSet: TDataSet);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
uses u_main, u_data_share, my_sys_function, u_op_state_add;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
procedure Tfra_op_state.add_state(Sender:TObject);
|
|
|
var
|
|
|
menu_skins:Tmenuitem;
|
|
|
begin
|
|
|
menu_skins:= Sender as Tmenuitem;
|
|
|
try
|
|
|
modify_all:=true;
|
|
|
t_op_state.Append;
|
|
|
t_op_state['ҵ<><D2B5>״̬']:=menu_skins.caption;
|
|
|
try
|
|
|
t_op_state['˳<><CBB3>']:=strtoint(menu_skins.Hint);
|
|
|
except
|
|
|
t_op_state['˳<><CBB3>']:=0;
|
|
|
end;
|
|
|
t_op_state.post;
|
|
|
finally
|
|
|
modify_all:=false;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.add_all(Sender:TObject);
|
|
|
var
|
|
|
menu_skins:Tmenuitem;
|
|
|
begin
|
|
|
menu_skins:= Sender as Tmenuitem;
|
|
|
try
|
|
|
modify_all:=true;
|
|
|
frm_data_share.t_code_state.first;
|
|
|
while not frm_data_share.t_code_state.eof do
|
|
|
begin
|
|
|
t_op_state.Append;
|
|
|
t_op_state['ҵ<><D2B5>״̬']:=frm_data_share.t_code_state.fieldbyname('ҵ<><D2B5>״̬').asstring;
|
|
|
t_op_state['˳<><CBB3>']:=frm_data_share.t_code_state.fieldbyname('˳<><CBB3>').asinteger;
|
|
|
t_op_state.post;
|
|
|
frm_data_share.t_code_state.next;
|
|
|
end;
|
|
|
finally
|
|
|
modify_all:=false;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.add_state_menu(n1:TPopupMenu);
|
|
|
var
|
|
|
nn:Tmenuitem;
|
|
|
i:integer;
|
|
|
begin
|
|
|
nn:=Tmenuitem.Create(application);
|
|
|
with nn do
|
|
|
begin
|
|
|
caption:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬ ';
|
|
|
onclick:=add_all;
|
|
|
n1.Items.Add(nn);
|
|
|
end;
|
|
|
|
|
|
i:=0;
|
|
|
frm_data_share.t_code_state.first;
|
|
|
while not frm_data_share.t_code_state.eof do
|
|
|
begin
|
|
|
i:=i+1;
|
|
|
|
|
|
nn:=Tmenuitem.Create(application);
|
|
|
with nn do
|
|
|
begin
|
|
|
caption:='-';
|
|
|
n1.Items.Add(nn);
|
|
|
end;
|
|
|
|
|
|
nn:=Tmenuitem.Create(application);
|
|
|
with nn do
|
|
|
begin
|
|
|
caption:=frm_data_share.t_code_state.fieldbyname('ҵ<><D2B5>״̬').asstring;
|
|
|
nn.Hint:=frm_data_share.t_code_state.fieldbyname('˳<><CBB3>').asstring;
|
|
|
onclick:=add_state;
|
|
|
n1.Items.Add(nn);
|
|
|
end;
|
|
|
frm_data_share.t_code_state.next;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.t_op_stateAfterInsert(DataSet: TDataSet);
|
|
|
begin
|
|
|
t_op_state['<27><><EFBFBD><EFBFBD>']:=t_op_state.DataSource.DataSet['<27><><EFBFBD><EFBFBD>'];
|
|
|
t_op_state['¼<><C2BC><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_op_state['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=date;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton1Click(Sender: TObject);
|
|
|
var
|
|
|
Pnt:Tpoint;
|
|
|
begin
|
|
|
Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height));
|
|
|
PopupMenu1.Popup(Pnt.x,Pnt.y);
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton2Click(Sender: TObject);
|
|
|
begin
|
|
|
table_post(t_op_state);
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton3Click(Sender: TObject);
|
|
|
begin
|
|
|
table_cancel(t_op_state);
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.t_op_stateBeforePost(DataSet: TDataSet);
|
|
|
begin
|
|
|
table_before_post(t_op_state,'ҵ<><D2B5>״̬');
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.Panel1Resize(Sender: TObject);
|
|
|
var
|
|
|
i:integer;
|
|
|
begin
|
|
|
i:=round(Panel1.Width/8);
|
|
|
bsSkinButton1.Width:=i;
|
|
|
bsSkinButton2.Width:=i;
|
|
|
bsSkinButton4.Width:=i;
|
|
|
bsSkinButton11.Width:=i;
|
|
|
bsSkinButton5.Width:=i;
|
|
|
bsSkinButton7.Width:=i;
|
|
|
bsSkinButton6.Width:=i;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.t_op_stateBeforeDelete(DataSet: TDataSet);
|
|
|
begin
|
|
|
if t_op_state.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
begin
|
|
|
showmessage('ҵ<><D2B5>״̬<D7B4>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.t_op_stateBeforeInsert(DataSet: TDataSet);
|
|
|
begin
|
|
|
if t_op_state.DataSource.DataSet.State=dsinsert then
|
|
|
t_op_state.DataSource.DataSet.post;
|
|
|
if (if_open('776')) then begin
|
|
|
showmessage('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>');
|
|
|
abort;
|
|
|
end;
|
|
|
if not modify_all then
|
|
|
begin
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.FrameEnter(Sender: TObject);
|
|
|
begin
|
|
|
case strtoint(edit_state.text) of
|
|
|
1:
|
|
|
begin
|
|
|
frm_data_share.t_code_state.Filtered:=false;
|
|
|
frm_data_share.t_code_state.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state.Filtered:=true;
|
|
|
end;
|
|
|
2:
|
|
|
begin
|
|
|
frm_data_share.t_code_state.Filtered:=false;
|
|
|
frm_data_share.t_code_state.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state.Filtered:=true;
|
|
|
end;
|
|
|
3:
|
|
|
begin
|
|
|
frm_data_share.t_code_state.Filtered:=false;
|
|
|
frm_data_share.t_code_state.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state.Filtered:=true;
|
|
|
end;
|
|
|
4:
|
|
|
begin
|
|
|
frm_data_share.t_code_state.Filtered:=false;
|
|
|
frm_data_share.t_code_state.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state.Filtered:=true;
|
|
|
end;
|
|
|
end;
|
|
|
PopupMenu1.Items.Clear;
|
|
|
add_state_menu(PopupMenu1);
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton11Click(Sender: TObject);
|
|
|
var
|
|
|
str:string;
|
|
|
begin
|
|
|
str:=t_op_state.fieldbyname('ҵ<><D2B5>״̬').asstring;
|
|
|
if t_op_state.IsEmpty then
|
|
|
exit;
|
|
|
table_post(t_op_state);
|
|
|
|
|
|
try
|
|
|
modify_all:=true;
|
|
|
if not (t_op_state.DataSource.DataSet['ҵ<><D2B5>״̬']='<27><>ɾ<D7BC><C9BE>') then begin
|
|
|
t_op_state.DataSource.DataSet.edit;
|
|
|
t_op_state.DataSource.DataSet['ҵ<><D2B5>״̬']:=str;
|
|
|
t_op_state.DataSource.DataSet.Post;
|
|
|
end;
|
|
|
finally
|
|
|
modify_all:=false;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton7Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_op_state.isempty then
|
|
|
exit;
|
|
|
if not t_op_state.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
begin
|
|
|
t_op_state.edit;
|
|
|
t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=1;
|
|
|
t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=date;
|
|
|
t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=employee;
|
|
|
t_op_state.post;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton6Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_op_state.isempty then
|
|
|
exit;
|
|
|
if t_op_state.FieldByName('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>').asboolean then
|
|
|
begin
|
|
|
t_op_state.edit;
|
|
|
t_op_state['<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>']:=0;
|
|
|
t_op_state['<27><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>']:=null;
|
|
|
t_op_state['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=null;
|
|
|
t_op_state.post;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.dxDBGrid1Column1CustomDraw(Sender: TObject;
|
|
|
ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode;
|
|
|
AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont;
|
|
|
var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean);
|
|
|
begin
|
|
|
case strtoint(edit_state.text) of
|
|
|
1:
|
|
|
begin
|
|
|
AColor:=dxgrid_color('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>',ANode.Strings[dxDBGrid1Column1.Index]);
|
|
|
end;
|
|
|
2:
|
|
|
begin
|
|
|
AColor:=dxgrid_color('<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>',ANode.Strings[dxDBGrid1Column1.Index]);
|
|
|
end;
|
|
|
3:
|
|
|
begin
|
|
|
AColor:=dxgrid_color('<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>',ANode.Strings[dxDBGrid1Column1.Index]);
|
|
|
end;
|
|
|
4:
|
|
|
begin
|
|
|
AColor:=dxgrid_color('<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>',ANode.Strings[dxDBGrid1Column1.Index]);
|
|
|
end;
|
|
|
end;
|
|
|
AFont.Color:=clblack;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton5Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_op_state.DataSource.DataSet=nil then
|
|
|
exit;
|
|
|
if t_op_state.DataSource.DataSet.state=dsinsert then
|
|
|
t_op_state.DataSource.DataSet.post;
|
|
|
try
|
|
|
frm_op_state_add:=tfrm_op_state_add.Create (self);
|
|
|
|
|
|
case strtoint(edit_state.text) of
|
|
|
1:
|
|
|
begin
|
|
|
frm_data_share.t_code_state_project.Filtered:=false;
|
|
|
frm_data_share.t_code_state_project.requery;
|
|
|
frm_data_share.t_code_state_project.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state_project.Filtered:=true;
|
|
|
end;
|
|
|
2:
|
|
|
begin
|
|
|
frm_data_share.t_code_state_project.Filtered:=false;
|
|
|
frm_data_share.t_code_state_project.requery;
|
|
|
frm_data_share.t_code_state_project.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state_project.Filtered:=true;
|
|
|
end;
|
|
|
3:
|
|
|
begin
|
|
|
frm_data_share.t_code_state_project.Filtered:=false;
|
|
|
frm_data_share.t_code_state_project.requery;
|
|
|
frm_data_share.t_code_state_project.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˳<EFBFBD><CBB3><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state_project.Filtered:=true;
|
|
|
end;
|
|
|
4:
|
|
|
begin
|
|
|
frm_data_share.t_code_state_project.Filtered:=false;
|
|
|
frm_data_share.t_code_state_project.requery;
|
|
|
frm_data_share.t_code_state_project.Filter:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>='+''''+'<27><><EFBFBD>˽<EFBFBD><CBBD><EFBFBD>'+'''';
|
|
|
frm_data_share.t_code_state_project.Filtered:=true;
|
|
|
end;
|
|
|
end;
|
|
|
frm_op_state_add.DataSource1.DataSet:=t_op_state;
|
|
|
frm_op_state_add.ShowModal;
|
|
|
finally
|
|
|
frm_op_state_add.Free;
|
|
|
frm_op_state_add:=nil;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.bsSkinButton4Click(Sender: TObject);
|
|
|
begin
|
|
|
if t_op_state.isempty then
|
|
|
exit;
|
|
|
if application.MessageBox('<27><>ȷ<EFBFBD><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?','<27><><EFBFBD><EFBFBD>:',MB_OKCANCEL)<>IDOK then
|
|
|
exit;
|
|
|
if dxDBGrid1.SelectedCount>=1 then
|
|
|
begin
|
|
|
while dxDBGrid1.SelectedCount>0 do
|
|
|
begin
|
|
|
t_op_state.GotoBookmark(pointer(dxDBGrid1.selectedrows[0]));
|
|
|
t_op_state.Delete;
|
|
|
end;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
t_op_state.Delete;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure Tfra_op_state.t_op_stateBeforeEdit(DataSet: TDataSet);
|
|
|
begin
|
|
|
if (if_open('776')) then begin
|
|
|
showmessage('<27><>Ʊҵ<C6B1><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>');
|
|
|
abort;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
end.
|