project QadFinancials > class BCDocumentReport > method CDocumentReportPromisNote

report procedure


Parameters


icLanguageCodeinputcharacter
tFilterinputtemp-table
dcrCDocumentReportPromisNoteoutputdataset
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program4/bcdocumentreport.p)

empty temp-table tqCDocumentReportPromisNote.

<M-1 run GetReportLabels (input  'CDocumentReportPromisNote':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-PROMNOTE} (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 tqCDocumentReportPromisNote.
    buffer-copy tCDocumentReportAll to tqCDocumentReportPromisNote.
     if tqCDocumentReportPromisNote.tiPaySelLine_ID = ?
     then assign tqCDocumentReportPromisNote.tiPaySelLine_ID = 0.
 
     if tqCDocumentReportPromisNote.tcCDocRepCInvoiceType = {&INVOICETYPE-PREPAYMENT} and
        tqCDocumentReportPromisNote.tiPaySelLine_ID <> 0
     then do:
        <Q-93 run PaySelLineByIDAllInfo (all) (Read) (NoCache)
           (input tqCDocumentReportPromisNote.tiPaySelLine_ID, (PaySelLine_ID)
            output dataset tqPaySelLineByIDAllInfo) in BPaymentSelection> 
         
         find first tqPaySelLineByIDAllInfo where tqPaySelLineByIDAllInfo.tiPaySelLine_ID = tqCDocumentReportPromisNote.tiPaySelLine_ID no-error.
 
         if available tqPaySelLineByIDAllInfo
         then do:
 
             if (tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&INVOICETYPE-INVOICE} and tqCDocumentReportPromisNote.tdCDocRepInvOrigDebitTC <> 0) or
                (tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} and tqCDocumentReportPromisNote.tdCDocRepInvOrigCreditTC <> 0)
             then
                 assign tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC = tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC
                        tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC = tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC.
 
             else if tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} and tqCDocumentReportPromisNote.tdCDocRepInvOrigDebitTC <> 0
             then
                 assign tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC = - abs(tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC)
                        tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC = - abs(tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC).
 
         end.
     end.
 
     else do:
 
        if (tqCDocumentReportPromisNote.tcCDocRepCInvoiceType   = {&INVOICETYPE-PREPAYMENT} and tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefPaidAmtTC <> 0 and tqCDocumentReportPromisNote.tdCDocRepInvOrigDebitTC <> 0) or
           (tqCDocumentReportPromisNote.tcCDocRepCInvoiceType   = {&INVOICETYPE-ADJUSTMENT} and tqCDocumentReportPromisNote.tdCDocRepInvOrigDebitTC <> 0) or
            tqCDocumentReportPromisNote.tcCDocRepCInvoiceType   = {&INVOICETYPE-CREDITNOTE}
        then 
            assign tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC = - abs(tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC)
                   tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC = - abs(tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC).
        else
            assign tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC = tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefAmountTC
                   tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC = tqCDocumentReportPromisNote.tdCDocRepCInvoiceXRefDiscAmTC.
     end.
end.