project QadFinancials > class BRecurringEntry > method AdditionalUpdates

Description

This empty method allows to do additional updates on class temp-tables after records were received (and validated) from outside, using method SetPublicTables.
You can start instances of other business classes to do those updates.


Parameters


oiReturnStatusoutputinteger


Internal usage


QadFinancials
method BRecurringEntry.ApiPostRecEntryCommit


program code (program/brecurringentry.p)

/* ============================================================================== */
/* If the Recurring Entry is active then produce a                                */
/* Warning when there are any lines with status 'waiting' and postingdate < today */
/* ============================================================================== */
for each tRecEntry where 
         tRecEntry.tc_Status        <> 'D':U and
         tRecEntry.RecEntryIsActive  = true
         no-lock:
    for each tRecEntryLine where
             tRecEntryLine.tc_ParentRowid     = tRecEntry.tc_Rowid and
             tRecEntryLine.tc_status         <> 'D':U and
             tRecEntryLine.RecEntryLineStatus = {&RECENTRYLINESTATUS-WAITING}
             no-lock:
        if tRecEntryLine.RecEntryLinePostingDate < today
        then do:
            vcDatetemp = <M-78 DisplayDate  (input  tRecEntryLine.RecEntryLinePostingDate (itDate)) in BRecurringEntry>.
            assign vcMessageRE    = trim(substitute(#T-4'There are open recurring entry lines with a posting date (&1) in the past.':150(3525)t-4#, vcDatetemp))  + chr(10) + 
                                    trim(substitute(#T-5'Recurring entry code: &1.':255(3493)T-5#,trim(tRecEntry.RecEntryCode)))
                   oiReturnStatus = 1.
            <M-1 run SetMessage
               (input  vcMessageRE (icMessage), 
                input  '':U (icArguments), 
                input  'tRecEntryLine.RecEntryLinePostingDate':U (icFieldName), 
                input  vcDatetemp (icFieldValue), 
                input  'W':U (icType), 
                input  3 (iiSeverity), 
                input  tRecEntryLine.tc_rowid (icRowid), 
                input  'QADFIN-974':U (icFcMsgNumber), 
                input  '' (icFcExplanation), 
                input  '' (icFcIdentification), 
                input  '' (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BRecurringEntry>    
            leave. /* f.e. tRecEntryLine */
        end.
    end. /* for each tRecEntryLine */
end. /* for each tRecEntry */

/* ======================================================================= */
/* A recurring Entry can not be deleted if there are non-waiting lines     */
/* ======================================================================= */
for each tRecEntry where 
         tRecEntry.tc_Status = 'D':U
         no-lock:
    for each tRecEntryLine where
             tRecEntryLine.tc_ParentRowid      = tRecEntry.tc_Rowid and
             tRecEntryLine.RecEntryLineStatus <> {&RECENTRYLINESTATUS-WAITING}
             no-lock:
        assign vcMessageRE = trim(substitute(#T-6'You cannot delete this recurring entry. There are already &1 or &2 lines.':150(3526)T-6#, {&RECENTRYLINESTATUS-POSTED-TR}, {&RECENTRYLINESTATUS-DELETED-TR})) + chr(10) +
                             trim(substitute(#T-7'Recurring entry code: &1.':255(3493)T-7#,trim(tRecEntry.RecEntryCode)))
               oiReturnStatus = -1. 
        <M-2 run SetMessage (input  vcMessageRE (icMessage),
                     input  '':U (icArguments),
                     input  'tRecEntry.RecEntryCode':U (icFieldName),
                     input  tRecEntry.RecEntryCode (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  tRecEntry.tc_Rowid (icRowid),
                     input  'QADFIN-980':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BRecurringEntry>    
        leave. 
    end.
end.

/* ===================================================================================================== */
/* All reversingdates on open Recurring Entry Lines must be filled in if the reversing-flag is active.   */
/* Reversingdates on open Recurring Entry Lines cannot be filled in if the reversing-flag is not active. */
/* ===================================================================================================== */
assign vcMessageRE = '':U.
for each tRecEntry where 
         tRecEntry.tc_Status <> 'D':U
         no-lock:
    if tRecEntry.RecEntryIsReversing = true
    then do:
        if can-find(first tRecEntryLine where
                          tRecEntryLine.tc_ParentRowid            = tRecEntry.tc_Rowid            and
                          tRecEntryLine.RecEntryLineStatus        = {&RECENTRYLINESTATUS-WAITING} and
                          tRecEntryLine.RecEntryLineReversingDate = ?                             and
                          tRecEntryLine.tc_Status                <> 'D':U)                         
        then do:
            assign vcMessageRE = trim(#T-8'You must enter all reversing dates on open recurring entry lines if the Reversing field is selected':255(3527)T-8#) + chr(10) +
                                 trim(substitute(#T-9'Recurring entry reversing: &1.':255(3528)T-9#, trim(string(tRecEntry.RecEntryIsReversing)) ))            + chr(10) +
                                 trim(substitute(#T-10'Recurring entry code: &1.':255(3529)T-10#, trim(tRecEntry.RecEntryCode) )).
            leave.
        end.
    end. /* if tRecEntry.RecEntryIsReversing = true */
    else do:
        if can-find(first tRecEntryLine where
                          tRecEntryLine.tc_ParentRowid             = tRecEntry.tc_Rowid            and
                          tRecEntryLine.RecEntryLineStatus         = {&RECENTRYLINESTATUS-WAITING} and
                          tRecEntryLine.RecEntryLineReversingDate <> ?                             and
                          tRecEntryLine.tc_Status                 <> 'D':U)                         
        then do:
            assign vcMessageRE = trim(#T-11'You cannot define reversing dates for open recurring entry lines if the Reversing field is cleared.':255(3530)t-11#) + chr(10) +
                                 trim(substitute(#T-12'Recurring entry reversing: &1.':255(3528)T-12#, trim(string(tRecEntry.RecEntryIsReversing)) ))            + chr(10) +
                                 trim(substitute(#T-13'Recurring entry code: &1.':255(3529)T-13#, trim(tRecEntry.RecEntryCode) )).
            leave.
        end.
    end. /* else tRecEntry.RecEntryIsReversing = true */
end. /* for each tRecEntry */
        
if vcMessageRE <> '':U
then do:
    assign oiReturnStatus = -1. 
    <M-3 run SetMessage (input  vcMessageRE (icMessage),
                     input  '':U (icArguments),
                     input  'tRecEntry.RecEntryIsReversing':U (icFieldName),
                     input  string(tRecEntry.RecEntryIsReversing) (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  tRecEntry.tc_Rowid (icRowid),
                     input  'QADFIN-1060':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BRecurringEntry>    
end.

if oiReturnStatus < 1
then return.

<ANCESTOR-CODE>