Cost Centre Allocation Error

Discussion in 'Free Source Codes' started by A Sam, Feb 24, 2023.

    
  1. A Sam

    A Sam Member


    Payment get posted without Cost Centre Allocation (Bulk Entry)

    Also on loading TDL when entering voucher normally it gives error "Allocation Total is more than Original Amount" and cant allocate cost centre

    anyone can help please

    Code:
    [Field  : MasPay CCNameFld]
                         
            Type        : String
            Use         : Name Field
            Table       : Cost Centres, EndOfList     
        ;    Keys        : Create Cost Centre, Alter Cost Centre
            Storage     : CCName
            Set as        : $CostCentreAllocation ;Name
            Show Table  : Always
            Case        : Title Case
            Width        : @@AmountWidth
            Align       : Left
            Inactive    : $$IsEndOfList:$PartyLedgerName 
    
    [System: UDF]
            MasPayment BulkEntry    : Aggregate : 41071
    ;        VchNo                    : String    : 41072 
            MasCCName                : String    : 41072
            Date                    : Date      : 41073
            PartyLedgerName        : String    : 41074
            Amount                  : Amount    : 41075
            RBCBLedgerName          : String    : 41076
            CheNumUDf              : String    : 41077
            Reference              : String    : 41078 
            Narration              : String    : 41079
    
    
    
    
    [Function: BulkManualPaymentEntry]
    ;; Procedural Block
    
    ;    Variable : MasVchNo         : String 
            Variable : MasDate          : Date 
            Variable : MasDrLedgerName  : String
            Variable : MasCrLedgerName  : String
            Variable : MasCCName        : String
            Variable : MasAmount        : Amount
            Variable : ChqNo            : String
            Variable : Reference        : String
            Variable : Narration        : String
    
    
            Variable : Counter      : Number: 1
     
            001 :    Start Batch Post    : 10
    
            005 :   START PROGRESS          : ($$NumItems:MasPaymentCollection)   : "Creating Vouchers" : @@CmpMailName : "Creating Payment Vouchers ..."
            007 :   WALK COLLECTION         : MasPaymentCollection    ;;Sales Info
    
            010 :   SET : MasDate           : $$Date:$Date
            020 :   SET : MasDrLedgerName   : $PartyLedgerName
            030 :   SET : MasCrLedgerName   : #MasPaymentCrLedFld
            035 :   SET : MasCCName            : #MasPayCCNameFld
            040 :   SET : MasAmount         : $$AsAmount:$Amount 
            041 :   SET : ChqNo             : #MasChequeNo
            042 :   SET : Reference         : $Reference
            043 :   SET : Narration          : $Narration
            050 :   SET  : SVViewName    : $$SysName:AcctgVchView
       
            060 :   NEW OBJECT            : Voucher 
            065 :   SET VALUE            : VoucherNumber        : $VchNo
            070 :   SET VALUE            : Date                : ##MasDate
     
            080 :   SET VALUE            : VoucherTypeName   : $$VchTypePayment
            085 :   SET VALUE            : Reference         : $Reference
            088 :     Set Value            : MasCCName            : $CostCentreAllocation ;##MasCCName 
            090 :   SET VALUE            : Narration         : $Narration
    ;;----------------------------------------------------------------------------
    ;;Debit Entry
            110 : INSERT COLLECTION OBJECT : AllLedgerEntries
            110a: SET TARGET    : LedgerEntries
            120 : SET VALUE     : Ledger Name        : ##MasDrLedgerName
            140 : SET VALUE     : IsDeemedPositive     : "Yes" 
            141 : SET VALUE     : Amount            : ##MasAmount * (-) 1     ;##MasAmount
            150 : SET TARGET    : ..
            150a: LOG : $$String:##MasDrLedgerName ;+ $$String:#MasAmount + "Dr"
    
     
    ;----------------------------------------------------------------------------
    ;;Credit Entry
        160 : INSERT COLLECTION OBJECT :  AllLedgerEntries
        160a: SET TARGET    : LedgerEntries
        170 : SET VALUE     : Ledger Name        : ##MasCrLedgerName
        180 : SET VALUE     : Amount            : ##MasAmount * (-) 1 ;##MasAmount
        190 : SET VALUE     : IsDeemedPositive  : "No"
    
     
    
    ;-----------------------------------------------------------------------------------
        ;Bank Allocations
        201 : IF                : ($$IsLedOfGrp:$RBCBLedgerName:$$GroupBank OR $$IsLedOfGrp:$RBCBLedgerName:$$GroupBankOD)
        202 : SET TARGET        : LedgerEntries[$$LoopIndex]
        203 : SET               : BankLedgerAmount    : $Amount
        209 : INSERT COLLECTION OBJECT                : BankAllocations
        210 : WALK                : BankAllocations
        211 : SET TARGET        : BankAllocations[$$LoopIndex]
        220 : SET VALUE            : Date                  : $$Owner:$$Owner:$Date
        230 : SET VALUE            : TransactionType       : $$LocaleString:"Cheque"
    
        240 : SET VALUE            : InstrumentNumber      : $$Owner:$$Owner:$ChqNumUDF
        250 : SET VALUE            : InstrumentDate        : $$String:##MasDate
        260 : SET VALUE            : PAYMENTFAVOURING      : $$String:##MasDrLedgerName
        270 : SET VALUE            : Amount                : (##MasAmount) *-1
    ;-----------------------------------------------------------------------------------
        ;Cost Centre Allocations
        280    : If                : $IsCostCentresOn:Ledger:$MasDrLedgerName
        290    : Insert Collection Object    : CategoryAllocations
        300    :                Set Target                    : CategoryAllocations
        310    :                    Set Value                    : Category            : $Category:CostCentre:$MasCCName
        320    :                    Set Value                    : IsDeemedPositive    : "No"
        330    :                    Insert Collection Object    : CostCentreAllocations
        340    :                    Set Target                    : CostCentreAllocations
        350    :                        Set Value                    : Name        : $MasCCName
        360    :                        Set Value                    : Amount    : $$AsAmount:$MasAmount
        370    :                    Set Target                    : ..
        380    :                Set Target                    : ..
        390    :            End If
        400    :        Set Target        : ..
    
        410 : End Walk 
        420 : SET TARGET            : ..
        430 : END IF
     
    ;-----------------------------------------------------------------------------------
        510 : SET VALUE        : PersistedView : ##SVViewName
    
        520 : CREATE TARGET
     
    
        540 : INCREMENT     : Counter
        550a: SHOW PROGRESS : ##Counter
        560 : END WALK 
    
        580 : END PROGRESS
    
        600 : RETURN
        610 : End Batch Post
    
    
     
    Last edited: Feb 25, 2023



  2. Incomplete information to give the solution. Kindly provide code & a context also. Where is <MasPaymentCollection> collection etc?
     


Share This Page