243 lines
5.8 KiB
ObjectPascal
243 lines
5.8 KiB
ObjectPascal
unit U_GKInput;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, StrUtils, 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, cxDropDownEdit, BtnEdit, cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, dxDateRanges, dxBarBuiltInMenu, U_BaseList, cxContainer, dxCore,
|
||
cxDateUtils, cxImage, cxDBEdit, IdExplicitTLSClientServerBase, cxMemo,
|
||
U_BaseInput, System.ImageList, Vcl.ImgList, cxImageList, dxSkinsCore,
|
||
dxSkinsDefaultPainters;
|
||
|
||
type
|
||
TfrmGKInput = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton3: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
Label2: TLabel;
|
||
Label6: TLabel;
|
||
Label39: TLabel;
|
||
GKCS: TcxTextEdit;
|
||
GKNO: TcxTextEdit;
|
||
GKBH: TcxTextEdit;
|
||
Label7: TLabel;
|
||
GKKH: TcxTextEdit;
|
||
Label3: TLabel;
|
||
Note: TcxMemo;
|
||
Label1: TLabel;
|
||
GKSpec: TcxTextEdit;
|
||
Label4: TLabel;
|
||
Price: TcxTextEdit;
|
||
Label5: TLabel;
|
||
DQZL: TcxTextEdit;
|
||
Label26: TLabel;
|
||
GKGYS: TcxButtonEdit;
|
||
Label8: TLabel;
|
||
IODate: 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 ToolButton3Click(Sender: TObject);
|
||
procedure CoareaBtnDnClick(Sender: TObject);
|
||
procedure GKGYSPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
function SaveData(): Boolean;
|
||
public
|
||
fFlileFlag: string;
|
||
fkhType: string;
|
||
{ Public declarations }
|
||
FGKID: string;
|
||
end;
|
||
|
||
var
|
||
frmGKInput: TfrmGKInput;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmGKInput.InitGrid();
|
||
begin
|
||
try
|
||
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered := False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from BS_GK where GKID=''' + Trim(FGKID) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOQueryMain, ScrollBox1, 2);
|
||
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGKInput.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmGKInput := nil;
|
||
end;
|
||
|
||
procedure TfrmGKInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmGKInput.TBCloseClick(Sender: TObject);
|
||
begin
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
procedure TfrmGKInput.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
InitGrid();
|
||
|
||
if FGKID = '' then
|
||
begin
|
||
IODate.Date := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmGKInput.GKGYSPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.GKGYS.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGKInput.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
function TfrmGKInput.SaveData(): Boolean;
|
||
var
|
||
MaxId, MaxSubId, FCoCode, FCCID, MaxCFID: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if Trim(FGKID) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, MaxId, 'GK', 'BS_GK', 4, 1) = False then
|
||
begin
|
||
Result := False;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
end
|
||
else
|
||
begin
|
||
MaxId := Trim(FGKID);
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from BS_GK where GKID=''' + Trim(FGKID) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FGKID) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('Edittime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('GKID').Value := Trim(MaxId);
|
||
RTSetsavedata(ADOQueryCmd, 'BS_GK', ScrollBox1, 2);
|
||
Post;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from BS_GK where GKNo=' + quotedstr(trim(GKNo.Text)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.RecordCount > 1 then
|
||
begin
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
FCCID := Trim(MaxSubId);
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGKInput.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if Trim(GKNo.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmGKInput.CoareaBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).Text := '';
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
end;
|
||
|
||
end.
|
||
|