project QadFinancials > class BFixedAssetRevaluation > method AdditionalUpdatesFAAsset

Description

Updates tFAAssetBook


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFixedAssetRevaluation.AdditionalUpdates


program code (program1/bfixedassetrevaluation.p)

/* start and/or open the BFixedAssetAsset instance */
if viBFixedAssetAssetRevalID = 0 or viBFixedAssetAssetRevalID = ?
then do:
    <I-1 {bFcStartAndOpenInstance
            &ADD-TO-TRANSACTION = "true"
            &CLASS              = "BFixedAssetAsset"}>
    assign vlBFAAssetIsStartedFromReval = true.
end.
else do:
    <I-2 {bFcOpenInstance
            &CLASS           = "BFixedAssetAsset"}>
end.

/* Build the temp-table with all asset books that are revaluated */
empty temp-table tRevalFAAssetBookRef.
for each tFAReval where
         tFAReval.tc_Status = 'N':U:
    find tRevalFAAssetBookRef where
         tRevalFAAssetBookRef.tiFAAssetBookId = tFAReval.FAAssetBook_ID no-error.
    if not available tRevalFAAssetBookRef
    then do:
        create tRevalFAAssetBookRef.
        assign tRevalFAAssetBookRef.tiFAAssetBookId = tFAReval.FAAssetBook_ID.
    end.    
    assign tRevalFAAssetBookRef.tcFARevalIndexType        = tFAReval.FARevalIndexType 
           tRevalFAAssetBookRef.tdRevalAmountLC           = tFAReval.FARevalAmountLC
           tRevalFAAssetBookRef.tdRevalAmountCC           = tFAReval.FARevalAmountCC
           tRevalFAAssetBookRef.tdFAAssetBookDeprAmountLC = tFAReval.tdFAAssetBookDeprAmountLC
           tRevalFAAssetBookRef.tdFAAssetBookDeprAmountCC = tFAReval.tdFAAssetBookDeprAmountCC.    
end.

/* Update the LC and CC amounts in the fixed asset book*/
<M-6 run RevalFAAssetBook
          (input  tRevalFAAssetBookRef (tRevalFAAssetBook), 
           output viFcReturnSuper (oiReturnStatus)) in BFixedAssetAsset>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus >= 0)
then assign oiReturnStatus = viFcReturnSuper.

/* ValidateBC And AdditionalUpdates */
if vlBFAAssetIsStartedFromReval = true
then do:
    <M-4 run ValidateBCAndAdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BFixedAssetAsset>
    if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus >= 0)
    then assign oiReturnStatus = viFcReturnSuper.
end.

/* close the BFixedAssetAsset instance */
<I-5 {bFcCloseInstance
            &CLASS           = "BFixedAssetAsset"}>