D7myYunxiang/工资管理(Wage.dll)/U_KouKuanInPut.pas
DESKTOP-E401PHE\Administrator 1011cb7292 1
2025-01-20 13:04:03 +08:00

682 lines
17 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_KouKuanInPut;
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,
CheckLst;
type
TfrmKouKuanInPut = class(TForm)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
ADOTemp: TADOQuery;
ADOCmd: TADOQuery;
ADOMain: TADOQuery;
ScrollBox1: TScrollBox;
Label2: TLabel;
Label3: TLabel;
Label22: TLabel;
Label27: TLabel;
Label28: TLabel;
CRTime: TDateTimePicker;
CLBZQty: TEdit;
MiShu: TEdit;
ZhenShu: TEdit;
JTNo: TcxButtonEdit;
YGCode: TEdit;
Label37: TLabel;
Label39: TLabel;
Label51: TLabel;
Label24: TLabel;
Price1: TEdit;
ElseWage: TEdit;
Price: TEdit;
Money: TEdit;
Note: TMemo;
OutputWage: TEdit;
Label8: TLabel;
BanCi: TEdit;
Label9: TLabel;
YGName: TEdit;
JXModel: TEdit;
Label10: TLabel;
HXName: TcxButtonEdit;
TouJu: TEdit;
Label13: TLabel;
Label4: TLabel;
KKMoney: TEdit;
Qty1: TEdit;
Label7: TLabel;
Label15: TLabel;
ElseWageName: TcxButtonEdit;
ISMS: TCheckBox;
ISZS: TCheckBox;
IFCLBZ: TCheckBox;
Label16: TLabel;
CLBZMoney: TEdit;
Label1: TLabel;
TXBZQty: TEdit;
IFTXBZ: TCheckBox;
Label6: TLabel;
TXBZMoney: TEdit;
Label12: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label14: TLabel;
KKNote: TcxButtonEdit;
Label17: TLabel;
Label18: TLabel;
Label11: TLabel;
IsPrice: TCheckBox;
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cxButtonEdit3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure qjtsKeyPress(Sender: TObject; var Key: Char);
procedure ScrollBox1Click(Sender: TObject);
procedure HXNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure PDTiaoXian1Change(Sender: TObject);
procedure MiShuExit(Sender: TObject);
procedure ElseWageNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure KKNotePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure ISMSClick(Sender: TObject);
procedure ISZSClick(Sender: TObject);
procedure ISMSExit(Sender: TObject);
procedure IFTXBZClick(Sender: TObject);
procedure IFCLBZClick(Sender: TObject);
procedure JTNoKeyPress(Sender: TObject; var Key: Char);
procedure KKNoteKeyPress(Sender: TObject; var Key: Char);
procedure ElseWageNameKeyPress(Sender: TObject; var Key: Char);
procedure MoneyKeyPress(Sender: TObject; var Key: Char);
procedure NoteKeyPress(Sender: TObject; var Key: Char);
procedure ISMSKeyPress(Sender: TObject; var Key: Char);
procedure IsPriceClick(Sender: TObject);
private
FXS: Integer;
procedure InitData();
function SaveData(): Boolean;
function RoundFloat(f: double; i: integer): double;
procedure DJHJ();
procedure CBHJ();
function Setstring(cString: string): string;
{ Private declarations }
public
PState, PCopyInt: Integer;
FMainId, FSubId, FConNo: string;
{ Public declarations }
end;
var
frmKouKuanInPut: TfrmKouKuanInPut;
implementation
uses
U_DataLink, U_ZDYHelp, U_Fun, U_ZdyAttachCP_HX_Sel, U_ZDYHelpTouJu;
{$R *.dfm}
procedure TfrmKouKuanInPut.DJHJ();
var
FHXName: string;
AZhenShu, FZhenShu, FPrice: Double;
begin
if not IsPrice.Checked then
Exit;
FPrice := 0;
FHXName := Trim(HXName.Text);
FZhenShu := StrToIntDef(ZhenShu.Text, 0);
if ISMS.Checked then
begin
FPrice := 0.5;
end;
if ISZS.Checked then
begin
if Pos('<27><><EFBFBD><EFBFBD>', FHXName) > 0 then
begin
if FZhenShu < 33 then
FPrice := 2.5
else
FPrice := 2.6;
end
else
begin
with ADOTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from KH_ZDY_TJList where ZdyName=''' + Trim(TouJu.Text) + ''' ');
Open;
end;
AZhenShu := ADOTemp.fieldbyname('LJZhenShu').AsFloat;
if FZhenShu < AZhenShu then
FPrice := ADOTemp.fieldbyname('Price1').AsFloat
else
FPrice := ADOTemp.fieldbyname('Price2').AsFloat;
end;
end;
if IFTXBZ.Checked then
begin
FPrice := 3.2;
end;
Price.Text := FloatToStr(FPrice);
end;
function TfrmKouKuanInPut.Setstring(cString: string): string; {<7B><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>}
var
i: integer;
str: string;
begin
str := '';
for i := 1 to length(cString) do
begin
if Pos(cString[i], '0123456789.') <= 0 then
break
else
case cString[i] of
'.':
str := str + '.';
'0':
str := str + '0';
'1':
str := str + '1';
'2':
str := str + '2';
'3':
str := str + '3';
'4':
str := str + '4';
'5':
str := str + '5';
'6':
str := str + '6';
'7':
str := str + '7';
'8':
str := str + '8';
'9':
str := str + '9';
end;
end;
Setstring := str;
end;
function TfrmKouKuanInPut.RoundFloat(f: double; i: integer): double;
var
s: string;
ef: extended;
begin
s := '#.' + StringOfChar('0', i);
ef := StrToFloat(FloatToStr(f)); //<2F><>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
result := StrToFloat(FormatFloat(s, ef));
end;
procedure TfrmKouKuanInPut.CBHJ();
var
FISMS, FISZS, FIFTXBZ, FIFCLBZ: Boolean;
FElseWageName, FHXName: string;
FQty1, FPrice1, FMiShu, AZhenShu, FZhenShu, FPrice, FMoney, FOutputWage, FElseWage, FTXBZMoney, FCLBZMoney, FTXBZQty, FCLBZQty, FKKMoney: Double;
begin
FISMS := ISMS.Checked;
FISZS := ISZS.Checked;
FIFTXBZ := IFTXBZ.Checked;
FIFCLBZ := IFCLBZ.Checked;
FPrice := StrToFloatDef(Price.Text, 0);
FQty1 := StrToFloatDef(Qty1.Text, 0);
FPrice1 := StrToFloatDef(Price1.Text, 0);
FMiShu := StrToFloatDef(MiShu.Text, 0);
FZhenShu := StrToFloatDef(ZhenShu.Text, 0);
FHXName := trim(HXName.Text);
FElseWageName := trim(ElseWageName.Text);
FTXBZQty := StrToFloatDef(TXBZQty.Text, 0);
FCLBZQty := StrToFloatDef(CLBZQty.Text, 0);
FKKMoney := StrToFloatDef(KKMoney.Text, 0);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if FISMS then
FOutputWage := FPrice * FMiShu;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if FISZS then
FOutputWage := FPrice * FZhenShu;
//<2F><><EFBFBD>߲<EFBFBD><DFB2><EFBFBD>
if FIFTXBZ then
FTXBZMoney := FOutputWage * FTXBZQty / 100;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if FIFCLBZ then
FCLBZMoney := FOutputWage * FCLBZQty / 100;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Trim(FElseWageName) <> '' then
FElseWage := FPrice1 * FQty1;
FMoney := FOutputWage + FElseWage + FCLBZMoney + FTXBZMoney - FKKMoney;
OutputWage.Text := floattostr(FOutputWage);
TXBZMoney.Text := floattostr(FTXBZMoney);
CLBZMoney.Text := floattostr(FCLBZMoney);
ElseWage.Text := floattostr(FElseWage);
Money.Text := floattostr(FMoney);
end;
procedure TfrmKouKuanInPut.TBCloseClick(Sender: TObject);
begin
ModalResult := 1;
end;
procedure TfrmKouKuanInPut.InitData();
begin
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select * from GZListMain ');
sql.Add('where GZMainID=''' + FMainId + '''');
Open;
end;
SCSHData(ADOTemp, ScrollBox1, 0);
with ADOTemp do
begin
Close;
SQL.Clear;
sql.Add(' select * from GZListSub ');
sql.Add('where GZSubID=''' + FSubId + '''');
Open;
end;
SCSHData(ADOTemp, ScrollBox1, 1);
if not ADOTemp.IsEmpty then
begin
ISMS.Checked := ADOTemp.FieldByName('ISMS').Value;
ISZS.Checked := ADOTemp.FieldByName('ISZS').Value;
IFTXBZ.Checked := ADOTemp.FieldByName('IFTXBZ').Value;
IFCLBZ.Checked := ADOTemp.FieldByName('IFCLBZ').Value;
IsPrice.Checked := ADOTemp.FieldByName('IsPrice').Value;
end;
end;
procedure TfrmKouKuanInPut.FormShow(Sender: TObject);
begin
InitData();
if PState = 0 then
begin
end;
if PCopyInt = 1 then
begin
FSubId := '';
PState := 0;
MiShu.Text := '0';
ZhenShu.Text := '0';
ElseWageName.Text := '';
Price1.Text := '0';
Qty1.Text := '0';
KKNote.Text := '';
KKMoney.Text := '0';
end;
end;
function TfrmKouKuanInPut.SaveData(): Boolean;
var
maxno, maxSubNo: string;
begin
try
ADOCmd.Connection.BeginTrans;
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Trim(FSubId) = '' then
begin
if GetLSNo(ADOCmd, maxno, 'GZS', 'GZListSub', 3, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
end
else
begin
maxno := Trim(FSubId);
end;
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from GZListSub where GZSubID=''' + Trim(maxno) + '''');
Open;
end;
with ADOCmd do
begin
if ADOCmd.IsEmpty then
Append
else
edit;
FieldByName('GZMainID').Value := Trim(FMainId);
FieldByName('GZSubID').Value := Trim(maxno);
SSetsaveSql(ADOCmd, 'GZListSub', ScrollBox1, 1);
FieldByName('ISMS').Value := ISMS.Checked;
FieldByName('ISZS').Value := ISZS.Checked;
FieldByName('IFTXBZ').Value := IFTXBZ.Checked;
FieldByName('IFCLBZ').Value := IFCLBZ.Checked;
FieldByName('IsPrice').Value := IsPrice.Checked;
if Trim(FSubId) = '' then
begin
FieldByName('Filler').Value := Trim(DName);
FieldByName('FillTime').Value := SGetServerDateTime(ADOTemp);
end
else
begin
// FieldByName('Editer').Value := Trim(DName);
// FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp);
end;
Post;
end;
FSubId := Trim(maxno);
ADOCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmKouKuanInPut.TBSaveClick(Sender: TObject);
begin
Note.SetFocus;
// if Trim(CustomerName.Text)='' then
// begin
// Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
// Exit;
// end;
//
// if TV1.DataController.Summary.FooterSummaryValues[1]<>100 then
// begin
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ϼƱ<CFBC><C6B1><EFBFBD>Ϊ100<30><30>','<27><>ʾ',0);
// Exit;
// end;
if SaveData() then
begin
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
ModalResult := 1;
end;
end;
procedure TfrmKouKuanInPut.FormCreate(Sender: TObject);
begin
// SetWindowLong(Qty.Handle, GWL_STYLE, GetWindowLong(Qty.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(ZzCost.Handle, GWL_STYLE, GetWindowLong(ZzCost.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(DjBzCost.Handle, GWL_STYLE, GetWindowLong(DjBzCost.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(YfCost.Handle, GWL_STYLE, GetWindowLong(YfCost.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(CbPrice.Handle, GWL_STYLE, GetWindowLong(CbPrice.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(Price.Handle, GWL_STYLE, GetWindowLong(Price.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(Lr.Handle, GWL_STYLE, GetWindowLong(Lr.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// SetWindowLong(Lrd.Handle, GWL_STYLE, GetWindowLong(Lrd.Handle, GWL_STYLE) or ES_MULTILINE or ES_RIGHT);
// Bjtime.DateTime := SGetServerDate(ADOTemp);
end;
procedure TfrmKouKuanInPut.cxButtonEdit3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'XHJTXinXi';
flagname := '<27><>̨<EFBFBD><CCA8>Ϣ';
fnote := True;
Label1.Caption := '<27><><EFBFBD><EFBFBD>';
V1Name.Caption := '<27><><EFBFBD><EFBFBD>';
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
JTNo.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
JXModel.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('Note').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmKouKuanInPut.qjtsKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
if not (((Key >= '0') and (Key <= '9')) or (Key = '.') or (Key = #8)) then
begin
Key := #0;
end
else if (pos('.', TEdit(Sender).text) <> 0) then
begin
if Key = '.' then
begin
Key := #0;
end;
end;
end;
procedure TfrmKouKuanInPut.ScrollBox1Click(Sender: TObject);
begin
Note.SetFocus;
end;
procedure TfrmKouKuanInPut.HXNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZdyAttachCP_HX_Sel := TfrmZdyAttachCP_HX_Sel.Create(Application);
with frmZdyAttachCP_HX_Sel do
begin
if ShowModal = 1 then
begin
HXName.Text := Trim(frmZdyAttachCP_HX_Sel.CDS_HZ.fieldbyname('ZdyName').AsString);
TouJu.Text := Trim(frmZdyAttachCP_HX_Sel.CDS_HZ.fieldbyname('defstr2').AsString);
end;
end;
finally
frmZdyAttachCP_HX_Sel.Free;
end;
CBHJ();
end;
procedure TfrmKouKuanInPut.PDTiaoXian1Change(Sender: TObject);
begin
CBHJ();
end;
procedure TfrmKouKuanInPut.MiShuExit(Sender: TObject);
begin
DJHJ();
CBHJ();
end;
procedure TfrmKouKuanInPut.ElseWageNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'ElseWageName';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ';
fnote := True;
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
ElseWageName.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
Price1.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('Note').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmKouKuanInPut.cxButtonEdit1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'ElseWageName';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ';
fnote := True;
V1Note.Caption := '<27><><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
ElseWageName.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
Price1.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('Note').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmKouKuanInPut.KKNotePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'KKNote';
flagname := '<27>ۿ<EFBFBD><DBBF><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
KKNote.Text := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmKouKuanInPut.ISMSClick(Sender: TObject);
begin
if not ISMS.Checked then
begin
ISZS.Checked := True;
end
else
begin
ISZS.Checked := False;
end;
end;
procedure TfrmKouKuanInPut.ISZSClick(Sender: TObject);
begin
if not ISZS.Checked then
begin
ISMS.Checked := True;
end
else
begin
ISMS.Checked := False;
end;
end;
procedure TfrmKouKuanInPut.ISMSExit(Sender: TObject);
begin
CBHJ();
end;
procedure TfrmKouKuanInPut.IFTXBZClick(Sender: TObject);
begin
if not IFTXBZ.Checked then
begin
IFCLBZ.Checked := True;
end
else
begin
IFCLBZ.Checked := False;
end;
end;
procedure TfrmKouKuanInPut.IFCLBZClick(Sender: TObject);
begin
if not IFCLBZ.Checked then
begin
IFTXBZ.Checked := True;
end
else
begin
IFTXBZ.Checked := False;
end;
end;
procedure TfrmKouKuanInPut.JTNoKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmKouKuanInPut.KKNoteKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmKouKuanInPut.ElseWageNameKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmKouKuanInPut.MoneyKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmKouKuanInPut.NoteKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmKouKuanInPut.ISMSKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SelectNext(ActiveControl as TWinControl, True, True);
end;
end;
procedure TfrmKouKuanInPut.IsPriceClick(Sender: TObject);
begin
DJHJ();
CBHJ();
end;
end.