Printing "UnApproved" PO

Hi Everyone,

Is there a way to print unapproved PO in the system?
As per the current system design, the print option would only be available if the PO is approved.

Wasn’t sure if there are any alternative way to allow the printing without approving it.


you can customize and add your own print button and write your own BAQ to get data based on report data POForm:

	[PODetail].[Company] as [PODetail_Company],
	[PODetail].[PONUM] as [PODetail_PONUM],
	[PODetail].[POLine] as [PODetail_POLine],
	[PODetail].[LineDesc] as [PODetail_LineDesc],
	[PODetail].[IUM] as [PODetail_IUM],
	[PODetail].[OrderQty] as [PODetail_OrderQty],
	[PODetail].[XOrderQty] as [PODetail_XOrderQty],
	[PODetail].[UnitCost] as [PODetail_UnitCost],
	[PODetail].[DocUnitCost] as [PODetail_DocUnitCost],
	[PODetail].[PUM] as [PODetail_PUM],
	[PORel].[PORelNum] as [PORel_PORelNum],
	[PORel].[DueDate] as [PORel_DueDate],
	[PORel].[XRelQty] as [PORel_XRelQty],
	[PORel].[RelQty] as [PORel_RelQty],
	[PORel].[Plant] as [PORel_Plant],
	[PORel].[OrderRelNum] as [PORel_OrderRelNum],
	[Company].[Name] as [Company_Name],
	[Company].[Address1] as [Company_Address1],
	[Company].[Address2] as [Company_Address2],
	[Company].[Address3] as [Company_Address3],
	[Company].[City] as [Company_City],
	[Company].[Company] as [Company_Company],
	[Company].[Country] as [Company_Country],
	[Company].[PhoneNum] as [Company_PhoneNum],
	[Company].[FaxNum] as [Company_FaxNum],
	[Company].[StateTaxID] as [Company_StateTaxID],
	[Company].[TaxRegionCode] as [Company_TaxRegionCode],
	[Company].[TaxRegReason] as [Company_TaxRegReason],
	[Company].[Character03] as [Company_Character03],
	[PODetail].[CostPerCode] as [PODetail_CostPerCode],
	[PODetail].[CommentText] as [PODetail_CommentText],
	[PODetail].[DocInUnitCost] as [PODetail_DocInUnitCost],
	[PODetail].[PartNum] as [PODetail_PartNum],
	[PODetail].[VenPartNum] as [PODetail_VenPartNum],
	[POHeader].[ApprovedBy] as [POHeader_ApprovedBy],
	[POHeader].[ApprovedDate] as [POHeader_ApprovedDate],
	[POHeader].[BuyerID] as [POHeader_BuyerID],
	[POHeader].[CurrencyCode] as [POHeader_CurrencyCode],
	[POHeader].[DocTotalMisc] as [POHeader_DocTotalMisc],
	[POHeader].[DocTotalOrder] as [POHeader_DocTotalOrder],
	[POHeader].[FOB] as [POHeader_FOB],
	[POHeader].[TermsCode] as [POHeader_TermsCode],
	[POHeader].[DocTotalTax] as [POHeader_DocTotalTax],
	[POHeader].[OrderDate] as [POHeader_OrderDate],
	[POHeader].[ShortChar04] as [POHeader_ShortChar04],
	[VendorPP].[Name] as [VendorPP_Name],
	[VendorPP].[Address1] as [VendorPP_Address1],
	[VendorPP].[Address2] as [VendorPP_Address2],
	[VendorPP].[Address3] as [VendorPP_Address3],
	[VendorPP].[City] as [VendorPP_City],
	[VendorPP].[Country] as [VendorPP_Country],
	[PurAgent].[Name] as [PurAgent_Name],
	[PurAgent].[EMailAddress] as [PurAgent_EMailAddress],
	[Vendor].[PhoneNum] as [Vendor_PhoneNum],
	[Vendor].[FaxNum] as [Vendor_FaxNum],
	[FOB].[Description] as [FOB_Description],
	[FOB].[DeliveryTerms] as [FOB_DeliveryTerms],
	[PurTerms].[Description] as [PurTerms_Description],
	[POHeader].[CommentText] as [POHeader_CommentText],
	[POHeader].[ShipName] as [POHeader_ShipName],
	[POHeader].[ShipAddress1] as [POHeader_ShipAddress1],
	[POHeader].[ShipCity] as [POHeader_ShipCity],
	[POHeader].[ShipCountry] as [POHeader_ShipCountry],
	[Company].[Character02] as [Company_Character02],
	[PODetail].[DueDate] as [PODetail_DueDate]
