report procedure
Parameters
icLanguageCode | input | character | |
tFilter | input | temp-table | |
dcrCashBook | output | dataset | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program7/bcashboxreport.p)
empty temp-table tqCashBook.
<M-26 run GetReportLabels (input 'CashBook':U (icReportName),
input icLanguageCode (icLanguageCode),
input tFilter (tFilter),
output tqHeader (tqHeader),
output tqFilter (tqFilter),
output tqText (tqText),
output oiReturnStatus (oiReturnStatus)) in BCashBoxReport>
if oiReturnStatus <> 0
then return.
<M-2 run SetDataItemsBasedOnFilterTT (output oiReturnStatus (oiReturnStatus)) in BCashBoxReport>
/*mandatory filter fields>>*/
if vcCashGLCodeFilter = ? or vcCashGLCodeFilter = "":U
then do:
<M-14 run SetMessage
(input #T-17'You must specify the cash GL account.':50(17320)T-17# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-4252':U (icFcMsgNumber),
input #T-18'You must specify the cash GL account.':100(17323)T-18# (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output oiReturnStatus (oiReturnStatus)) in BCashBoxReport>
assign oiReturnStatus = -1.
end.
if vtCashPostingDateFromFilter = ? or vtCashPostingDateToFilter = ?
then do:
<M-8 run SetMessage
(input #T-20'The From - To Posting Date (cash balance) range requires a value.':100(17327)t-20# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-4251':U (icFcMsgNumber),
input #T-21'The From - To Posting Date range requires a value.':50(17328)t-21# (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output oiReturnStatus (oiReturnStatus)) in BCashBoxReport>
assign oiReturnStatus = -1.
end.
/*<<mandatory filter fields*/
if oiReturnStatus <> 0
then return.
/*balance from history>>*/
<Q-28 run GLByIDCode (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input ?, (GLID)
input vcCashGLCodeFilter, (GLCode)
output dataset tqGLByIDCode) in BGL >
find first tqGLByIDCode no-error.
if available tqGLByIDCode
then assign viGL_ID = tqGLByIDCode.tiGL_ID.
<Q-22 run PeriodByStartEndDate (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input vtCashPostingDateFromFilter, (Date)
output dataset tqPeriodByStartEndDate) in BPeriod >
find first tqPeriodByStartEndDate no-error.
if available tqPeriodByStartEndDate
then do:
assign
vdPostingCreditLC = 0
vdPostingCreditTC = 0
vdPostingDebitLC = 0
vdPostingDebitTC = 0.
<Q-24 run PeriodPrevPeriodByYearPeriod (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tqPeriodByStartEndDate.tiPeriodYear, (PeriodYear)
input tqPeriodByStartEndDate.tiPeriodPeriod, (PeriodPeriod)
output dataset tqPeriodPrevPeriodByYearPeriod) in BPeriod >
find last tqPeriodPrevPeriodByYearPeriod no-error.
if available tqPeriodPrevPeriodByYearPeriod
then do:
<Q-29 run PostingHistByYearPeriodGL (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input viGL_ID, (GL_ID)
input tqPeriodPrevPeriodByYearPeriod.tiPeriodYearPeriod, (YearPeriod)
output dataset tqPostingHistByYearPeriodGL) in BCashBoxReport >
for each tqPostingHistByYearPeriodGL:
assign
vdPostingCreditLC = vdPostingCreditLC + tqPostingHistByYearPeriodGL.tdPostingHistBalanceCreditLC
vdPostingCreditTC = vdPostingCreditTC + tqPostingHistByYearPeriodGL.tdPostingHistBalanceCreditTC
vdPostingDebitLC = vdPostingDebitLC + tqPostingHistByYearPeriodGL.tdPostingHistBalanceDebitLC
vdPostingDebitTC = vdPostingDebitTC + tqPostingHistByYearPeriodGL.tdPostingHistBalanceDebitTC.
end.
end.
if tqPeriodByStartEndDate.ttPeriodStartDate <> vtCashPostingDateFromFilter then
do:
<Q-25 run BaseCashBook (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input vcCashGLCodeFilter, (GLCode)
input tqPeriodByStartEndDate.ttPeriodStartDate, (FromPostingDate)
input vtCashPostingDateFromFilter - 1, (ToPostingDate)
input vcCBJournalCodeFilter, (JournalCode)
input viCBPostingVoucherFilter, (PostingVoucher)
input vcCBPostingLayerFilter, (Layer)
input ?, (AccPeriod)
input ?, (AccYear)
output dataset tqBaseCashBook) in BCashBoxReport >
for each tqBaseCashBook where tqBaseCashBook.tcGLCode = tqBaseCashBook.tcGLCodeBank:
assign
vdPostingDebitLC = tqBaseCashBook.tdPostingLineDebitLC + vdPostingDebitLC
vdPostingDebitTC = tqBaseCashBook.tdPostingLineDebitTC + vdPostingDebitTC
vdPostingCreditLC = tqBaseCashBook.tdPostingLineCreditLC + vdPostingCreditLC
vdPostingCreditTC = tqBaseCashBook.tdPostingLineCreditTC + vdPostingCreditTC.
end.
end. /* if tqPeriodByStartEndDate.ttPeriodStartDate <> vtCashPostingDateFormFilter */
end.
/*<<balance from history*/
<Q-27 run BaseCashBook (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input vcCashGLCodeFilter, (GLCode)
input vtCashPostingDateFromFilter, (FromPostingDate)
input vtCashPostingDateToFilter, (ToPostingDate)
input vcCBJournalCodeFilter, (JournalCode)
input viCBPostingVoucherFilter, (PostingVoucher)
input vcCBPostingLayerFilter, (Layer)
input ?, (AccPeriod)
input ?, (AccYear)
output dataset tqBaseCashBook) in BCashBoxReport >
for each tqBaseCashBook:
create tqCashBook.
buffer-copy tqBaseCashBook to tqCashBook.
if tqBaseCashBook.tcBankStateLineInOut = "+":U
then do:
assign
tqCashBook.tdReceivedTC = tqBaseCashBook.tdPostingLineDebitTC - tqBaseCashBook.tdPostingLineCreditTC
tqCashBook.tdReceivedLC = tqBaseCashBook.tdPostingLineDebitLC - tqBaseCashBook.tdPostingLineCreditLC.
end.
else do:
assign
tqCashBook.tdPaidTC = tqBaseCashBook.tdPostingLineCreditTC - tqBaseCashBook.tdPostingLineDebitTC
tqCashBook.tdPaidLC = tqBaseCashBook.tdPostingLineCreditLC - tqBaseCashBook.tdPostingLineDebitLC.
end.
assign
tqCashBook.tdInitialBalance = vdPostingDebitTC - vdPostingCreditTC
tqCashBook.tcCurrencyCodeLC = vcCompanyLC.
end.