📄 pm_enter_po_p.pas
字号:
unit Pm_Enter_Po_P;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, QrCtrls, QuickRpt, AdODB, ExtCtrls, StdCtrls;
Type
TFrm_Pm_Enter_Po_P = Class(TForm)
QuickRep1: TQuickRep;
AdoQryMain: TAdoQuery;
ColumnHeaderBand1: TQRBand;
QRLabel2: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRShApe2: TQRShApe;
QRShApe3: TQRShApe;
QRShApe4: TQRShApe;
QRLabel11: TQRLabel;
QRShApe9: TQRShApe;
AdoQry_tmp: TAdoQuery;
QRLabel6: TQRLabel;
QRDBText5: TQRDBText;
QRLabel8: TQRLabel;
QRDBText7: TQRDBText;
QRLabel7: TQRLabel;
QRLabel9: TQRLabel;
QRDBText6: TQRDBText;
QRDBText8: TQRDBText;
QRLabel10: TQRLabel;
QRDBText9: TQRDBText;
QRShApe19: TQRShApe;
QRShApe20: TQRShApe;
QRShApe21: TQRShApe;
QRShApe10: TQRShApe;
QRLabel13: TQRLabel;
AdoQryMainpono: TStringField;
AdoQryMainpoType: TStringField;
AdoQryMainpodate: TDateTimeField;
AdoQryMaInvendorCode: TStringField;
AdoQryMaInvendorName: TStringField;
AdoQryMainItemCode: TStringField;
AdoQryMainItemName: TStringField;
AdoQryMainUomName: TStringField;
AdoQryMainpoqty: TFloatField;
AdoQryMainpotaxPrice: TFloatField;
AdoQryMainpotaxAmount: TBCDField;
AdoQryMainpolinedate: TDateTimeField;
AdoQryMainporemArk: TStringField;
AdoQryMaInvendorowner: TStringField;
AdoQryMaInvendorAddress: TStringField;
AdoQryMaInvendorbank: TStringField;
AdoQryMaInvendorbankaccno: TStringField;
AdoQryMaInvendortaxno: TStringField;
AdoQryMaInvendortel: TStringField;
AdoQryMaindate: TDateTimeField;
AdoQryMainpolineno: TIntegerField;
AdoQryMainpotaxrate: TIntegerField;
QRLabel50: TQRLabel;
QRDBText20: TQRDBText;
QrLbl_Title: TQRLabel;
Qrlbl_Caption: TQRLabel;
Qrlbl_IsoCode: TQRLabel;
AdoQryMainEmployeeCode: TStringField;
AdoQryMainEmployeeName: TStringField;
SummAryBand1: TQRBand;
PageFooterBand1: TQRBand;
AdoQryMainItemflag: TStringField;
AdoQryMaInvendorfax: TStringField;
QRLabel1: TQRLabel;
QRDBText11: TQRDBText;
QRLabel12: TQRLabel;
QRLabel18: TQRLabel;
qrlblpageno: TQRLabel;
QRLabel23: TQRLabel;
QRLabel22: TQRLabel;
qrpageCount: TQRLabel;
QRLabel25: TQRLabel;
QRShApe1: TQRShApe;
QRLabel24: TQRLabel;
QRDBText12: TQRDBText;
QRLabel26: TQRLabel;
AdoQryMainPassEmployeeCode: TStringField;
AdoQryMaInvendorordinal: TIntegerField;
QRLabel28: TQRLabel;
QRDBText13: TQRDBText;
QRBand1: TQRBand;
QRDBText14: TQRDBText;
QRDBText15: TQRDBText;
QRDBText16: TQRDBText;
QRShApe6: TQRShApe;
QRShApe7: TQRShApe;
QRShApe13: TQRShApe;
QRShApe15: TQRShApe;
QRShApe16: TQRShApe;
QRDBText17: TQRDBText;
QRDBText18: TQRDBText;
QRShApe17: TQRShApe;
ChildBand1: TQRChildBand;
QRLabel29: TQRLabel;
QRLabel30: TQRLabel;
QRLabel31: TQRLabel;
QRLabel32: TQRLabel;
QRLabel33: TQRLabel;
QRLabel34: TQRLabel;
QRLabel35: TQRLabel;
QRLabel36: TQRLabel;
QRLabel37: TQRLabel;
QRLabel3: TQRLabel;
procedure FormDestroy(Sender: TObject);
procedure QuickRep1endPage(Sender: TCustomQuickRep);
procedure QuickRep1StArtPage(Sender: TCustomQuickRep);
private
function lookupParam(ParamCode:string):string;
function getAmount:double;
function getsum(ItemCode:string):real;
function getuser(pono:string):string;
{ Private declarations }
public
userCode:string;
procedure GetDataSource(AdoConnect:TAdoConnection;PoNo:String;Status:String;MenuId:String);
end;
var
Frm_Pm_Enter_Po_P: TFrm_Pm_Enter_Po_P;
int:integer;
implementation
uses Sys_Global,Pm_Enter_Po;
{$R *.DFM}
procedure TFrm_Pm_Enter_Po_P.GetDataSource(AdoConnect:TAdoConnection;PoNo:String;Status:String;MenuId:String);
var
SqlText,tmpItemCode,tmpQryItemCode,i,termCode:String;
Count,j:integer;
printterm:boolean;
begin
j:=0;
AdoQryMain.Connection:=AdoConnect;
AdoQry_tmp.Connection:=Adoconnect;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:='select SysParamValueC From SysParam Where Upper(SysParamCode)='''+UpperCase('Name0')+'''';
AdoQry_Tmp.Open;
QrLbl_Title.Caption:=AdoQry_Tmp.fieldbyname('SysParamValueC').AsString;
AdoQry_Tmp.Close;
AdoQry_Tmp.SQL.Text:=' Select ReportName1,ISOCode1 From ReportCtrl Where SysMenuID='''+MenuId+'''';
AdoQry_Tmp.Open;
QrLbl_Caption.Caption:=AdoQry_Tmp.fieldbyname('ReportName1').AsString;
QrLbl_IsoCode.Caption:=AdoQry_Tmp.fieldbyname('ISOCode1').AsString;
ExecuteSql(AdoQry_Tmp,'select PmParamValueC from PmParam '
+' where PmParamCode='+QuotedStr('PchOrderSignIn'),0);
QrLabel26.Caption := AdoQry_Tmp.fieldbyname('PmParamValueC').AsString;
QrLabel3.Caption := AdoQry_Tmp.fieldbyname('PmParamValueC').AsString;
sqltext:='create table #tmp'+
' (pono varchAr(55) null,'+
' polineno int null,'+
' poType varchAr(50) null,'+
' podate datetime null,'+
' potaxRate int null,'+
' Vendorordinal int null,'+
' VendorCode varchAr(50) null,'+
' VendorName varchAr(160) null,'+
' EmployeeCode varchAr(160) null,'+
' EmployeeName varchAr(160) null,'+
' ItemCode varchAr(120) null,'+
' ItemName varchAr(120) null,'+
' Itemflag varchAr(150) null,'+
' UomName varchAr(8) null,'+
' poqty float null,'+
' potaxPrice float null,'+
' potaxAmount float null,'+
' polinedate datetime null,'+
' poRemArk varchAr(150) null,'+
' VendorOwner varchAr(140) null,'+
' VendorAddress varchAr(160) null,'+
' Vendorbank varchAr(140) null,'+
' Vendorbankaccno varchAr(140) null,'+
' Vendortaxno varchAr(140) null,'+
' Vendortel varchAr(140) null,'+
' Vendorfax varchAr(140) null,'+
' PassEmployeeCode varchAr(130) null,'+
' date datetime null)'+
// 'cr
' declAre @rc int'+
// ' set rowCount 67 '+
' insert into #tmp '+
' select t1.pono,'+
' t1.polineNo,'+
' poType=case t2.poType'+
' when 0 then '+'''普通采购'''+
' when 1 then '+'''委外加工'''+
' end,'+
't2.podate, '+
't2.potaxrate_Percent,'+
't2.Vendorordinal,'+
't2.VendorCode,'+
't3.VendorName,'+
' t2.EmployeeCode,'+
' t6.EmployeeName,'+
't1.ItemCode,'+
't4.ItemName,'+
'Itemflag=substring((t1.ItemCode+'' ''+t4.ItemName),1,55),'+
't5.UomName,'+
' t1.poqty as poqty, '+
' potaxPrice=convert(decimal(14,2),t1.potaxPrice),'+
' t1.potaxAmount,'+
' t1.polinedate,'+
' t2.poremArk,'+
' t3.Vendorowner,'+
' t3.VendorAddress,'+
' t3.Vendorbank,'+
' t3.Vendorbankaccno,'+
' t3.Vendortaxno,'+
' t3.Vendortel,'+
' t3.Vendorfax,'+
' t1.PassEmployeeCode, '+
'date=getdate()'+
'from poline t1(nolock),'+
' po t2(nolock),'+
' Vendor t3(nolock),'+
' Item t4(nolock),'+
' Uom t5(nolock),'+
' Employee t6(nolock)'+
' where t1.pono=t2.pono'+
' and t1.ItemCode=t4.ItemCode'+
' and t2.VendorCode*=t3.VendorCode'+
' and t4.UomCode=t5.UomCode'+
' and t2.EmployeeCode*=t6.EmployeeCode'+
// ' and t2.poType=1'+
' and t1.pono='+''''+PoNo+'''';
Try
AdoQryMain.EnableBCD:=False;
with AdoQryMain do
begin
Close;
sql.clear;
sql.Add(sqltext);
try
execsql;
except
end;
Close;
sql.clear;
sql.Add('select * from #tmp Order by ItemCode,polinedate');
open;
First;
tmpItemCode:=fieldbyname('ItemCode').asstring;
if recordCount=1 then
begin
with AdoQry_tmp do
begin
Close;
sql.clear;
sql.Add('insert into #tmp(pono,VendorCode,VendorName,poType,podate,Vendorfax,date,'
+'ItemCode,Itemflag,poqty) Values('+quotedstr(AdoQryMain.fieldbyname('pono').asstring)+','
+quotedstr(AdoQryMain.fieldbyname('VendorCode').asstring)+','
+quotedstr(AdoQryMain.fieldbyname('VendorName').asstring)+','
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -