project QadFinancials > class BExchangeRate > 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 BExchangeRate.ApiSaveDerivedExchangeRates
method BExchangeRate.ApiStdMaintainTT


program code (program/bexchangerate.p)

/* ================================= */
    /* Update towards the Mfg equivalent */
    /* ================================= */
    assign 
        oiReturnStatus = -98
        vtInitialStartDate = ?
        vcExchangeRateTypeCode = ?.
        
    /* Determine business key to allow for change in MFG/PRO */
    for first tExchangeRate where tExchangeRate.tc_status='C':U:
        for first t_iExchangeRate where t_iExchangeRate.tc_rowid=tExchangeRate.tc_rowid:
            /* Because exchange rates are conditionally replicated to MFG/PRO (based on
             * ExchangeRateType.ExchangeRateTypeIsExported flag) it is not possible to
             * modify the exchange rate type.  Otherwise the synchronization between
             * financials and MFG/PRO can get out of synch due to switching to a 
             * exchange rate type which does not replicate.  A subsequent attempt to 
             * change the exchange rate type back to one which does replicate would 
             * result in not finding the MFG/PRO exchange rate since the financial and
             * MFG/PRO types would not match.
             */
            if(t_iExchangeRate.ExchangeRateType_ID <> tExchangeRate.ExchangeRateType_ID) then do:
                vcMessage = #T-9'You cannot modify the exchange rate type.':100(56755)T-9#.
                <M-10 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '' (icArguments), 
                    input  'tExchangeRate.tcExchangeRateTypeCode':U (icFieldName), 
                    input  tExchangeRate.tcExchangeRateTypeCode (icFieldValue), 
                    input  'E':U (icType), 
                    input  3 (iiSeverity), 
                    input  '' (icRowid), 
                    input  'QadFin-5787':U (icFcMsgNumber), 
                    input  '' (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BExchangeRate>
                oiReturnStatus = -1.
                return.
            end.
            assign
                vtInitialStartDate = t_iExchangeRate.ExchangeRateValidDateFrom
                vcModifiedRowID = t_iExchangeRate.tc_Rowid
                vcExchangeRateTypeCode = t_iExchangeRate.tcExchangeRateTypeCode.
        end.
    end.

    if (viBMfgExchangeRateID = 0 or viBMfgExchangeRateID = ?) 
    then do:
        <I-2 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BMfgExchangeRate"}>
    end.
    else do:
        <I-6 {bFcOpenInstance
            &CLASS           = "BMfgExchangeRate"}>
    end.
    <M-8 run MaintainData
       (input  tExchangeRate (tCopyExchangeRate), 
        input  vtInitialStartDate (itValidDateFrom), 
        input  vcModifiedRowID (icModifiedRowID), 
        input  vcExchangeRateTypeCode (icExchangeRateTypeCode), 
        output viLocalReturnStatus (oiReturnStatus)) in BMfgExchangeRate>
    <I-4 {bFcCloseInstance
            &CLASS           = "BMfgExchangeRate"}>
    if viLocalReturnStatus <> 0 then assign oiReturnStatus = viLocalReturnStatus.
    if viLocalReturnStatus < 0
    then do :
        <M-11 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BExchangeRate>
        Return.
    end.
    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.

<ANCESTOR-CODE>