Modify udf Value in Bill Allocation Screen in voucher

Discussion in 'Tally Developer' started by Reshma, Oct 13, 2020.

    
  1. Reshma

    Reshma Member


    Dear Experts,

    Please help me to set Udf value in Bill allocation of voucher. Here is my tried code. Value is not getting updated. What is wrong in this function?


    [#Menu:Gateway of Tally]
    Add:Button:Update Broker

    [Button:Update Broker]
    Key:F7
    Action:Alter:GRP Report;Call:Broker Update

    [Report:GRP Report]
    Title:"Select Vouchertype"
    Form:GRP Report

    [Form:GRP Report]
    Background:Light Petal Pink
    Part:GRP Report
    Height:25% Page
    Width:50% page
    On:Form Accept:Yes:Form Accept
    On:Form Accept:Yes:Call:Broker Update

    [Part:GRP Report]
    Line:GRP Head, GRP Report

    [Line:GRP Head]
    Field:GRP Head

    [Field:GRP Head]
    Use:Name Field
    Set as:"Select Vouchertype (Sales) to Update"
    Full Width:Yes
    Align:Centre
    Style:Large Bold
    Skip:Yes
    Border:Thin Bottom


    [Line:GRP Report]
    Space Top:5 mms
    Field:Long Prompt, GRP Report
    Local:Field:Long prompt:Set as:"Select Vouchertype"


    [Field:GRP Report]
    Use:Name Field
    Modifies:MYVCHTYP
    Table:MY Sale VCH
    Show Table:Always
    Width:50 mms
    Style:Normal Bold
    Align:Left

    [Collection:MY Sale VCH]
    Type:Vouchertype
    Child Of:"Sales"

    [Variable:MYVCHTYP]
    Type:String
    Persistent:Yes

    [System:Variable]
    MYVCHTYP:""

    [Collection : My Pur Vch]
    Type :Vouchers
    Filter:pP
    Fetch:*


    [System:Formula]

    PP:$Vouchertypename Equals ##MYVCHTYP


    [Function: Broker Update]
    Variable : MID : String
    Variable : StkName : String
    Variable:party:String
    002:Start Batch Post
    003 : Walk Collection : My Pur Vch
    004 : Set : MID :$$Sprintf:mad:@VCHMasterID:$MasterId
    005 :New Object:Voucher:##MID
    ;005D:Log:##Stkname
    006:Set Target:Ledgerentries
    005A:Set:party:$Partyledgername
    005B:Set:StkName:$uni11:ledger:##Party
    ;005C:Log:##party
    007:Set Value:Uni1:##StkName ;;; This Value is getting updated which is on main screen of voucher
    008:Set Target:..
    009:Set Target:Ledgerentries
    010:Set Target:BillAllocations
    011:Set Value:Billbroker:##StkName ;;;; This UDF value is not getting updated.
    012:Set Target:..
    013:Set Target:..
    014:Accept Alter
    015 : End Walk
    016 :End Batch Post
    017 : Msg Box : "Status" : "Broker name Updated in Vouchers!!"
    ;
    ;
     


  2. Reshma

    Reshma Member


    Please reply...
     


  3. Himanshu-2002

    Himanshu-2002 Active Member


    Your Collection Contain UDF Value ?

    To check Write This in your calculator

    Select $StkName From MyPurVch

    If Not Then Check Your UDF Value is Saving Or not If Saving Then Export That Voucher in XML Which Contains That UDF and If XML Contains UDF then Create a Collection of Vouchers
    Example:
    [Collection: VchColl]
    Type: Voucher: VoucherType
    Child of:$$VchTypePurchase

    Create a Summary Collection and walk in UDF Collection

    Example:

    [Collection:VchColllSummary]
    Source Collection: VchColl
    Walk:UDFName
    Compute:UDFNAME:$UDFNAME

    After all This use this summary collection in function...
     


  4. Reshma

    Reshma Member


    Sorry, But I am not getting you. My issue is only that, I want to update value to new UDF (Billbroker) which is added in Bill allocation screen of Sales Voucher, From the UDF value which is added in Partyledger without opening any voucher. I am setting Broker name in Party ledger which should be updated in Bill allocation screen for old vouchers.
     


  5. Himanshu-2002

    Himanshu-2002 Active Member


    You want to update the UDF?
     


  6. Reshma

    Reshma Member


    Yes..
     


  7. Himanshu-2002

    Himanshu-2002 Active Member


    Sorry For Late Reply... I just forgot to reply and as far as I know bill allocation comes under inventory Entries Collection So, You have to walk into inventory entries and after that walk into bill allocation then update the value
     


  8. Reshma

    Reshma Member


    After lot of struggle with trials and errors, finally I got my solution. Sharing updated function as someone may get help from this.
    Thanks for your valuable responses.

    [Function: Broker Update]
    Variable : MSTID : String
    Variable : StkName : String
    Variable:party:String
    002:Start Batch Post
    003 : Walk Collection : My Pur Vch
    004 : Set : MSTID :$$Sprintf:mad:@VCHMasterID:$MasterId
    005 :New Object:Voucher:##MSTID:Yes
    006:Set:party:$Partyledgername
    007:Set:StkName:$uni11:ledger:##Party
    005C:If:$$IsEmpty:$Uni1 or $Uni1 contains "NotApplicable"
    ;007A:Set Value:Narration:"My Narration"
    ;007B:Set Value:Reference:$Vouchernumber
    008:Set Value:Uni1:##StkName
    009:Set Target:..
    009A:Set Object
    008A:Set Target:Ledgerentries[1]
    ;008C:Set Value:Ledgername:$Ledgername ;;; We can set Partyname from here
    008D1:Set Target:Billallocations
    08:Insert Collection Object:Billallocations
    08A:Set Target:Billallocations[1]
    008D2:Set:Stkname:$uni11:ledger:##Party
    ;008D3:Set Value:Name:$Vouchernumber ;; Default Field value Updated
    008D4:Set Value:Billbroker:##Stkname ;; Customized Field value Updated
    008E:End If
    008F:Set Target:..
    008G:Set Target:..
    008H:Set Target:..
    010:Alter Target
    011:Save Target
    012:End Walk
    013 :End Batch Post
    014 : Msg Box : "Status" : "Broker name Updated in Vouchers!!"
     
    Pritam Krishna likes this.


  9. Himanshu-2002

    Himanshu-2002 Active Member


    Nice To hear that... Congrats
     


  10. Reshma

    Reshma Member


    Thanks... :)
     


Share This Page