Class PO_PurchaseOrderDetail_bus

Properties

LOCAL cItmCommonFields$="PurchaseOrderNo$, LineKey$, LineSeqNo$"  
LOCAL cIsSysDB=isFALSE  
LOCAL cMainTable$="PO_PurchaseOrderDetail"  
LOCAL cNoUpdateUI=-1  

Flag to not update into UI record when setting a partial record in the copy from process

LOCAL cPMFieldsToClearIOL$=CPL("IOLIST StepLineKey$, WorkTicketLineKey$, WorkTicketStatus$")  

[string] Providex IOLIST of variables to be cleared when work ticket is changed

LOCAL cAllowDeleteCopiedLine=isFALSE  
LOCAL cIsMaterialRequisition=isTRUE  
LOCAL cCopiedLineKeyCol$  
LOCAL cCopiedLineKeyFromCol$="MASTERREPEATINGORDERNO$"  
PROPERTY AuditTracking  

[boolean] Flag to indicate whether to track changes in audit trail

PROPERTY IsOrderInvoiced   * Read Only *
PROPERTY JCLines   * Read Only *

[numeric] Count of all lines that reference job numbers

PROPERTY PMLines   * Read Only *

[numeric] Count of all lines that reference work ticket numbers

PROPERTY PoCopyMasterRepeatSrc$   * Read Only *
PROPERTY PoCopyMasterRepeatDest$   * Read Only *
PROPERTY PoCopySalesOrderSrc$   * Read Only *
PROPERTY PoCopySalesOrderDest$   * Read Only *
PROPERTY POCopyUnitCost  

Methods

FUNCTION AccumulateBatchTotals()  
FUNCTION AddLine()  
FUNCTION CheckForWorkTicketLink(workTicket$, wtLineKey$)  

Checks to see if the given work ticket key and work ticket line key in the PM_WorkTicketDetail table is linked to the current Purchase Order and Purchase Order line key. This is called when changing the work ticket number to see if the previous value was linked.

ParameterDescription
workTicket$ [input, string] Work Ticket Key value to be used to read the PM_WorkTicketDetail table.
wtLineKey$ [input, string] Work Ticket Line Key value to be used to read the PM_WorkTicketDetail table
Returns [boolean]
ValueDescription
True - The work ticket detail line is linked to the current purchase order and line
False - The work ticket detail has no matching link to the current purchase order and line.
FUNCTION CheckLinesForOrderStatus(changeOrderStatus$)  
FUNCTION CheckLinesForPendingWorkTicketLinks(poNum$)  

Checks if there are any pending links for the given purchase order. This will scan through the PO_PurchaseOrderDetail table looking for WorkTicketStatus equal to "N" or "E" or if there are pending transactions for the current user and purchase order in the PO_WorkTicketPOLink table.

ParameterDescription
poNum$ [input, string] Purchase Order number to check for pending work ticket links.
Returns [boolean]
ValueDescription
True - If a pending link transaction is found
False - If no pending link transactions are found.
FUNCTION CheckLinesForWorkTickets(workTickets$)  
FUNCTION CheckLinesForWorkTickets(workTickets$, hasWTLineWithQtyReceived)  

Checks all lines for the current purchase order for references to any work tickets. If work tickets are found, then true is returned and a SEP (hex 8A) separated list of WorkTicketKeys are returned in the workTickets$ argument.

