project QadFinancials > class BDebtor > method ValCurrency

Description

Validates Default Currency of Debtor.
Note: The method is called within PreValidateComponent, thus all the relevant data can be found in t_s tables.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BDebtor.PostValidateComponent


program code (program1/bdebtor.p)

/*error: Currency must exist - checked by FC*/
/*error: Currency must be active*/
if t_sDebtor.Currency_ID <> 0 and t_sDebtor.Currency_ID <> ? and 
   (t_sDebtor.tc_Status = "N":U or 
    (t_sDebtor.tc_Status = "C" and 
     can-find (t_iDebtor where 
               t_iDebtor.tc_Rowid     = t_sDebtor.tc_Rowid and 
               t_iDebtor.Currency_ID <> t_sDebtor.Currency_ID )))
then do:
    <Q-1 run CurrencyById (all) (Read) (Cache)
       (input t_sDebtor.Currency_ID, (CurrencyId)
        output dataset tqCurrencyById) in BCurrency>

    find first tqCurrencyById no-error.
    if available tqCurrencyById and
       not tqCurrencyById.tlCurrencyIsActive
    then do:
        assign vcMessage     = trim(substitute(#T-3'The currency code (&1) is not active.':200(1427)T-3#, 
                                                trim(tqCurrencyById.tcCurrencyCode))) + chr(10) + 
                               program-name(1)
              oiReturnStatus = -1.

        <M-2 run SetMessage (input  vcMessage (icMessage),
                     input  '':U (icArguments),
                     input  'tDebtor.tcCurrecncyCode':U (icFieldName),
                     input  t_sDebtor.tcCurrencyCode (icFieldValue),
                     input  'E':U (icType),
                     input  3 (iiSeverity),
                     input  t_sDebtor.tc_Rowid (icRowid),
                     input  'QADFIN-310':U (icFcMsgNumber),
                     input  '' (icFcExplanation),
                     input  '' (icFcIdentification),
                     input  '' (icFcContext),
                     output viFcReturnSuper (oiReturnStatus)) in BDebtor>        
    end.
end.