Description
This method is to process allocation check.
Parameters
iiPeriodYear | input | integer | GL Period Year |
iiPeriodPeriod | input | integer | GL Period Period |
icFile | input | character | |
ocConCheckLineDetResult | output | character | |
otConCheckLineDetStartDate | output | date | |
oiConCheckLineDetStartTime | output | integer | |
oiConCheckLineDetDuration | output | integer | |
oiErrorNumbers | output | integer | |
iiCompanyID | input | integer | |
ocConCheckLineDetVersion | output | character | |
icAppVersion | input | character | |
icSumFile | input | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program7/bclosingpostingsreport.p)
/* =================================================================== */
/* This method is called by ConCheckProcessor to call allocation check */
/* and log the result. */
/* =================================================================== */
assign vdStartEtime2 = etime(no).
assign otConCheckLineDetStartDate = now
oiConCheckLineDetStartTime = time
oiErrorNumbers = 0
ocConCheckLineDetVersion = icAppVersion + '.1'.
empty temp-table tFilter.
empty temp-table tqAllocationCheck.
create tFilter.
assign tFilter.tcBusinessFieldName = 'PeriodYear':U
tFilter.tcOperator = '='
tFilter.tcParameterValue = string(iiPeriodYear).
create tFilter.
assign tFilter.tcBusinessFieldName = 'PeriodPeriod':U
tFilter.tcOperator = '='
tFilter.tcParameterValue = string(iiPeriodPeriod).
<Q-30 run CompanyPrim (all) (Read) (NoCache)
(input iiCompanyID, (LookupCompanyId)
input ?, (CompanyCode)
output dataset tqCompanyPrim) in BCompany >
find first tqCompanyPrim no-error.
if available tqCompanyPrim
then do:
create tFilter.
assign tFilter.tcBusinessFieldName = 'Company_CANDO':U
tFilter.tcOperator = '='
tFilter.tcParameterValue = tqCompanyPrim.tcCompanyCode.
end.
<M-77 run AllocationCheckDet
(output dcrAllocationCheck (dcrAllocationCheck),
output oiReturnStatus (oiReturnStatus)) in BClosingPostingsReport>
/* check pass or fail status */
if can-find(first tqAllocationCheck where tqAllocationCheck.tiExceptionNbr = -1)
then assign ocConCheckLineDetResult = {&CONCHECKRESULT-PASSED}.
else assign ocConCheckLineDetResult = {&CONCHECKRESULT-WARNING}.
/* try to get header information */
for each tqText:
case tqText.tcCode:
when 'coLblAllocationCode':U
then assign vcAllocCode = tqText.tcText.
when 'coLblAllocationDescription':U
then assign vcAllocDesc = tqText.tcText.
when 'coLblJournalCode':U
then assign vcDaybookCode = tqText.tcText.
when 'coLblPostingTemplateCode':U
then assign vcTemplateCode = tqText.tcText.
when 'coLblAllocationSourceAmountBy':U
then assign vcAmtBy = tqText.tcText.
when 'coLblAllocationBatchCode':U
then assign vcAllocBatchCode = tqText.tcText.
end.
end.
/* set validation execution duration */
assign oiConCheckLineDetDuration = etime - vdStartEtime2.
/* open log file stream */
output stream sCloseOut to value(icFile) append.
/* to format the total duration time */
assign viMilliSecs2 = oiConCheckLineDetDuration.
assign viSecs2 = TRUNCATE (oiConCheckLineDetDuration / 1000, 0).
assign viMilliSecs2 = viMilliSecs2 mod 1000.
assign vcTotalTime2 = string(viSecs2, 'HH:MM:SS') + '.' + string(viMilliSecs2).
put stream sCloseOut unformatted ' 'skip.
put stream sCloseOut unformatted '##### Allocations #####' skip.
PUT STREAM sCloseOut unformatted 'Version: ' ocConCheckLineDetVersion skip.
put stream sCloseOut unformatted 'Validation Start At: ' string(now, '99/99/9999 HH:MM:SS') skip.
/* log errors if validation failed */
if ocCOnCheckLineDetResult = {&CONCHECKRESULT-WARNING}
then do:
/* Header Info */
put stream sCloseOut unformatted '** Group By: AllocationCode and AllocationBatchCode **' skip.
put stream sCloseOut unformatted vcAllocCode at 1
vcAllocDesc at 30
vcDaybookCode at 80
vcTemplateCode at 100
vcAmtBy at 130
vcAllocBatchCode at 160 skip.
/* Detail Info */
for each tqAllocationCheck
where tqAllocationCheck.tiExceptionNbr <> -1
break by tqAllocationCheck.tcAllocationCode
by tqAllocationCheck.tcAllocationBatchCode:
assign oiErrorNumbers = oiErrorNumbers + 1.
put stream sCloseOut unformatted tqAllocationCheck.tcAllocationCode at 1
tqAllocationCheck.tcAllocationDescription at 30
tqAllocationCheck.tcJournalCode at 80
tqAllocationCheck.tcPostingTemplateCode at 100
tqAllocationCheck.tcAllocationSourceAmountBy at 130
tqAllocationCheck.tcAllocationBatchCode at 160 skip.
/* output a blank line when grouping changed */
if last-of(tqAllocationCheck.tcAllocationBatchCode)
then put stream sCloseOut unformatted '':U skip.
end.
end.
put stream sCloseOut unformatted 'Execution Duration: ' vcTotalTime2 skip.
put stream sCloseOut unformatted 'Execution Result: ' ocConCheckLineDetResult skip.
put stream sCloseOut unformatted '<Error Count:> ' oiErrorNumbers skip.
put stream sCloseOut unformatted '**********************************************************************' skip.
/* close log file stream */
output stream sCloseOut close.
/* Store summary result into the text file */
output stream sCloseOut to value(icSumFile) append.
put stream sCloseOut unformatted ' 'skip.
put stream sCloseOut unformatted {&CONCHECKLINEDETTYPE-ALLOCATION-TR} skip.
put stream sCloseOut unformatted '-----------' skip.
put stream sCloseOut unformatted trim(#T-93'Execution Result':255(510391963)T-93#) + ': ':U + ocConCheckLineDetResult skip.
put stream sCloseOut unformatted trim(#T-12'Total number of allocations that have not run':100(663415568)T-12#) + ': ':U + string(oiErrorNumbers) skip.
put stream sCloseOut unformatted '____________________________________________________________' skip.
output stream sCloseOut close.