project QadFinancials > class BCDocumentReport > method CDocumentReportAutoIncasso

report procedure


Parameters


icLanguageCodeinputcharacter
tFilterinputtemp-table
dcrCDocumentReportAutoIncassooutputdataset
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program4/bcdocumentreport.p)

empty temp-table tqCDocumentReportAutoIncasso.

<M-1 run GetReportLabels (input  'CDocumentReportAutoIncasso':U (icReportName), 
                          input  icLanguageCode (icLanguageCode), 
                          input  tFilter (tFilter), 
                          output tqHeader (tqHeader), 
                          output tqFilter (tqFilter), 
                          output tqText (tqText), 
                          output viFcReturnSuper (oiReturnStatus)) in BCDocumentReport>

if viFcReturnSuper < 0 or
   oiReturnStatus  = 0
then assign oiReturnStatus = viFcReturnSuper.

if oiReturnStatus < 0
then return.

<M-2 run CDocumentReportAll (input  {&DOCUMENTTYPECREDITOR-ELECTRONIC} (icCDocumentType), 
                             output viFcReturnSuper (oiReturnStatus)) in BCDocumentReport>

if viFcReturnSuper < 0 or
   oiReturnStatus  = 0
then assign oiReturnStatus = viFcReturnSuper.

if oiReturnStatus < 0
then return.

for each tCDocumentReportAll:
    create tqCDocumentReportAutoIncasso.
    buffer-copy tCDocumentReportAll to tqCDocumentReportAutoIncasso.

     if tqCDocumentReportAutoIncasso.tiPaySelLine_ID = ?
     then assign tqCDocumentReportAutoIncasso.tiPaySelLine_ID = 0.
 
     if tqCDocumentReportAutoIncasso.tcCDocRepCInvoiceType = {&INVOICETYPE-PREPAYMENT} and
        tqCDocumentReportAutoIncasso.tiPaySelLine_ID <> 0
     then do:
 
         <Q-60 run PaySelLineByIDAllInfo (all) (Read) (NoCache)
            (input tqCDocumentReportAutoIncasso.tiPaySelLine_ID, (PaySelLine_ID)
             output dataset tqPaySelLineByIDAllInfo) in BPaymentSelection>

         find first tqPaySelLineByIDAllInfo where tqPaySelLineByIDAllInfo.tiPaySelLine_ID = tqCDocumentReportAutoIncasso.tiPaySelLine_ID no-error.
 
         if available tqPaySelLineByIDAllInfo
         then do:
 
             if (tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&INVOICETYPE-INVOICE} and tqCDocumentReportAutoIncasso.tdCDocRepInvOrigDebitTC <> 0) or
                (tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} and tqCDocumentReportAutoIncasso.tdCDocRepInvOrigCreditTC <> 0)
             then
                 assign tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC = tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC
                        tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC = tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC.
 
             else if tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} and tqCDocumentReportAutoIncasso.tdCDocRepInvOrigDebitTC <> 0
             then
                 assign tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC = - abs(tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC)
                        tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC = - abs(tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC).
 
         end.
     end.
 
     else do:
 
         if (tqCDocumentReportAutoIncasso.tcCDocRepCInvoiceType   = {&INVOICETYPE-PREPAYMENT} and tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefPaidAmtTC <> 0 and tqCDocumentReportAutoIncasso.tdCDocRepInvOrigDebitTC <> 0) or
            (tqCDocumentReportAutoIncasso.tcCDocRepCInvoiceType   = {&INVOICETYPE-ADJUSTMENT} and tqCDocumentReportAutoIncasso.tdCDocRepInvOrigDebitTC <> 0) or
             tqCDocumentReportAutoIncasso.tcCDocRepCInvoiceType   = {&INVOICETYPE-CREDITNOTE}
         then
             assign tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC = - abs(tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC)
                    tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC = - abs(tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC).
         else
             assign tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC = tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefAmountTC
                    tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC = tqCDocumentReportAutoIncasso.tdCDocRepCInvoiceXRefDiscAmTC.
     end.

end.