project QadFinancials > class BBankEntry > method ValidateComponentPreExchRateTolGetPerc

Description

This method gets current values of exchange rate tolerance percentage for certain entity.


Parameters


iiCompanyIdinputintegerCompany ID
odARExchangeRateToleranceoutputdecimalAR Exchange Rate Tolerance
odAPExchangeRateToleranceoutputdecimalAP Exchange Rate Tolerance
ocCompanyCodeoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBankEntry.ValidateComponentPreExchRateTol


program code (program4/bbankentry.p)

/* =================================================================================================== */
/* Method      : ValidateGetExchangeRateTolerancePercentage                                            */
/* Desc        : This method is used to retrieve values of percentages for tolerance of exchange rate  */
/*               change.                                                                               */
/* Note        : Method is optimalized for performance                                                 */
/* --------------------------------------------------------------------------------------------------- */
/* Params:  (I)  CompanyId            ID of the company                                                */
/*          (O)  ARExchangeRateTolerance  Exchange rate tolerance for Account receivable               */
/*          (O)  APExchangeRateTolerance  Exchange rate tolerance for Account payable                  */
/* =================================================================================================== */

assign oiReturnStatus = -98.

/* =================================================================================================== */
/* Default output values                                                                               */
/* =================================================================================================== */
assign odARExchangeRateTolerance = 0
       odAPExchangeRateTolerance = 0.    

/* =================================================================================================== */
/* Validate input parameters                                                                           */
/* =================================================================================================== */
if iiCompanyId = 0 or
   iiCompanyId = ?
then do:
    assign oiReturnStatus = 0.
    return.
end.

/* =================================================================================================== */
/* Check, whether value has not be read from database already. If not, get it from database            */
/* =================================================================================================== */
find first tqCompanyPropertyByIdCode where
           tqCompanyPropertyByIdCode.tiCompany_ID = t_sBankStateAlloc.Company_ID no-error.
if not available tqCompanyPropertyByIdCode
then do:
     /* read company definition from database */
     <Q-56 run CompanyPropertyByIdCode (all) (Append) (NoCache)
        (input t_sBankStateAlloc.Company_ID, (CompanyId)
         input ?, (CompanyPropertyId)
         input ?, (BusinessRelationId)
         input ?, (CurrencyId)
         input ?, (CompanyPropertyCode)
         input ?, (CompanyCode)
         input ?, (BusinessRelationCode)
         input ?, (CurrencyCode)
         output dataset tqCompanyPropertyByIdCode) in BCompanyProperty >
    
    find first tqCompanyPropertyByIdCode no-error.
    if not available tqCompanyPropertyByIdCode
    then do:
        assign vcMessage = #T-8'The entity &1 is not defined in the system.':255(65672)t-8#
               vcMessage = substitute(vcMessage, t_sBankStateAlloc.Company_ID).
        <M-6 run SetMessage
           (input  vcMessage (icMessage), 
            input  '':U (icArguments), 
            input  '':U (icFieldName), 
            input  '':U (icFieldValue), 
            input  'S':U (icType), 
            input  2 (iiSeverity), 
            input  t_sBankStateAlloc.tc_RowID (icRowid), 
            input  'QadFin-894805':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BBankEntry>
        assign oiReturnStatus = -1.
        return.
    end.
end.

/* =================================================================================================== */
/* Assign return values                                                                                */
/* =================================================================================================== */
assign odARExchangeRateTolerance = tqCompanyPropertyByIdCode.tdCompanyPropertyExchTolAR
       odAPExchangeRateTolerance = tqCompanyPropertyByIdCode.tdCompanyPropertyExchTolAP
       ocCompanyCode             = tqCompanyPropertyByIdCode.tcCompanyCode.

/* =================================================================================================== */
/* Return                                                                                              */
/* =================================================================================================== */
if oiReturnStatus = -98 then assign oiReturnStatus = 0.