The MakePO component generates a purchase order (PO) by merging the information on the order form with a purchase order template.
C:\Inetpub\Wwwroot\Market\config\PoMailtemplate.txt
_po_text
.MakePO can be used to dynamically generate a text entry on the OrderForm (usually a purchase order). The entry is generated from a template file similar to an ASP page. Like an ASP page, a MakePO template contains plain text interspersed with special tags containing script code. From within script, output can be achieved using PageGen.Print expression, or <%% = expression %%> similar to ASP's shortcut for Response.Write. The script language is configurable in the property page.
From within the MakePO template, the business object (OrderForm, dictionary, or child object) is exposed as an object with the name Items
. The selected scripting language's library is also extended to include the members of this object as built-in properties, so referring to the business object's entries using the Items.xxx
notation is optional. For this reason it is advisable to declare any temporary variables, so that they are not saved to the business object.
The following script is an example from the POMailTemplate.txt template, used by the MakePO component in the Purchase Order Submit stage of the SubmitViaMail.pcf pipeline for the Microsoft Market sample site:
Item Class:<%%= item.partclasscode %%>
#:<%%= item.partnumber %%>
Qty:<%%= item.quantity %%>
Cost:<%%= item.[_display_list_price] %%>
Unit Code:<%%= item.unitcode %%>
The PO generated by MakePO can be saved to a file using the POToFile component.
Note MakePO can not output variant subtype VT_DECIMAL. Any usage of decimal or currency in MakePO must be wrapped with a call to CStr, which properly coerces the value to a string. For example:
Requisition # <%% = CStr(RequisitionID) %%>