CHANGE THE VALUE THROUGH FUNCTION

Discussion in 'Requests' started by Murtaza Shakir, Aug 24, 2020.

    
  1. Murtaza Shakir

    Murtaza Shakir New Member


    Dear Experts
    i need to change the value through the fuction but its not getting updated

    [Function : DUEDATE Voucher]

    001 : START BATCH POST : 500
    002 : Walk Collection : DUEDATE for Update
    003 : Set Object : (Voucher, ##VchID).
    004 : Set Target
    005 : Set Value : BILLCREDITPERIOD : "31-12-2020"
    ;060 : Set Value : BILLCREDITPERIOD : "220 DAYS"
    007 : Set Value : Narration : "Status Changed31313"
    008 : Alter Target
    010 : Set Target : ..
    011 : End Walk
    013 : End Batch Post

    kindly suggest
     


  2. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    you need to set target to Bill Allocations in Ledger Entries.

    means you are at voucher level, need to go to ledger entries and then bill allocations( where $billcreditperiodmethod is there ) and then come down and save
     


  3. Murtaza Shakir

    Murtaza Shakir New Member


    Thank your for your reply
    if possible can u give me a reference function in the developer to refer to

    regards
     


  4. Murtaza Shakir

    Murtaza Shakir New Member


    HI
    Can any member give me the reference of function in developer

    regards
     


  5. Murtaza Shakir

    Murtaza Shakir New Member


    dear memeber

    i have written this function it doesnot give error but also doesnot update

    kindly inform me my mistake

    [Function : DUEDATE Voucher]
    0001 : START BATCH POST : 500
    0002 : Walk Collection : DUEDATE for Update
    0010 : Set Object : (Voucher, ##VchID). ;; Set object as voucher
    0020 : Set Target ;; Set the target as voucher
    0030 : Walk Collection : All Ledger Entries ;; Walking Ledger Entries
    0050 : Set Target : LedgerEntries ;; Setting target as Ledger Entries
    0060 : Walk Collection : Bill Allocations ;; Walking bill Allocations
    0070 : Set Target : Bill Allocations ;; Setting Target as bill allocations
    0080 : Set Value : BILLCREDITPERIOD : "31-12-2020";; Set the value
    0090 : Set Target : .. ;; Set target back to ledger entries
    0100 : End Walk ;; Ending walk to bank allocations
    0110 : Set Target : .. ;; Setting target back to voucher level
    0130 : End Walk ;; Ending walk to Ledger Entries
    0140 : Accept Alter ;; Accepting the alteration
    0150 : End Walk
    0160 : End Batch Post
     


  6. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    Dear, information you provided is not sufficient for members to give you a working solution..

    still

    First create a function to Walk through DUEDATE colllection to get ##VCHID only

    [Function : YourFirstCollection]
    Variable : VchID : String
    Variable : ProgressCount : String

    150 : START PROGRESS : ($$NumItems:DUEDATE) : "Voucher" : "Alteration"
    155 : Start Batch Post : 500
    160 : WALK COLLECTION : DUEDATE
    165 : Set: VchID : "ID:"+ $$String:$MasterId ; (Your ##VchID)

    ;195 : Log: $$String:##VchID

    210 : Call: RNGAlterLedEntries:##VchID


    370 : SHOW PROGRESS : ##ProgressCount
    ;380 : Log: $$String:##ProgressCount+ "-Updated Voucher No " + "- " +$$String:##VchID

    400 : SET : ProgressCount : ##ProgressCount + 1
    410 : END WALK
    415 : End Batch Post
    420 : END PROGRESS
    440 : MSGBOX : "Status" : "Process completed !!"

    450 : RETURN : TRUE


    ;Pass ##VCHID to a new function

    [Function : YourNewFunction]
    Parameter : pVchID : String

    Object : Voucher: ##pVchID

    0010 : SET TARGET
    0130 : SET OBJECT

    0060 : Call : YourSetPartyBills

    0110 : Set Target : .. ;; Setting target back to voucher level

    0140 : Accept Alter ;; Accepting the alteration



    [Function: YourSetPartyBills]

    ; New For this function Refer to VchFunctions.tdl in Default TDL (FunctionName is SetPartyBills)
    ; and modify it accordingly
     


  7. Murtaza Shakir

    Murtaza Shakir New Member


    dear sir

    thank your for your guide line , i did as per your recommendation the code is executed but the field is not updated
    hence sending the full code


    [#Form: Day Book]
    Add : Button : DUEDATE

    [Button : DUEDATE]
    Title : "DUEDATE"
    Key : Ctrl + e
    Action : Execute : DUEDATE

    [Report : DUEDATE]
    Title : "DUEDATE"

    [Form : DUEDATE]
    Parts : DUEDATE
    Option : Small Size Form
    Full Width : No
    Space Left : 1
    Space Right : 1
    On : Form Accept : Yes : Call : YourFirstCollection

    [Part : DUEDATE]
    Lines : Form SubTitle, DUEDATE
    Local : Field : Form SubTitle : Info : "Update Voucher Status"
    Space Bottom: 1

    [Line : DUEDATE]
    Fields : Long Prompt, Logical Field
    Local : Field : Long Prompt : Set as : $$String:"due date will be updated:"



    [Function : YourFirstCollection]
    Variable : VchID : String
    Variable : ProgressCount : String

    150 : START PROGRESS : ($$NumItems:DUEDATEforUpdate) : "Voucher" : "Alteration"
    155 : Start Batch Post : 500
    160 : WALK COLLECTION : DUEDATE for Update
    165 : Set: VchID : "ID:"+ $$String:$MasterId ; (Your ##VchID)
    ;195 : Log: $$String:##VchID
    210 : Call: YourNewFunction:##VchID
    370 : SHOW PROGRESS : ##ProgressCount
    380 : Log: $$String:##ProgressCount+ "-Updated Voucher No " + "- " +$$String:##VchID
    400 : SET : ProgressCount : ##ProgressCount + 1
    410 : END WALK
    415 : End Batch Post
    420 : END PROGRESS
    440 : MSGBOX : "Status" : "Process completed !!"
    450 : RETURN : TRUE
    ;Pass ##VCHID to a new function
    [Function : YourNewFunction]
    Parameter : pVchID : String

    Object : Voucher: ##pVchID

    0010 : SET TARGET
    0130 : SET OBJECT

    0060 : Call : YourSetPartyBills

    0110 : Set Target : .. ;; Setting target back to voucher level

    0140 : Accept Alter ;; Accepting the alteration



    [Function: YourSetPartyBills]
    Variable : vBillAllocIndex : Number

    040: SET OBJECT : AllLedgerEntries[1]
    050: IF : ($$NumFilledItems:BillAllocations > 0)
    060: RETURN : TRUE
    070: END IF
    080: SET TARGET : AllLedgerEntries[1]
    150: SET TARGET : ..
    210: SET TARGET : Bill Allocations[##vBillAllocIndex]
    220: SET VALUE : Bill Credit Period : "31-12-2020"
    230: SET TARGET : ..
    270: RETURN : TRUE

    [Collection: DUEDATE for Update]
    Data Source : Parent Report : Selected Lines
     


  8. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    You missed the collection just below it, which gives the index number of bill to be modified which is set in vBillAllocIndex.

    It uses bill name(ref) to search it and if found then gives the Index, of the bill which is to be updated.
     


  9. Murtaza Shakir

    Murtaza Shakir New Member


    dear Garima

    i tried my best but no result


    [#Form: Day Book]
    Add : Button : DUEDATE

    [Button : DUEDATE]
    Title : "DUEDATE"
    Key : Ctrl + e
    Action : Execute : DUEDATE

    [Report : DUEDATE]
    Title : "DUEDATE"

    [Form : DUEDATE]
    Parts : DUEDATE
    Option : Small Size Form
    Full Width : No
    Space Left : 1
    Space Right : 1
    On : Form Accept : Yes : Call : YourFirstCollection

    [Part : DUEDATE]
    Lines : Form SubTitle, DUEDATE
    Local : Field : Form SubTitle : Info : "Update Voucher Status"
    Space Bottom: 1

    [Line : DUEDATE]
    Fields : Long Prompt, Logical Field
    Local : Field : Long Prompt : Set as : $$String:"due date will be updated:"



    [Function : YourFirstCollection]
    Variable : VchID : String
    Variable : ProgressCount : String

    150 : START PROGRESS : ($$NumItems:DUEDATEforUpdate) : "Voucher" : "Alteration"
    155 : Start Batch Post : 500
    160 : WALK COLLECTION : DUEDATE for Update
    165 : Set: VchID : "ID:"+ $$String:$MasterId ; (Your ##VchID)
    ;195 : Log: $$String:##VchID
    210 : Call: YourNewFunction:##VchID
    370 : SHOW PROGRESS : ##ProgressCount
    380 : Log: $$String:##ProgressCount+ "-Updated Voucher No " + "- " +$$String:##VchID
    400 : SET : ProgressCount : ##ProgressCount + 1
    410 : END WALK
    415 : End Batch Post
    420 : END PROGRESS
    440 : MSGBOX : "Status" : "Process completed !!"
    450 : RETURN : TRUE
    ;Pass ##VCHID to a new function
    [Function : YourNewFunction]
    Parameter : pVchID : String

    Object : Voucher: ##pVchID

    0010 : SET TARGET
    0130 : SET OBJECT

    0060 : Call : YourSetPartyBills

    0110 : Set Target : .. ;; Setting target back to voucher level

    0140 : Accept Alter ;; Accepting the alteration



    [Function: YourSetPartyBills]

    LOCAL FORMULA : locTaxBillSearch : $Name
    LOCAL FORMULA : locBillName : $$ReportObject:$$CollectionFieldByKey:$PartyBillName:mad:locTaxBillSearch:DUEDATEforUpdate
    LOCAL FORMULA : locBillAmount : $$Abs:$TDSTaxAmount * -1

    ;; this variable will be used to store the index of bill name
    ;; if a bill is present with the same number which we want to insert then we will store 1 else 0
    Variable : vBillAllocIndex : Number

    ;010: IF : (NOT (##SVTDSDeduction AND ($$IsTDSOn OR $$IsTCSOn) AND $$InCreateMode AND $$IsBillWiseOn AND ($IsBillWiseOn:Ledger:##TDSSupplierName)))
    ;020: RETURN : TRUE
    ;030: END IF

    040: SET OBJECT : AllLedgerEntries[1]
    050: IF : ($$NumFilledItems:BillAllocations > 0)
    060: RETURN : TRUE
    070: END IF
    080: SET TARGET : AllLedgerEntries[1]
    090: WALK COLLECTION : TDSDeductionBills
    095: SET : vBillAllocIndex : $$IndexOfBillAlloc:mad:locBillName
    100: IF : $$LoopIndex = 1 or ( ##vBillAllocIndex= 0)
    110: INSERT COLLECTION OBJECT : Bill Allocations
    120: SET VALUE : Bill Credit Period : "300 DAYS"
    ;130: SET VALUE : Name : @locBillName
    ;140: SET VALUE : Amount : $$Abs:$TDSTaxAmount * -1
    150: SET TARGET : ..
    200: ELSE
    210: SET TARGET : Bill Allocations[##vBillAllocIndex]
    220: SET VALUE : Bill Credit Period : "31-12-2020"
    230: SET TARGET : ..
    240: END IF
    250: END WALK
    270: RETURN : TRUE

    [Collection: DUEDATE for Update]
    Data Source : Parent Report : Selected Lines

    Walk : All Ledger Entries, Bill Allocations

    By : Name : $Name
    By : Category : $Category
    By : PartyLedger : $PartyLedger


    Sort : @@Default : $Name


    [System : Formula]
    VchID : $$SPrintF:mad:VCHMasterID:$MasterID
     


Share This Page