Description
This method is the sub-method of CDocumentReportAll because character limitation.
Parameters
icCDocumentType | input | character | Supplier Payment Type |
icPrintType | input | character | Print Type |
ilAssignCDocumentPrePrintedNum | input | logical | Whether to assign payment preprinted number |
ilIncreaseCDocumentTimesPrinted | input | logical | whether to increase payment printed times |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bcdocumentreport.p)
/* Created voided payment records */
/* For some reason the CreateVoidedDocument cannot be called */
/* with vhFcComponent set to ? - so start explicit instance */
if viBCDocumentID = ? or viBCDocumentID = 0
then do:
<I-1 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "no"
&CLASS = "BCDocument"}>
end.
else do:
<I-2 {bFcOpenInstance
&CLASS = "BCDocument"}>
end.
FOR EACH tVoided WHERE tVoided.tlVoid = yes:
for each tCDocumentReportAll where
tCDocumentReportAll.tcReportDocID = tVoided.tcReportDocID
break by tCDocumentReportAll.tcReportDocID:
/* Only create voided documents if setting pre-printed numbers (real check print) */
/* Do not create a void document when printtype is TESTPRINT */
if (ilAssignCDocumentPrePrintedNum and icPrintType <> {&PRINTTYPE-TEST} and first-of(tCDocumentReportAll.tcReportDocID))
then do:
<M-3 run CreateVoidedDocument
(input tCDocumentReportAll.tiCDocRepPrePrintedNum (iiPrePrintedNumber),
input tCDocumentReportAll.tiCDocumentID (iiCDocumentID),
output viDocID (oiVoidedCDocumentID),
output oiReturnStatus (oiReturnStatus)) in BCDocument>
if oiReturnStatus < 0 then leave.
end.
/* Set report values for voided document */
ASSIGN
tCDocumentReportAll.tcCDocRepDocumentStatus = "VOID".
/* tCDocumentReportAll.tiCDocRepChequeDollars = ?
tCDocumentReportAll.tiCDocRepChequeCents = ?
tCDocumentReportAll.tdCDocRepOrigCreditTC = ?
tCDocumentReportAll.tdCDocRepOrigDebitTC = ?
tCDocumentReportAll.tcCurrencyCode = ?
tCDocumentReportAll.tcCDocRepCInvoiceCurrencyCode = ?. */
END. /* FOR EACH tCDocumentReportAll */
END. /* FOR EACH tVoided */
<I-4 {bFcCloseInstance
&CLASS = "BCDocument"}>
if(oiReturnStatus < 0) then return.
/* Ensure that documents are updated with appropriate numbers */
if(ilAssignCDocumentPrePrintedNum) then do:
for each tCDocumentReportAll where tCDocumentReportAll.tcCDocRepDocumentStatus <> {&DOCUMENTSTATUS-VOID}:
find tCDocumentPrintCDR where tCDocumentPrintCDR.tiCDocumentId = tCDocumentReportAll.tiCDocumentID no-error.
if(not available(tCDocumentPrintCDR)) then do:
create tCDocumentPrintCDR.
assign
tCDocumentPrintCDR.tiCDocumentId = tCDocumentReportAll.tiCDocumentID
tCDocumentPrintCDR.tlIncreaseCDocumentTimesPrinted = ilIncreaseCDocumentTimesPrinted.
end.
tCDocumentPrintCDR.tiCDocumentPrePrintedNumber = tCDocumentReportAll.tiCDocRepPrePrintedNum.
end.
end.
/* Update CDocument */
if icPrintType <> {&PRINTTYPE-TEST}
then do:
if can-find(first tCDocumentPrintCDR)
then do:
<I-5 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "no"
&CLASS = "BCDocument"}>
<M-6 run ApiUpdateCDocumentPrint (input tCDocumentPrintCDR (tCDocumentPrint),
output viFcReturnSuper (oiReturnStatus)) in BCDocument>
<I-7 {bFcCloseInstance
&CLASS = "BCDocument"}>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
end.
end. /* if vcPrintType <> {&PRINTTYPE-TEST} */
/* Report is ordered by tcReportDocID which should sort by pre-printed check numbers */
if(ilAssignCDocumentPrePrintedNum = true) then do:
for each tCDocumentReportAll by tCDocumentReportAll.tiCDocRepPrePrintedNum:
assign
tCDocumentReportAll.tcReportDocID =
string(tCDocumentReportAll.tiCDocRepPrePrintedNum,"9999999999") +
".":U + tCDocumentReportAll.tcReportDocID.
end.
end.
/* Reset numbers to '?' if numbers are not assigned (check numbers not printed) */
if not ((icCDocumentType = {&DOCUMENTTYPECREDITOR-CHEQUE} or
icCDocumentType = {&DOCUMENTTYPECREDITOR-DRAFT}) and
icPrintType <> {&PRINTTYPE-FINAL})
then do:
if(ilAssignCDocumentPrePrintedNum <> true) then do:
for each tCDocumentReportAll:
tCDocumentReportAll.tiCDocRepPrePrintedNum = ?.
end.
end.
end. /* if not ((icCDocumentType = {&DOCUMENTTYPECREDITOR-CHEQUE} */