project QadFinancials > class TConCheck > method UnmatchInvoiceCheck
Description
Unmatched invoices validation check
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 | |
| ihTranslationHandle | input | handle | |
| oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/tconcheck.p)
/* ================================================================================= */
/* Unmatched invoices check */
/* ================================================================================= */
assign oiReturnStatus = -98
viSessionID = iiSessionID
ocConCheckLineDetResult = {&CONCHECKRESULT-PASSED}
vdStartEtime = etime(no)
otConCheckLineDetStartDate = now
oiConCheckLineDetStartTime = time
oiErrorNumbers = 0
ocConCheckLineDetVersion = icAppVersion + '.1'.
output stream sTechOut TO value(icFile) append.
output stream sSumOut TO value(icSumFile) append.
put stream sTechOut unformatted ' 'skip.
put stream sTechOut unformatted '##### Unmatched Invoices #####' skip.
PUT STREAM sTechOut unformatted 'Version: ' ocConCheckLineDetVersion skip.
put stream sTechOut unformatted 'Validation Start At: ' string(now, '99/99/9999 HH:MM:SS') skip.
put stream sSumOut unformatted ' 'skip.
put stream sSumOut unformatted trim({&CONCHECKLINEDETTYPE-UNMATCHEDINVOICE-TR}) skip.
put stream sSumOut unformatted '------------------' skip.
MAIN_BLOCK:
do on error undo, throw:
if iiCompanyID = ? or
iiCompanyID = 0
then do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
PUT STREAM sTechOut unformatted "**Error** Input parameter CompanyID is null." skip.
LEAVE MAIN_BLOCK.
end.
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.
empty temp-table tqCIRECClosingDate.
empty temp-table tqCurrBalance.
define buffer bGL for gl.
for first company where company.company_id = iiCompanyID no-lock:
find first DomainProperty where DomainProperty.Domain_ID = Company.Domain_ID no-lock no-error.
if available DomainProperty then
assign viLocalCompanyLC = DomainProperty.Currency_ID
viLocalCompanyCC = DomainProperty.StatutoryCurrency_ID.
/* check if exists active SIREC system gl account */
assign vcCurrentCompanyCode = companycode
viglid = 0
vcGLcode = '':U
vcGLDescription = '':U.
for each companysharedset where companysharedset.company_id = company.company_id no-lock,
each sharedset of companysharedset where sharedsettype = 'gl' no-lock,
each gl of sharedset where gltypecode = 'SYSTEM'
and glsystemtypecode = 'CIREC'
and gl.glisactive = yes no-lock:
assign viGLId = gl.gl_id
vcGLCode = glcode
vcGLDescription = gldescription.
end. /* end for companysharedset */
if viglid = 0
then do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}
vcOutputStr = "The system account 'Unmatched Invoices' is not defined."
oiErrorNumbers = oiErrorNumbers + 1.
put stream sTechOut unformatted vcOutputStr skip.
leave MAIN_BLOCK.
end. /* end if viglid = 0 */
/* check cinvoicecirecclosingdate */
for each cinvoice of company where cinvoicecirecclosingdate <> 12/31/9999 no-lock:
if not can-find(first cinvoiceposting of cinvoice where cinvoiceposting.cinvoicepostingtype = "ALLOC")
then do:
create tqCIRECClosingDate.
assign
tqCIRECClosingDate.tiCInvoiceId = cinvoice.cinvoice_id
tqCIRECClosingDate.ttCIRECClosingDate = cinvoicecirecclosingdate.
end.
end. /* for each cinvoice of company where cinvoicecirecclosingdate <> 12/31/9999 no-lock: */
if can-find(first tqCIRECClosingDate)
then do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
put stream sTechOut unformatted ' ':U skip.
put stream sTechOut unformatted 'Supplier Invoice ID' at 1
'SIREC Closing Date' at 25
skip.
for each tqCIRECClosingDate:
assign oiErrorNumbers = oiErrorNumbers + 1.
put stream sTechOut unformatted string(tqCIRECClosingDate.tiCInvoiceId) at 1
tqCIRECClosingDate.ttCIRECClosingDate at 25
skip.
end.
put stream sTechOut unformatted 'Please correct the upper CInvoiceCIRECClosingDate to continue. That date should be 12/31/9999.' skip.
put stream sTechOut unformatted ' ':U skip.
leave MAIN_BLOCK.
end. /* if can-find(first tqCIRECClosingDate) */
find first period of company where period.period_id = iiPeriodID no-lock no-error.
/* go through cinvoices */
for each cinvoice of company where cinvoice.cinvoicecirecclosingdate > period.periodenddate and
cinvoice.cinvoicepostingdate <= period.periodenddate no-lock,
first currency where currency.currency_id = CInvoiceCurrency_ID no-lock:
/* skip initial invoices */
find cinvoicemovement of cinvoice where cinvoicemovement.cinvoicemovementtype = "INITIAL" no-lock no-error.
if not available cinvoicemovement then next. /* invoices with no movements at all are 'INITIAL" status (not to confuse with the "INITIAL" movementtype */
if cinvoicemovement.cinvoicemovementpostdate > period.periodenddate then next. /* this invoice was still initial status at the end of the period */
/* additional skipping and technical checking */
find cinvoiceposting of cinvoice where cinvoiceposting.cinvoicepostingtype = "INIT" no-lock no-error.
if not available cinvoiceposting
then do:
find journal of cinvoice no-lock no-error.
/* this happens for Open Balance created SI, for prepayments in supplier payment create, prepayments in banking entry and prepayments in OIA */
if available journal and
(journal.journaltypecode = "CREDITORPAYMENT" or
journal.journaltypecode = "BANKINGENTRY" or
journal.journaltypecode = "CREDITORADJUSTMENT" or
journal.journaltypecode = "DEBTORADJUSTMENT")
then next.
/* check if CIREC account exists in posting. */
find first posting where
posting.company_id = cinvoice.company_id and
posting.PostingYear = cinvoice.cinvoicepostingyear and
posting.Journal_ID = cinvoice.journal_id and
posting.PostingVoucher = cinvoice.cinvoicevoucher
no-lock no-error.
if available posting
then do:
assign vlHasCIRECGL = no.
for each postingline of posting no-lock,
each bGL of postingline where bgl.gltypecode = 'SYSTEM' and bgl.glsystemtypecode = 'CIREC' no-lock:
assign vlHasCIRECGL = yes.
leave.
end.
if vlHasCIRECGL = yes
then do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
assign oiErrorNumbers = oiErrorNumbers + 1.
put stream sTechOut unformatted 'SIREC GL account should not be used for supplier invoice posting. (invoice id:' + string(cinvoice.cinvoice_id) + ').' skip.
end.
else do:
next.
end. /* if vlHasCIRECGL = yes */
end. /* if available posting */
else do:
assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
assign oiErrorNumbers = oiErrorNumbers + 1.
put stream sTechOut unformatted 'There is no posting for supplier invoice:' + string(cinvoice.cinvoice_id) + '.' skip.
end.
end. /* if not available cinvoiceposting */
/* preparing output temp-table buffer */
find first tqCurrBalance where tcCurr = currencycode no-error.
if not available tqCurrBalance
then do:
create tqCurrBalance.
assign
tcCurr = currencycode
tcGLCode = vcglcode
tcGLDescription = vcgldescription
tdCIBalanceTC = 0
tdCIBalanceLC = 0
tdCIBalanceCC = 0
tdPHBalanceTC = 0
tdPHBalanceLC = 0
tdPHBalanceCC = 0.
end. /* if not available tqCurrBalance */
/* calculate cinvoice amount*/
assign
vdCInvoiceAmtTC = - CInvoiceOriginalDebitTC + CInvoiceOriginalCreditTC
vdCInvoiceAmtLC = - CInvoiceOriginalDebitLC + CInvoiceOriginalCreditLC
vdCInvoiceAmtCC = - CInvoiceOriginalDebitCC + CInvoiceOriginalCreditCC.
/* deduct tax amount from invoice */
if cinvoice.cinvoiceistaxexcluded = no
then do:
assign
vdCinvoiceAmtTC = vdCinvoiceAmtTC - CInvoiceVatDebitTC + CInvoiceVatCreditTC
vdCinvoiceAmtLC = vdCinvoiceAmtLC - CInvoiceVatDebitLC + CInvoiceVatCreditLC
vdCinvoiceAmtCC = vdCinvoiceAmtCC - CInvoiceVatDebitCC + CInvoiceVatCreditCC.
/* make a correction for non-recoverable taxes, but since those are only stored in TC we have to prorate the other currencies */
if CInvoiceVatDebitTC - CInvoiceVatCreditTC <> 0 and CInvoiceNonRecTaxAmtTC <> 0
then do:
assign
vdCinvoiceAmtLC = vdCinvoiceAmtLC + ((CInvoiceNonRecTaxAmtTC / (CInvoiceVatDebitTC - CInvoiceVatCreditTC)) * (CInvoiceVatDebitLC - CInvoiceVatCreditLC))
vdCinvoiceAmtCC = vdCinvoiceAmtCC + ((CInvoiceNonRecTaxAmtTC / (CInvoiceVatDebitTC - CInvoiceVatCreditTC)) * (CInvoiceVatDebitCC - CInvoiceVatCreditCC))
vdCinvoiceAmtTC = vdCinvoiceAmtTC + CInvoiceNonRecTaxAmtTC.
end.
end.
else do:
if CInvoiceVatDebitTC - CInvoiceVatCreditTC <> 0 and CInvoiceNonRecTaxAmtTC <> 0
then do:
assign
vdCInvoiceAmtTC = vdCInvoiceAmtTC -(CInvoiceVatDebitTC - CInvoiceVatCreditTC)
vdCInvoiceAmtLC = vdCInvoiceAmtLC -(CInvoiceVatDebitLC - CInvoiceVatCreditLC)
vdCInvoiceAmtCC = vdCInvoiceAmtCC -(CInvoiceVatDebitCC - CInvoiceVatCreditCC).
if CInvoiceVatDebitTC > 0
then
assign
vdCInvoiceAmtLC = vdCInvoiceAmtLC + ((CInvoiceNonRecTaxAmtTC / (CInvoiceVatDebitTC - CInvoiceVatCreditTC)) * (CInvoiceVatDebitLC - CInvoiceVatCreditLC))
vdCInvoiceAmtCC = vdCInvoiceAmtCC + ((CInvoiceNonRecTaxAmtTC / (CInvoiceVatDebitTC - CInvoiceVatCreditTC)) * (CInvoiceVatDebitCC - CInvoiceVatCreditCC))
vdCInvoiceAmtTC = vdCInvoiceAmtTC + CInvoiceNonRecTaxAmtTC.
else
assign
vdCInvoiceAmtLC = vdCInvoiceAmtLC - ((CInvoiceNonRecTaxAmtTC / (CInvoiceVatDebitTC - CInvoiceVatCreditTC)) * (CInvoiceVatDebitLC - CInvoiceVatCreditLC))
vdCInvoiceAmtCC = vdCInvoiceAmtCC - ((CInvoiceNonRecTaxAmtTC / (CInvoiceVatDebitTC - CInvoiceVatCreditTC)) * (CInvoiceVatDebitCC - CInvoiceVatCreditCC))
vdCInvoiceAmtTC = vdCInvoiceAmtTC - CInvoiceNonRecTaxAmtTC.
end.
end. /* else do */
/* round the invoice amount */
<M-57 run RoundAmount
(input vdCInvoiceAmtLC (idUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount2 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-12 run RoundAmount
(input vdCInvoiceAmtCC (idUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount3 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
/* calculate total unmatched invoice amount */
assign
tdCIBalanceTC = tdCIBalanceTC + vdCInvoiceAmtTC
tdCIBalanceLC = tdCIBalanceLC + vdCInvoiceAmtLC
tdCIBalanceCC = tdCIBalanceCC + vdCInvoiceAmtCC.
end. /* for each CInvoice where */
/* go through PostingHist of unmatched invoice system GL account */
for each postinghist where postinghist.company_ID = Company.Company_ID and
postingHist.GL_ID = viglid and
postinghistyearperiodfrom <= period.periodyearperiod and
postinghistyearperiodtill >= period.periodyearperiod no-lock,
first currency of postinghist no-lock:
find first tqCurrBalance where tcCurr = currencycode no-error.
if not available tqCurrBalance
then do:
create tqCurrBalance.
assign
tcCurr = currencycode
tcGLCode = vcglcode
tcGLDescription = vcgldescription
tdCIBalanceTC = 0
tdCIBalanceLC = 0
tdCIBalanceCC = 0
tdPHBalanceTC = 0
tdPHBalanceLC = 0
tdPHBalanceCC = 0.
end. /* end not available tqCurrBalance */
assign tdPHBalanceTC = tdPHBalanceTC + (PostingHist.PostingHistBalanceDebitTC - PostingHist.PostingHistBalanceCreditTC)
tdPHBalanceLC = tdPHBalanceLC + (PostingHist.PostingHistBalanceDebitLC - PostingHist.PostingHistBalanceCreditLC)
tdPHBalanceCC = tdPHBalanceCC + (PostingHist.PostingHistBalanceDebitCC - PostingHist.PostingHistBalanceCreditCC).
end. /* for each postinghist where */
end. /* for each company where company.companycode = '10usaco' no-lock: */
end. /* MAIN_BLOCK: */
for each tqCurrBalance:
assign
tdDiffTC = tdPHBalanceTC - tdCIBalanceTC
tdDiffLC = tdPHBalanceLC - tdCIBalanceLC
tdDiffCC = tdPHBalanceCC - tdCIBalanceCC.
if tdDiffTC <> 0 or tdDiffLC <> 0 or tdDiffCC <> 0
then assign oiErrorNumbers = oiErrorNumbers + 1.
end. /* end for each tqCurrBalance */
if oiErrorNumbers > 0
then assign ocConCheckLineDetResult = {&CONCHECKRESULT-FAILED}.
assign oiConCheckLineDetDuration = etime - vdStartEtime.
put stream sSumOut unformatted trim(#T-65'Execution Result':255(510391963)T-65#) + ': ' + ocConCheckLineDetResult skip.
if oiErrorNumbers > 0
then do:
put stream sSumOut unformatted
trim(#T-73'Total number of errors':100(376712702)T-73#)
': ':U + string(oiErrorNumbers) skip.
put stream sSumOut unformatted
'(' +
trim(#T-433'Please see details in the file':150(806040074)T-433#) +
' ' icFile + ')':U skip.
end.
put stream sSumOut unformatted ' ':U skip.
find first tqCurrBalance no-error.
if available tqCurrBalance
then do:
put stream sTechOut unformatted ' ':U skip.
put stream sTechOut unformatted 'GL: ':U tqCurrBalance.tcGLCode ' ':U tqCurrBalance.tcGLDescription ' ':U skip.
put stream sSumOut unformatted
trim(#T-39'GL':20(199)T-39#)
': ':U tqCurrBalance.tcGLCode
' ':U
tqCurrBalance.tcGLDescription
' ':U skip.
end.
assign
vdTotalInvoiceBCAmt = 0
vdTotalInvoiceSCAmt = 0
vdTotalGLBCAmt = 0
vdTotalGLSCAmt = 0
vdTotalBCDiff = 0
vdTotalSCDiff = 0.
for each tqCurrBalance:
assign vlIsShowSum = if (tdDiffTC <> 0 or tdDiffLC <> 0 or tdDiffCC <> 0) then yes else no.
assign
vdTotalInvoiceBCAmt = vdTotalInvoiceBCAmt + tqCurrBalance.tdCIBalanceLC
vdTotalInvoiceSCAmt = vdTotalInvoiceSCAmt + tqCurrBalance.tdCIBalanceCC
vdTotalGLBCAmt = vdTotalGLBCAmt + tqCurrBalance.tdPHBalanceLC
vdTotalGLSCAmt = vdTotalGLSCAmt + tqCurrBalance.tdPHBalanceCC.
put stream sTechOut unformatted 'Currency: ':U + tqCurrBalance.tcCurr at 1
'GL Balance':U to 30
'Supplier Invoice Amount':U to 60
'Difference':U to 90 skip.
if vlIsShowSum then
put stream sSumOut unformatted
trim(#T-5'Currency':20(220)T-5#) + ': ':U + tqCurrBalance.tcCurr at 1
trim(#T-79'GL Balance':20(1017)T-79#) to 30
trim(#T-68'Supplier Invoice Amount':100(262856126)T-68#) to 60
trim(#T-64'Difference':20(4114)T-64#) to 90 skip.
<M-92 run RoundAmount
(input-output tqCurrBalance.tdPHBalanceTC (bdUnroundedAmount),
input ? (iiCurrencyId),
input tqCurrBalance.tcCurr (icCurrencyCode),
output vcFormatedAmount1 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-1 run RoundAmount
(input-output tqCurrBalance.tdCIBalanceTC (bdUnroundedAmount),
input ? (iiCurrencyId),
input tqCurrBalance.tcCurr (icCurrencyCode),
output vcFormatedAmount2 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-89 run RoundAmount
(input-output tqCurrBalance.tdDiffTC (bdUnroundedAmount),
input ? (iiCurrencyId),
input tqCurrBalance.tcCurr (icCurrencyCode),
output vcFormatedAmount3 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
put stream sTechOut unformatted 'TC':U at 1
tqCurrBalance.tdPHBalanceTC to 30
tqCurrBalance.tdCIBalanceTC to 60
tqCurrBalance.tdDiffTC to 90 skip.
if vlIsShowSum then
put stream sSumOut unformatted trim(#T-19'TC':3(4029)T-19#) at 1
vcFormatedAmount1 to 30
vcFormatedAmount2 to 60
vcFormatedAmount3 to 90 skip.
<M-86 run RoundAmount
(input-output tqCurrBalance.tdPHBalanceLC (bdUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount1 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-76 run RoundAmount
(input-output tqCurrBalance.tdCIBalanceLC (bdUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount2 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-80 run RoundAmount
(input tqCurrBalance.tdDiffLC (idUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount3 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
put stream sTechOut unformatted 'BC':U at 1
tqCurrBalance.tdPHBalanceLC to 30
tqCurrBalance.tdCIBalanceLC to 60
tqCurrBalance.tdDiffLC to 90 skip.
if vlIsShowSum then
put stream sSumOut unformatted trim(#T-749'BC':3(4030)T-749#) at 1
vcFormatedAmount1 to 30
vcFormatedAmount2 to 60
vcFormatedAmount3 to 90 skip.
<M-81 run RoundAmount
(input-output tqCurrBalance.tdPHBalanceCC (bdUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount1 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-28 run RoundAmount
(input-output tqCurrBalance.tdCIBalanceCC (bdUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount2 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-48 run RoundAmount
(input-output tqCurrBalance.tdDiffCC (bdUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount3 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
put stream sTechOut unformatted 'SC':U at 1
tqCurrBalance.tdPHBalanceCC to 30
tqCurrBalance.tdCIBalanceCC to 60
tqCurrBalance.tdDiffCC to 90 skip.
if vlIsShowSum then
put stream sSumOut unformatted trim(#T-10'SC':12(3936)T-10#) at 1
vcFormatedAmount1 to 30
vcFormatedAmount2 to 60
vcFormatedAmount3 to 90 skip.
end. /* end for each tqCurrBalance */
/* for each tqCurrBalance: */
put stream sTechOut unformatted ' ':U skip.
put stream sSumOut unformatted ' ':U skip.
put stream sSumOut unformatted
trim(#T-63'Total':15(14489)T-63#) at 1
trim(#T-40'GL Balance':20(1017)T-40#) to 30
trim(#T-23'Supplier Invoice Amount':100(262856126)T-23#) to 60
trim(#T-27'Difference':20(4114)T-27#) to 90 skip.
assign
vdTotalBCDiff = vdTotalGLBCAmt - vdTotalInvoiceBCAmt
vdTotalSCDiff = vdTotalGLSCAmt - vdTotalInvoiceSCAmt.
<M-93 run RoundAmount
(input-output vdTotalGLBCAmt (bdUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount1 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-98 run RoundAmount
(input-output vdTotalInvoiceBCAmt (bdUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount2 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-15 run RoundAmount
(input-output vdTotalBCDiff (bdUnroundedAmount),
input viLocalCompanyLC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount3 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
put stream sTechOut unformatted 'Total BC':U at 1
vdTotalGLBCAmt to 30
vdTotalInvoiceBCAmt to 60
vdTotalBCDiff to 90 skip.
put stream sSumOut unformatted
trim(#T-34'Total BC':50(330832880)T-34#) at 1
vcFormatedAmount1 to 30
vcFormatedAmount2 to 60
vcFormatedAmount3 to 90 skip.
<M-95 run RoundAmount
(input-output vdTotalGLSCAmt (bdUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount1 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-69 run RoundAmount
(input-output vdTotalInvoiceSCAmt (bdUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount2 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
<M-9 run RoundAmount
(input-output vdTotalSCDiff (bdUnroundedAmount),
input viLocalCompanyCC (iiCurrencyId),
input ? (icCurrencyCode),
output vcFormatedAmount3 (ocFormatedAmount),
output oiReturnStatus (oiReturnStatus)) in TConCheck>
put stream sTechOut unformatted 'Total SC':U at 1
vdTotalGLSCAmt to 30
vdTotalInvoiceSCAmt to 60
vdTotalSCDiff to 90 skip.
put stream sSumOut unformatted
trim(#T-54'Total SC':50(601335079)T-54#) at 1
vcFormatedAmount1 to 30
vcFormatedAmount2 to 60
vcFormatedAmount3 to 90 skip.
put stream sTechOut unformatted ' ':U skip.
/* 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).
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.
put stream sSumOut unformatted "____________________________________________________________" skip.
output stream sTechOut close.
output stream sSumOut close.
if oiReturnStatus = -98
then assign oiReturnStatus = 0.