project QadFinancials > class BBLWIReport > method CreateBWLIReportFromDInvoiceMovement

Description

This method is called by the report method DocumentBLWIReport. Since the report method is not used, this method is also obsolete.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BBLWIReport.DocumentBLWIReport


program code (program5/bblwireport.p)

<Q-3 run DInvoiceMovementForBLWIReport (all) (Read) (NoCache)
   (input {&INVOICEPOSTINGTYPE-INITIAL}, (Type)
    input int(vcyearPeriod), (YearPeriod)
    input vcCountryCodeBE, (CountryCode)
    input viCompanyId, (CompanyId)
    output dataset tqDInvoiceMovementForBLWIReport) in BBLWIReport >
for each tqDInvoiceMovementForBLWIReport:
    if tqDInvoiceMovementForBLWIReport.tcBLWICountryCode = "":U
    then assign vcCountryCode = tqDInvoiceMovementForBLWIReport.tcCountryCode.
    else assign vcCountryCode = tqDInvoiceMovementForBLWIReport.tcBLWICountryCode.
    find first tBWLIReport where tBWLIReport.tcBWLICountryCode = tqDInvoiceMovementForBLWIReport.tcCountryCode
                                 exclusive-lock no-error.
    if not available tBWLIReport
    then do:
        create tBWLIReport.
        assign tBWLIReport.tcBWLICountryCode        = vcCountryCode
               tBWLIReport.tcBWLICountryDescription = if tqDInvoiceMovementForBLWIReport.tcBLWICountryCode = "":U
                                                      then "":U
                                                      else tqDInvoiceMovementForBLWIReport.tcCountryDescription.
    end. /* if not available tBWLIReport */
    assign vdCalcAmountTC = ((tqDInvoiceMovementForBLWIReport.tdPostingLineDebitTC + tqDInvoiceMovementForBLWIReport.tdPostingLineCreditTC) * -1)
           vdCalcAmountLC = ((tqDInvoiceMovementForBLWIReport.tdPostingLineDebitLC + tqDInvoiceMovementForBLWIReport.tdPostingLineCreditLC) * -1).
    case tqDInvoiceMovementForBLWIReport.tcCurrencyCode:
      when "EUR":U then assign tBWLIReport.tdAmountEUR     = tBWLIReport.tdAmountEUR + vdCalcAmountLC.
      when "CHF":U then assign tBWLIReport.tdAmountCHF_EUR = tBWLIReport.tdAmountCHF_EUR + vdCalcAmountLC
                               tBWLIReport.tdAmountCHF     = tBWLIReport.tdAmountCHF + vdCalcAmountTC.
      when "GBP":U then assign tBWLIReport.tdAmountGBP_EUR = tBWLIReport.tdAmountGBP_EUR + vdCalcAmountLC
                               tBWLIReport.tdAmountGBP     = tBWLIReport.tdAmountGBP + vdCalcAmountTC.
      when "JPY":U then assign tBWLIReport.tdAmountJPY_EUR = tBWLIReport.tdAmountJPY_EUR + vdCalcAmountLC
                               tBWLIReport.tdAmountJPY     = tBWLIReport.tdAmountJPY + vdCalcAmountTC.
      when "USD":U then assign tBWLIReport.tdAmountUSD_EUR = tBWLIReport.tdAmountUSD_EUR + vdCalcAmountLC
                               tBWLIReport.tdAmountUSD     = tBWLIReport.tdAmountUSD + vdCalcAmountTC.
      otherwise do:
        <M-39 run GetExchangeRate
           (input  ? (iiCompanyID), 
            input  ? (iiFromCurrencyID), 
            input  tqDInvoiceMovementForBLWIReport.tcCurrencyCode (icFromCurrencyCode), 
            input  viCompanyLCId (iiToCurrencyID), 
            input  ? (icToCurrencyCode), 
            input  ? (iiExchangeRateTypeID), 
            input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateTypeCode), 
            input  tqDInvoiceMovementForBLWIReport.ttPostingDate (itValidityDate), 
            output vdRateCurrency (odExchangeRate), 
            output vdRateScaleCurrency (odExchangeScaleFactor), 
            output viFcReturnSuper (oiReturnStatus)) in BBLWIReport>
        assign tBWLIReport.tdAmountOTHER_EUR = tBWLIReport.tdAmountOther_EUR + (vdCalcAmountTC * vdRateCurrency).
      end. /* otherwise */
    end case. /* case tqSelectCInvoicesBWLI.tcCurrencyCode: */
end. /* for each tqSelectCInvoicesBWLI */