project QadFinancials > class TConvertInstalNETXML > method SetOutputDataSub

Description

SubMethod of SetOutputData


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method TConvertInstalNETXML.SetOutputData


program code (program1/tconvertinstalnetxml.p)

assign vhCurrentTable = temp-table t_oCInvoicePO:default-buffer-handle.

/* Cost Centre Code */
/* Project Code */
if vcOrderNumberBuyer <> '':U and
   vcOrderNumberBuyer <> '?':U and
   vcOrderNumberBuyer <> ?
then do:
    assign viPOYear = integer(substring(vcOrderNumberBuyer,1,4,"CHARACTER":U)) no-error.
    if not error-status:error
    then assign viPONumber = integer(substring(vcOrderNumberBuyer,5,-1,"CHARACTER":U)) no-error.
    if not error-status:error
    then do:
        <M-7 run SetMessageInLog
           (input  #T-1'The specified purchase order is not defined in the system.':200(16203)T-1# (icMessage), 
            output viFcReturnSuper (oiReturnStatus)) in TConvertInstalNETXML>
        assign oiReturnStatus = -3.
        return.                          
    end.
end.
else assign t_oCInvoice.Project_ID       = ?
            t_oCInvoice.CostCentre_ID    = ?
            t_oCInvoice.tcCostCentreCode = '':U
            t_oCInvoice.tcProjectCode    = '':U.

/* from file */
/* Original Debit TC */
/* Original Credit TC */
/* VAT Base Debit TC */
/* VAT Base Credit TC */    
/* VAT Debit TC */
/* VAT Credit TC */

/* Balance Debit TC */
/* Balance Credit TC */
/* Balance TC */
assign t_oCInvoice.CInvoiceBalanceDebitTC  = t_oCInvoice.CInvoiceOriginalDebitTC
       t_oCInvoice.CInvoiceBalanceCreditTC = t_oCInvoice.CInvoiceOriginalCreditTC
       t_oCInvoice.CInvoiceBalanceTC       = t_oCInvoice.CInvoiceBalanceDebitTC - t_oCInvoice.CInvoiceBalanceCreditTC.

/* CInvoice Exchange Rate */
if t_oCInvoice.tcCurrencyCode <> '':U       and
   t_oCInvoice.tcCurrencyCode <> ?          and
   t_oCInvoice.tcCurrencyCode <> '?':U      and
   t_oCInvoice.tcLocalCurrencyCode <> '':U  and
   t_oCInvoice.tcLocalCurrencyCode <> ?     and
   t_oCInvoice.tcLocalCurrencyCode <> '?':U
