project QadFinancials > class BCInvoice > method ValidateComponentPostExchangeRate

Description

This method is a submethod of ValidateComponentPost.

This method does some validations on the creditor exchange rate.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.ValidateComponentPost


program code (program5/bcinvoice.p)

/* Exchange rate should be 1 in case of local currency */
if (t_sCInvoice.tc_Status             = "N":U                              or
    t_sCInvoice.tc_Status             = "C":U                              and
   (t_sCInvoice.CInvoiceCurrency_ID  <> t_iCInvoice.CInvoiceCurrency_ID    or
    t_sCInvoice.CInvoiceExchangeRate <> t_iCInvoice.CInvoiceExchangeRate)) and
    t_sCInvoice.CInvoiceCurrency_ID   = viCompanyLCId                      and
    t_sCInvoice.CInvoiceExchangeRate <> 1
then do:
    <M-1 run SetMessage
       (input  trim(#T-1'The exchange rate should be 1 for invoices ($1) in the base currency.':255(65429)t-1#) (icMessage), 
        input  string(t_sCInvoice.CInvoicePostingYear) + ' ':U + t_sCInvoice.tcJournalCode + ' ':U + string(t_sCInvoice.CInvoiceVoucher) (icArguments), 
        input  'tCInvoice.CInvoiceExchangeRate':U (icFieldName), 
        input  t_sCInvoice.CInvoiceExchangeRate (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  t_sCInvoice.tc_Rowid (icRowid), 
        input  'QadFin-7046':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCInvoice>

    assign oiReturnStatus = -1.
end.

/* Exchange rate is mandatory in case of foreign currency */
if (t_sCInvoice.tc_Status             = "N":U                              or
    t_sCInvoice.tc_Status             = "C":U                              and
   (t_sCInvoice.CInvoiceCurrency_ID  <> t_iCInvoice.CInvoiceCurrency_ID    or
    t_sCInvoice.CInvoiceExchangeRate <> t_iCInvoice.CInvoiceExchangeRate)) and
    t_sCInvoice.CInvoiceCurrency_ID  <> viCompanyLCId                      and
   (t_sCInvoice.CInvoiceExchangeRate  = 0                                  or
    t_sCInvoice.CInvoiceExchangeRate  = ?)
then do:
    <M-2 run SetMessage
       (input  trim(#T-2'You must define an exchange rate for invoices ($1) that are not in the base currency.':255(65430)t-2#) (icMessage), 
        input  string(t_sCInvoice.CInvoicePostingYear) + ' ':U + t_sCInvoice.tcJournalCode + ' ':U + string(t_sCInvoice.CInvoiceVoucher) (icArguments), 
        input  'tCInvoice.CInvoiceExchangeRate':U (icFieldName), 
        input  t_sCInvoice.CInvoiceExchangeRate (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  t_sCInvoice.tc_Rowid (icRowid), 
        input  'QadFin-7047':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCInvoice>

    assign oiReturnStatus = -1.
end.