project QadFinancials > class BClosingPostingsReport > method AllocationCheckDet

report procedure

Description

Detail method for allocation check


Parameters


dcrAllocationCheckoutputdatasetDataset of dcrAllocationCheck.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BClosingPostingsReport.AllocationCheck
method BClosingPostingsReport.ProcessAllocationCheck


program code (program7/bclosingpostingsreport.p)

empty temp-table tqAllocationCheck.
<M-76 run SetDataItemsBasedOnFilterTTDet  (output oiReturnStatus (oiReturnStatus)) in BClosingPostingsReport>

if viPeriodPeriodFilter = ? or viPeriodYearFilter = ?
then do:
    <M-67 run SetMessage
       (input  #T-19'The GL Period filter requires a value.':50(2285)T-19# (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'qadfin-643664':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output oiReturnStatus (oiReturnStatus)) in BClosingPostingsReport>
    assign oiReturnStatus = -1.                     
end.

if oiReturnStatus <> 0
then return.

/* Company iteration */
do viCPCompanyIterator = 1 to viCompanyEntries:

    /* Assign company ID based on code */
    if vcCPCompanyCodeFilter = ? 
    then do:
        assign viCPCurrentCompany_ID = viCompanyId.
        <Q-12 run CompanyPrim (first) (Read) (NoCache)
           (input viCompanyId, (LookupCompanyId)
            input ?, (CompanyCode)
            output dataset tqCompanyPrim) in BCompany>
            
        find first tqCompanyPrim no-error.
        if available tqCompanyPrim 
        then assign vcCPCurrentCompany = tqCompanyPrim.tcCompanyCode.
    end.
    else do:
        assign vcCPCurrentCompany = entry(viCPCompanyIterator ,vcCPCompanyCodeFilter,",":U).
        <Q-45 run CompanyPrim (first) (Read) (NoCache)
           (input ?, (LookupCompanyId)
            input vcCPCurrentCompany, (CompanyCode)
            output dataset tqCompanyPrim) in BCompany>            
        
        find first tqCompanyPrim no-error.
        if available tqCompanyPrim
        then assign viCPCurrentCompany_ID = tqCompanyPrim.tiCompany_ID.
    end.

    <Q-31 run BaseAllocation (all) (Read) (NoCache)
       (input viCPCurrentCompany_ID, (CompanyId)
        input true, (IsActive)
        output dataset tqBaseAllocation) in BClosingPostingsReport>
    
    <Q-37 run PostedAllocation (all) (Read) (NoCache)
       (input viCPCurrentCompany_ID, (CompanyId)
        input viPeriodYearFilter * 100 + viPeriodPeriodFilter, (PeriodYearPeriod)
        input true, (IsActive)
        output dataset tqPostedAllocation) in BClosingPostingsReport>
    
    
    ALLOCATIONLINES:                        
    for each tqBaseAllocation:
        if not can-find(first tqPostedAllocation where tqPostedAllocation.tiAllocation_ID = tqBaseAllocation.tiAllocation_ID)
        then do:
             create tqAllocationCheck.
             buffer-copy tqBaseAllocation to tqAllocationCheck.
             case tqBaseAllocation.tcAllocationSourceAmountBy:
                    when {&ALLOCAMOUNTBY-BLANK}
                    then assign tqAllocationCheck.tcAllocationSourceAmountBy = {&ALLOCAMOUNTBY-BLANK-TR}.
                    when {&ALLOCAMOUNTBY-PERIOD}
                    then assign tqAllocationCheck.tcAllocationSourceAmountBy = {&ALLOCAMOUNTBY-PERIOD-TR}.
                    when {&ALLOCAMOUNTBY-YTD}
                    then assign tqAllocationCheck.tcAllocationSourceAmountBy = {&ALLOCAMOUNTBY-YTD-TR}.
             end. /* case */
        end. /* if not can-find(tqPostedAllocation where tqPostedAllocation.tiAllocation_ID = tqBaseAllocation.tiAllocation_ID) */
    end.

end.
find first tqAllocationCheck no-error.                          
if not available tqAllocationCheck
then do:
    create tqAllocationCheck. 
    assign tqAllocationCheck.tiExceptionNbr = -1
           tqAllocationCheck.tcExceptionMsg = #T-54'No pending allocations were found for the selected GL period.':255(57354)T-54#.       
end.