ParameterDescription
workTickets$ [output, string] SEP (hex 8A0 separated list of work ticket keys that were found on the lines. If no work tickets found

@param+ this will be returned blank.

ParameterDescription
hasWTLineWithQtyReceived {optional} [output, boolean] True if at least one purchase order line is linked to work ticket and has quantity received.
Returns [boolean]
ValueDescription
True - if any line on the purchase order has a reference to a work ticket. List of work ticket keys returned in workTickets$ parameter.
False - if there are no lines that reference a work ticket.
FUNCTION CheckLinesForWorkTicketTransactions()  

Checks all lines for the current purchase order checking for any work ticket reference that has transactions in PM_TransactionHistory. This is used to determine whether a purchase order can be deleted from within Purchase Order Entry.

Returns [boolean]
ValueDescription
True - If any work ticket reference has transactions in PM_TransactionHistory
False - If no work ticket references or the references that do exist do not have any transactions in PM_TransactionHistory.
FUNCTION CheckLinesFromSalesOrder()  
FUNCTION CheckWorkTicketLineStatus(workTicket$, wtLineKey$)  

Checks to see if the updated quantity issued value exceeds or equals the quantity required for the given work ticket line. This is used in the changing of the quantity ordered on a line with a work ticket link.

ParameterDescription
workTicket$ [input, string] WorkTicketKey value for the work ticket to be looked up.
wtLineKey$ [input, string] LineKey value for the work ticket detail line to be looked up.
Returns [boolean]
ValueDescription
True - if quantities are acceptable
False - if updated issued quantity exceeds or is equal to the quantity required for the work ticket line.
FUNCTION CheckWorkTicketLineTransactions(workTicket$, wtLineKey$)  

Checks if a given work ticket key and work ticket line key has any transactions in PM_TransactionHistory.

ParameterDescription
workTicket$ [input, string] Work Ticket Key value to search for transactions in PM_TransactionHistory
wtLineKey$ [input, string] Work Ticket Line Key value to search for transactions in PM_TransactionHistory
Returns [boolean]
ValueDescription
True - if a transaction is found in PM_TransactionHistory for the given WorkTicketKey + WorkTicketLineKey combination.
False - if no transactions are found in PM_TransactionHistory for the given WorkTicketKey + WorkTicketLineKey combination.
FUNCTION CheckWorkTicketUseInTransEntry(workTicket$)  

Checks the PM_TransactionHeader (Work Ticket Transaction Entry) table for any transctions for the given work ticket key.

ParameterDescription
workTicket$ [input, string] WorkTicketKey value to search for.
Returns [boolean]
ValueDescription
True - if the given work ticket key is found in the PM_TransactionHeader table.
False - if the given work ticket key is not found in the PM_TransactionHeader table
FUNCTION ClearSetFiles()  
FUNCTION ClearSetFileWorkTable(clearKey$)  

Clear Set File Work Table, overridden from PO_CommonEntryDetailVendor

ParameterDescription
clearKey$ [input, string] key value of detail line.
Returns [boolean] True
FUNCTION ConfirmDeleteWorkTicket()  

Checks if a purchase order line with work ticket number can be deleted

Returns [boolean] retSUCCESS (1) if line can be deleted, retFAILURE (0) if line cannot be deleted
FUNCTION CopyInvoiceHistoryLines(invoiceKey$, copyOrderType$)  

Create purchase order lines from invoice lines in a/p invoice history sourced from p/o

ParameterDescription
invoiceKey$ [input, string] key to invoice history header record to create in purchase order entry
copyOrderType$ [input, string] Order type of purchase order to be created
FUNCTION CopyMasterRepeatingOrderLines(PONo$)  
FUNCTION CopyOrderHistoryLines(order$, type$)  

Create purchase order lines from a purchase order in history

ParameterDescription
order$ [input, string] purchase order number to copy
type$ [input, string] order type of purchase order to be created
Returns [boolean] True for success, False for failure
FUNCTION CopyOrderLines(order$, type$)  
FUNCTION CopyOrderLines(order$, type$, copyComments$, setVendorAliasItem$)  

Create purchase order lines from an existing purchase order

ParameterDescription
order$ [input, string] purchase order number to copy
type$ [input, string] order type of purchase order to be created
copyComments$ {optional} [input, string] 'Y/N' flag to copy comment lines (assumed 'Y' if not specified)
setVendorAliasItem$ {optional} [input, string] 'Y/N' flag to set vendor alias item number in order detail (assumed 'N' if not specified)
Returns [boolean] True for success, False for failure
FUNCTION CopyReceiptHistoryLines(receiptKey$, copyOrderType$)  
FUNCTION CopyReceiptHistoryLines(receiptKey$, copyOrderType$, poNumber$)  

Create purchase order lines from receipt lines in purchase order receipt history

ParameterDescription
receiptKey$ [input, string] key to receipt history header record to create in purchase order entry
copyOrderType$ [input, string] Order type of purchase order to be created
poNumber$ {optional} [input, string] applied purchase order number to copy receipt history detail from, when blank detail from all applied p/o's will be copied
FUNCTION CopySalesOrderLines(SoNo$, APDivNo$, VendNo$, CopyAllLines$, useVendorPricing)  
FUNCTION DeleteLine(LineKey$)  
FUNCTION GetContext$(destTable$)  
FUNCTION GetContextSourceTables$(context$)  
FUNCTION GetCostStatusMsg$()  

Get Cost Status Message text for current line where there is a Regular item

Returns [string] message text formatted as -> Last Cost: ##,###,###.000- Average Cost: ##,###,###.000- Standard Cost: ##,###,###.000-
FUNCTION GetOldRecordValues(flds$, oldValues$)  

Returns the values of the fields specified in the flds$ argument from the old record (cOrigRcd$).

ParameterDescription
fld$ [input, string] Comma separated list of field names to retrieve from the old record.
oldValues$ [output, string] SEP separated list of values from the old record that correspond to the fields given.
Returns Always returns True (1)
FUNCTION GetStepLineKey$(workTicket$, step$)  

Function returns the step line key for the given work ticket and step number

ParameterDescription
workTicket$ [input, string] work ticket number that the step belongs to
step$ [input, string] step number on the work ticket.
Returns [string] returns the StepLineKey$ for the given work ticket and step number or blank if the work ticket/step not found.
FUNCTION GetWorkTicketLinkLines()  

Function will scan through the current purchase order lines for any line that does not have a current work ticket key associated with the line. It will then test to ensure line has a quantity and is a valid item type and in a warehouse that is available. Any line that meets the criteria will be written to the PM_WorkTicketLinkWork table and used in the multiple work ticket link screen.

Returns [numeric] Returns a count of the number of lines selected.
FUNCTION IsWorkTicketLocked(workTicket$)  
FUNCTION IsWorkTicketLocked(workTicket$, wtNumber$)  

Checks to see if the given work ticket is in use by trying to extract the record.

ParameterDescription
workTicket$ [input, string] WorkTicketKey value to try and extract.
wtNumber$ [output, string] {optional} WorkTicketNo for the work ticket key that is being checked.
Returns [boolean]
ValueDescription
True - If given work ticket key is locked by another user.
False - If given work ticket key is not locked.
FUNCTION OrderHasWorkTickets()  
FUNCTION OrderHasWorkTickets(order$)  
FUNCTION OrderHasWorkTickets(order$, skipStatus$)  

Function will check to see if the given order has any lines that reference a work ticket number. If no order number given, then the purchase order being editted will be checked.

ParameterDescription
order$ [input, string] {optional} order number to check for work tickets
skipStatus$ [input, string] {optional} concatenated one character status codes to skip checking
Returns [boolean]
ValueDescription
True(1) If given order has work tickets
False(0) If order has no associated work tickets
FUNCTION ResetWorkTicketInfo(workTicket$, wtStepKey$, wtLineKey$, wtStatus$)  

Function will reset work ticket values into the business object, and reset child collections for work ticket and step back to the given values. Also resets values of UI variables ML_WorkTicketNo and ML_WorkTicketStepNo, so that UI can retrieve them when resetting the UI values.

ParameterDescription
workTicket$ [input, string] value to reset WorkTicketKey back too.
wtStepKey$ [input, string] value to reset WorkTicketStepLineKey back too.
wtLineKey$ [input, string] value to reset WorkTicketLineKey$ back too.
wtStatus$ [input, string] value to reset WorkTicketStatus$ back too.
Returns Always returns True (1)
FUNCTION SetCopyLines(boolean)  
FUNCTION SetExtensionColumn(orderType$)  
FUNCTION SetFilter(whereClause$)  
FUNCTION SetFilter(whereClause$, restrictKey$)  

Function overridden from base class SY_Maint. Overridden to clean up production management work tables when reloading the lines from the physical table.

ParameterDescription
whereClause$ [input, string] where clause to use on the selection of the physical file. Used in the WHERE clause on the SELECT
restrictKey$ [input, string] {optional} restrict key to use on the selection of the pyhsical file. Used in the BEGIN/END of the SELECT
Returns Returns the value from the call to the base class.
FUNCTION UpdateCostHierarchyForQuote()  

Function will update the unit cost for the detail based on the cost hierarchy

Returns [boolean] True if successful, False if not
FUNCTION UpdateLastCostForQuote()  

Function will update the last unit cost for the detail

Returns [boolean] True if successful, False if not
FUNCTION UpdatePendingWorkTicketLink(poNum$, poLine$, workTicket$, stepKey$, workTicketLine$, linkStatus$, linkType$)  

Function will update the given purchase order/line with link information from the work ticket. This will only setup the purchase order line with values in WorkTicketStatus, WorkTicketKey, WorkTicketLineKey$, WorkTicketStepLineKey$ to be used when writing the order.

ParameterDescription
poNum$ [input, string] Purchase order number that has lines to be linked.
poLine$ [input, string] Purchase order line key to be linked
workTicket$ [input, string] WorkTicketKey to link the purchase order line(s) with.
stepKey$ [input, string] WorkTicketStepLineKey$ to linke the purchase order line(s) with.
workTicketLine$[output, string] WorkTicketLineKey$ assigned if a "MATCH" work ticket link type.
linkStatus$ [output, string] Status of the link
linkType$ [input, string] Link type to attempt, either "MATCH" or "NEW". Match will look for an existing work ticket line that matches

@param+ the purchase order/line. "NEW" will create a new work ticket line for the purchase order/line.

Returns [boolean]
ValueDescription
True - If successful link info is established.
False - If successful link could not be established.
FUNCTION UpdateRequiredDate(oldReqDate$, reqDate$)  
FUNCTION UpdateWorkTicketLinks(poNum$, linkType$)  

Function will set links to the values in the PO_WorkTicketLinkWork table after the multiple link utility is used in the UI. This will set the pending link hooks to be used when the record is written.

ParameterDescription
poNum$ [input, string] Purchase order number that is being linked too.
linkType$ [input, string] This is set from the selection dialogue and valid values are "MATCH" or "NEW". "MATCH" will attempt to match

@param+ a line on the work ticket with the values from the purchase order, if one exists then this will match an existing line. "NEW" will @param+ create a new line on the work ticket and link it with the values from the PO_WorkTicketLinkWork table.

Returns Always returns True (1)
FUNCTION UpdateWorkTicketPOLinkInfo(poNum$, poLine$, type$)  
FUNCTION UpdateWorkTicketPOLinkInfo(poNum$, poLine$, type$, skipExisting)  

Updates the PO_WorkTicketPOLinkWork table with purchase order line information used for unlinking or deleting links & lines, when deleting purchase order lines or changing work ticket references on existing lines.

ParameterDescription
poNum$ [input, string] Purchase Order number to unlink references for.
poLine$ [input, string] Purchase Order Line Key to unlink references for
type$ [input, string] Type of process to do when removing link. "U"nlink = strictly remove reference information from purchase order

@param+ line and work ticket line. "D"elete - unlink purchase order line and remove line from the work ticket. "B" - remove line from both @param+ purchase order and work ticket.

ParameterDescription
skipExisting [input, boolean] {optional} Flag to indicate that if record already exists in PO_WorkTicketLinkPOLinkWork to not overwrite

@param+ it. This is used mainly for business object defaults that do not want to overwrite UI preferences from the user.

Returns Always returns True (1)
FUNCTION ValidateAccumulateLines()  
FUNCTION ValidateGroupFAIntegration()  
FUNCTION ValidateGroupMPSetup()  
FUNCTION ValidateGroupNotMasterOrder()  
FUNCTION ValidateGroupNotMasterRepeating()  
FUNCTION ValidateGroupPOMasterOrder()  
FUNCTION ValidateGroupRepeatingOrder()  
FUNCTION ValidateGroupSOSetup()  
FUNCTION ValidateLines()  
FUNCTION ValidateWorkTicketStepNo(value$)  

Method to validate the work ticket step number, which will in turn validate the WorkTicketStepLineKey.

ParameterDescription
value$ [input, string] value of the Step Number to be validated.
Returns [boolean]
ValueDescription
True - If step number is valid
False - If step number is invalid

Properties inherited from: CI_AssetTemplate_Val

AssetTemplates$, CheckForRequired, DropShipOrder, FAAccountKey$, FAIntegrateAP$, FAIntegratePO$, FAQuantity, FATemplateRequired$, FL_AllowAssetCreation, InheritedBy$, JobCostIntegrated$, POAccountKey$, POInvoiceRequiredForFA$, POQuantity$, WorkOrderIntegrated$

Properties inherited from: PO_CommonEntryDetailVendor

TaxClassWarningMsg$, WoFocusLastErrorMsg$, WoFocusLastErrorNum$, VendorPriceLevelExists

Methods inherited from: CI_AssetTemplate_Val

CheckForAssetTemplates(), ValidateAssetAccount(), ValidateGroupFAIntegration(), ValidateGroupFAKey(), ClassValidateAssetTemplate()

Methods inherited from: CI_WorkTicket_val

ClassValidateWorkTicket()

Methods inherited from: PO_CommonEntryDetailVendor

ValidateGroupAPSalesTax(), ValidateGroupJobNo(), AddIn(), Backout(), CheckIMItemVendor(), CheckVendorAliasItem(), GetTotalCols(), SetCurrentKey(), ValidateTaxClass()