📄 u_payment.~pas
字号:
unit u_PayMent;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, ADODB, DB;
type
TfrmPayMent = class(TForm)
cmbSup: TComboBox;
Label1: TLabel;
edtPay: TLabeledEdit;
btnPay: TBitBtn;
btnClose: TBitBtn;
btnCancel: TBitBtn;
edtInDH: TLabeledEdit;
procedure btnCloseClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure cmbSupKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure edtPayKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure btnPayClick(Sender: TObject);
procedure btnCancelClick(Sender: TObject);
procedure edtInDHKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmPayMent: TfrmPayMent;
implementation
uses u_DataCtrl, u_ShareFun;
{$R *.dfm}
procedure TfrmPayMent.btnCloseClick(Sender: TObject);
begin
Close ;
end;
procedure TfrmPayMent.FormClose(Sender: TObject; var Action: TCloseAction);
begin
edtInDH.Clear;
Action := Cafree ;
end;
procedure TfrmPayMent.FormShow(Sender: TObject);
var
SupQry : TADOQuery ;
begin
SupQry := TADOQuery.Create(self);
SupQry.Connection := frmDataCtrl.ADOConn ;
SupQry.Close;
SupQry.SQL.Clear;
SupQry.SQL.Text := 'select * from vw_SupBalanceMonStat where BalanceMon>0';
try
SupQry.Active := true;
if SupQry.RecordCount<1 then Exit ;
while not SupQry.Eof do
begin
cmbSup.Items.Add(SupQry.FieldValues['SupSName']);
SupQry.Next;
end;
except
showmessage('数据添加失败!!');
end;
cmbSup.Text := '';
edtPay.Text := '0.0';
cmbSup.SetFocus ;
SupQry.Close;
SupQry.Free;
SupQry :=nil ;
end;
procedure TfrmPayMent.cmbSupKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key =13) and (cmbSup.Text<>'') then
edtInDH.SetFocus;
end;
procedure TfrmPayMent.edtPayKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key=13) and Not IsNumeric(edtPay.Text) then
showmessage('请输入数字!');
if (key=13) and (IsNumeric(edtPay.Text)) then
btnpay.SetFocus;
end;
procedure TfrmPayMent.btnPayClick(Sender: TObject);
var
SupQry,InDH : TADOQuery ;
Summary,TempInDH: String ;
begin
if (cmbSup.Text='') then
begin
showmessage('请选择供应商!!');
cmbSup.SetFocus;
exit;
end;
if Not IsNumeric(edtPay.Text) then
begin
showmessage('请输入数字!');
edtPay.SetFocus;
exit ;
end;
if edtInDH.Text = '' then
TempInDH := '0'
else
begin
TempInDH := edtInDH.Text;
InDH := TADOQuery.Create(self);
InDH.Connection := frmDataCtrl.ADOConn;
InDH.Close;
InDH.SQL.Clear;
InDH.SQL.Add('select * from tb_GoodsInMaster where InBH='+QuotedStr(TempInDH));
InDH.Open;
if InDH.IsEmpty then
begin
Application.MessageBox('该入库单号不存在','警告',MB_OK);
edtInDH.SetFocus;
Exit;
end;
InDH.Close;
InDH.Free;
InDH := nil;
end;
if Application.MessageBox('确实要为此供应商付款吗?','询问',mb_Iconquestion+mb_yesNo)=IDNO then
Exit ;
Summary := cmbSup.Text +' 付款 ';
SupQry := TADOQuery.Create(self);
SupQry.Connection := frmDataCtrl.ADOConn ;
SupQry.Close;
SupQry.SQL.Clear;
SupQry.SQL.Add('exec pip_SupAccount '+QuotedStr(cmbSup.Text)+',');
SupQry.SQL.Add(QuotedStr(Summary)+',0,0,'+QuotedStr(TempInDH)+','+edtPay.Text);
try
SupQry.ExecSQL;
showmessage('欠付款成功!!');
except
showmessage('欠付款失败!!');
end;
cmbSup.Text := '';
edtInDH.Text:= '';
edtPay.Text := '0.0';
cmbSup.SetFocus ;
SupQry.Close;
SupQry.Free;
SupQry :=nil ;
end;
procedure TfrmPayMent.btnCancelClick(Sender: TObject);
begin
cmbSup.Text := '';
edtPay.Text := '0.0';
cmbSup.SetFocus ;
end;
procedure TfrmPayMent.edtInDHKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key = vk_Return then
edtPay.SetFocus;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -