323 lines
8.0 KiB
ObjectPascal
323 lines
8.0 KiB
ObjectPascal
|
|
unit U_WorkDeptList_XJGL;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, ComCtrls, ToolWin, cxStyles, cxCustomData, cxGraphics, cxFilter,
|
|||
|
|
cxData, cxDataStorage, cxEdit, DB, cxDBData, cxTextEdit, cxCalendar,
|
|||
|
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxClasses, cxControls, cxGridCustomView, cxGrid, ADODB, DBClient,
|
|||
|
|
cxButtonEdit, cxPC, StdCtrls, ExtCtrls;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TFrmWorkDeptList_XJGL = class(TForm)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBRafresh: TToolButton;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
TFK: TToolButton;
|
|||
|
|
TDSFK: TToolButton;
|
|||
|
|
TSel: TToolButton;
|
|||
|
|
TBExport: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1LYDate: TcxGridDBColumn;
|
|||
|
|
v1LYName: TcxGridDBColumn;
|
|||
|
|
v1LYMoney: TcxGridDBColumn;
|
|||
|
|
v1Note: TcxGridDBColumn;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
Order_Main: TClientDataSet;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
ADOQueryDel: TADOQuery;
|
|||
|
|
v1PriceUnit: TcxGridDBColumn;
|
|||
|
|
TCHK: TToolButton;
|
|||
|
|
TNOChk: TToolButton;
|
|||
|
|
cxTabControl1: TcxTabControl;
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
BegDate: TDateTimePicker;
|
|||
|
|
EndDate: TDateTimePicker;
|
|||
|
|
procedure TBExportClick(Sender: TObject);
|
|||
|
|
procedure v1Column1PropertiesButtonClick(Sender: TObject;
|
|||
|
|
AButtonIndex: Integer);
|
|||
|
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure cxTabControl1Change(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure FormDestroy(Sender: TObject);
|
|||
|
|
procedure TFKClick(Sender: TObject);
|
|||
|
|
procedure TDSFKClick(Sender: TObject);
|
|||
|
|
procedure TSelClick(Sender: TObject);
|
|||
|
|
procedure TCHKClick(Sender: TObject);
|
|||
|
|
procedure TNOChkClick(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
procedure initGrid();
|
|||
|
|
procedure SetStatus();
|
|||
|
|
{ Private declarations }
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
FrmWorkDeptList_XJGL: TFrmWorkDeptList_XJGL;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses U_ZDYHelp,U_RTfun,U_DataLink;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.SetStatus();
|
|||
|
|
begin
|
|||
|
|
TDSFK.Visible:=False;
|
|||
|
|
TFK.Visible:=False;
|
|||
|
|
tSel.Visible:=False;
|
|||
|
|
Tchk.Visible:=False;
|
|||
|
|
tNochk.Visible:=False;
|
|||
|
|
if trim(DParameters1)='<27><>Ȩ<EFBFBD><C8A8>' then
|
|||
|
|
begin
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:begin
|
|||
|
|
//TFK.Visible:=True;
|
|||
|
|
Tchk.Visible:=True;
|
|||
|
|
//TDSFK.Visible:=true;
|
|||
|
|
//Tsel.Visible:=True;
|
|||
|
|
end;
|
|||
|
|
1:begin
|
|||
|
|
Tnochk.Visible:=true;
|
|||
|
|
end;
|
|||
|
|
2:begin
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
case cxTabControl1.TabIndex of
|
|||
|
|
0:begin
|
|||
|
|
TFK.Visible:=true;
|
|||
|
|
TDSFK.Visible:=true;
|
|||
|
|
Tsel.Visible:=True;
|
|||
|
|
end;
|
|||
|
|
1:begin
|
|||
|
|
end;
|
|||
|
|
2:begin
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.initGrid();
|
|||
|
|
begin
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Worker_Fee_LK ');
|
|||
|
|
sql.add('where LYDate>='''+formatdatetime('yyyy-MM-dd',BegDate.DateTime)+''' ');
|
|||
|
|
sql.add('and LYDate<'''+formatdatetime('yyyy-MM-dd',EndDate.DateTime+1)+'''');
|
|||
|
|
if cxTabControl1.TabIndex=0 then
|
|||
|
|
begin
|
|||
|
|
sql.add('and ChkStatus=''0'' ');
|
|||
|
|
end;
|
|||
|
|
if cxtabControl1.TabIndex=1 then
|
|||
|
|
begin
|
|||
|
|
sql.add('and ChkStatus=''1'' ');
|
|||
|
|
end;
|
|||
|
|
open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TBExportClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then Exit;
|
|||
|
|
TcxGridToExcel('<27>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>',cxGrid1);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.v1Column1PropertiesButtonClick(
|
|||
|
|
Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
|
with frmZDYHelp do
|
|||
|
|
begin
|
|||
|
|
flag:='PriceUnit';
|
|||
|
|
flagname:='<27><><EFBFBD><EFBFBD>';
|
|||
|
|
if ShowModal=1 then
|
|||
|
|
begin
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
edit;
|
|||
|
|
fieldbyname('PriceUnit').AsString:=trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmZDYHelp.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TBRafreshClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
initGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
|
SCreateCDS20(ADOQueryMain,Order_Main);
|
|||
|
|
SInitCDSData20(ADOQueryMain,Order_Main);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.cxTabControl1Change(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
SetStatus();
|
|||
|
|
initGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
ReadCxGrid('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>',Tv1,'<27><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>');
|
|||
|
|
endDate.Date:=SGetServerDate(ADOQueryDel);
|
|||
|
|
BegDate.Date:=EndDate.Date-15;
|
|||
|
|
cxGrid1.Align:=alClient;
|
|||
|
|
SetStatus();
|
|||
|
|
InitGrid();
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.FormClose(Sender: TObject;
|
|||
|
|
var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
Action:=caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.FormDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FrmWorkDeptList_XJGL:=nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TFKClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
with Order_Main do
|
|||
|
|
begin
|
|||
|
|
append;
|
|||
|
|
fieldbyname('LYName').AsString:=trim(DName);
|
|||
|
|
fieldbyname('LYDate').Value:=SGetServerDate(ADOQueryDel);
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TDSFKClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Order_Main.IsEmpty then exit;
|
|||
|
|
if application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>','<27><>ʾ',1)=2 then exit;
|
|||
|
|
with ADOQueryDel do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('delete from Worker_Fee_LK ');
|
|||
|
|
sql.add('where LKID='''+trim(Order_Main.fieldbyname('LKID').asstring)+''' ');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
Order_Main.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TSelClick(Sender: TObject);
|
|||
|
|
var maxno: string;
|
|||
|
|
begin
|
|||
|
|
if order_Main.IsEmpty then exit;
|
|||
|
|
if Order_main.Locate('PriceUnit','',[])=True then
|
|||
|
|
begin
|
|||
|
|
application.MessageBox('<27><><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
try
|
|||
|
|
if Order_main.FieldByName('LKID').AsString='' then
|
|||
|
|
begin
|
|||
|
|
if GetLSNo(ADOQueryMain,maxno,'LK','Worker_Fee_LK',4,1)=False then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
Maxno:=trim(Order_main.FieldByName('LKID').AsString);
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('select * from Worker_Fee_LK ');
|
|||
|
|
sql.add('where LKID='''+trim(Order_Main.fieldbyname('LKID').AsString)+''' ');
|
|||
|
|
open;
|
|||
|
|
if isempty then
|
|||
|
|
begin
|
|||
|
|
append;
|
|||
|
|
fieldbyname('fillTime').Value:=SGetServerDate(ADOQueryDel);
|
|||
|
|
fieldbyname('Filler').value:=Trim(DName);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
edit;
|
|||
|
|
fieldbyname('LKID').AsString:=trim(Maxno);
|
|||
|
|
RTSetSaveDataCDS(ADOQueryMain,Tv1,Order_Main,'Worker_Fee_LK',0);
|
|||
|
|
fieldbyname('LYMoney').Value:=Order_Main.fieldbyname('LYMoney').AsFloat;
|
|||
|
|
fieldbyname('Chkstatus').AsString:='0';
|
|||
|
|
post;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
initGrid();
|
|||
|
|
except;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>','<27><>ʾ',0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TCHKClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Worker_Fee_LK set Chker='''+trim(Dname)+''',Chktime=getdate(),chkstatus=''1'' ');
|
|||
|
|
sql.add('where LKID='''+trim(Order_Main.fieldbyname('LKID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD>˳ɹ<CBB3>','<27><>ʾ');
|
|||
|
|
initGrid();
|
|||
|
|
except;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>','<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TNOChkClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Worker_Fee_LK set Chker='''',Chktime=null,chkstatus=''0'' ');
|
|||
|
|
sql.add('where LKID='''+trim(Order_Main.fieldbyname('LKID').AsString)+'''');
|
|||
|
|
execsql;
|
|||
|
|
end;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>','<27><>ʾ');
|
|||
|
|
initGrid();
|
|||
|
|
except;
|
|||
|
|
application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>','<27><>ʾ');
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TFrmWorkDeptList_XJGL.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid('<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>',TV1,'<27><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|