437 lines
11 KiB
ObjectPascal
437 lines
11 KiB
ObjectPascal
unit U_BankMoneyGYSInPut;
|
||
|
||
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, cxPC, cxDropDownEdit, BtnEdit;
|
||
|
||
type
|
||
TfrmBankMoneyGYSInPut = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton4: TToolButton;
|
||
Label4: TLabel;
|
||
Note: TEdit;
|
||
Label12: TLabel;
|
||
JSMoney: TEdit;
|
||
Label3: TLabel;
|
||
CRTime: TDateTimePicker;
|
||
FactoryName: TBtnEditC;
|
||
Label5: TLabel;
|
||
Label6: TLabel;
|
||
YFName: TBtnEditC;
|
||
Label7: TLabel;
|
||
ADOQueryMain: TADOQuery;
|
||
CRType1: TEdit;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
CRType2: TEdit;
|
||
Label10: TLabel;
|
||
ConNo: TEdit;
|
||
Label11: TLabel;
|
||
CRType4: TEdit;
|
||
Label8: TLabel;
|
||
CRType3: TEdit;
|
||
CRType5: TEdit;
|
||
Label9: TLabel;
|
||
Label13: TLabel;
|
||
CRType6: TEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure FactoryNameBtnUpClick(Sender: TObject);
|
||
procedure FactoryNameBtnDnClick(Sender: TObject);
|
||
procedure YFNameBtnUpClick(Sender: TObject);
|
||
procedure YFNameBtnDnClick(Sender: TObject);
|
||
procedure CRType1Click(Sender: TObject);
|
||
procedure CRType2Click(Sender: TObject);
|
||
procedure CRType4Click(Sender: TObject);
|
||
procedure CRType3Click(Sender: TObject);
|
||
procedure CRType5Click(Sender: TObject);
|
||
procedure CRType6Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FKType:string;
|
||
procedure InitData();
|
||
function SaveData():Boolean;
|
||
|
||
public
|
||
{ Public declarations }
|
||
FMainId:String;
|
||
|
||
end;
|
||
|
||
var
|
||
frmBankMoneyGYSInPut: TfrmBankMoneyGYSInPut;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun,U_GSListBankSel,U_GYSListSelJJ;
|
||
|
||
{$R *.dfm}
|
||
|
||
|
||
|
||
procedure TfrmBankMoneyGYSInPut.InitData();
|
||
var
|
||
FFYFName:String;
|
||
begin
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select A.*,B.BankNo,B.BankName,B.HuMingJC ');
|
||
sql.Add(' from YS_Money_CR A');
|
||
sql.Add(' left join KH_Sub_Bank B on A.BKNO=B.BKNO');
|
||
sql.Add(' left join KH_Main C on B.KHMainId=C.KHMainId');
|
||
sql.Add(' where YFID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
FFYFName:=Trim(ADOQueryMain.fieldbyname('FKType').AsString);
|
||
|
||
SCSHDataNew(ADOQueryMain,Panel1,2);
|
||
SCSHDataNew(ADOQueryMain,Panel1,0);
|
||
if FFYFName='<27>Ը<EFBFBD>' then
|
||
begin
|
||
CRType1.text:='<27><>';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
end
|
||
else if FFYFName='<27><>Ӧ<EFBFBD>̵渶' then
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='<27><>';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
end
|
||
else if FFYFName='<27>ۿ<EFBFBD>' then
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='<27><>';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
end
|
||
else if FFYFName='<27><>˰<EFBFBD><CBB0>' then
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='<27><>';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
end
|
||
else if FFYFName='<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>' then
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='<27><>';
|
||
CRType6.Text:='';
|
||
end
|
||
else if FFYFName='<27><><EFBFBD><EFBFBD>' then
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='<27><>';
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmBankMoneyGYSInPut.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmBankMoneyGYSInPut:=nil;
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
end;
|
||
procedure TfrmBankMoneyGYSInPut.FormShow(Sender: TObject);
|
||
begin
|
||
CRTime.Date:=SGetServerDate(ADOQueryTemp);
|
||
if Trim(FMainId)<>'' then
|
||
begin
|
||
InitData();
|
||
end;
|
||
end;
|
||
|
||
function TfrmBankMoneyGYSInPut.SaveData():Boolean;
|
||
var
|
||
maxId:String;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YS_Money_CR where YFID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
FMainId:=Trim(ADOQueryCmd.fieldbyname('YFID').AsString);
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxId,'YU','YS_Money_CR',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:=FMainId;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YS_Money_CR where YFID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('ChkStatusP').Value:='δ<><CEB4><EFBFBD><EFBFBD>';
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('YFID').Value:=Trim(maxId);
|
||
|
||
FieldByName('CRType').Value:='<27><>Ӧ<EFBFBD>̷<EFBFBD><CCB7>ù<EFBFBD><C3B9><EFBFBD>';
|
||
FieldByName('CRFlag').Value:='<27><><EFBFBD>ù<EFBFBD><C3B9><EFBFBD>';
|
||
FieldByName('BZType').Value:='<27><>';
|
||
if Trim(CRType1.Text)<>'' then
|
||
begin
|
||
FieldByName('FKType').Value:=Trim(CRType1.Hint);
|
||
FieldByName('QtyFlag').Value:=0;
|
||
end else
|
||
if Trim(CRType2.Text)<>'' then
|
||
begin
|
||
FieldByName('FKType').Value:=Trim(CRType2.Hint);
|
||
FieldByName('QtyFlag').Value:=1;
|
||
end else
|
||
if Trim(CRType3.Text)<>'' then
|
||
begin
|
||
FieldByName('FKType').Value:=Trim(CRType3.Hint);
|
||
FieldByName('QtyFlag').Value:=1;
|
||
end else
|
||
if Trim(CRType4.Text)<>'' then
|
||
begin
|
||
FieldByName('FKType').Value:=Trim(CRType4.Hint);
|
||
FieldByName('QtyFlag').Value:=-1;
|
||
end else
|
||
if Trim(CRType5.Text)<>'' then
|
||
begin
|
||
FieldByName('FKType').Value:=Trim(CRType5.Hint);
|
||
FieldByName('QtyFlag').Value:=-1;
|
||
end else
|
||
if Trim(CRType6.Text)<>'' then
|
||
begin
|
||
FieldByName('FKType').Value:=Trim(CRType6.Hint);
|
||
FieldByName('QtyFlag').Value:=-1;
|
||
end;
|
||
FieldByName('FactoryNo').Value:=Trim(FactoryName.TxtCode);
|
||
RTSetsavedata(ADOQueryCmd,'YS_Money_CR',Panel1,2);
|
||
Post;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YS_Money_CR Set Money=JSMoney where YFID='''+Trim(maxId)+'''');
|
||
ExecSQL;
|
||
end;
|
||
FMainId:=Trim(maxId);
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Result:=True;
|
||
except
|
||
Result:=True;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.ToolButton4Click(Sender: TObject);
|
||
var
|
||
FReal:Double;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(FactoryName.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><>Ӧ<EFBFBD>̲<EFBFBD><CCB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Trim(JSMoney.Text)<>'' then
|
||
begin
|
||
if TryStrToFloat(JSMoney.Text,FReal)=False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
{if StrToFloat(JSMoney.Text)<0 then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EEB2BB>С<EFBFBD><D0A1><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end; }
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
end;
|
||
end;
|
||
|
||
|
||
procedure TfrmBankMoneyGYSInPut.FactoryNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmGYSListSelJJ:=TfrmGYSListSelJJ.Create(Application);
|
||
with frmGYSListSelJJ do
|
||
begin
|
||
frmGYSListSelJJ.canshu2:='<27><>Ȩ<EFBFBD><C8A8>';
|
||
if ShowModal=1 then
|
||
begin
|
||
FactoryName.Text:=Trim(frmGYSListSelJJ.CDS_HZ.fieldbyname('KHNameJC').AsString);
|
||
FactoryName.TxtCode:=Trim(frmGYSListSelJJ.CDS_HZ.fieldbyname('KHNO').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSListSelJJ.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.FactoryNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
FactoryName.Text:='';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.YFNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='YFNameGYS';
|
||
flagname:='<27><>ĿժҪ';
|
||
if ShowModal=1 then
|
||
begin
|
||
YFName.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.YFNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
yfname.Text:='';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.CRType1Click(Sender: TObject);
|
||
begin
|
||
CRType1.Text:='<27><>';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
FKType:='<27>Ը<EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.CRType2Click(Sender: TObject);
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='<27><>';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
FKType:='<27><>Ӧ<EFBFBD>̵渶';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.CRType4Click(Sender: TObject);
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='<27><>';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
FKType:='<27>ۿ<EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.CRType3Click(Sender: TObject);
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='<27><>';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='';
|
||
FKType:='<27><>˰<EFBFBD><CBB0>';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.CRType5Click(Sender: TObject);
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='<27><>';
|
||
CRType6.Text:='';
|
||
FKType:='<27><><EFBFBD><EFBFBD>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>';
|
||
end;
|
||
|
||
procedure TfrmBankMoneyGYSInPut.CRType6Click(Sender: TObject);
|
||
begin
|
||
CRType1.Text:='';
|
||
CRType2.Text:='';
|
||
CRType3.Text:='';
|
||
CRType4.Text:='';
|
||
CRType5.Text:='';
|
||
CRType6.Text:='<27><>';
|
||
FKType:='<27><><EFBFBD><EFBFBD>';
|
||
end;
|
||
|
||
end.
|