project QadFinancials > class TConCheck > method DebtorControlGLBalance
Description
AR sub-administration with GL
Parameters
icFile | input | character | |
ocConCheckLineDetResult | output | character | |
otConCheckLineDetStartDate | output | date | |
oiConCheckLineDetStartTime | output | integer | |
oiConCheckLineDetDuration | output | integer | |
iiCompanyID | input | integer | |
iiPeriodID | input | integer | |
iiSessionID | input | integer | |
oiErrorNumbers | output | integer | |
ocConCheckLineDetVersion | output | character | |
icAppVersion | input | character | |
icSumFile | input | character | Summary file |
ihTranslationHandle | input | handle | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/tconcheck.p)
/**********************************************************************************/
/* CheckARGL */
/**********************************************************************************/
assign oiReturnStatus = -98.
assign vdStartEtime = etime (no)
otConCheckLineDetStartDate = now
oiConCheckLineDetStartTime = time
oiErrorNumbers = 0
ocConCheckLineDetVersion = icAppVersion + '.1'.
/* open logfile stream */
output stream sTechOut TO value(icFile) append.
output stream sSumOut TO value(icSumFile) append.
put stream sTechOut unformatted ' 'skip.
put stream sTechOut unformatted '##### AR sub-administration with GL #####' skip.
PUT STREAM sTechOut unformatted 'Version: ' ocConCheckLineDetVersion skip.
put stream sTechOut unformatted 'Validation Start At: ' string(now, '99/99/9999 HH:MM:SS') skip.
MAIN_BLOCK:
do:
if iiPeriodID = ? or iiPeriodID = 0
then do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
PUT STREAM sTechOut unformatted "**Error** Input parameter PeriodID is null." skip.
LEAVE MAIN_BLOCK.
end.
assign ocConCheckLineDetResult = {&CONCHECKRESULT-PASSED}.
for first Company NO-LOCK where company.company_id = iiCompanyID,
each CompanySharedSet OF Company NO-LOCK,
first SharedSet OF CompanySharedSet where
SharedSet.SharedSetType = 'GL' NO-LOCK:
find first Period of Company where
Period_id = iiPeriodID
no-lock no-error.
if not available Period
then do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
PUT STREAM sTechOut unformatted "**Error** Input parameter PeriodID is not available." skip.
LEAVE MAIN_BLOCK.
end.
find first DomainProperty where DomainProperty.Domain_ID = Company.Domain_ID no-error.
if available DomainProperty then
assign viCompanyLC = DomainProperty.Currency_ID
viCompanyCC = DomainProperty.StatutoryCurrency_ID.
assign vdTotGLLCMovementCredit = 0
vdTotINLCMovementCredit = 0
vdTotGLLCMovementDebit = 0
vdTotINLCMovementDebit = 0
vdTotGLCCMovementCredit = 0
vdTotINCCMovementCredit = 0
vdTotGLCCMovementDebit = 0
vdTotINCCMovementDebit = 0
viSelectedYearPeriod = Period.PeriodYearPeriod
vcCompanyCode = Company.CompanyCode.
/**********************************************************************************/
/* Check the movement balance of the selected period */
/**********************************************************************************/
empty temp-table tBalanceByGLAR.
/* Get the balance of GL as of date */
for each GL no-lock
where
GL.GLTypeCode = {&GLTYPECODE-DEBT} and
GL.SharedSet_Id = SharedSet.SharedSet_Id,
each PostingHist no-lock
where
PostingHist.Company_ID = Company.Company_ID and
PostingHist.GL_ID = GL.GL_ID and
PostingHist.PostingHistYearPeriodFrom = viSelectedYearPeriod
break by gl.gl_id:
if first-of(gl.gl_id) then
do:
create tBalanceByGLAR.
assign tBalanceByGLAR.tiGLID = gl.gl_id
tBalanceByGLAR.tcGLCode = gl.glcode.
end.
assign tBalanceByGLAR.tdBalanceGLLC = tBalanceByGLAR.tdBalanceGLLC + PostingHist.PostingHistMovemntDebitLC
tBalanceByGLAR.tdBalanceGLCC = tBalanceByGLAR.tdBalanceGLCC + PostingHist.PostingHistMovemntDebitCC
tBalanceByGLAR.tdBalanceGLLCCredit = tBalanceByGLAR.tdBalanceGLLCCredit + PostingHist.PostingHistMovemntCreditLC
tBalanceByGLAR.tdBalanceGLCCCredit = tBalanceByGLAR.tdBalanceGLCCCredit + PostingHist.PostingHistMovemntCreditCC
vdTotGLLCMovementCredit = vdTotGLLCMovementCredit + PostingHistMovemntCreditLC
vdTotGLLCMovementDebit = vdTotGLLCMovementDebit + PostingHistMovemntDebitLC
vdTotGLCCMovementCredit = vdTotGLCCMovementCredit + PostingHistMovemntCreditCC
vdTotGLCCMovementDebit = vdTotGLCCMovementDebit + PostingHistMovemntDebitCC.
end. /* end for each GL. */
/* Get the AR movement */
for each DInvoiceMovement of Company NO-LOCK
where
DInvoiceMovement.DInvoiceMovementYearPeriod = viSelectedYearPeriod,
first PostingLine NO-LOCK
where
PostingLine.PostingLine_ID = DInvoiceMovement.PostingLine_ID:
find first tBalanceByGLAR where tBalanceByGLAR.tiGLID = PostingLine.GL_ID no-lock no-error.
if available tBalanceByGLAR then
do:
assign tBalanceByGLAR.tdBalanceARLC = tBalanceByGLAR.tdBalanceARLC + postinglinedebitlc
tBalanceByGLAR.tdBalanceARCC = tBalanceByGLAR.tdBalanceARCC + postinglinedebitcc
tBalanceByGLAR.tdBalanceARLCCredit = tBalanceByGLAR.tdBalanceARLCCredit + postinglinecreditlc
tBalanceByGLAR.tdBalanceARCCCredit = tBalanceByGLAR.tdBalanceARCCCredit + postinglinecreditcc.
end.
else do:
find first gl no-lock where GL.GL_ID = PostingLine.GL_ID
and GL.SharedSet_Id = SharedSet.SharedSet_Id no-error.
if available gl then
do:
create tBalanceByGLAR.
assign tBalanceByGLAR.tiGLID = gl.gl_id
tBalanceByGLAR.tcGLCode = gl.glcode
tBalanceByGLAR.tdBalanceARLC = postinglinedebitlc
tBalanceByGLAR.tdBalanceARCC = postinglinedebitcc
tBalanceByGLAR.tdBalanceARLCCredit = postinglinecreditlc
tBalanceByGLAR.tdBalanceARCCCredit = postinglinecreditcc.
end.
end.
assign vdTotINLCMovementCredit = vdTotINLCMovementCredit + postinglinecreditlc
vdTotINLCMovementDebit = vdTotINLCMovementDebit + postinglinedebitlc
vdTotINCCMovementCredit = vdTotINCCMovementCredit + postinglinecreditcc
vdTotINCCMovementDebit = vdTotINCCMovementDebit + postinglinedebitcc.
End. /* end for each DInvoiceMovement */
if vdTotINLCMovementDebit <> vdTotGLLCMovementDebit
then do :
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Movements in selected period - Base Currency':U skip.
put stream sTechOut unformatted 'GL Account Debit':U at 1
'GL Amount Debit':U to 60
'AR Amount Debit':U to 90
'Difference Debit':U to 120 skip.
for each tBalanceByGLAR:
if tBalanceByGLAR.tdBalanceGLLC <> tBalanceByGLAR.tdBalanceARLC then
do:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLLC to 60
tBalanceByGLAR.tdBalanceARLC to 90
tBalanceByGLAR.tdBalanceGLLC - tBalanceByGLAR.tdBalanceARLC to 120 skip.
end.
end.
end.
if vdTotINLCMovementCredit <> vdTotGLLCMovementCredit
then do :
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Movements in selected period - Base Currency':U skip.
put stream sTechOut unformatted 'GL Account Credit':U at 1
'GL Amount Credit':U to 60
'AR Amount Credit':U to 90
'Difference Credit':U to 120 skip.
for each tBalanceByGLAR:
if tBalanceByGLAR.tdBalanceGLLCCredit <> tBalanceByGLAR.tdBalanceARLCCredit then
do:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLLCCredit to 60
tBalanceByGLAR.tdBalanceARLCCredit to 90
tBalanceByGLAR.tdBalanceGLLCCredit - tBalanceByGLAR.tdBalanceARLCCredit to 120 skip.
end.
end.
end.
if vdTotINCCMovementDebit <> vdTotGLCCMovementDebit
then do :
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Movements in selected period - Statutory Currency':U skip.
put stream sTechOut unformatted 'GL Account Debit':U at 1
'GL Amount Debit':U to 60
'AR Amount Debit':U to 90
'Difference Debit':U to 120 skip.
for each tBalanceByGLAR:
if tBalanceByGLAR.tdBalanceGLCC <> tBalanceByGLAR.tdBalanceARCC then
do:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLCC to 60
tBalanceByGLAR.tdBalanceARCC to 90
tBalanceByGLAR.tdBalanceGLCC - tBalanceByGLAR.tdBalanceARCC to 120 skip.
end.
end.
end.
if vdTotINCCMovementCredit <> vdTotGLCCMovementCredit
then do :
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Movements in selected period - Statutory Currency':U skip.
put stream sTechOut unformatted 'GL Account Credit':U at 1
'GL Amount Credit':U to 60
'AR Amount Credit':U to 90
'Difference Credit':U to 120 skip.
for each tBalanceByGLAR:
if tBalanceByGLAR.tdBalanceGLCCCredit <> tBalanceByGLAR.tdBalanceARCCCredit then
do:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLCCCredit to 60
tBalanceByGLAR.tdBalanceARCCCredit to 90
tBalanceByGLAR.tdBalanceGLCCCredit - tBalanceByGLAR.tdBalanceARCCCredit to 120 skip.
end.
end.
end.
/**********************************************************************************/
/* Check the current balance ( As of Date ) end of selected period */
/**********************************************************************************/
empty temp-table tBalanceByGLAR.
/* Get the balance of GL as of date */
for each GL no-lock
where
GL.GLTypeCode = {&GLTYPECODE-DEBT} and
GL.SharedSet_Id = SharedSet.SharedSet_Id,
each PostingHist no-lock
where
PostingHist.Company_ID = Company.Company_id and
PostingHist.GL_ID = GL.GL_ID and
PostingHist.PostingHistYearPeriodFrom <= viSelectedYearPeriod and
PostingHist.PostingHistYearPeriodTill >= viSelectedYearPeriod
break by gl.gl_id:
find first tBalanceByGLAR where tBalanceByGLAR.tiGLID = GL.GL_ID and
tBalanceByGLAR.tiCurrencyID = PostingHist.Currency_ID no-error.
if not available tBalanceByGLAR
then do:
create tBalanceByGLAR.
assign tBalanceByGLAR.tiGLID = gl.gl_id
tBalanceByGLAR.tiCurrencyID = PostingHist.Currency_ID
tBalanceByGLAR.tcGLCode = gl.glcode
tBalanceByGLAR.tcGLDescription = gl.gldescription.
for first Currency where Currency.Currency_ID = PostingHist.Currency_ID:
assign tBalanceByGLAR.tcCurrencyCode = Currency.CurrencyCode.
end.
end.
assign tBalanceByGLAR.tdBalanceGLLC = tBalanceByGLAR.tdBalanceGLLC + PostingHist.PostingHistBalanceDebitLC - PostingHist.PostingHistBalanceCreditLC
tBalanceByGLAR.tdBalanceGLCC = tBalanceByGLAR.tdBalanceGLCC + PostingHist.PostingHistBalanceDebitCC - PostingHist.PostingHistBalanceCreditCC
tBalanceByGLAR.tdBalanceGLTC = tBalanceByGLAR.tdBalanceGLTC + PostingHist.PostingHistBalanceDebitTC - PostingHist.PostingHistBalanceCreditTC.
end. /* end for each gl */
/* Get the balance of AR as of date */
for each DInvoice OF Company no-lock
where
DInvoice.DInvoiceClosingDate > Period.PeriodEndDate and
DInvoice.DInvoicePostingDate <= Period.PeriodEndDate,
each DInvoiceMovement no-lock
where
DInvoiceMovement.DInvoice_ID = DInvoice.DInvoice_ID and
DInvoiceMovement.DInvoiceMovementPostDate <= Period.PeriodEndDate,
first PostingLine no-lock
where
PostingLine.PostingLine_ID = DInvoiceMovement.PostingLine_ID,
first GL no-lock
where
GL.GL_ID = PostingLine.GL_ID:
/* break by GL.GL_ID:*/
find first tBalanceByGLAR where tBalanceByGLAR.tiGLID = GL.GL_ID and
tBalanceByGLAR.tiCurrencyID = PostingLine.Currency_ID no-error.
if available tBalanceByGLAR then
do:
assign tBalanceByGLAR.tdBalanceARLC = tBalanceByGLAR.tdBalanceARLC + postinglinedebitlc - postinglinecreditlc
tBalanceByGLAR.tdBalanceARCC = tBalanceByGLAR.tdBalanceARCC + postinglinedebitcc - postinglinecreditcc
tBalanceByGLAR.tdBalanceARTC = tBalanceByGLAR.tdBalanceARTC + postinglinedebittc - postinglinecredittc.
end.
else do:
create tBalanceByGLAR.
assign tBalanceByGLAR.tiGLID = gl.gl_id
tBalanceByGLAR.tcGLCode = gl.glcode
tBalanceByGLAR.tcGLDescription = gl.gldescription
tBalanceByGLAR.tiCurrencyID = PostingLine.Currency_ID
tBalanceByGLAR.tdBalanceARLC = postinglinedebitlc - postinglinecreditlc
tBalanceByGLAR.tdBalanceARCC = postinglinedebitcc - postinglinecreditcc
tBalanceByGLAR.tdBalanceARTC = postinglinedebittc - postinglinecredittc .
for first Currency where Currency.Currency_ID = PostingLine.Currency_ID:
assign tBalanceByGLAR.tcCurrencyCode = Currency.CurrencyCode.
end.
end.
End. /* end for each DInvoice of company */
if can-find (first tBalanceByGLAR where tBalanceByGLAR.tdBalanceGLTC <> tBalanceByGLAR.tdBalanceARTC)
then do:
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Balance as of end of selected period - Transaction Currency':U skip.
put stream sTechOut unformatted 'GL Account':U at 1
'GL Amount':U to 60
'AP Amount':U to 90
'Difference':U to 120 skip.
for each tBalanceByGLAR where tBalanceByGLAR.tdBalanceGLTC <> tBalanceByGLAR.tdBalanceARTC:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLTC to 60
tBalanceByGLAR.tdBalanceARTC to 90
tBalanceByGLAR.tdBalanceGLTC - tBalanceByGLAR.tdBalanceARTC to 120 skip.
assign oiErrorNumbers = oiErrorNumbers + 1.
end.
end. /* if can-find (first tBalanceByGLAR) */
if can-find (first tBalanceByGLAR where tBalanceByGLAR.tdBalanceGLLC <> tBalanceByGLAR.tdBalanceARLC)
then do :
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Balance as of end of selected period - Base Currency':U skip.
put stream sTechOut unformatted 'GL Account':U at 1
'GL Amount':U to 60
'AP Amount':U to 90
'Difference':U to 120 skip.
for each tBalanceByGLAR where tBalanceByGLAR.tdBalanceGLLC <> tBalanceByGLAR.tdBalanceARLC:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLLC to 60
tBalanceByGLAR.tdBalanceARLC to 90
tBalanceByGLAR.tdBalanceGLLC - tBalanceByGLAR.tdBalanceARLC to 120 skip.
assign oiErrorNumbers = oiErrorNumbers + 1.
end.
end. /* if can-find (first tBalanceByGLAR) */
if can-find (first tBalanceByGLAR where tBalanceByGLAR.tdBalanceGLCC <> tBalanceByGLAR.tdBalanceARCC)
then do :
/* try to get header info */
put stream sTechOut unformatted skip (1) 'Balance as of end of selected period - Statutory Currency':U skip.
put stream sTechOut unformatted 'GL Account':U at 1
'GL Amount':U to 60
'AP Amount':U to 90
'Difference':U to 120 skip.
for each tBalanceByGLAR where tBalanceByGLAR.tdBalanceGLCC <> tBalanceByGLAR.tdBalanceARCC:
put stream sTechOut unformatted tBalanceByGLAR.tcGLCode at 1
tBalanceByGLAR.tdBalanceGLCC to 60
tBalanceByGLAR.tdBalanceARCC to 90
tBalanceByGLAR.tdBalanceGLCC - tBalanceByGLAR.tdBalanceARCC to 120 skip.
assign oiErrorNumbers = oiErrorNumbers + 1.
end.
end. /* if can-find (first tBalanceByGLAP) */ end. /* for each Company */
if oiErrorNumbers > 0 then assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
else assign ocConCheckLineDetResult = {&CONCHECKRESULT-PASSED}.
end. /* End Main_Block */
assign oiConCheckLineDetDuration = etime - vdStartEtime.
/* to format the total duration time */
assign viMilliSecs = oiConCheckLineDetDuration.
assign viSecs = TRUNCATE (oiConCheckLineDetDuration / 1000, 0).
assign viMilliSecs = viMilliSecs mod 1000.
assign vcTotalTime = string(viSecs, 'HH:MM:SS') + '.' + string(viMilliSecs).
/* log passed or failed status */
put stream sTechOut unformatted 'Execution Duration: ' vcTotalTime skip.
put stream sTechOut unformatted 'Execution Result: ' ocConCheckLineDetResult skip.
put stream sTechOut unformatted '<Error Count:> ' oiErrorNumbers skip.
put stream sTechOut unformatted '**********************************************************************' skip.
output stream sTechOut close.
PUT STREAM sSumOut unformatted ' ' skip.
PUT STREAM sSumOut unformatted trim({&CONCHECKLINEDETTYPE-ARSUBGL-TR}) skip.
PUT STREAM sSumOut unformatted '-----------------------------' skip.
put stream sSumOut unformatted trim(#T-12'Execution Result':255(510391963)T-12#) + ': ' + ocConCheckLineDetResult skip.
if oiErrorNumbers > 0
then do:
put stream sSumOut unformatted
trim(#T-35'Total number of errors':100(376712702)T-35#)
+ ': ' + string(oiErrorNumbers) skip.
put stream sSumOut unformatted
'('
trim(#T-62'Please see details in the file':150(806040074)T-62#) ' ' icFile ')' skip.
end.
if can-find (first tBalanceByGLAR)
then do:
for each tBalanceByGLAR break by tBalanceByGLAR.tiGLID
by tBalanceByGLAR.tiCurrencyID:
if first-of(tBalanceByGLAR.tiGLID)
then do:
assign vdGLBalanceLCPerGL = 0
vdGLBalanceCCPerGL = 0
vdSubBalanceCCPerGL = 0
vdSubBalanceLCPerGL = 0
vlDetailPrinted = no.
put stream sSumOut unformatted ' ' skip.
put stream sSumOut unformatted trim(#T-97'GL':20(199)T-97#)
': ':U
tBalanceByGLAR.tcGLCode
' ':U
tBalanceByGLAR.tcGLDescription
' ':U skip.
end.
assign vdGLBalanceLCPerGL = vdGLBalanceLCPerGL + tBalanceByGLAR.tdBalanceGLLC
vdGLBalanceCCPerGL = vdGLBalanceCCPerGL + tBalanceByGLAR.tdBalanceGLCC
vdSubBalanceLCPerGL = vdSubBalanceLCPerGL + tBalanceByGLAR.tdBalanceARLC
vdSubBalanceCCPerGL = vdSubBalanceCCPerGL + tBalanceByGLAR.tdBalanceARCC.
if tBalanceByGLAR.tdBalanceGLTC <> tBalanceByGLAR.tdBalanceARTC or
tBalanceByGLAR.tdBalanceGLLC <> tBalanceByGLAR.tdBalanceARLC or
tBalanceByGLAR.tdBalanceGLCC <> tBalanceByGLAR.tdBalanceARCC
then do:
assign vlDetailPrinted = yes.
put stream sSumOut unformatted trim(#T-22'Currency':20(220)T-22#) +
': ':U + tqGLCurrency.tcCurrencyCode at 1
trim(#T-91'GL Balance':20(1017)T-91#) +
'':U to 30
trim(#T-64'Sub-ledger Balance':20(254104290)T-64#) to 60
trim(#T-30'Difference':20(4114)T-30#) to 90 skip.
<M-40 run RoundAmount
(input-output tBalanceByGLAR.tdBalanceGLTC (bdUnroundedAmount),
input tBalanceByGLAR.tiCurrencyID (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-73 run RoundAmount
(input-output tBalanceByGLAR.tdBalanceARTC (bdUnroundedAmount),
input tBalanceByGLAR.tiCurrencyID (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = tBalanceByGLAR.tdBalanceGLTC - tBalanceByGLAR.tdBalanceARTC.
<M-66 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input tBalanceByGLAR.tiCurrencyID (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-45'TC':3(4029)T-45#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
<M-54 run RoundAmount
(input-output tBalanceByGLAR.tdBalanceGLLC (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-6 run RoundAmount
(input-output tBalanceByGLAR.tdBalanceARLC (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = tBalanceByGLAR.tdBalanceGLLC - tBalanceByGLAR.tdBalanceARLC.
<M-90 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-92'BC':3(4030)T-92#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
<M-61 run RoundAmount
(input-output tBalanceByGLAR.tdBalanceGLCC (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-84 run RoundAmount
(input-output tBalanceByGLAR.tdBalanceARCC (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = tBalanceByGLAR.tdBalanceGLCC - tBalanceByGLAR.tdBalanceARCC.
<M-38 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-172'SC':12(3936)T-172#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
end.
if last-of(tBalanceByGLAR.tiGLID)
then do:
assign vdSumGLBalanceCC = vdSumGLBalanceCC + vdGLBalanceCCPerGL
vdSumGLBalanceLC = vdSumGLbalanceLC + vdGLBalanceLCPerGL
vdSumSubBalanceCC = vdSumSubBalanceCC + vdSubBalanceCCPerGL
vdSumSubBalanceLC = vdSumSubBalanceLC + vdSubBalanceLCPerGL.
if vlDetailPrinted then put stream sSumOut unformatted ' ':U skip.
put stream sSumOut unformatted trim(#T-89'All Currencies':50(837972044)T-89#) at 1
trim(#T-80'GL Balance':20(1017)T-80#) to 30
trim(#T-19'Sub-ledger Balance':20(254104290)T-19#) to 60
trim(#T-5'Difference':20(4114)T-5#) to 90 skip.
<M-9 run RoundAmount
(input-output vdGLBalanceLCPerGL (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-44 run RoundAmount
(input-output vdSubBalanceLCPerGL (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = vdGLBalanceLCPerGL - vdSubBalanceLCPerGL.
<M-41 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-78'BC':3(4030)T-78#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
<M-59 run RoundAmount
(input-output vdGLBalanceCCPerGL (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-3 run RoundAmount
(input-output vdSubBalanceCCPerGL (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = vdGLBalanceCCPerGL - vdSubBalanceCCPerGL.
<M-1 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-227'SC':12(3936)T-227#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
end.
end. /* for each tBalanceByGLAR */
put stream sSumOut unformatted ' ' skip.
<M-7 run RoundAmount
(input-output vdSumGLBalanceLC (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-60 run RoundAmount
(input-output vdSumSubBalanceLC (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = vdSumGLBalanceLC - vdSumSubBalanceLC.
<M-2 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input viCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-52'Total BC':50(330832880)T-52#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
<M-16 run RoundAmount
(input-output vdSumGLBalanceCC (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcGLBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
<M-75 run RoundAmount
(input-output vdSumSubBalanceCC (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcSubBalanceFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
assign vdDiff = vdSumGLBalanceCC - vdSumSubBalanceCC.
<M-33 run RoundAmount
(input-output vdDiff (bdUnroundedAmount),
input viCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcDiffFormat (ocFormatedAmount),
output viFcReturnSuper (oiReturnStatus)) in TConCheck>
put stream sSumOut unformatted trim(#T-28'Total SC':50(601335079)T-28#) at 1
vcGLBalanceFormat to 30
vcSubBalanceFormat to 60
vcDiffFormat to 90 skip.
end.
put stream sSumOut unformatted "____________________________________________________________" skip.
output stream sSumOut close.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.