287 lines
7.1 KiB
ObjectPascal
287 lines
7.1 KiB
ObjectPascal
|
unit U_BankFlowIOInput;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, ComCtrls, ToolWin, DB, ADODB, cxControls, cxContainer, cxEdit,
|
|||
|
cxTextEdit, cxCurrencyEdit, BtnEdit, StdCtrls, ExtCtrls, cxGraphics,
|
|||
|
cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters;
|
|||
|
|
|||
|
type
|
|||
|
TfrmBankFlowIOInput = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TSAVE: TToolButton;
|
|||
|
Tclose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
Label11: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
note: TMemo;
|
|||
|
BFTime: TDateTimePicker;
|
|||
|
ADOQueryTMP: TADOQuery;
|
|||
|
ADOQueryCMD: TADOQuery;
|
|||
|
Amount: TcxCurrencyEdit;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
OurBKName: TBtnEditC;
|
|||
|
OppBKName: TBtnEditC;
|
|||
|
procedure TcloseClick(Sender: TObject);
|
|||
|
procedure TSAVEClick(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure OppBKNameBtnUpClick(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure OurBKNameBtnUpClick(Sender: TObject);
|
|||
|
procedure OppCoNameBtnDnClick(Sender: TObject);
|
|||
|
private
|
|||
|
function savedata(): Boolean;
|
|||
|
procedure initdata();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FBFID: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmBankFlowIOInput: TfrmBankFlowIOInput;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_ZDYHelp, U_RTFun, U_DataLink, U_BankSel, U_CompanySel;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
procedure TfrmBankFlowIOInput.initdata();
|
|||
|
begin
|
|||
|
with ADOQueryTMP do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.clear;
|
|||
|
sql.Add('select * from BS_Bank_Flow ');
|
|||
|
sql.Add('where BFID=' + quotedstr(trim(FBFID)));
|
|||
|
open;
|
|||
|
|
|||
|
end;
|
|||
|
if not ADOQueryTMP.isempty then
|
|||
|
begin
|
|||
|
SCSHData(ADOQueryTMP, Panel1, 0);
|
|||
|
OurBKName.TxtCode := ADOQueryTMP.FieldByName('OurBKID').AsString;
|
|||
|
OppBKName.TxtCode := ADOQueryTMP.FieldByName('OppBKID').AsString;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
function TfrmBankFlowIOInput.savedata(): Boolean;
|
|||
|
var
|
|||
|
MaxNo, ZMaxNo: string;
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryCMD.Connection.BeginTrans;
|
|||
|
if Trim(FBFID) = '' then
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCMD, MaxNo, 'YL', 'BS_Bank_Flow', 4, 1) = False then
|
|||
|
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
end
|
|||
|
else
|
|||
|
MaxNo := FBFID;
|
|||
|
|
|||
|
ZMaxNo := 'Z' + MaxNo;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from BS_Bank_Flow where BFID=''' + Trim(MaxNo) + ''' ');
|
|||
|
Open;
|
|||
|
if Trim(FBFID) = '' then
|
|||
|
begin
|
|||
|
Append;
|
|||
|
fieldbyname('fillid').Value := trim(DCode);
|
|||
|
fieldbyname('filler').Value := trim(Dname);
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
fieldbyname('Editid').Value := trim(DCode);
|
|||
|
Fieldbyname('Editer').Value := trim(Dname);
|
|||
|
Fieldbyname('Edittime').Value := SGetServerDateTime(adoqueryTmp);
|
|||
|
end;
|
|||
|
RTSetsavedata(ADOQueryCmd, 'BS_Bank_Flow', Panel1, 0);
|
|||
|
FieldByName('BFID').Value := Trim(MaxNo);
|
|||
|
FieldByName('BFType').Value := 'ת<><D7AA>';
|
|||
|
fieldbyname('inAmount').Value := 0;
|
|||
|
fieldbyname('OutAmount').Value := strtofloatdef(trim(Amount.Text), 0);
|
|||
|
fieldbyname('status').Value := '0';
|
|||
|
fieldbyname('OurBKID').Value := OurBKName.TxtCode;
|
|||
|
fieldbyname('OppBKID').Value := OppBKName.TxtCode;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('delete from BS_Bank_Flow where fromID=''' + Trim(MaxNo) + ''' ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from BS_Bank_Flow where 1=2 ');
|
|||
|
Open;
|
|||
|
Append;
|
|||
|
RTSetsavedata(ADOQueryCmd, 'BS_Bank_Flow', Panel1, 0);
|
|||
|
fieldbyname('fillid').Value := trim(DCode);
|
|||
|
fieldbyname('filler').Value := trim(Dname);
|
|||
|
FieldByName('fromID').Value := Trim(MaxNo);
|
|||
|
FieldByName('BFID').Value := Trim(ZMaxNo);
|
|||
|
FieldByName('BFType').Value := 'ת<><D7AA>';
|
|||
|
fieldbyname('inAmount').Value := strtofloatdef(trim(Amount.Text), 0);
|
|||
|
fieldbyname('OutAmount').Value := 0;
|
|||
|
fieldbyname('OurBKID').Value := OppBKName.TxtCode;
|
|||
|
fieldbyname('OurBKName').Value := OppBKName.Text;
|
|||
|
fieldbyname('OppBKID').Value := OurBKName.TxtCode;
|
|||
|
fieldbyname('OppBKName').Value := OurBKName.Text;
|
|||
|
fieldbyname('status').Value := '0';
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
ADOquerycmd.Connection.CommitTrans;
|
|||
|
FBFID := MaxNo;
|
|||
|
|
|||
|
Result := True;
|
|||
|
except
|
|||
|
Result := false;
|
|||
|
ADOquerycmd.Connection.RollbackTrans;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.TcloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.ToolButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if OurBKName.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>ҷ<EFBFBD><D2B7>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if OppBKName.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Է<EFBFBD><D4B7>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Amount.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if SaveData() then
|
|||
|
begin
|
|||
|
Amount.Text := '';
|
|||
|
FBFID := '';
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.TSAVEClick(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
if OurBKName.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>ҷ<EFBFBD><D2B7>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
if OppBKName.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>Է<EFBFBD><D4B7>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Amount.Text = '' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD>գ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if SaveData() then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmBankFlowIOInput := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
BFTime.DateTime := SGetServerDate(adoqueryTmp);
|
|||
|
|
|||
|
initData();
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel1.Align := alclient;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.OppBKNameBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmBankSel := TfrmBankSel.Create(self);
|
|||
|
with frmBankSel do
|
|||
|
begin
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
SELF.OppBKName.TxtCode := Trim(CDS_1.fieldbyname('BKID').AsString);
|
|||
|
SELF.OppBKName.Text := Trim(CDS_1.fieldbyname('BankName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBankSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.OppCoNameBtnDnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
TBtnEditC(Sender).Text := '';
|
|||
|
TBtnEditC(Sender).TxtCode := '';
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmBankFlowIOInput.OurBKNameBtnUpClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmBankSel := TfrmBankSel.Create(self);
|
|||
|
with frmBankSel do
|
|||
|
begin
|
|||
|
|
|||
|
if showmodal = 1 then
|
|||
|
begin
|
|||
|
SELF.OurBKName.TxtCode := Trim(CDS_1.fieldbyname('BKID').AsString);
|
|||
|
SELF.OurBKName.Text := Trim(CDS_1.fieldbyname('BankName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmBankSel.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|