inv_opout_pi.pas
来自「一个MRPII系统源代码版本」· PAS 代码 · 共 290 行
PAS
290 行
// 20001.05.04
unit Inv_OpOut_Pi;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Base_Common, ExtCtrls, QuickRpt, Db, AdODB, Grids, DBGrids, StdCtrls,
Mask, DBCtrls, QrCtrls,printers,variants;
Type
TFrm_Inv_OpOut_Pi= Class(TFrm_Base_Common)
AdoQry_Head: TAdoQuery;
AdoQry_Line: TAdoQuery;
QuickRep1: TQuickRep;
DataSource1: TDataSource;
DetailBand1: TQRBand;
Label3: TLabel;
DataSource2: TDataSource;
ColumnHeaderBand1: TQRBand;
SummAryBand1: TQRBand;
QRLabel13: TQRLabel;
QRLabel14: TQRLabel;
QRLabel16: TQRLabel;
QRLabel18: TQRLabel;
QRLabel17: TQRLabel;
QRShApe16: TQRShApe;
QRLabel1: TQRLabel;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
QRLabel5: TQRLabel;
QRShApe17: TQRShApe;
QRDBText9: TQRDBText;
QRDBText10: TQRDBText;
QRDBText12: TQRDBText;
QRDBText13: TQRDBText;
QRShApe1: TQRShApe;
QRShApe20: TQRShApe;
QRLabel9: TQRLabel;
QRShApe10: TQRShApe;
QRLabel19: TQRLabel;
QLWHCode: TQRLabel;
QLWhPositionCode: TQRLabel;
QLVendorCode: TQRLabel;
QRShApe2: TQRShApe;
QRShApe4: TQRShApe;
QRShApe5: TQRShApe;
QRShApe6: TQRShApe;
QRShApe7: TQRShApe;
QRShApe8: TQRShApe;
QRShApe3: TQRShApe;
TitleBand1: TQRBand;
QLSysParamValueC: TQRLabel;
QLBillCtrlCode: TQRLabel;
QLBillColorDESC: TQRLabel;
QLWH_EmployeeCode: TQRLabel;
QRLabel23: TQRLabel;
QLPONo: TQRLabel;
QLInvBillNo: TQRLabel;
QLInvBillDate: TQRLabel;
QLInvBillRemArk: TQRLabel;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel20: TQRLabel;
QRShApe9: TQRShApe;
QRExpr1: TQRExpr;
QRSysData1: TQRSysData;
QRShApe11: TQRShApe;
procedure QRDBText13Print(sender: TObject; var Value: String);
procedure QRSysData1Print(sender: TObject; var Value: String);
private
{ Private declarations }
FWHCode,FBillNo:string;
FBillTypeCode:string;
FPreview:Boolean;
FModuleCode:string;
fCount:integer;
isop:boolean;
public
{ Public declarations }
procedure SetDBConnect(AdOConnection:TAdOConnection); Override;
procedure SetFormParam(FrmParam1,FrmParam2,FrmParam3,FrmParam4,FrmParam5,
FrmParam6:String);Override;
end;
var
Frm_Inv_OpOut_Pi: TFrm_Inv_OpOut_Pi;
implementation
uses Sys_Global,Inv_OpOutBillQry;
{$R *.DFM}
procedure TFrm_Inv_OpOut_Pi.SetFormParam(FrmParam1, FrmParam2, FrmParam3,
FrmParam4, FrmParam5,FrmParam6: String);
begin
inherited;
FBillNo:=lowercase(FrmParam1);
FWHCode:=lowercase(FrmParam2);
FBillTypeCode:=lowercase(FrmParam3);
FPreview:=(lowercase(FrmParam4)='preview');
FModuleCode:=lowercase(FrmParam5);
end;
procedure TFrm_Inv_OpOut_Pi.SetDBConnect(AdOConnection:TAdOConnection);
var
tmpBillid:string;
sqltext1,sqltext2,sqltext:string;
begin
inherited;
AdoQry_Head.Connection:=AdoConnection;
AdoQry_Line.Connection:=AdoConnection;
if Frm_Inv_OpOutBillQry=nil then
isop:=True
else
isop:=Frm_Inv_OpOutBillQry.isop ;
if isop then
begin
qrshApe10.Enabled :=True;
qrdbtext9.Enabled :=True;
qrlabel1.Enabled :=True;
qrlabel2.Left :=73;
qrdbtext10.Left :=62;
end
else
begin
qrshApe10.Enabled :=False;
qrdbtext9.Enabled :=False;
qrlabel1.Enabled :=False;
qrlabel2.Left :=15;
qrdbtext10.Left :=5;
end;
with AdoQry_Tmp do
begin
Close;
SQL.clear;
SQL.Text:='Select SysParamValueC from SysParam Where SysParamCode=''Name0''';
open;
end;
QLSysParamValueC.Caption:=AdoQry_Tmp.fieldbyname('SysParamValueC').asstring;
with AdoQry_Tmp do
begin
Close;
SQL.clear;
SQL.Text:='Select BillCtrlCode,BillTypeName,BillColorDESC '+
'From BillType Where BillTypeCode=:FBillTypeCode';
Parameters.ParamByName('FBillTypeCode').Value:=FBillTypeCode;
open;
end;
QLBillCtrlCode.Caption:=AdoQry_Tmp.fieldbyname('BillCtrlCode').asstring;
QLSysParamValueC.Caption:=QLSysParamValueC.Caption+AdoQry_Tmp.fieldbyname('BillTypeName').asstring;
QLBillColorDESC.Caption:=AdoQry_Tmp.fieldbyname('BillColorDESC').asstring;
AdoQry_Head.Close;
AdoQry_Head.sql.text:=
' select B.WHCode,W.WHName,B.WhPositionCode,P.WhPositionName, '+
' B.InvBillNo,B.VendorCode,V.VendorName,B.OverPlan, '+
' B.InvBillDate,B.InvBillId,'+
' E.EmployeeName,F.EmployeeName as EmployeeName1,'+
' B.Pono,B.InvBillRemArk,B.InvBillValuation'+
' from InvOutBill B '+
' left join Employee E on B.WH_EmployeeCode=E.EmployeeCode '+
' left join Employee F on B.EmployeeCode=f.EmployeeCode, '+
' Warehouse W,WhPosition P,Vendor V,Currency C '+
' where B.WHCode=:WHCode and '+
' B.InvBillNo=:BillNo and '+
' B.WHCode=W.WHCode and '+
' B.WhPositionCode=P.WhPositionCode and '+
' B.WHCode=P.WHCode and '+
' B.VendorCode=V.VendorCode ';
AdoQry_Head.Parameters.ParamByName('WHCode').Value:=FWHCode;
AdoQry_Head.Parameters.ParamByName('BillNo').Value:=FBillNo;
AdoQry_Head.open;
TmpBillId:=AdoQry_Head.fieldbyname('InvBillId').asstring;
If AdoQry_Head.fieldbyname('OverPlan').asstring='1' then
QLInvBillRemArk.Caption:='超订单 '+AdoQry_Head.fieldbyname('InvBillRemArk').asstring
else
QLInvBillRemArk.Caption:=AdoQry_Head.fieldbyname('InvBillRemArk').asstring;
sqltext1:='Create table #tmp'+
'(InvBillLineno int null,'+
'ItemCode varchAr(16) null,'+
'ItemName varchAr (80) null,'+
'POLineNo int null,'+
'UomName varchAr (10) null,'+
'InvBillQty float null )'+
' declAre @rc int'+
' insert into #tmp'+
' select L.InvBillLineno,L.ItemCode,I.ItemName,L.POLineNo,U.UomName,'+
' L.InvBillQty '+
' from InvOutBillLine L,Item I,Uom U '+
' where L.InvBillId='+TmpBillId+' and '+
' L.ItemCode=I.ItemCode and '+
' I.UomCode=U.UomCode '+
' Order by InvBillLineno '+
' select @rc=@@rowCount%10 '+
' if @rc<>0'+
' while @rc<10'+
' begin '+
' insert into #tmp'+
' Values(null,null,null,null,null,null)'+
' select @rc=@rc+1'+
' end';
sqltext2:='Create table #tmp'+
'(ItemCode varchAr(16) null,'+
'ItemName varchAr (80) null,'+
'UomName varchAr (10) null,'+
'InvBillQty float null )'+
' declAre @rc int'+
' insert into #tmp'+
' select ItemCode,ItemName,UomName,sum(InvBillqty) InvBillqty'+
' from (select L.ItemCode,I.ItemName,U.UomName,'+
' L.InvBillqty '+
' from InvOutBillLine L,Item I,Uom U '+
' where L.InvBillId='+TmpBillId+' and '+
' L.ItemCode=I.ItemCode and '+
' I.UomCode=U.UomCode) tmpBill '+
' group by ItemCode,ItemName,UomName '+
' select @rc=@@rowCount%10 '+
' if @rc<>0'+
' while @rc<10'+
' begin '+
' insert into #tmp'+
' Values(null,null,null,null)'+
' select @rc=@rc+1'+
' end';
if isop then
sqltext:=sqltext1
else
sqltext:=sqltext2;
with AdoQry_Line do
begin
Close;
SQL.clear;
SQL.Add(sqltext);
ExecSQL;
Close;
SQL.clear;
SQL.Add('select * from #tmp');
open;
end;
QLWHCode.Caption:=AdoQry_Head.fieldbyname('WHCode').asstring+' '+
AdoQry_Head.fieldbyname('WHName').asstring;
QLWhPositionCode.Caption:=AdoQry_Head.fieldbyname('WhPositionCode').asstring+' '+
AdoQry_Head.fieldbyname('WhPositionName').asstring;
QLVendorCode.Caption:=AdoQry_Head.fieldbyname('VendorCode').asstring+' '+
AdoQry_Head.fieldbyname('VendorName').asstring;
QLPONo.Caption:=AdoQry_Head.fieldbyname('Pono').asstring;
QLInvBillNo.Caption:=AdoQry_Head.fieldbyname('InvBillno').asstring;
QLInvBillDate.Caption:=AdoQry_Head.fieldbyname('InvBillDate').asstring;
QLWH_EmployeeCode.Caption:=AdoQry_Head.fieldbyname('EmployeeName').asstring;
//QLEmployeeCode.Caption:=AdoQry_Head.fieldbyname('EmployeeName1').asstring;
//QLInvBillRemArk.Caption:=AdoQry_Head.fieldbyname('InvBillRemArk').asstring;
AdoQry_Head.Close;
AdoQry_Head.sql.clear;
AdoQry_Head.SQL.Add('drop table #tmp');
AdoQry_Head.ExecSQL;
quickrep1.Prepare ;
fCount:=QuickRep1.QRPrinter.PageCount;
if FPreview then
begin
QuickRep1.PreviewModal;
end
else
QuickRep1.print;
end;
procedure TFrm_Inv_OpOut_Pi.QRDBText13Print(sender: TObject;
var Value: String);
begin
inherited;
if AdoQry_line.fieldbyname('InvBillQty').asfloat=0.00 then
Value:=varToStr(formatfloat('#,##',AdoQry_line.fieldbyname('InvBillQty').asfloat))
end;
procedure TFrm_Inv_OpOut_Pi.QRSysData1Print(sender: TObject;
var Value: String);
begin
inherited;
Value:=Value+'页 共'+inttostr(fCount)+'页';
end;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?