from Erp.PODetail as PODetail
inner join Erp.POHeader as POHeader on 
	PODetail.Company = POHeader.Company
	and PODetail.PONUM = POHeader.PONum
inner join Erp.VendorPP as VendorPP on 
	POHeader.Company = VendorPP.Company
	and POHeader.VendorNum = VendorPP.VendorNum
	and POHeader.PurPoint = VendorPP.PurPoint
inner join Erp.Vendor as Vendor on 
	VendorPP.Company = Vendor.Company
	and VendorPP.VendorNum = Vendor.VendorNum
inner join Erp.PurAgent as PurAgent on 
	POHeader.Company = PurAgent.Company
	and POHeader.BuyerID = PurAgent.BuyerID
left outer join Erp.FOB as FOB on 
	POHeader.Company = FOB.Company
	and POHeader.FOB = FOB.FOB
inner join Erp.PurTerms as PurTerms on 
	POHeader.Company = PurTerms.Company
	and POHeader.TermsCode = PurTerms.TermsCode
inner join Erp.PORel as PORel on 
	PODetail.Company = PORel.Company
	and PODetail.PONUM = PORel.PONum
	and PODetail.POLine = PORel.POLine
inner join Erp.Company as Company on 
	Company.Company = PODetail.Company
where (PODetail.PONUM = @PONum)

here is the code to add the print button to the print menu:

// Add Custom Module Level Variables Here **
	PopupMenuTool menuActionTool;
public void InitializeCustomCode()
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization		
		menuActionTool = (PopupMenuTool)baseToolbarsManager.Tools["ActionsMenu"];//Chú ý GroupTool là name của menu Group debug hoặc dùng message show để lấy đc thông tin này
		this.baseToolbarsManager.ShowToolTips = true;
		this.baseToolbarsManager.ToolTipDisplayStyle = Infragistics.Win.UltraWinToolbars.ToolTipDisplayStyle.Formatted;		
		//bổ sung menu PrintPayment
		ButtonTool PrintPaymentInv = new ButtonTool("PrintPaymentInv");
        PrintPaymentInv.SharedProps.Caption = "**DMS - Print Payment Invoice"; // Sets the visible name
        PrintPaymentInv.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;		
		PrintPaymentInv.SharedProps.ToolTipText = "Sử dụng nút này để in đề nghị thanh toán theo hóa đơn";
		//muốn biết Item name của Image vào đây xem:
        PrintPaymentInv.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.GetImage("SBPrint"); // Item name from the resource

		//bổ sung menu PrintPaymentGroup
		ButtonTool PrintPaymentGrp = new ButtonTool("PrintPaymentGrp");
        PrintPaymentGrp.SharedProps.Caption = "**DMS - Print Payment Group"; // Sets the visible name
        PrintPaymentGrp.SharedProps.DisplayStyle = ToolDisplayStyle.ImageAndText;		
		PrintPaymentGrp.SharedProps.ToolTipText = "Sử dụng nút này để in đề nghị thanh toán theo Group";
		//muốn biết Item name của Image vào đây xem:
        PrintPaymentGrp.SharedProps.AppearancesSmall.Appearance.Image = EpiUIImages.GetImage("SBPrint"); // Item name from the resource

private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
		switch (args.Tool.Key)
			case "PrintPaymentInv":
			case "PrintPaymentGrp":

here is the code in:

