896 lines
27 KiB
ObjectPascal
896 lines
27 KiB
ObjectPascal
unit U_WageListTKJ;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||
cxTextEdit, cxDBLookupComboBox, cxPC, cxDropDownEdit, Menus, cxLookAndFeels,
|
||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxDateRanges, U_BaseList, dxSkinWXI,
|
||
dxScrollbarAnnotations, cxContainer, dxCore, cxDateUtils;
|
||
|
||
type
|
||
TfrmWageListTKJ = class(TfrmBaseList)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
Label3: TLabel;
|
||
fabricName: TcxTextEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridLevel1: TcxGridLevel;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
v2Column6: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
Label1: TLabel;
|
||
fabricNo: TcxTextEdit;
|
||
v2Column10: TcxGridDBColumn;
|
||
Label2: TLabel;
|
||
userName: TcxTextEdit;
|
||
v2Column17: TcxGridDBColumn;
|
||
v2Column18: TcxGridDBColumn;
|
||
v2Column19: TcxGridDBColumn;
|
||
BegDate: TDateTimePicker;
|
||
Label4: TLabel;
|
||
EndDate: TDateTimePicker;
|
||
v2Column3: TcxGridDBColumn;
|
||
v2Column4: TcxGridDBColumn;
|
||
ToolButton3: TToolButton;
|
||
PopupMenu2: TPopupMenu;
|
||
ToolButton4: TToolButton;
|
||
v2Column8: TcxGridDBColumn;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
v2Column14: TcxGridDBColumn;
|
||
v2Column15: TcxGridDBColumn;
|
||
v2Column16: TcxGridDBColumn;
|
||
v2Column20: TcxGridDBColumn;
|
||
cxTabControl1: TcxTabControl;
|
||
Label5: TLabel;
|
||
machineNo: TcxTextEdit;
|
||
v2Column7: TcxGridDBColumn;
|
||
v2Column9: TcxGridDBColumn;
|
||
ToolButton5: TToolButton;
|
||
CDS_Data: TClientDataSet;
|
||
ToolButton6: TToolButton;
|
||
Panel2: TPanel;
|
||
v2Column11: TcxGridDBColumn;
|
||
v2Column12: TcxGridDBColumn;
|
||
v2Column13: TcxGridDBColumn;
|
||
v2Column21: TcxGridDBColumn;
|
||
v2Column22: TcxGridDBColumn;
|
||
ToolButton7: TToolButton;
|
||
Panel3: TPanel;
|
||
Label8: TLabel;
|
||
ToolButton8: TToolButton;
|
||
Tv2Column1: TcxGridDBColumn;
|
||
Tv2Column2: TcxGridDBColumn;
|
||
BLDate: TcxDateEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure fabricNameChange(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure v2Column19PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure v2Column14PropertiesEditValueChanged(Sender: TObject);
|
||
procedure cxTabControl1Change(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure v2Column17PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure v2Column21PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure ToolButton8Click(Sender: TObject);
|
||
|
||
private
|
||
|
||
{ Private declarations }
|
||
canshu1: string;
|
||
procedure InitGrid();
|
||
public
|
||
end;
|
||
|
||
var
|
||
frmWageListTKJ: TfrmWageListTKJ;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_ClothSCSelList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmWageListTKJ.InitGrid();
|
||
begin
|
||
try
|
||
ToolBar1.SetFocus;
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' exec P_Kint_Wage_FS_Data :Begdate,:EndDate,:Status ');
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
Parameters.ParamByName('Status').Value := '<27><><EFBFBD>˶<EFBFBD>';
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
Parameters.ParamByName('Status').Value := '<27>Ѻ˶<D1BA>';
|
||
end;
|
||
Parameters.ParamByName('Begdate').Value := Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date));
|
||
Parameters.ParamByName('Enddate').Value := Trim(FormatDateTime('yyyy-MM-dd', Enddate.Date + 1));
|
||
Open;
|
||
end;
|
||
|
||
SCreateCDS(ADOQueryMain, CDS_HZ);
|
||
SInitCDSData(ADOQueryMain, CDS_HZ);
|
||
CDS_HZ.Last;
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmWageListTKJ := nil;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʺ<EFBFBD><CABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>LJ', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
ReadCxGrid('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʺ<EFBFBD><CABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>LJ', Tv2, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
||
SCreateCDS(ADOQueryMain, CDS_HZ);
|
||
SInitCDSData(ADOQueryMain, CDS_HZ);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.fabricNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.IsEmpty then
|
||
Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', cxgrid2);
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.FormCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
EndDate.DateTime := SGetServerDate(ADOQueryTemp);
|
||
BegDate.DateTime := EndDate.DateTime;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.v2Column19PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'SCPerson';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote := True;
|
||
V1Name.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
// V1Note1.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
// fnote1 := True;
|
||
TBAdd.Visible := False;
|
||
TBDel.Visible := False;
|
||
TBEdit.Visible := False;
|
||
TBSave.Visible := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('DName').Value := Trim(ClientDataSet1.FieldByName('ZDYName').AsString);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update DCGMoney set DName=' + QuotedStr(Trim(ClientDataSet1.FieldByName('ZDYName').AsString)));
|
||
sql.Add(' where GZID=' + trim(Self.CDS_HZ.FieldByName('GZID').AsString));
|
||
EXECSQL;
|
||
end;
|
||
tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_HZ, True);
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.N2Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_HZ, false);
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
exit;
|
||
if cxTabControl1.TabIndex <> 1 then
|
||
Exit;
|
||
if CDS_HZ.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
Panel2.Visible := True;
|
||
Panel2.Refresh;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_HZ.DisableControls;
|
||
with CDS_HZ do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update SalaryDay Set JSID=Null,JSFlag=0,JSTime=getdate(),JSPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
EXECSQL;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
|
||
end;
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Panel2.Visible := False;
|
||
except
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.v2Column14PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
FBTMoney, FCLMoney, FJLMoney, FCFMoney, FGZMoney: Double;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
if Trim(mvalue) <> '' then
|
||
FieldByName(FFieldName).Value := Trim(mvalue)
|
||
else
|
||
FieldByName(FFieldName).Value := Null;
|
||
Post;
|
||
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('CLMoney').AsString) <> '' then
|
||
begin
|
||
FCLMoney := CDS_HZ.fieldbyname('CLMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FCLMoney := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('BTMoney').AsString) <> '' then
|
||
begin
|
||
FBTMoney := CDS_HZ.fieldbyname('BTMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FBTMoney := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('JLMoney').AsString) <> '' then
|
||
begin
|
||
FJLMoney := CDS_HZ.fieldbyname('JLMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FJLMoney := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('CFMoney').AsString) <> '' then
|
||
begin
|
||
FCFMoney := CDS_HZ.fieldbyname('CFMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FCFMoney := 0;
|
||
end;
|
||
FGZMoney := FBTMoney + FCLMoney + FJLMoney - FCFMoney;
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('GZMoney').Value := FGZMoney;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if Trim(mvalue) <> '' then
|
||
sql.Add('Update SalaryDay Set ' + FFieldName + ' =' + mvalue)
|
||
else
|
||
sql.Add('Update SalaryDay Set ' + FFieldName + ' =Null');
|
||
sql.Add(', GZMoney =' + FloatToStr(FGZMoney));
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
EXECSQL;
|
||
end;
|
||
tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.cxTabControl1Change(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
if cxTabControl1.TabIndex = 0 then
|
||
begin
|
||
v2Column14.Options.Editing := True;
|
||
v2Column15.Options.Editing := True;
|
||
v2Column16.Options.Editing := True;
|
||
v2Column17.Options.Editing := True;
|
||
v2Column21.Options.Editing := True;
|
||
v2Column22.Options.Editing := True;
|
||
end
|
||
else if cxTabControl1.TabIndex = 1 then
|
||
begin
|
||
v2Column14.Options.Editing := False;
|
||
v2Column15.Options.Editing := False;
|
||
v2Column16.Options.Editing := False;
|
||
v2Column17.Options.Editing := False;
|
||
v2Column21.Options.Editing := False;
|
||
v2Column22.Options.Editing := False;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if CDS_HZ.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
// ruixindata
|
||
try
|
||
frmClothSCSelList := TfrmClothSCSelList.Create(Application);
|
||
with frmClothSCSelList do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
|
||
Self.CDS_HZ.DisableControls;
|
||
with Self.CDS_HZ do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
with Self.ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update SalaryDay Set fabricNo=''' + Trim(frmClothSCSelList.Order_Main.fieldbyname('C_Code').AsString) + '''');
|
||
sql.Add(',fabricName=''' + Trim(frmClothSCSelList.Order_Main.fieldbyname('C_CodenName').AsString) + '''');
|
||
SQL.Add(',processPrice=:processPrice');
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
if Trim(frmClothSCSelList.Order_Main.fieldbyname('CZCarPrice').AsString) <> '' then
|
||
begin
|
||
Parameters.ParamByName('processPrice').Value := frmClothSCSelList.Order_Main.fieldbyname('CZCarPrice').Value;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('processPrice').Value := Null;
|
||
end;
|
||
ExecSQL;
|
||
end;
|
||
with Self.ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Get_GZData :processPrice,:machineCycleNumber,:upTimeCycle,:AddQty,:DecQty,:BTMoney,:JLMoney,:CFMoney');
|
||
Parameters.ParamByName('processPrice').Value := frmClothSCSelList.Order_Main.fieldbyname('CZCarPrice').Value;
|
||
Parameters.ParamByName('machineCycleNumber').Value := Self.CDS_HZ.fieldbyname('machineCycleNumber').Value;
|
||
if Trim(Self.CDS_HZ.fieldbyname('upTimeCycle').AsString) = '' then
|
||
begin
|
||
Parameters.ParamByName('upTimeCycle').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('upTimeCycle').Value := Self.CDS_HZ.fieldbyname('upTimeCycle').Value;
|
||
end;
|
||
if Trim(Self.CDS_HZ.fieldbyname('AddQty').AsString) = '' then
|
||
begin
|
||
Parameters.ParamByName('AddQty').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('AddQty').Value := Self.CDS_HZ.fieldbyname('AddQty').Value;
|
||
end;
|
||
if Trim(Self.CDS_HZ.fieldbyname('DecQty').AsString) = '' then
|
||
begin
|
||
Parameters.ParamByName('DecQty').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('DecQty').Value := Self.CDS_HZ.fieldbyname('DecQty').Value;
|
||
end;
|
||
if Trim(Self.CDS_HZ.fieldbyname('BTMoney').AsString) = '' then
|
||
begin
|
||
Parameters.ParamByName('BTMoney').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('BTMoney').Value := Self.CDS_HZ.fieldbyname('BTMoney').Value;
|
||
end;
|
||
if Trim(Self.CDS_HZ.fieldbyname('JLMoney').AsString) = '' then
|
||
begin
|
||
Parameters.ParamByName('JLMoney').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('JLMoney').Value := Self.CDS_HZ.fieldbyname('JLMoney').Value;
|
||
end;
|
||
if Trim(Self.CDS_HZ.fieldbyname('CFMoney').AsString) = '' then
|
||
begin
|
||
Parameters.ParamByName('CFMoney').Value := 0;
|
||
end
|
||
else
|
||
begin
|
||
Parameters.ParamByName('CFMoney').Value := Self.CDS_HZ.fieldbyname('CFMoney').Value;
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS(Self.ADOQueryTemp, CDS_Data);
|
||
SInitCDSData(Self.ADOQueryTemp, CDS_Data);
|
||
Edit;
|
||
FieldByName('fabricNo').Value := frmClothSCSelList.Order_Main.fieldbyname('C_Code').Value;
|
||
FieldByName('fabricName').Value := frmClothSCSelList.Order_Main.fieldbyname('C_CodeName').Value;
|
||
FieldByName('processPrice').Value := frmClothSCSelList.Order_Main.fieldbyname('CZCarPrice').Value;
|
||
FieldByName('CLMoney').Value := Self.CDS_Data.fieldbyname('CLMoney').Value;
|
||
FieldByName('GZMoney').Value := Self.CDS_Data.fieldbyname('GZMoney').Value;
|
||
FieldByName('SSel').Value := False;
|
||
end;
|
||
end;
|
||
Self.CDS_HZ.EnableControls;
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothSCSelList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if CDS_HZ.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'SCPerson';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote := True;
|
||
V1Name.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
|
||
// TBAdd.Visible := False;
|
||
// TBDel.Visible := False;
|
||
// TBEdit.Visible := False;
|
||
// TBSave.Visible := False;
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_HZ.DisableControls;
|
||
with Self.CDS_HZ do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
with Self.ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update SalaryDay Set userName=''' + Trim(frmZDYHelp.ClientDataSet1.fieldbyname('Note').AsString) + '''');
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
ExecSQL;
|
||
end;
|
||
Edit;
|
||
FieldByName('userName').Value := frmZDYHelp.ClientDataSet1.fieldbyname('Note').Value;
|
||
FieldByName('SSel').Value := False;
|
||
end;
|
||
end;
|
||
Self.CDS_HZ.EnableControls;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.v2Column17PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
if Trim(mvalue) <> '' then
|
||
FieldByName(FFieldName).Value := Trim(mvalue)
|
||
else
|
||
FieldByName(FFieldName).Value := Null;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if Trim(mvalue) <> '' then
|
||
sql.Add('Update SalaryDay Set ' + FFieldName + ' =''' + mvalue + '''')
|
||
else
|
||
sql.Add('Update SalaryDay Set ' + FFieldName + ' =Null');
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
EXECSQL;
|
||
end;
|
||
tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if CDS_HZ.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD>˶<EFBFBD><CBB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
Panel2.Visible := True;
|
||
Panel2.Refresh;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_HZ.DisableControls;
|
||
with CDS_HZ do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update SalaryDay Set JSID=:JSID,JSFlag=1,JSTime=Getdate(),JSPerson=''' + Trim(DName) + '''');
|
||
sql.Add(',CLMoney=:CLMoney,GZMoney=:GZMoney');
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
Parameters.ParamByName('JSID').Value := Trim(Self.CDS_HZ.fieldbyname('machineNo').AsString) + '#' + Trim(Self.CDS_HZ.fieldbyname('uptime').AsString);
|
||
Parameters.ParamByName('CLMoney').Value := Self.CDS_HZ.fieldbyname('CLMoney').Value;
|
||
Parameters.ParamByName('GZMoney').Value := Self.CDS_HZ.fieldbyname('GZMoney').Value;
|
||
EXECSQL;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' exec P_Kint_Wage_FS_UpDate ');
|
||
sql.Add(' @machineNo=' + Quotedstr(Self.CDS_HZ.fieldbyname('machineNo').AsString));
|
||
sql.Add(' ,@uptime=' + Quotedstr(Self.CDS_HZ.fieldbyname('uptime').AsString));
|
||
// ShowMessage(sql.Text);
|
||
ExecSQL;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
|
||
end;
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Panel2.Visible := False;
|
||
except
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.v2Column21PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
Fcycle, FupTimeCycle, FAddQty, FDecQty, FHSQty: Double;
|
||
FBTMoney, FCLMoney, FJLMoney, FCFMoney, FGZMoney, FCZCarPrice: Double;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
if Trim(mvalue) <> '' then
|
||
FieldByName(FFieldName).Value := Trim(mvalue)
|
||
else
|
||
FieldByName(FFieldName).Value := Null;
|
||
Post;
|
||
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('machineCycleNumber').AsString) <> '' then
|
||
begin
|
||
Fcycle := CDS_HZ.fieldbyname('machineCycleNumber').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
Fcycle := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('upTimeCycle').AsString) <> '' then
|
||
begin
|
||
FupTimeCycle := CDS_HZ.fieldbyname('upTimeCycle').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FupTimeCycle := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('AddQty').AsString) <> '' then
|
||
begin
|
||
FAddQty := CDS_HZ.fieldbyname('AddQty').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FAddQty := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('DecQty').AsString) <> '' then
|
||
begin
|
||
FDecQty := CDS_HZ.fieldbyname('DecQty').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FDecQty := 0;
|
||
end;
|
||
FHSQty := Fcycle + FupTimeCycle + FAddQty - FDecQty;
|
||
if Trim(CDS_HZ.fieldbyname('processPrice').AsString) <> '' then
|
||
begin
|
||
FCZCarPrice := CDS_HZ.fieldbyname('processPrice').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FCZCarPrice := 0;
|
||
end;
|
||
FCLMoney := FHSQty * 0.0001 * FCZCarPrice;
|
||
if Trim(CDS_HZ.fieldbyname('BTMoney').AsString) <> '' then
|
||
begin
|
||
FBTMoney := CDS_HZ.fieldbyname('BTMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FBTMoney := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('JLMoney').AsString) <> '' then
|
||
begin
|
||
FJLMoney := CDS_HZ.fieldbyname('JLMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FJLMoney := 0;
|
||
end;
|
||
if Trim(CDS_HZ.fieldbyname('CFMoney').AsString) <> '' then
|
||
begin
|
||
FCFMoney := CDS_HZ.fieldbyname('CFMoney').AsFloat;
|
||
end
|
||
else
|
||
begin
|
||
FCFMoney := 0;
|
||
end;
|
||
FGZMoney := FBTMoney + FCLMoney + FJLMoney - FCFMoney;
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('HSQty').Value := FHSQty;
|
||
FieldByName('CLMoney').Value := FCLMoney;
|
||
FieldByName('GZMoney').Value := FGZMoney;
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
if Trim(mvalue) <> '' then
|
||
sql.Add('Update SalaryDay Set ' + FFieldName + ' =' + mvalue)
|
||
else
|
||
sql.Add('Update SalaryDay Set ' + FFieldName + ' =Null');
|
||
sql.Add(', HSQty =' + FloatToStr(FHSQty));
|
||
sql.Add(', CLMoney =' + FloatToStr(FCLMoney));
|
||
sql.Add(', GZMoney =' + FloatToStr(FGZMoney));
|
||
sql.Add(' where machineNo=:machineNo');
|
||
sql.Add(' and uptime=:uptime');
|
||
Parameters.ParamByName('machineNo').Value := Self.CDS_HZ.fieldbyname('machineNo').Value;
|
||
Parameters.ParamByName('uptime').Value := Self.CDS_HZ.fieldbyname('uptime').Value;
|
||
EXECSQL;
|
||
end;
|
||
tv2.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton7Click(Sender: TObject);
|
||
var
|
||
FDateStr, maxId: string;
|
||
begin
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
FDateStr := Trim(FormatDateTime('yyyy-MM-dd', BLDate.Date));
|
||
if Application.MessageBox(PChar('ȷ<><C8B7>Ҫ<EFBFBD><D2AA>¼ ' + Trim(FDateStr) + ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'), '', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if GetLSNo(ADOQueryCmd, maxId, '', 'SalaryDay', 3, 1) = False then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from SalaryDay where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('machineId').Value := Trim('<27><>¼');
|
||
FieldByName('salaryId').Value := Trim(maxId);
|
||
FieldByName('icCard').Value := Trim('<27><>¼');
|
||
FieldByName('upTime').Value := Trim(FDateStr);
|
||
FieldByName('scheduleDay').Value := Trim(FDateStr);
|
||
|
||
FieldByName('machineNo').Value := Trim(maxId);
|
||
FieldByName('machineCycleNumber').Value := 0;
|
||
|
||
FieldByName('BLPerson').Value := Trim(DName);
|
||
FieldByName('BLTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
FieldByName('updateTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
FieldByName('BLFlag').Value := 1;
|
||
Post;
|
||
end;
|
||
with CDS_HZ do
|
||
begin
|
||
Append;
|
||
FieldByName('machineId').Value := Trim('<27><>¼');
|
||
FieldByName('salaryId').Value := Trim(maxId);
|
||
FieldByName('upTime').Value := Trim(FDateStr);
|
||
FieldByName('scheduleDay').Value := Trim(FDateStr);
|
||
FieldByName('machineNo').Value := Trim(maxId);
|
||
FieldByName('machineCycleNumber').Value := 0;
|
||
FieldByName('SSel').Value := true;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><>¼ʧ<C2BC><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWageListTKJ.ToolButton8Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then
|
||
Exit;
|
||
if cxTabControl1.TabIndex <> 0 then
|
||
Exit;
|
||
if Trim(CDS_HZ.fieldbyname('machineId').AsString) <> '<27><>¼' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add(' insert into SalaryDay_Delog ');
|
||
sql.Add(' select * from SalaryDay where salaryId=''' + Trim(CDS_HZ.fieldbyname('salaryId').AsString) + '''');
|
||
sql.Add(' Update SalaryDay_Delog Set DelTime=getdate(),DelPerson=''' + Trim(DName) + '''');
|
||
sql.Add(' where salaryId=''' + Trim(CDS_HZ.fieldbyname('salaryId').AsString) + '''');
|
||
sql.Add(' delete SalaryDay where salaryId=''' + Trim(CDS_HZ.fieldbyname('salaryId').AsString) + '''');
|
||
execsql;
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
CDS_HZ.Delete;
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|