RTFormwork/项目代码/RTBasicsV1/A09财务通用管理/U_BankFlowOutInput.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

351 lines
9.3 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_BankFlowOutInput;
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
TfrmBankFlowOutInput = 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;
Label7: TLabel;
ToolButton1: TToolButton;
OppCoName: TBtnEditC;
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);
procedure OppCoNameBtnUpClick(Sender: TObject);
private
function savedata(): Boolean;
procedure initdata();
{ Private declarations }
public
FBFID: string;
{ Public declarations }
end;
var
frmBankFlowOutInput: TfrmBankFlowOutInput;
implementation
uses
U_ZDYHelp, U_RTFun, U_DataLink, U_BankSel, U_CompanySel;
{$R *.dfm}
procedure TfrmBankFlowOutInput.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;
OppCoName.TxtCode := ADOQueryTMP.FieldByName('OppCoNO').AsString;
end;
end;
function TfrmBankFlowOutInput.savedata(): Boolean;
var
MaxNo: 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;
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 := '<27><><EFBFBD><EFBFBD>';
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;
fieldbyname('OppCoNo').Value := OppCoName.TxtCode;
Post;
end;
{
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('delete from BS_Bank_Flow where fromBFID=''' + Trim(FBFID) + ''' ');
execsql;
end;
if trim(CRType.Text) = '<27>˻<EFBFBD><CBBB><EFBFBD>ת' then
begin
if GetLSNo(ADOQueryCMD, fid, 'YL', 'BS_Bank_Flow', 4, 1) = False then
begin
ADOQueryCMD.Connection.RollbackTrans;
Application.MessageBox('ȡ<><C8A1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ');
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from BS_Bank_Flow where BFID=''' + Trim(fid) + ''' ');
Open;
append;
fieldbyname('filler').Value := trim(Dname);
RTSetsavedata(ADOQueryCmd, 'BS_Bank_Flow', Panel1, 0);
FieldByName('BFID').Value := Trim(fid);
fieldbyname('Bkid').Value := trim(OppBKName.TxtCode);
fieldbyname('OurBKName').Value := trim(OppBKName.Text);
fieldbyname('ToBkid').Value := trim(OurBKName.TxtCode);
fieldbyname('OppBKName').Value := trim(OurBKName.Text);
fieldbyname('inAmount').Value := strtofloatdef(trim(OutAmount.Text), 0);
fieldbyname('OutAmount').Value := strtofloatdef(trim(InAmount.Text), 0);
fieldbyname('status').Value := '0';
fieldbyname('fromBFID').Value := trim(FBFID);
Post;
end;
end;
if trim(CRType.Text) = '<27><><EFBFBD><EFBFBD>' then
begin
if GetLSNo(ADOQueryCMD, fid, 'YL', 'BS_Bank_Flow', 4, 1) = False then
begin
ADOQueryCMD.Connection.RollbackTrans;
Application.MessageBox('ȡ<><C8A1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!', '<27><>ʾ');
Exit;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from BS_Bank_Flow where BFID=''' + Trim(fid) + ''' ');
Open;
append;
fieldbyname('filler').Value := trim(Dname);
RTSetsavedata(ADOQueryCmd, 'BS_Bank_Flow', Panel1, 0);
FieldByName('BFID').Value := Trim(fid);
fieldbyname('Bkid').Value := trim(OppBKName.TxtCode);
fieldbyname('OurBKName').Value := trim(OppBKName.Text);
fieldbyname('ToBkid').Value := trim(OurBKName.TxtCode);
fieldbyname('OppBKName').Value := trim(OurBKName.Text);
fieldbyname('inAmount').Value := strtofloatdef(trim(JHAmount.Text), 0);
fieldbyname('OutAmount').Value := strtofloatdef(trim(InAmount.Text), 0);
fieldbyname('JHAmount').Value := strtofloatdef(trim(JHAmount.Text), 0);
fieldbyname('JHHulLv').Value := strtofloatdef(trim(JHHulLv.Text), 0);
fieldbyname('status').Value := '0';
fieldbyname('fromBFID').Value := trim(FBFID);
Post;
end;
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 TfrmBankFlowOutInput.TcloseClick(Sender: TObject);
begin
ModalResult := 1;
end;
procedure TfrmBankFlowOutInput.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 TfrmBankFlowOutInput.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 TfrmBankFlowOutInput.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := cafree;
end;
procedure TfrmBankFlowOutInput.FormDestroy(Sender: TObject);
begin
frmBankFlowOutInput := nil;
end;
procedure TfrmBankFlowOutInput.FormShow(Sender: TObject);
begin
BFTime.DateTime := SGetServerDate(adoqueryTmp);
initData();
end;
procedure TfrmBankFlowOutInput.FormCreate(Sender: TObject);
begin
Panel1.Align := alclient;
end;
procedure TfrmBankFlowOutInput.OppBKNameBtnUpClick(Sender: TObject);
begin
try
frmZDYHelp := TfrmZDYHelp.Create(Application);
with frmZDYHelp do
begin
MainType := 'Bank';
flag := self.OppCoName.TxtCode;
flagname := '<27>Է<EFBFBD><D4B7>˻<EFBFBD>';
if ShowModal = 1 then
begin
TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
end;
end;
finally
frmZDYHelp.Free;
end;
end;
procedure TfrmBankFlowOutInput.OppCoNameBtnDnClick(Sender: TObject);
begin
TBtnEditC(Sender).Text := '';
TBtnEditC(Sender).TxtCode := '';
end;
procedure TfrmBankFlowOutInput.OppCoNameBtnUpClick(Sender: TObject);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
if ShowModal = 1 then
begin
OppCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
OppCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
end;
end;
finally
frmCompanySel.Free;
end;
end;
procedure TfrmBankFlowOutInput.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.