project QadFinancials > class BERSProcessor > method ERSProcessFinishERSLine

Description

Create ERS Line Log records


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BERSProcessor.ERSProcessFinish


program code (program5/bersprocessor.p)

/* =================================================================================================== */
/* Method      : ERSProcessFinishERSLine                                                               */
/* Desc        : Create ERS Line records                                                               */
/* =================================================================================================== */

assign oiReturnStatus = -98.

/* =================================================================================================== */
/* Preconditions                                                                                       */
/* =================================================================================================== */
if vlIsCreateCIAndAPMatching <> true or
   viERSId                    = ?        /* has been ERS record created */
then do:
    assign oiReturnStatus = 0.
    return.
end.

/* =================================================================================================== */
/* Go through all processed records                                                                    */
/* =================================================================================================== */
empty temp-table tERSLineRefERSP.

for each tERSProcessorRef where
         tERSProcessorRef.tlIsProcessed     = true and 
         tERSProcessorRef.tiAPMatchingLnId <> 0:   
    create tERSLineRefERSP.
    assign tERSLineRefERSP.tiERSId          = viERSId
           tERSLineRefERSP.tiPvodLineId     = tERSProcessorRef.tiPvoId
           tERSLineRefERSP.tiAPMatchingLnId = tERSProcessorRef.tiAPMatchingLnId.
end. /* for each tERSProcessorRef where */

/* =================================================================================================== */
/* Store data to database                                                                              */
/* =================================================================================================== */
<I-1 {bFcStartAndOpenInstance
     &ADD-TO-TRANSACTION = "true"
     &CLASS              = "BERSLine"}>
     
<M-2 run AddErsLines
   (input  tERSLineRefERSP (tERSLineRef), 
    output viFcReturnSuper (oiReturnStatus)) in BERSLine>
if viFcReturnSuper < 0 or
   viFcReturnSuper > 0 and viLocalReturn = 0
then assign viLocalReturn = viFcReturnSuper.
         
if viLocalReturn >= 0
then do:
    <M-3 run ValidateBCAndAdditionalUpdates  (output viFcReturnSuper (oiReturnStatus)) in BERSLine>
    if viFcReturnSuper < 0 or
       viFcReturnSuper > 0 and viLocalReturn = 0
    then assign viLocalReturn = viFcReturnSuper.
end.

<I-4 {bFcCloseInstance
     &CLASS           = "BERSLine"}>
     
/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
assign oiReturnStatus = viLocalReturn.