project QadFinancials > class BERSProcessor > method ERSProcessLegalDocumentsVal
Description
Main method used for ERS processing: all pending voucher records flagged by the user will be processed: the pending vouchers will be validated. If the validation is passed, the supplier invoices and AP matching records will be created for the pending vouchers.
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program5/bersprocessor.p)
/* ================================================================================================== */
/* A legal document should be processed as a whole, if there are lines of a legal document not shown */
/* in the grid then the legal document should not be processed. */
/* For example, on PO Maintenance the supplier for LC can be changed to a supplier with ERS Option 1. */
/* However, the supplier on the PO is set to ERS option 3. In ERS Processor this will only show the */
/* material line and the processing of such document should stop. */
/* ================================================================================================== */
assign vlAllLDLinesFound = true.
for each tqLegalDocumentByLegalDocNbr where
tqLegalDocumentByLegalDocNbr.tclgd_domain = tERSProcessorRef.tcDomainCode and
tqLegalDocumentByLegalDocNbr.tclgd_nbr = tERSProcessorRef.tcLegalDocNbr and
tqLegalDocumentByLegalDocNbr.tclgd_shipfrom = tERSProcessorRef.tcShipFrom and
tqLegalDocumentByLegalDocNbr.ttlgd_effdate = tERSProcessorRef.ttEffectiveIssueDate
break by tqLegalDocumentByLegalDocNbr.tclgdd_order:
/* we should ignore LE, UNP, TRANS and NONE lines - as these will not be shown in the ERS processor grid */
if tqLegalDocumentByLegalDocNbr.tclgdd_doc_type = {&LEGALDOCUMENT-LINE-TYPE-LE} or
tqLegalDocumentByLegalDocNbr.tclgdd_doc_type = {&LEGALDOCUMENT-LINE-TYPE-UNP} or
tqLegalDocumentByLegalDocNbr.tclgdd_doc_type = {&LEGALDOCUMENT-LINE-TYPE-NONE} or
tqLegalDocumentByLegalDocNbr.tclgdd_doc_type = {&LEGALDOCUMENT-LINE-TYPE-TRANS}
then next.
/* check to see if we can find the legal document line in the grid */
if not can-find(first bERSProcessorRef where
bERSProcessorRef.tcDomainCode = tERSProcessorRef.tcDomainCode and
bERSProcessorRef.tcLegalDocNbr = tERSProcessorRef.tcLegalDocNbr and
bERSProcessorRef.ttEffectiveIssueDate = tERSProcessorRef.ttEffectiveIssueDate and
bERSProcessorRef.tcShipFrom = tERSProcessorRef.tcShipFrom and
bERSProcessorRef.tcPurchaseOrderNbr = tqLegalDocumentByLegalDocNbr.tclgdd_order)
then assign vlAllLDLinesFound = false.
if vlAllLDLinesFound = false then leave.
end. /* for each tqLegalDocumentByLegalDocNbr where... */
if vlAllLDLinesFound = false
then do:
assign vcMessage = #T-19'Legal document &1 has not been processed by ERS. Not all legal document lines are present in the grid.':255(874700922)T-19#
vcMessage = substitute(vcMessage, tERSProcessorRef.tcLegalDocNbr).
<M-51 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-151468':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
assign oiReturnStatus = -1.
end. /* if vlAllLDLinesFound = false */
/* =============================================================================================== */
/* All pending vouchers from certain legal document have to be processed and this have to be */
/* with option 3 (supplier invoice in final status ) */
/* =============================================================================================== */
if can-find(first bERSProcessorRef where
bERSProcessorRef.tcDomainCode = tERSProcessorRef.tcDomainCode and
bERSProcessorRef.tcLegalDocNbr = tERSProcessorRef.tcLegalDocNbr and
bERSProcessorRef.ttEffectiveIssueDate = tERSProcessorRef.ttEffectiveIssueDate and
bERSProcessorRef.tcShipFrom = tERSProcessorRef.tcShipFrom and
bERSProcessorRef.tiERSOpt <> 3)
then do:
assign vcMessage = #T-96'Legal document &1 has been skipped from ERS processing as there are pending vouchers not referencing ERS option 3.':255(916782712)T-96# + " ":U
+ #T-69'Default value of ERS processor can be changed in the ERS maintenance.':255(135276165)T-69#
vcMessage = substitute(vcMessage, tERSProcessorRef.tcLegalDocNbr).
<M-93 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-522964':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
assign oiReturnStatus = -1.
end.
/* all lines of the pending voucher needs to be all selected or not-selected */
if can-find(first bERSProcessorRef where
bERSProcessorRef.tcDomainCode = tERSProcessorRef.tcDomainCode and
bERSProcessorRef.tcLegalDocNbr = tERSProcessorRef.tcLegalDocNbr and
bERSProcessorRef.ttEffectiveIssueDate = tERSProcessorRef.ttEffectiveIssueDate and
bERSProcessorRef.tcShipFrom = tERSProcessorRef.tcShipFrom and
bERSProcessorRef.tlIsSelected = false)
then do:
assign vcMessage = #T-42'Legal document &1 has not been processed. All pending vouchers for a legal document must be processed in the same batch, but not all lines were selected for processing.':255(122862302)T-42#
vcMessage = substitute(vcMessage, tERSProcessorRef.tcLegalDocNbr).
<M-85 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'qadfin-276461':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BERSProcessor>
assign oiReturnStatus = -1.
end.