RTFormwork/项目代码/RTBasicsV1/A01基础公司管理/U_EmployeeInPut.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

321 lines
8.2 KiB
ObjectPascal
Raw Permalink 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_EmployeeInPut;
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, cxCalendar, StrUtils,
cxDropDownEdit, jpeg, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdFTP, cxPC, cxGridCustomPopupMenu, cxGridPopupMenu, Menus,
ExtDlgs, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu;
type
TfrmYGInPut = class(TForm)
ToolBar1: TToolBar;
TBClose: TToolButton;
ADOTemp: TADOQuery;
ADOCmd: TADOQuery;
TBSave: TToolButton;
DataSource1: TDataSource;
Order_Sub: TClientDataSet;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1YGName: TcxGridDBColumn;
v1Column1: TcxGridDBColumn;
v1GangWei: TcxGridDBColumn;
v1YGSex: TcxGridDBColumn;
v1Phone: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
v1RuZhiDate: TcxGridDBColumn;
cxGridPopupMenu1: TcxGridPopupMenu;
v1SFZNo: TcxGridDBColumn;
v1YGNo: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
Tv1Column2: TcxGridDBColumn;
Tv1Column3: TcxGridDBColumn;
Tv1Column4: TcxGridDBColumn;
Tv1Column5: TcxGridDBColumn;
Tv1Column6: TcxGridDBColumn;
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure v1SYRNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure v1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
private
TPInt: Integer;
procedure InitData();
function SaveData(): Boolean;
function SaveMXData(Tv11: TcxGridDBTableView; CDS1: TClientDataSet; FMaxNo, FYOType: string): Boolean;
procedure SaveImageOther();
procedure InitImage();
{ Private declarations }
public
canshu1: string;
PState, CopyInt: Integer;
FMainId, FDPID, FDPName: string;
{ Public declarations }
end;
var
frmYGInPut: TfrmYGInPut;
implementation
uses
U_DataLink, U_ZDYHelp, U_RTFun;
{$R *.dfm}
procedure TfrmYGInPut.TBCloseClick(Sender: TObject);
begin
WriteCxGrid(<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>2', Tv1, '<27><><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmYGInPut.InitData();
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('select * from SY_Employee where EEID=''' + Trim(FMainId) + '''');
Open;
end;
SCreateCDS(ADOCmd, Order_Sub);
SInitCDSData(ADOCmd, Order_Sub);
end;
procedure TfrmYGInPut.FormShow(Sender: TObject);
begin
ReadCxGrid(<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>2', Tv1, '<27><><EFBFBD><EFBFBD>');
InitData();
end;
function TfrmYGInPut.SaveData(): Boolean;
var
maxno, FHZStatus: string;
begin
Result := False;
try
ADOCmd.Connection.BeginTrans;
with Order_Sub do
begin
first;
while not eof do
begin
if Trim(Order_Sub.fieldbyname('EEID').AsString) = '' then
begin
if GetLSNo(ADOCmd, maxno, 'OA', 'SY_Employee', 4, 1) = False then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxno := Trim(Order_Sub.fieldbyname('EEID').AsString);
end;
with ADOCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from SY_Employee where EEID=''' + Trim(maxno) + '''');
Open;
end;
with ADOCmd do
begin
if ADOCmd.IsEmpty then
begin
Append;
FieldByName('Filler').Value := Trim(DName);
end
else
begin
edit;
FieldByName('Editer').Value := Trim(DName);
FieldByName('Edittime').Value := SGetServerDateTime(ADOTemp);
end;
FieldByName('EEID').Value := Trim(maxno);
FieldByName('EEType').Value := '<27><>ʽ';
fieldbyname('DPID').Value := Trim(FDPID);
RTSetSaveDataCDS(ADOCmd, Tv1, Order_Sub, 'SY_Employee', 0);
post;
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from SY_Employee where EECode=''' + Trim(Order_Sub.fieldbyname('EECode').AsString) + '''');
Open;
end;
if ADOCmd.RecordCount > 1 then
begin
ADOCmd.Connection.RollbackTrans;
application.MessageBox(PChar(<><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' + trim(ADOCmd.fieldbyname('EECode').AsString) + '<27>Ѵ<EFBFBD><D1B4><EFBFBD>'), '<27><>ʾ');
Exit;
end;
with Order_Sub do
begin
Edit;
FieldByName('EEID').Value := Trim(maxno);
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('exec P_EE_in_Account @DataID=''' + Trim(maxno) + '''');
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
ADOCmd.Connection.RollbackTrans;
Application.MessageBox(PChar(ADOCmd.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
exit;
end;
next;
end;
end;
ADOCmd.Connection.CommitTrans;
Result := True;
except
;
Result := False;
ADOCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
function TfrmYGInPut.SaveMXData(Tv11: TcxGridDBTableView; CDS1: TClientDataSet; FMaxNo, FYOType: string): Boolean;
begin
end;
procedure TfrmYGInPut.InitImage();
begin
end;
procedure TfrmYGInPut.TBSaveClick(Sender: TObject);
var
FSFNO: string;
begin
ToolBar1.SetFocus;
if Order_Sub.Locate('IdCard', '', []) = true then
begin
application.MessageBox('<27><><EFBFBD><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>Ϊ<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 TfrmYGInPut.SaveImageOther();
begin
end;
procedure TfrmYGInPut.ToolButton1Click(Sender: TObject);
begin
with Order_Sub do
begin
Append;
fieldbyname('EntryDate').Value := SGetServerDate(ADOTemp);
FieldByName('Dept').Value := Trim(FDPName);
Post;
end;
end;
procedure TfrmYGInPut.ToolButton2Click(Sender: TObject);
begin
if Order_Sub.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
if Trim(Order_Sub.fieldbyname('EEID').AsString) <> '' then
begin
with ADOCmd do
begin
Close;
sql.Clear;
sql.Add('delete SY_Employee where EEID=''' + Trim(Order_Sub.fieldbyname('EEID').AsString) + '''');
ExecSQL;
end;
with ADOCmd do
begin
Close;
SQL.Clear;
sql.Add('exec P_EE_in_Account @DataID=''' + Trim(Order_Sub.fieldbyname('EEID').AsString) + '''');
Open;
end;
if ADOCmd.FieldByName('intReturn').AsInteger = -1 then
begin
Application.MessageBox(PChar(ADOCmd.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
exit;
end;
end;
Order_Sub.Delete;
end;
procedure TfrmYGInPut.v1SYRNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
frmZDYHelp := TfrmZDYHelp.Create(self);
with frmZDYHelp do
begin
flag := 'SYRName';
flagName := '<27><><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
with Order_Sub do
begin
edit;
FieldByName('SYRName').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
free;
end;
end;
procedure TfrmYGInPut.v1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
flag := 'BZName';
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if ShowModal = 1 then
begin
with Order_Sub do
begin
Edit;
FieldByName('BZName').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
end;
end;
end;
finally
frmZDYHelp.Free;
end;
end;
end.