project QadFinancials > class BCurrency > method InitialValues

Description

Add code here to initialize the calculated fields of a 'new' record (= a record that must be created in the application database) in a class temp-table.

Set the default for Rounding Method Code and Description.


Parameters


icTableNameinputcharacterName of the database table of which a record is created in the class temp-table.
oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bcurrency.p)

/* to test svn implementation: an additional comment line */

<ANCESTOR-CODE>

if icTableName = "Currency":U
then do:
    assign tCurrency.CurrencyIsActive = true.
    
    /* Fill the rounding method with rounding method '2' or with the first method available */
    <Q-1 run RoundingMethodPrim (all) (Read) (NoCache)
       (input 0, (RoundingMethodID)
        input '2':U, (RoundingMethodCode)
        output dataset tqRoundingMethodPrim) in BRoundingMethod >
    find tqRoundingMethodPrim where
         tqRoundingMethodPrim.tcRoundingMethodCode = "2":U
         no-lock no-error.
    if not available tqRoundingMethodPrim
    then do:
        <Q-2 run RoundingMethodPrim (first) (Read) (NoCache)
           (input 0, (RoundingMethodID)
            input '':U, (RoundingMethodCode)
            output dataset tqRoundingMethodPrim) in BRoundingMethod >        
        find first tqRoundingMethodPrim no-lock no-error.
    end. /* if not available tqRoundingMethodPrim */
    if available tqRoundingMethodPrim
    then assign tCurrency.tcRoundingMethodCode        = tqRoundingMethodPrim.tcRoundingMethodCode
                tCurrency.tcRoundingMethodDescription = tqRoundingMethodPrim.tcRoundingMethodDescription.                    
end.