📄 pm_qry_supplypoitem_c.pas
字号:
unit Pm_Qry_SupplyPoItem_C;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Condition, Db, AdODB, StdCtrls, Mask, ExtEdit;
Type
TFrm_Pm_Qry_SupplyPoItem_C = Class(TFrm_Base_Condition)
Label5: TLabel;
Label10: TLabel;
Extedt_ItemCodes: TExtEdit;
Extedt_ItemCodee: TExtEdit;
Label2: TLabel;
Label7: TLabel;
medts: TMaskEdit;
medte: TMaskEdit;
Label3: TLabel;
Extedt_VendorCode: TExtEdit;
Label1: TLabel;
lbl_VendorName: TLabel;
procedure btn_okClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Extedt_VendorCodeKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure Extedt_VendorCodeExit(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_Pm_Qry_SupplyPoItem_C: TFrm_Pm_Qry_SupplyPoItem_C;
implementation
uses Pm_Qry_SupplyPoItem,Sys_Global;
{$R *.DFM}
procedure TFrm_Pm_Qry_SupplyPoItem_C.btn_okClick(Sender: TObject);
var sqltext1,sqltext2:string;
begin
//inherited;
try
Executesql(AdoQry_tmp,'drop table #tmppoline,#tmppoItemResult',1);
except
end;
sqltext1:='Select Po.VendorCode, '
+' PoLine.ItemCode, '
+' Sum(PoQty) As PoQty, '
+' PoLine.PoLineDate '
+' into #tmppoline '
+' From PoLine '
+' Join Po On PoLine.PoNo=Po.PoNo '
+' where po.VendorCode='+quotedstr(Extedt_VendorCode.Text)
+' and poline.ItemCode between '+quotedstr(Extedt_ItemCodes.Text)+' and '+quotedstr(Extedt_ItemCodee.text)
+' and poline.polinedate between '+quotedstr(medts.text)+' and '+quotedstr(medte.text)
+' Group by Po.VendorCode,PoLine.ItemCode,PoLine.PoLineDate ';
sqltext2:='select VendorItem.VendorItemCode, '
+' #tmppoline.ItemCode, '
+' Item.ItemName, '
+' Itemflag=#tmppoline.ItemCode+'' ''+Item.ItemName, '
+' Uom.UomName, '
+' #tmppoline.poqty, '
+' #tmppoline.polinedate '
+' into #tmppoItemResult '
+' from #tmppoline '
+' left outer join VendorItem on #tmppoline.ItemCode=VendorItem.ItemCode '
+' and #tmppoline.VendorCode=VendorItem.VendorCode '
+' join Item on #tmppoline.ItemCode=Item.ItemCode '
+' left outer join Uom on Item.UomCode=Uom.UomCode ';
with Frm_Pm_Qry_SupplyPoItem.AdoQry_Main do
begin
Close;
sql.clear;
sql.Add(sqltext1);
Prepared;
try
execsql;
except
end;
Close;
sql.clear;
sql.Add(sqltext2);
Prepared;
try
execsql;
except
end;
Close;
sql.clear;
sql.Add('select * from #tmppoItemResult');
Prepared;
try
open;
except
end;
if recordCount=0 then
begin
DispInfo('无符合条件的数据!',3);
Extedt_VendorCode.SetFocus;
modalResult:=mrnone;
end
else
begin
ConditionHint:='供应商代码: '+Extedt_VendorCode.Text+' / 下单日期从 '+medts.Text+' 到 '+medte.Text+' / 物料代码从 '+Extedt_ItemCodes.Text+' 到 '+Extedt_ItemCodee.Text;
modalResult:=mrok;
end;
end;
end;
procedure TFrm_Pm_Qry_SupplyPoItem_C.FormDestroy(Sender: TObject);
begin
inherited;
Frm_Pm_Qry_SupplyPoItem_C:=nil;
end;
procedure TFrm_Pm_Qry_SupplyPoItem_C.Extedt_VendorCodeKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
inherited;
if key=120 then
commonHint(Extedt_VendorCode,AdoQry_tmp,'VendorName','供应商名称','VendorCode','供应商代码','Vendor')
end;
procedure TFrm_Pm_Qry_SupplyPoItem_C.Extedt_VendorCodeExit(Sender: TObject);
begin
inherited;
if activecontrol.Name='btn_Cancel' then exit;
if Trim(Extedt_VendorCode.text)='' then
begin
DispInfo('请输入供应商代码!',3);
Extedt_VendorCode.SetFocus;
abort;
end;
//AdoQry_tmp.Connection:=dbconnect;
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('select * from Vendor where VendorCode='+quotedstr(Extedt_VendorCode.text));
try
open;
except
end;
if recordCount=0 then
begin
DispInfo('输入了错误的供应商代码,请重新输入!',3);
Extedt_VendorCode.SetFocus;
abort;
end;
lbl_VendorName.Caption:=fieldbyname('VendorName').asstring;
end;
end;
procedure TFrm_Pm_Qry_SupplyPoItem_C.FormCreate(Sender: TObject);
begin
inherited;
medts.Text:=formatdatetime('yyyy.mm.dd',date-30);
medte.Text:=formatdatetime('yyyy.mm.dd',date);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -