project QadFinancials > class BExpenseNote > 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 BExpenseNote.ValidateBCAndAdditionalUpdates


program code (program/bexpensenote.p)

<ANCESTOR-CODE>
for each tExpNote where tExpNote.tc_Status <> "D":U:
    if vcActivityCode = "ConfirmOwn":U or
       vcActivityCode = "ConfirmOthers":U
    then do:
        assign tExpNote.ExpNoteStatusCode = {&EXPENSENOTESTATUS-CONFIRMED}
               tExpNote.ExpNoteConfirmationDate = today
               tExpNote.ConfirmationUsr_ID      = viUsrId.
        if tExpNote.tc_status = "":U 
        then assign tExpNote.tc_status = "C":U.
    end.
    if vcActivityCode = {&EXPNOTEACTIVITY-CONFIRM} or
       vcActivityCode = {&EXPNOTEACTIVITY-UNDOCONFIRM} or 
       vcActivityCode = "ConfirmOwn":U or
       vcActivityCode = "ConfirmOthers":U
    then do:
        /* We need to force unconditional refresh of all calculated amounts */
        empty temp-table tAdvances.

        <M-5 run RefreshAdvances (input  false (ilMerge), 
                          input  tExpNote.ExpNote_ID (iiExpenseNote_ID), 
                          input  tExpNote.tcEmployeeCode (icEmployeeCode), 
                          output tAdvances (tAdvances), 
                          output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
        then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.
        
        empty temp-table tProposedAdvanceLink.
        empty temp-table tExpNoteLineRef.
        for each tExpNoteLine:
            create tExpnoteLineRef.
            buffer-copy tExpNoteLine to tExpNoteLineRef.
        end.

        <M-6 run GetProposedAdvanceLink (input  tExpNoteLineRef (t_sExpNoteLineRef), 
                                 input-output tAdvances (t_sAdvances), 
                                 output tProposedAdvanceLink (tProposedAdvanceLink), 
                                 input  true (ilCleanOnExpNoteTC), 
                                 output viFcReturnSuper (oiReturnStatus)) in BExpenseNote>
        if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
        then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper < 0
        then return.          
    end.

    if vcActivityCode <> {&EXPNOTEACTIVITY-VIEW} and
       vcActivityCode <> {&EXPNOTEACTIVITY-REGISTER}
    then do:
        /* Clean-up Obsolete Links */
        for each tAdvances where tAdvances.tiExpNote_ID = tExpNote.ExpNote_ID 
                           break by tAdvances.tiCInvoice_ID:
            
            if last-of(tAdvances.tiCInvoice_ID)
            then do:
                find first tExpNoteCInvoice where 
                           tExpNoteCInvoice.CInvoice_ID = tAdvances.tiCInvoice_ID
                           no-error.
                if not available tExpNoteCInvoice
                then next.

                assign tExpNoteCInvoice.ExpNoteCInvoiceTypeCode   = {&EXPNOTECINVOICETYPE-ADVANCE}
                       tExpNoteCInvoice.ExpNoteCInvoiceStatusCode = tExpNote.ExpNoteStatusCode
                       tExpNoteCInvoice.ExpNoteCInvoiceDeductTC   = tAdvances.tdOnExpNoteTC
                       tExpNoteCInvoice.ExpNoteCInvoiceDeductLC   = tAdvances.tdOnExpNoteTC * tAdvances.tdAdvanceExchangeRateTCLC * tAdvances.tdAdvanceExchangeRateScaleTCLC
                       tExpNoteCInvoice.ExpNoteCInvoiceIsReturned = tAdvances.tlAdvanceReturnRest
                       tExpNoteCInvoice.ExpNoteCInvoiceToReturnTC = tAdvances.tdToReturnTC
                       tExpNoteCInvoice.tc_Status = if tExpNoteCInvoice.tc_Status = "" then "C":U else tExpNoteCInvoice.tc_Status.
                if tExpNoteCInvoice.ExpNoteCInvoiceDeductTC = 0 or
                   tExpNoteCInvoice.ExpNoteCInvoiceDeductTC = ?
                then do:
                    if tExpNoteCInvoice.tc_status = "N":U
                    then assign tExpNoteCInvoice.tc_status = "":U.
                    else assign tExpNoteCInvoice.tc_status = "D":U.
                end.
            end.
        end.
    end.
end.