private void PrintReport(string reportfile, int PrintGrp)
				session= (Session)this.oTrans.Session;  
				//string invoicenum="";
				string PathRoot=@"\\"+session.AppServer.Split('/')[2].Split(':')[0];		
			/*	if(txtListInv.Text=="")
					EpiDataView view = oTrans.EpiDataViews["InvcHead"] as EpiDataView;
					invoicenum = view.dataView[view.Row]["InvoiceNum"].ToString()+"~";
				}	*/
				string Key_link11="";
				string Key_link12="";	       
				//string [] Parameter ={invoicenum.Substring(0,invoicenum.Length-1)};
				string Parameter=string.Empty, InvoiceNum=string.Empty;
				DataRow CurrentInvoiceNumRow =null;
				EpiDataView grdInvoiceList = (EpiDataView)(oTrans.EpiDataViews["InvListView"]);
				if(grdInvoiceList.dataView.Count>0 && grdInvoiceList.CurrentDataRow != null)
					CurrentInvoiceNumRow = grdInvoiceList.CurrentDataRow;
					InvoiceNum = CurrentInvoiceNumRow["InvoiceNum"].ToString();//dùng cách này mới lấy đúng số InvoiceNum vì có code remove số 0 ở sự kiện textchange của InvoiceNum	
					Parameter = CurrentInvoiceNumRow["GroupID"].ToString();	
				DataTable tmpGrp =  GetData("PaymentRequest",Parameter);
				DataTable tmpInv = new DataTable();
					tmpInv = tmpGrp.AsEnumerable().Where(row=>row.Field<string>("LogAPInv_InvoiceNum") == InvoiceNum).CopyToDataTable();
					/*IEnumerable<DataRow> query =from order in tmpGrp.AsEnumerable()
    											where order.Field<string>("LogAPInv_InvoiceNum")==InvoiceNum
    											select order;
					tmpInv = query.CopyToDataTable<DataRow>();*/
					tmpInv.TableName = "Results";//phải set lại tên TableName giống với hàm private DataTable GetData(string BAQID,string s) để mapping với report và có tên table mới ghi file XML đc
				string strPat=@"\\"+session.AppServer.Split('/')[2].Split(':')[0];	
				string PathXml=Key_link11+"\\"+((Session)this.oTrans.Session).UserID+"\\PaymentRequest.XML";
				string PathDesRpt=Key_link11+"\\"+((Session)this.oTrans.Session).UserID+"\\" +reportfile;
				string PathRpt=Key_link12+"\\"+reportfile;
				if(PrintGrp==1)//in theo Group
				else//in theo Inv
				Ice.Lib.Report.EpiCrystalViewer report = new Ice.Lib.Report.EpiCrystalViewer(PathDesRpt, PathXml,"Payment Request");		
			 catch(Exception ex)

DMS_GetPOPrintSendMaill.baq (44.7 KB)
:smiling_face_with_three_hearts: :smiling_face_with_three_hearts:
Thank you have a nice day! :thinking: :thinking: :smiling_face_with_three_hearts:

Hey, Thank you very much for the prompt response and sharing above, appreciate it very much!
May I check with you if the solution above is able to access to the same print interface as per what the default print button does?

Initially thought that it could be achieved by setting the ReadyToPrint as True but that doesn’t seem to be the case to enable the print form without approving the PO

I’m also wondering if it is possible to create a button to call the ERP.UIRpt.POForm process … scratching my head trying all sort of methods :sweat_smile:

This is a segment of the load code for that module.

Judging from this, if you use ProcessCaller to launch “PR000346” (at least in mine) with LaunchFormOptions
and ValueIn with your PO, it may do what you want.

if (this.LaunchFormOpts != null && this.LaunchFormOpts.ValueIn != null)
	this._PONum = Convert.ToInt32(this.LaunchFormOpts.ValueIn.ToString());

Unsolicited suggestion: In your unapproved PO Form, put some big warning in there like “THIS PO IS NOT APPROVED AND IS FOR REFERENCE PURPOSES ONLY.”

This isn’t a bug that you can’t print a PO that is not approved. It is intended to prevent buyers from sending the form to a supplier if their management does not want them to do so.


Thanks a lot! Will need to spend quite a sum of time to study through this :grinning:

Hi Jason,

Thank you for the suggestion! appreciate it very much, indeed the PO report needs to have some sort of labeling to indicate unapproved PO.

Yes, it is not a bug and I understand the intention of this design.
This is more towards our management preference actually :sweat_smile:

1 Like

Hi, I am trying to do a printing for UnApproved PO as well but may I know what are the 3 fields below in the BAQ for?

[Company].[Character03] as [Company_Character03]

[Company].[Character02] as [Company_Character02]

[POHeader].[ShortChar04] as [POHeader_ShortChar04]

I figured it out, just take out ad its all good :laughing: