report procedure
Parameters
Internal usage
unused
program code (program4/bcdocumentreport.p)
empty temp-table tqCDocumentReportTransfer.
<M-1 run GetReportLabels (input 'CDocumentReportTransfer':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-TRANSFER} (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 tqCDocumentReportTransfer.
buffer-copy tCDocumentReportAll to tqCDocumentReportTransfer.
if tqCDocumentReportTransfer.tiPaySelLine_ID = ?
then assign tqCDocumentReportTransfer.tiPaySelLine_ID = 0.
if tqCDocumentReportTransfer.tcCDocRepCInvoiceType = {&INVOICETYPE-PREPAYMENT} and
tqCDocumentReportTransfer.tiPaySelLine_ID <> 0
then do:
<Q-84 run PaySelLineByIDAllInfo (all) (Read) (NoCache)
(input tqCDocumentReportTransfer.tiPaySelLine_ID, (PaySelLine_ID)
output dataset tqPaySelLineByIDAllInfo) in BPaymentSelection>
find first tqPaySelLineByIDAllInfo where tqPaySelLineByIDAllInfo.tiPaySelLine_ID = tqCDocumentReportTransfer.tiPaySelLine_ID no-error.
if available tqPaySelLineByIDAllInfo
then do:
if (tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&INVOICETYPE-INVOICE} and tqCDocumentReportTransfer.tdCDocRepInvOrigDebitTC <> 0) or
(tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} and tqCDocumentReportTransfer.tdCDocRepInvOrigCreditTC <> 0)
then
assign tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC = tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC
tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC = tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC.
else if tqPaySelLineByIDAllInfo.tcPaySelLineObjectType = {&PAYMENTSELECTIONTYPE-PREPAYMENTINV} and tqCDocumentReportTransfer.tdCDocRepInvOrigDebitTC <> 0
then
assign tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC = - abs(tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC)
tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC = - abs(tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC).
end.
end.
else do:
if (tqCDocumentReportTransfer.tcCDocRepCInvoiceType = {&INVOICETYPE-PREPAYMENT} and tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefPaidAmtTC <> 0 and tqCDocumentReportTransfer.tdCDocRepInvOrigDebitTC <> 0) or
(tqCDocumentReportTransfer.tcCDocRepCInvoiceType = {&INVOICETYPE-ADJUSTMENT} and tqCDocumentReportTransfer.tdCDocRepInvOrigDebitTC <> 0) or
tqCDocumentReportTransfer.tcCDocRepCInvoiceType = {&INVOICETYPE-CREDITNOTE}
then
assign tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC = - abs(tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC)
tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC = - abs(tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC).
else
assign tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC = tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefAmountTC
tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC = tqCDocumentReportTransfer.tdCDocRepCInvoiceXRefDiscAmTC.
end.
end.