then do:
    if t_oCInvoice.tcCurrencyCode <> t_oCInvoice.tcLocalCurrencyCode
    then do:       
        assign vhFcComponent = ?.
        <M-5 run APIGetExchangeRate
           (input  ? (iiFromCurrencyId), 
            input  t_oCInvoice.tcCurrencyCode (icFromCurrencyCode), 
            input  ? (iiToCurrencyId), 
            input  t_oCInvoice.tcLocalCurrencyCode (icToCurrencyCode), 
            input  ? (iiExchangeRateTypeId), 
            input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateTypeCode), 
            input  t_oCInvoice.CInvoiceDate (itValidityDate), 
            output t_oCInvoice.CInvoiceExchangeRate (odMultiplyExchangeRate), 
            output t_oCInvoice.CinvoiceRateScale (odExchangeRateScaleFactor), 
            output viFcReturnSuper (oiReturnStatus)) in BExchangeRate>
                              
        /* Original Debit LC */
        /* Original Credit LC */
        /* Balance Debit LC */
        /* Balance Credit LC */
        /* VAT Base Debit LC */
        /* VAT Base Credit LC */
        /* VAT Debit LC */
        /* VAT Credit LC */
        if available tqCompanyPropertyForAllData
        then do:
            <Q-6 run CurrencyByCode (all) (Read) (NoCache)
               (input tqCompanyPropertyForAllData.tcCurrencyCode, (CurrencyCode)
                output dataset tqCurrencyByCode) in BCurrency >
            find first tqCurrencyByCode no-error.
            if available tqCurrencyByCode
            then assign vhFcComponent = ?
                        t_oCInvoice.CInvoiceOriginalDebitLC  = <M-12 RoundAmount
                                                                  (input  t_oCInvoice.CInvoiceOriginalDebitTC * t_oCInvoice.CInvoiceExchangeRate * t_oCInvoice.CinvoiceRateScale (idUnroundedAmount), 
                                                                   input  tqCurrencyByCode.tiCurrency_ID (iiCurrencyID), 
                                                                   input  tqCurrencyByCode.tcCurrencyCode (icCurrencyCode)) in business>
                        t_oCInvoice.CInvoiceOriginalCreditLC = <M-13 RoundAmount
                                                                  (input  t_oCInvoice.CInvoiceOriginalCreditTC * t_oCInvoice.CInvoiceExchangeRate * t_oCInvoice.CinvoiceRateScale (idUnroundedAmount), 
                                                                   input  tqCurrencyByCode.tiCurrency_ID (iiCurrencyID), 
                                                                   input  tqCurrencyByCode.tcCurrencyCode (icCurrencyCode)) in business>
                        t_oCInvoice.CInvoiceVatBaseDebitLC   = <M-14 RoundAmount
                                                                  (input  t_oCInvoice.CInvoiceVatBaseDebitTC * t_oCInvoice.CInvoiceExchangeRate * t_oCInvoice.CinvoiceRateScale (idUnroundedAmount), 
                                                                   input  tqCurrencyByCode.tiCurrency_ID (iiCurrencyID), 
                                                                   input  tqCurrencyByCode.tcCurrencyCode (icCurrencyCode)) in business>
                        t_oCInvoice.CInvoiceVatBaseCreditLC  = <M-15 RoundAmount
                                                                  (input  t_oCInvoice.CInvoiceVatBaseCreditTC * t_oCInvoice.CInvoiceExchangeRate * t_oCInvoice.CinvoiceRateScale (idUnroundedAmount), 
                                                                   input  tqCurrencyByCode.tiCurrency_ID (iiCurrencyID), 
                                                                   input  tqCurrencyByCode.tcCurrencyCode (icCurrencyCode)) in business>
                        t_oCInvoice.CInvoiceVatDebitLC       = <M-16 RoundAmount
                                                                  (input  t_oCInvoice.CInvoiceVatDebitTC * t_oCInvoice.CInvoiceExchangeRate * t_oCInvoice.CinvoiceRateScale (idUnroundedAmount), 
                                                                   input  tqCurrencyByCode.tiCurrency_ID (iiCurrencyID), 
                                                                   input  tqCurrencyByCode.tcCurrencyCode (icCurrencyCode)) in business>
                        t_oCInvoice.CInvoiceVatCreditLC      = <M-17 RoundAmount
                                                                  (input  t_oCInvoice.CInvoiceVatCreditTC * t_oCInvoice.CInvoiceExchangeRate * t_oCInvoice.CinvoiceRateScale (idUnroundedAmount), 
                                                                   input  tqCurrencyByCode.tiCurrency_ID (iiCurrencyID), 
                                                                   input  tqCurrencyByCode.tcCurrencyCode (icCurrencyCode)) in business>.
        end.                               
    end.
    else assign t_oCInvoice.CInvoiceOriginalDebitLC  = t_oCInvoice.CInvoiceOriginalDebitTC
                t_oCInvoice.CInvoiceOriginalCreditLC = t_oCInvoice.CInvoiceOriginalCreditTC
                t_oCInvoice.CInvoiceVatBaseDebitLC   = t_oCInvoice.CInvoiceVatBaseDebitTC
                t_oCInvoice.CInvoiceVatBaseCreditLC  = t_oCInvoice.CInvoiceVatBaseCreditTC
                t_oCInvoice.CInvoiceVatDebitLC       = t_oCInvoice.CInvoiceVatDebitTC
                t_oCInvoice.CInvoiceVatCreditLC      = t_oCInvoice.CInvoiceVatCreditTC.

    assign t_oCInvoice.CInvoiceBalanceDebitLC   = t_oCInvoice.CInvoiceOriginalDebitLC
           t_oCInvoice.CInvoiceBalanceCreditLC  = t_oCInvoice.CInvoiceOriginalCreditLC.
end.
else if t_oCInvoice.tcCurrencyCode = '':U       or
        t_oCInvoice.tcCurrencyCode = ?          or
        t_oCInvoice.tcCurrencyCode = '?':U
then do:
    <M-10 run SetMessageInLog
       (input  #T-4'The specified supplier invoice currency is not defined in the system.':200(16206)T-4# (icMessage), 
        output viFcReturnSuper (oiReturnStatus)) in TConvertInstalNETXML>
    assign oiReturnStatus = -3.
    return.                                    
end.
else if t_oCInvoice.tcLocalCurrencyCode = '':U  or
        t_oCInvoice.tcLocalCurrencyCode = ?     or
        t_oCInvoice.tcLocalCurrencyCode = '?':U
then do:
    <M-11 run SetMessageInLog
       (input  #T-5'The specified base currency is not defined.':200(16207)T-5# (icMessage), 
        output viFcReturnSuper (oiReturnStatus)) in TConvertInstalNETXML>
    assign oiReturnStatus = -3.
    return.                           
end.