332 lines
8.2 KiB
ObjectPascal
332 lines
8.2 KiB
ObjectPascal
unit U_WorkerDeptFeeInPut_JKSQ;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
||
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
||
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
||
ExtCtrls, BtnEdit, cxDropDownEdit, cxCalendar, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, cxCurrencyEdit;
|
||
|
||
type
|
||
TfrmWorkerDeptFeeInPut_JKSQ = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
ADOQuery1: TADOQuery;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
Panel1: TPanel;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label3: TLabel;
|
||
Label5: TLabel;
|
||
Label9: TLabel;
|
||
WFDate: TDateTimePicker;
|
||
PriceUnit: TBtnEditA;
|
||
Worker: TEdit;
|
||
Label6: TLabel;
|
||
FSDate: TDateTimePicker;
|
||
WFType: TComboBox;
|
||
Label8: TLabel;
|
||
Person1: TBtnEditA;
|
||
Label10: TLabel;
|
||
Person3: TBtnEditA;
|
||
Label11: TLabel;
|
||
Person2: TBtnEditA;
|
||
Label12: TLabel;
|
||
Person4: TComboBox;
|
||
Label13: TLabel;
|
||
Label4: TLabel;
|
||
filltime: TDateTimePicker;
|
||
HZMoney: TcxCurrencyEdit;
|
||
Label7: TLabel;
|
||
Note: TMemo;
|
||
Label14: TLabel;
|
||
selfMoney: TEdit;
|
||
Label15: TLabel;
|
||
ChkNote: TBtnEditA;
|
||
Label16: TLabel;
|
||
JKYongTu: TBtnEditA;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure PriceUnitBtnClick(Sender: TObject);
|
||
procedure Person1BtnClick(Sender: TObject);
|
||
procedure Person2BtnClick(Sender: TObject);
|
||
procedure Person3BtnClick(Sender: TObject);
|
||
procedure ChkNoteBtnClick(Sender: TObject);
|
||
procedure JKYongTuBtnClick(Sender: TObject);
|
||
private
|
||
FXS:Integer;
|
||
procedure InitData();
|
||
function SaveData():Boolean;
|
||
{ Private declarations }
|
||
public
|
||
PState,PCopyInt:Integer;
|
||
FMainId,FConNo,FConType:String;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmWorkerDeptFeeInPut_JKSQ: TfrmWorkerDeptFeeInPut_JKSQ;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun,U_GYSList,U_ZDYHelpSel,U_YGCXList,
|
||
U_SYDeptUserView, U_SYDeptView, U_WorkerDeptFeeInPut_XYS;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.InitData();
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select A.*,B.* from Worker_Fee_Main A left join Worker_Fee_Sub B on A.WFID=B.WFID');
|
||
sql.Add(' where A.WFID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCSHDataNew(ADOQuery1,Panel1,0);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Worker_Fee_Sub ');
|
||
sql.Add(' where WFID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,Order_Sub);
|
||
SInitCDSData20(ADOQuery1,Order_Sub);
|
||
if PState=0 then
|
||
begin
|
||
WFDate.DateTime:=SGetServerDate(ADOTemp);
|
||
WFDate.Checked:=False;
|
||
FSDate.DateTime:=SGetServerDate(ADOTemp);
|
||
FSDate.Checked:=False;
|
||
filltime.DateTime:=SGetServerDate(ADOTemp);
|
||
Worker.Text:=trim(frmWorkerDeptFeeInPut_XYS.Worker.Text);
|
||
Person1.Text:=trim(frmWorkerDeptFeeInPut_XYS.Person1.Text);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmWorkerDeptFeeInPut_JKSQ.SaveData():Boolean;
|
||
var
|
||
maxno,maxSubNo:String;
|
||
begin
|
||
try
|
||
Result:=False;
|
||
ADOCmd.Connection.BeginTrans;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'WF','Worker_Fee_Main',3,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(FMainId);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Worker_Fee_Main where WFId='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('WFId').Value:=Trim(maxno);
|
||
RTSetsavedata(ADOCmd,'Worker_Fee_Main',Panel1,0);
|
||
FieldByName('HZStatus').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fieldbyname('ItemName').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥';
|
||
if selfMoney.Text='' then
|
||
selfMoney.Text:='0';
|
||
if HZMoney.Text='' then
|
||
HZMoney.Text:='0';
|
||
fieldbyname('BXMoney').Value:=floattostr(strtofloat(HZMoney.Text)*(1+strtofloat(selfMoney.Text))/1000);
|
||
fieldbyname('HZMoney').value:=HZMoney.Text;
|
||
fieldbyname('selfMoney').Value:=selfMoney.Text;
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
FieldByName('FillerCode').Value:=Trim(DCode);
|
||
FieldByName('FillCode').Value:=Trim(DCode);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditerCode').Value:=Trim(DCode);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
Post;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.TBSaveClick(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
FPPrice,PRTPrice,BCMoney,FPQty,ChaMoney:string;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if WFDate.Checked=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if FSDate.Checked=False then
|
||
begin
|
||
Application.MessageBox('Ԥ<>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if PerSon1.text='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if HZMoney.Text='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD><CEAA>','<27><>ʾ');
|
||
exit;
|
||
end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.PriceUnitBtnClick(Sender: TObject);
|
||
begin
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='PriceUnit';
|
||
flagname:='<27><><EFBFBD><EFBFBD>';
|
||
if showModal=1 then
|
||
begin
|
||
PriceUnit.Text:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.Person1BtnClick(Sender: TObject);
|
||
begin
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='ZhaiYao';
|
||
flagname:='<27><><EFBFBD>';
|
||
if showModal=1 then
|
||
begin
|
||
Person1.Text:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.Person2BtnClick(Sender: TObject);
|
||
begin
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='Person2';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>';
|
||
if showModal=1 then
|
||
begin
|
||
Person2.Text:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.Person3BtnClick(Sender: TObject);
|
||
begin
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='Person3';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
if showModal=1 then
|
||
begin
|
||
Person3.Text:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.ChkNoteBtnClick(Sender: TObject);
|
||
begin
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='HKType';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
|
||
TBAdd.Visible:=False;
|
||
TBDel.Visible:=False;
|
||
TBEdit.Visible:=False;
|
||
TBSave.Visible:=False;
|
||
|
||
if showModal=1 then
|
||
begin
|
||
ChkNote.Text:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmWorkerDeptFeeInPut_JKSQ.JKYongTuBtnClick(Sender: TObject);
|
||
begin
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='JKYongTu';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;';
|
||
if showModal=1 then
|
||
begin
|
||
JKYongTu.Text:=trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
free;
|
||
end;
|
||
end;
|
||
|
||
end.
|