report procedure
Parameters
Internal usage
unused
program code (program4/bcdocumentreport.p)
/*
empty temp-table tqCDocumentReportDraft.
<M-1 run GetReportLabels (input 'CDocumentReportDraft':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-DRAFT} (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 tqCDocumentReportDraft.
buffer-copy tCDocumentReportAll to tqCDocumentReportDraft.
end.
*/
empty temp-table tqCDocumentReportDraft.
<M-10 run GetReportLabels (input 'CDocumentReportDraft':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.
find first tFilter where tFilter.tcBusinessFieldName = "BankPayFormatID":U no-error.
if available tFilter
then do:
viIndex = INDEX(tFilter.tcParameterValue, " ", 1).
viIndex = viIndex - 1.
vcBankNumber = SUBSTRING(tFilter.tcParameterValue, 1, viIndex, "CHARACTER").
viIndex = viIndex + 2.
tFilter.tcParameterValue = SUBSTRING(tFilter.tcParameterValue, viIndex, -1, "CHARACTER") no-error.
viIndex = INDEX(tFilter.tcParameterValue, "#", 1).
viIndex = viIndex - 1.
vcPayFormatTypeCode = TRIM(SUBSTRING(tFilter.tcParameterValue, 1, viIndex, "CHARACTER")) no-error.
<Q-12 run BankNumberByPayFormatTypeCode (all) (Read) (NoCache)
(input vcPayFormatTypeCode, (PaymentFormatTypeCode)
input vcBankNumber, (BankNumber)
input viCompanyId, (CompanyId)
output dataset tqBankNumberByPayFormatTypeCode) in BBankNumber >
find first tqBankNumberByPayFormatTypeCode no-error.
if available tqBankNumberByPayFormatTypeCode then
assign tFilter.tcParameterValue = STRING(tqBankNumberByPayFormatTypeCode.tiBankPayFormat_ID).
else
assign tFilter.tcParameterValue = "0".
end.
/* Check if necessary to update Next Pre-printed Number field of BankPayFormat */
/* When Print type is "Final Print" and Start From Number is blank, do update, else do not update */
assign vlUpdateNextPPNumber = false.
find first tFilter where tFilter.tcBusinessFieldName = "PrintType":U no-error.
if available tFilter
then do:
if tFilter.tcParameterValue = {&PRINTTYPE-FINAL}
then do:
assign vlUpdateNextPPNumber = true.
find first tFilter where tFilter.tcBusinessFieldName = "StartFromCDocumentPrePrintedNumber":U no-error.
if available tFilter
then do:
if tFilter.tcParameterValue <> ? and tFilter.tcParameterValue <> "":U
then assign vlUpdateNextPPNumber = false.
end. /* if available tFilter */
end. /* if tFilter.tcParameterValue = {&PRINTTYPE-FINAL} */
find first tFilter where tFilter.tcBusinessFieldName = "BankPayFormatID":U no-error.
if available tFilter then
assign viBankPayFormatID = integer(tFilter.tcParameterValue).
end. /* if available tFilter */
<M-4 run CDocumentReportAll
(input {&DOCUMENTTYPECREDITOR-DRAFT} (icCDocumentType),
output viFcReturnSuper (oiReturnStatus)) in BCDocumentReport>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then return.
assign viMaxPrePrintedNumber = -1.
for each tCDocumentReportAll:
create tqCDocumentReportDraft.
buffer-copy tCDocumentReportAll to tqCDocumentReportDraft.
if tCDocumentReportAll.tiCDocRepPrePrintedNum <> ?
then assign viMaxPrePrintedNumber = maximum(tCDocumentReportAll.tiCDocRepPrePrintedNum,
viMaxPrePrintedNumber).
end.
if vlUpdateNextPPNumber = true and viMaxPrePrintedNumber <> -1
then do:
if viBBankPayFormat5ID = 0 or viBBankPayFormat5ID = ?
then do:
<I-5 {bFcStartAndOpenInstance
&ADD-TO-TRANSACTION = "false"
&CLASS = "BBankPayFormat"}>
end. /* if viBankPayFormatID = 0 or viBankPayFormatID = ? */
else do:
<I-6 {bFcOpenInstance
&CLASS = "BBankPayFormat"}>
end. /* if viBankPayFormatID <> 0 and viBankPayFormatID <> ? */
<M-7 run UpdateBankPayFormatNbr
(input viBankPayFormatID (iiBankPayFormatID),
input viMaxPrePrintedNumber + 1 (iiNewPrePrintedNumber),
output viFcReturnSuper (oiReturnStatus)) in BBankPayFormat>
<I-8 {bFcCloseInstance
&CLASS = "BBankPayFormat"}>
if viFcReturnSuper < 0 or
oiReturnStatus = 0
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0
then do:
<I-9 {bFcStopInstance
&CLASS = "BBankPayFormat"}>
return.
end. /* if oiReturnStatus < 0 */
end. /* if vlUpdateNextPPNumber = true */