project QadFinancials > class BFixedAssetDepreciation > method ConvertIdToCode


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BFixedAssetDepreciation.DepreciationMain


program code (program1/bfixedassetdepreciation.p)

for each tFADepreciation where
         tFADepreciation.tc_Status = "N":U:
    assign tFADepreciation.tc_Status = "":U.

    find t_iFADepreciation where
         t_iFADepreciation.tc_Rowid = tFADepreciation.tc_Rowid no-error.

    if not available t_iFADepreciation
    then do:
        create t_iFADepreciation.
        buffer-copy tFADepreciation to t_iFADepreciation.
    end.
    
    for each tFADepreciationDet where
             tFADepreciationDet.tc_ParentRowid = tFADepreciation.tc_Rowid:

        assign tFADepreciationDet.tc_Status = "":U.

        find t_iFADepreciationDet where
             t_iFADepreciationDet.tc_Rowid = tFADepreciationDet.tc_Rowid no-error.

        if not available t_iFADepreciationDet
        then do:
            create t_iFADepreciationDet.
            buffer-copy tFADepreciationDet to t_iFADepreciationDet.
        end.
        
        for each tFADepreciationDetSaf where
                 tFADepreciationDetSaf.tc_ParentRowid = tFADepreciationDet.tc_Rowid:
            
            assign tFADepreciationDetSaf.tc_Status = "":U.            
            
            find t_iFADepreciationDetSaf where
                 t_iFADepreciationDetSaf.tc_Rowid = tFADepreciationDetSaf.tc_Rowid no-error.
            if not available t_iFADepreciationDetSaf
            then do:
                create t_iFADepreciationDetSaf.
                buffer-copy tFADepreciationDetSaf to t_iFADepreciationDetSaf.
            end.
        end.    
    end.    
end.

<M-1 run Calculate (output viFcReturnSuper (oiReturnStatus)) in BFixedAssetDepreciation>

assign oiReturnStatus = if (oiReturnStatus  > 0 and 
                            viFcReturnSuper = 0) or 
                            oiReturnStatus  < 0
                        then oiReturnStatus
                        else viFcReturnSuper.    

for each tFADepreciation where
         tFADepreciation.tc_Status = "":U and
         string(tFADepreciation.tc_Rowid) begins "-":U:
    for each tFADepreciationDet where
             tFADepreciationDet.tc_ParentRowid = tFADepreciation.tc_Rowid:

        find t_iFADepreciationDet where
             t_iFADepreciationDet.tc_Rowid = tFADepreciationDet.tc_Rowid no-error.

        if available t_iFADepreciationDet
        then delete t_iFADepreciationDet.

        for each tFADepreciationDetSaf where
                 tFADepreciationDetSaf.tc_ParentRowid = tFADepreciationDet.tc_Rowid:
            find t_iFADepreciationDetSaf where
                 t_iFADepreciationDetSaf.tc_Rowid = tFADepreciationDetSaf.tc_Rowid no-error.
            if available t_iFADepreciationDetSaf
            then delete t_iFADepreciationDetSaf.
            
            assign tFADepreciationDetSaf.tc_Status = "N":U.
        end.    
        
        assign tFADepreciationDet.tc_Status = "N":U.                    
    end.

    find t_iFADepreciation where
         t_iFADepreciation.tc_Rowid = tFADepreciation.tc_Rowid no-error.
               
    if available t_iFADepreciation
    then delete t_iFADepreciation.

    assign tFADepreciation.tc_Status = "N":U.
end.