How to calculate Opening balance for UDF

Discussion in 'Tally Developer' started by HarshaLalzare, Nov 29, 2013.

    
  1. HarshaLalzare

    HarshaLalzare New Member


    [Collection: SItemCollproductionsum1]
    Source Collection : Voucher Collectionproductionsum1
    AllInventoryEntries.BatchAllocations.SNFKGs,AllInventoryEntries.BatchAllocations.FatKGs
    Fetch: AllLedgerEntries.BankAllocations.*
    Walk: ALLInventoryEntries
    By: Name : $StockItemName ;; Grouping done by Stock Item
    Aggr Compute : PrPurcQty : Sum : If @@productionsum1PurcVr Then $BilledQty Else 0
    Aggr Compute : PrSaleQty : Sum : If @@productionsum1SaleVr Then $BilledQty Else 0
    Aggr Compute : PrTranOutQty : Sum : If @@productionsum1StockJrnlVr And NOT $$IsInwards:$BilledQty Then $BilledQty Else 0
    Aggr Compute : PrTranInQty : Sum : If @@productionsum1StockJrnlVr And $$IsInwards:$BilledQty Then $BilledQty Else 0
    Aggr Compute : PHVCHQTY : Sum : If @@prphvchqty Then $ACTUALQTY Else 0
    Aggr Compute : PrFATinQty : SUM: $stkFATKG
    Aggr Compute : PrSNFinQty : SUM: $stkSNFKG
    Aggr Compute : PrFATCONQty : SUM: $stkFATKG1
    Aggr Compute : PrSNFCONQty : SUM: $stkSNFKG1
    Aggr Compute : PHSNFc : SUM: $phvchsnf
    Aggr Compute : PHFATc : SUM: $PHVCHFAT

    Aggr Compute : PrFATOutQty : SUM: $$CollectionField:$FatKGs:1:BatchAllocations
    Aggr Compute : PrSNFOutQty : SUM: $$CollectionField:$SNFKGs:1:BatchAllocations
    Aggr Compute : PrSNFcloseQty : SUM: $$CollectionField:$SNFKGs:1:BatchAllocations-$stkSNFKG
    Aggr Compute : PrFATcloseQty : SUM: $$CollectionField:$FatKGs:1:BatchAllocations-$stkFatKG
    Compute : PItClQty : $StkClBalance:StockItem:$StockItemName
    Compute : PItOpQty : $StkOpBalance:StockItem:$StockItemName
    Compute : PItOpQtySNF : $StkOpBalance:StockItem:$StockItemName
    ;Compute : snfOpQty : $StkOpBalance:StockItem:$StockItemName
    Sort : @@SortAlphaIncr : $Name

    this is my collection for normal entries but now i want opening balance of above all fields i.e upto previous day entries of above collection how to write for getting upto previous day transactions please tell me..........................................
     


  2. PeaceOfMind

    PeaceOfMind New Member


    You need to call a function with parameter ##svfromdate. In which svfromdate should be set to $$systemperidfrom or company start date. And svtodate to be set as the passed value -1. The return value from this function. Hth.
     


  3. HarshaLalzare

    HarshaLalzare New Member


    thanks sir i call a function but i can't give condition on date or i want to filter vouchers by Specific date -1 my code are below
    [Collection: Voucher Collectionproductionsum1prvdt]
    Type : Voucher
    Filter:voufiltProductionPrvDt

    [Collection: SItemCollproductionsum1prvdt]
    Source Collection : Voucher Collectionproductionsum1prvdt
    Fetch: All Ledger Entries, Bank Allocations,AllLedgerEntries.BankAllocations.*,OstkFATKG,MasterID, Date, VoucherNumber

    Walk: ALLInventoryEntries

    By: Name : $StockItemName ;; Grouping done by Stock Item
    ;Compute: vdate : $$Owner:$Date

    Compute : SNAME : $StockItemName
    Aggr Compute : prvdtPHSNFc : SUM: $$CollectionField:$phvchsnf:1:BatchAllocations
    Aggr Compute : prvdtPHFATc : SUM: $$CollectionField:$PHVCHFAT:1:BatchAllocations

    ;; System Formula
    [System: Formula]
    voufiltProductionPrvDt:($VoucherTypeName="Physical Stock")
    rptdate:$$Abs:(##svfromdate)-1


    [Function : OpBalFATOfItem]
    Parameter: PITEMNAME : STRING
    ;Parameter: VDATE: DATE
    Variable: VoucherDate: Date
    VARIABLE: opbalFAT: number

    Returns : number
    LOCAL FORMULA : IsPLDate : IF $vDate = @@rptdate then yes else no
    ;001: WALK COLLECTION: Ledger Entries
    ;002: SET: VoucherDate: $Date
    ;003 : IF : @IsPLDate = Yes
    ;004:IF: ##VoucherDate BETWEEN @@rptDate AND @@rptDate
    005:Walk Collection: SItemCollproductionsum1prvdt
    006 :IF : $Sname =##PITEMNAME ;AND ($date = @@rptDate)
    007 :SET :eek:pbalFAT :$prvdtPHFATc
    008 :ENDIF
    009:END WALK
    ;010 :endif
    ;011 : END WALK
    012: RETURN : ##opbalFAT

    anyone tell me how to solve this prob
     


Share This Page