project QadFinancials > class BRoundingMethod > 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 BRoundingMethod.ApiSynchronise


program code (program/broundingmethod.p)

<ANCESTOR-CODE>

if oiReturnStatus < 0
then return.

assign oiReturnStatus  = -98.

empty temp-table tCurrencyUpdatesFromRounding.

for each tRoundingMethod where
         tRoundingMethod.tc_Status = "C":U:
    find first t_iRoundingMethod where
               t_iRoundingMethod.tc_Rowid = tRoundingMethod.tc_Rowid
               no-error.
    if not available t_iRoundingMethod
    then next.

    if tRoundingMethod.RoundingMethodUnit <> t_iRoundingMethod.RoundingMethodUnit
    then do:
        <M-8 run CalculateNumberOfDecimals
           (input  t_iRoundingMethod.RoundingMethodUnit (idRoundingMethodUnit), 
            output vdOldNumberOfDecimals (odNumberOfDecimals), 
            output viFcReturnSuper (oiReturnStatus)) in BRoundingMethod>

        <M-9 run CalculateNumberOfDecimals
           (input  tRoundingMethod.RoundingMethodUnit (idRoundingMethodUnit), 
            output vdNewNumberOfDecimals (odNumberOfDecimals), 
            output viFcReturnSuper (oiReturnStatus)) in BRoundingMethod>

        if vdOldNumberOfDecimals <> vdNewNumberOfDecimals
        then do:
            create tCurrencyUpdatesFromRounding.
            assign tCurrencyUpdatesFromRounding.tiRoundingMethodID         = tRoundingMethod.RoundingMethod_ID
                   tCurrencyUpdatesFromRounding.tdCurrencyNumberOfDecimals = vdNewNumberOfDecimals.
        end.
    end.
end.  /* for each tRoundingMethod */

if can-find (first tCurrencyUpdatesFromRounding)
then do:
    if viBCurrency6ID = 0 or viBCurrency6ID = ?
    then do:
        <I-10 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BCurrency"}>
    end.
    else do:
        <I-11 {bFcOpenInstance
            &CLASS           = "BCurrency"}>
    end.
    <M-12 run UpdateNumberOfDecimals
          (input  tCurrencyUpdatesFromRounding (tCurrUpdatesFromRounding), 
           output viLocalReturnStatus (oiReturnStatus)) in BCurrency>

    <I-13 {bFcCloseInstance
            &CLASS           = "BCurrency"}>
         
    if viLocalReturnStatus < 0 or (viLocalReturnStatus > 0 and oiReturnStatus >= 0)
    then assign oiReturnStatus = viLocalReturnStatus.
end.

if oiReturnStatus < 0 and oiReturnStatus <> -98
then do:
    <M-14 run StopExternalInstances
       (output viFcReturnSuper (oiReturnStatus)) in BRoundingMethod>
    return.
end.

<I-1 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BMfgRoundingMethod"}>

<M-5 run MaintainData
   (input  tRoundingMethod (tCopyRoundingMethod), 
    output viLocalReturnStatus (oiReturnStatus)) in BMfgRoundingMethod>

<I-3 {bFcCloseInstance
            &CLASS           = "BMfgRoundingMethod"}>                

if viLocalReturnStatus <> 0 then assign oiReturnStatus = viLocalReturnStatus.
if viLocalReturnStatus < 0 
then do :
    <M-7 run StopExternalInstances
       (output viFcReturnSuper (oiReturnStatus)) in BRoundingMethod>
     Return.
end. /* if viLocalReturnStatus < 0  */

/* ======================== */
/* Set ReturnStatus = OK    */
/* ======================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.