📄 ap_qry_subap_condition.pas
字号:
unit Ap_Qry_SubAp_Condition;
// 应付帐款帐龄分析
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Dialog, Db, AdODB, StdCtrls, ExtEdit, ActnList;
Type
TFrm_Ap_Qry_SubAp_Condition = Class(TFrm_Base_Dialog)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
CkBx_Include: TCheckBox;
Lbl_VendorName: TLabel;
ActionList1: TActionList;
Action1: TAction;
ExtEdt_VendorCode: TExtEdit;
procedure FormCreate(Sender: TObject);
procedure btn_okClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ExtEdt_VendorCodeExit(Sender: TObject);
procedure Action1Execute(Sender: TObject);
private
{ Private declarations }
procedure setdialog;
function VendorCodeUsable(R_VendorCode:String):Boolean;
function PickVendorCode(InitCode:String):String;
procedure SetVendor(R_VendorCode:String);
public
VendorCode:string;
IncludeNoInvoice:boolean;
{ Public declarations }
end;
var
Frm_Ap_Qry_SubAp_Condition: TFrm_Ap_Qry_SubAp_Condition;
implementation
uses Ap_Qry_SubAp,Sys_Global;
{$R *.DFM}
procedure TFrm_Ap_Qry_SubAp_Condition.FormCreate(Sender: TObject);
begin
inherited;
ExtEdt_VendorCode.Text:='';
Lbl_VendorName.Caption:='';
CkBx_Include.checked:=False;
if Trim(ExtEdt_VendorCode.text)<>'' then VendorCode:= ExtEdt_VendorCode.Text;
incLudeNoInvoice:=CkBx_Include.checked;
VendorCode:='';
incLudeNoInvoice:=False;
end;
procedure TFrm_Ap_Qry_SubAp_Condition.setdialog;
begin
ExtEdt_VendorCode.Text:=VendorCode;
if ExtEdt_VendorCode.Text<>'' then
begin
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select VendorName '+
'from Vendor '+
'where VendorCode='''+ExtEdt_VendorCode.Text+''' ');
open;
if not eof then
Lbl_VendorName.Caption:=fieldbyname('VendorName').asString;
Close;
end;
end;
if incLudeNoInvoice then CkBx_Include.Checked:=True
else CkBx_Include.Checked:=False;
end;
procedure TFrm_Ap_Qry_SubAp_Condition.btn_okClick(Sender: TObject);
begin
inherited;
VendorCode:=Extedt_VendorCode.Text;
IncludeNoInvoice:=CkBx_Include.Checked;
end;
procedure TFrm_Ap_Qry_SubAp_Condition.FormActivate(Sender: TObject);
begin
inherited;
setdialog;
ExtEdt_VendorCode.SetFocus;
end;
procedure TFrm_Ap_Qry_SubAp_Condition.ExtEdt_VendorCodeExit(
Sender: TObject);
begin
inherited;
if ExtEdt_VendorCode.Text='' then
begin
Lbl_VendorName.Caption:='';
exit;
end;
if VendorCodeUsable(ExtEdt_VendorCode.Text) then
begin
SetVendor(ExtEdt_VendorCode.Text);
end
else
begin
DispInfo('输入的代码没找到!',1);
TWinControl(Sender).SetFocus;
Abort;
end;
end;
function TFrm_Ap_Qry_SubAp_Condition.VendorCodeUsable(R_VendorCode:String):Boolean;
var
T_Count:integer;
T_Sql:string;
begin
T_Sql:=
'Select Count(*) as RecordCount '+
'from Vendor '+
'where VendorCode='''+R_VendorCode+''' ';
with AdoQry_Tmp do
begin
Close;
SQL.clear;
SQL.Add(T_Sql);
open;
T_Count:=fieldbyname('RecordCount').AsInteger;
Close;
end;
if T_Count>0 then Result:=True
else Result:=False;
end;
function TFrm_Ap_Qry_SubAp_Condition.PickVendorCode(InitCode:String):String;
begin
Result:=GetCodeHint(
AdoQry_Tmp,
'VendorName','供应商名称',
'VendorCode','供应商代码',
'Vendor',InitCode,'');
end;
procedure TFrm_Ap_Qry_SubAp_Condition.Action1Execute(Sender: TObject);
begin
inherited;
if ActiveControl.Name='ExtEdt_VendorCode' then
begin
ExtEdt_VendorCode.Text:=PickVendorCode(ExtEdt_VendorCode.Text);
ExtEdt_VendorCode.SetFocus;
end;
end;
procedure TFrm_Ap_Qry_SubAp_Condition.SetVendor(R_VendorCode: String);
begin
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select VendorName '+
'from Vendor '+
'where VendorCode='''+R_VendorCode+''' ');
open;
if not eof then
Lbl_VendorName.Caption:=fieldbyname('VendorName').asString;
Close;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -