Class PO_GeneratePurchaseOrders

This portable class embodies a common standard routine for generating purchase orders from sales orders.

Properties

LOCAL cItemTypesForDropShip$  
LOCAL cItemTypesRequiringCIItem$=itmREGULAR$+itmCHARGE$+itmMISC$  
PROPERTY PO_IntegrateInventory$   * Read Only *
PROPERTY PO_IntegrateJobCost$   * Read Only *
PROPERTY PO_CombineSalesOrdersByVendor$   * Read Only *
PROPERTY PO_UseSONoAsPONo$   * Read Only *
PROPERTY PO_ApplyIncrementalValToPONoAt$   * Read Only *
PROPERTY PO_BasePOHeaderReqDateOn$   * Read Only *
PROPERTY PO_BasePOLineReqDateOn$   * Read Only *
PROPERTY PO_PrintPONoAssignmentListing$   * Read Only *
PROPERTY PO_AccessPOEntryAfterGeneration$   * Read Only *
PROPERTY PO_PrintPOAfterGeneration$   * Read Only *
PROPERTY PO_IncludeSOFieldShipToAddrDSOnly$   * Read Only *
PROPERTY PO_IncludeSOFieldShipViaDSOnly$   * Read Only *
PROPERTY PO_IncludeSOFieldFOBDSOnly$   * Read Only *
PROPERTY PO_IncludeSOFieldConfirmTo$   * Read Only *
PROPERTY PO_IncludeSOFieldEmailAddress$   * Read Only *
PROPERTY PO_IncludeSOFieldCOGSAcctForDS$   * Read Only *
PROPERTY PO_IncludeSOFieldAliasItemNo$   * Read Only *
PROPERTY PO_IncludeAllocatedCostInUnitCost$   * Read Only *
PROPERTY PO_SortPOLinesBy$   * Read Only *
PROPERTY SO_IntegrateInventory$   * Read Only *
PROPERTY SO_IntegrateJobCost$   * Read Only *
PROPERTY SO_PostDropShipCostsToJC$   * Read Only *
PROPERTY IM_QuantityAvailableToInclude$   * Read Only *
PROPERTY IM_ReorderByWhse$   * Read Only *
PROPERTY CI_PrecisionPrice   * Read Only *
PROPERTY CI_PrecisionQty   * Read Only *
PROPERTY CI_PrecisionCost   * Read Only *
PROPERTY Opt_SalesOrderTypes$  
PROPERTY Opt_SalesOrderStatuses$  
PROPERTY Opt_ProcurementTypes$  
PROPERTY Opt_ProductTypes$  
PROPERTY Opt_ItemTypes$  
PROPERTY Opt_IncludeDropShipLines$  
PROPERTY Opt_SummarizeDropShipsByVendor$  
PROPERTY Opt_BaseOrderQuantityOn$  
PROPERTY Opt_UseBackorderedQty$  
PROPERTY Opt_UpdateUnitCostWith$  
PROPERTY Opt_UpdateCostWithSOCostForDSLines$  
PROPERTY Opt_SummarizeMultipleItemsByLine$  
PROPERTY Opt_AddSOCustDetailAsCommentLine$  
PROPERTY Opt_OnlySelectOpenJobs$  
PROPERTY Opt_IncludeExpiredSalesOrders$  
PROPERTY Opt_IncludeSOCommentLines$  
PROPERTY Opt_IncludeSOItemLineComments$  
PROPERTY Opt_FormatPOHeaderCommentWith$  
PROPERTY PromptedHeaderRequiredDate$  
PROPERTY PromptedLineRequiredDate$  
PROPERTY WithoutUI  

[boolean] set this to disable progress bars and messages. No progress meters, dialogs, or UI tasks will be displayed if this is true.

If using this option and PO_BasePOHeaderReqDateOn$=Promp"T" and/or PO_BasePOLineReqDateOn$=Promp"T", you will want to programmatically set the PromptedHeaderRequiredDate$ or PromptedLineRequiredDate$, as no dialog will be displayed.

Methods

FUNCTION CreateOrders(salesOrderNo$, ordersCreated$)  

Select and create purchase orders for a specific sales order number. This is a wrapper around SelectSalesOrders, PromptForAdditionalInformation, and CreateSelectedOrders that creates and uses a temporary in-memory copy of the PO_AutoGenerateOrders table to create purchase orders for a single sales order.

ParameterDescription
salesOrderNo$ [input, string] The sales order number you wish to create purchase orders to fill.
ordersCreated$ [output, string] A SEP-delimited list of purchase order numbers that were created.
Returns [boolean] Success if any purchase orders were actually created. Failure otherwise.
FUNCTION CreateSelectedOrders(ordersCreated$)  

Create purchase orders for all of the sales order lines described in the PO_AutoGenerateOrders table. May display an error log or offer to print the Purchase Order Assignment Listing, depending on options chosen, unless the WithoutUI property is true.

ParameterDescription
ordersCreated$ [output, string] A SEP-delimited list of purchase order numbers that were created.
Returns [boolean] Success if any purchase orders were actually created. Failure otherwise.
FUNCTION GetDefaultOptions(defaultRec$, defaultIOL$)  

Read the default options from PO_AutoGenerateOrdersDefaults, or failing that, assign defaults programmatically. Calls InitializeOptions if it has not already been called at least once.

ParameterDescription
defaultRec$ [output, string] SEP-delimited record from PO_AutoGenerateDefaults
defaultIOL$ [output, string] IOList describing the contents of defaultRec$
Returns [boolean] success
FUNCTION InitializeOptions()  

Read all options and settings relevant to generating purchase orders from sales orders, including default settings. Called implicitly by GetDefaultOptions, SelectSalesOrders, and CreateSelectedOrders if it has not been run at least once already. You may wish to call this explicitly between generation cycles if you believe options may have changed in the meantime.

Returns [boolean] success
FUNCTION PONumberListing(ordersCreated$)  

Print the Purchase Order Number Assignment Listing for a list of purchase orders. CreateSelectedOrders will run this at the end of a successful creation if PO_PrintPONoAssignmentListing$ is "Y" and WithoutUI is false. It may be called explicitly too.

ParameterDescription
ordersCreated$ [input, string] Provide a SEP-delimited list of purchase orders that you'd like to see on this report.
Returns [boolean] The "print status" of the listing, or failure if it couldn't print the listing.
FUNCTION PromptForAdditionalInformation()  

Display a dialog to collect the Next Purchase Order Number, PO Header Required Date, and PO Lines Required Date, as needed. If none of those things are needed (based on settings) then it simply returns success without displaying a dialog. The CreateOrders method runs this method if WithoutUI is not true. PO_AutoOrderSelect_ui runs this method prior to running CreateSelectedOrders.

Returns [boolean] Success, unless we show the dialog and the user cancels out of it. This would be interpreted as a sign that the user does not wish to proceed.
FUNCTION SaveDefaultOptions()  

Save the current Opt_ parameters to PO_AutoGenerateOrdersDefaults.

Returns [boolean] Failure if options were not initialized before calling this, otherwise success.
FUNCTION SelectSalesOrders(whereClause$, beginKey$, endKey$, whereIndex$, detailWhereClause$, itemWhereClause$)  

Select sales orders to generate purchase orders from. Then populate PO_AutoGenerateOrders with them. This would normally be called by PO_AutoOrderSelect_ui which uses methods from SY_Selection to collect data for these parameters.

ParameterDescription
whereClause$ [input, string] "where clause" to be used when selecting records from SO_SalesOrderHeader
beginKey$ [input, string] Key or partial key to begin the range of records to select from SO_SalesOrderHeader, using the index specified by whereIndex$.
endKey$ [input, string] Key or partial key to end the range of records to select from SO_SalesOrderHeader, using the index specified by whereIndex$.
whereIndex$ [input, string] Name of the index in SO_SalesOrderHeader that beginKey$ and endKey$ use. For example, "KPRIMARY"
detailWhereClause$ [input, string] "where clause" to be used when selecting records from SO_SalesOrderDetail
itemWhereClause$ [input, string] "where clause" to be used when selecting records from CI_Item
Returns [boolean] Success if any sales order lines met the selection criteria and were actually selected for purchase order creation. Failure otherwise.

Properties inherited from: CI_Constant

itmREGULAR$, itmSPECIAL$, itmCHARGE$, itmCOMMENT$, itmMISC$, valSTANDARD$, valAVERAGE$, valFIFO$, valLIFO$, valLOT$, valSERIAL$, typFINISHEDGOODS$, typRAWMATERIALS$, typDISCONTINUED$, typKIT$, proMAKE$, proBUY$, proSUBCONTRACT$

Properties inherited from: PO_Constant

allocateByCOST$, allocateByQUANTITY$, allocateByVOLUME$, allocateByWEIGHT$, ordTypeDROPSHIP$, ordTypeMASTER$, ordTypeMATERIALREQ$, ordTypeREPEATING$, ordTypeSTANDARD$, ordTypeDROPSHIPDesc$, ordTypeMASTERDesc$, ordTypeMATERIALREQDesc$, ordTypeREPEATINGDesc$, ordTypeSTANDARDDesc$, dataEntryRECEIPTGOODS$, dataEntryRECEIPTINVOICE$, dataEntryRETURNORDER$, dataEntryMATERIALISSUE$, openOrderItem$, openOrderJOBWORKORDER$, ordStatusNEW$, ordStatusOPEN$, ordStatusBACKORDERED$, ordStatusCHANGE$, ordStatusCOMPLETE$, ordStatusCANCELLED$, priceTypeVENDOR$, priceTypePRODUCT$, priceTypeITEM$, priceMethodCOSTDISC$, priceMethodDISCPERCENT$, priceMethodSTANDARD$, QuantityMask$, CostMask$, PriceMask$, ExtensionAmtMask$, UnitOfMeasureMask$

Properties inherited from: SY_Customization

cDummyIol$

Properties inherited from: SY_OpenObject

cLockInfoNOKEY$

Methods inherited from: CI_Constant

GetCalendarEndingDate(), GetDefaultExtendedDescriptionKey$()

Methods inherited from: SY_Common

FormatAddress(), ParseCityStateZip(), ClassValidateDirectory(), DirectoryCheck(), GetNextSequence(), GetUNCNamedDrive(), IsInstalled(), LocalizeFileIOList(), LocalizeIOList(), PackSequence$(), UnpackSequence(), UseChildKeyColl()

Methods inherited from: SY_Customization

GetCustomizations(), PostTableRead(), PreNextRecord(), PreTableWrite()

Methods inherited from: SY_OpenObject

CheckWhoHasLock(), CreateLockInfo(), RemoveLockInfo(), OpenTable(), OpenTempFile()