help needed in correcting this code, $ventrydt is a udf the value is being displayed but not able to

Discussion in 'Tally Developer' started by Manoj Anandan, Apr 30, 2023.

    
  1. Manoj Anandan

    Manoj Anandan Member


    [#Menu:Gateway of Tally]
    Add:Key Item:Cross Daybook:K:Display:MultiCmpDBRep

    [Report: MultiCmpDBRep]

    Use : DSP Template
    Form : MultiCmpDBForm
    Title : "Cross Journal Daybook"
    Set : SvFromDate : ##SVCurrentDate
    Set : SvToDate :##SVCurrentDate
    [Form: MultiCmpDBForm]
    Button : ChangeDybkDate,ChangePeriod
    Part : MultiCmpDBPart
    Background : @@SV_DAYBOOK

    [Part: MultiCmpDBPart]

    Lines : MultiCmpDBLnTitle, MultiCmpDBLnDetails
    Repeat : MultiCmpDBLnDetails:Vouchers of Multiple Companies

    Scroll : Vertical

    [Line : MultiCmpDBLnTitle]
    Height:8 mms
    Use : MultiCmpDBLnDetails
    Local : Field : MultiCmpOwnerCmpName : Set as : "Company"
    Local : Field : Name Field : Set as : "Debit Ledger"
    ;;Local : Field : MultiCmpVchNo : Set as : "Vch No."
    Local : Field : MultiCmpNarr : Set as : "Narration"
    Local : Field : UniDate Field : Set as : "Date"
    Local : Field : Amount Field : Set as : "Amount"
    Local:Field :multicmpcred : Set as :"Credit Ledger"
    Local:Field :entdt : Set as :"Seq"
    Local : Field : Default : Type : String
    Local : Field : Default : Align : Center
    Local : Field : Default : Style : extra Large Bold
    Local : Field : Default : Lines : 0

    Border : Thick Box

    [Line: MultiCmpDBLnDetails]

    Fields : UniDate Field,MultiCmpOwnerCmpName, Name Field ,multicmpcred,MultiCmpNarr,MultiCmpVchNo, Amount Field,entdt
    Local : Field : Default : Style : large
    Local : Field : Default : Align : Center

    Height:6 mms
    Local : Field : UniDate Field : Set as : $Date
    Local : Field : Unidate Field:Border:Thick box
    Local : Field : Amount Field : Set as : $Amount
    ;;Local : Field : Amount Field : Format : "ShowBaseCurrency"
    Local : Field : Amount Field : Width : 20
    Local : Field : Amount Field:Border:Thick box
    Local : Field : Name Field : Set as : $LedgerName
    Local : Field : Name Field:Border:Thick box
    Local : Field : Name Field:Width:35

    Option : Alter on Enter
    /*
    As our collection is a loop collection, when we press enter on voucher, alongwith its master id,
    we also need to modify the company name variable 'SVCurrentCompany' so the voucher understands its current company
    */

    [Field:entdt]
    Use:uni date field
    ;;Set as:$ventrydt
    Set as:$ventrydt
    Border:Thick box

    Align: Center
    ;;Invisible:Yes
    [Field:multicmpcred]
    Use : Name Field
    Set as:$AllLedgerEntries[-1].Ledgername
    ;;$$String:$masterid
    Border: THick Box
    Width:35
    [Field : MultiCmpOwnerCmpName]

    Use : Name Field
    Set as : $OwnerCompany
    Alter : Voucher
    Variable : SVCurrentCompany
    Modifies : SVCurrentCompany
    Invisible: No
    Border:Thick box
    [Field : MultiCmpVchNo]

    Use : Short Name Field
    Set as : $VoucherNumber
    Invisible:Yes
    [Field : MultiCmpNarr]

    Use : Narration Field
    Set as : $Narration
    Style : Normal Bold
    Case : Title Case
    Border:Thick box


    [Collection: Vouchers of Multiple Companies]

    Collection : MultiCmpDB VchCollection : Company Collection
    Sort:mad:@default:$ventrydt
    ;;Sort:mad:@default:$ventrydt

    [Collection: MultiCmpDB VchCollection]

    Type : Voucher
    Fetch : Date, Vouchernumber, VoucherTypeName, Amount, MasterID, LedgerName,Narration,ventrydt,partyledgername,all ledger entries.*
    Compute : Owner Company : $$LoopCollObj:$Name

    Sort:mad:@default:$ventrydt
    Filter: iscj
    ;;Filter: vent


    [Collection: Company Collection]

    Type : Company
    Fetch : Name, IsAggregate
    Filter : SimpleCompany
    ;;Delete:Sort
    [System:Formula]
    iscj:$vouchertypename="Cross journal"
    vent:$ventrydt=##svcurrentdate
     


  2. Manoj Anandan

    Manoj Anandan Member


    not able to sort with that
     


  3. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Where is the UDF defined ?
     


  4. Manoj Anandan

    Manoj Anandan Member


    thats in a separate tdl and the value is available here . only sort is not working
     


  5. Manoj Anandan

    Manoj Anandan Member


    /*
    [Function:func2]
    01:Set:svcurrentcompany:#cmpfld
    02:Return
    */
    [Function:collref]


    [Function:updt]

    10:Do If:$$InAlterMode:Set Value:ventrydt:$$SysInfo:Systemdate
    12:Save Target
    [#Line: VCH Narration]
    Add:Field:At End:ventrydt

    [Field:ventrydt]

    Use : uni date Field
    Type:Date:Forced
    Set as:if( $$InCreateMode or $$InAlterMode) then $$SysInfo:Systemdate else $$Value
    Storage : ventrydt
    Invisible : Yes
    Set always : Yes
    Skip : Yes
    Read Only:Yes
    ;;On:Focus:True:Trigger Key:Space,Enter


    [#Form: journal color]
    On:Form Accept:True:Call:updt

    [Function:cross select]

    Variable:gcmp:String
    Variable:fdate:Date
    Variable:fcmpname:String
    Variable:fdled:String
    Variable:fcled:String
    Variable:famt:Amount
    Variable:fnarr:String
    ;;01:Msg Box:"func":"func"
    01:Set:gcmp:##SVcurrentcompany
    05:Set:fdate:$$Date:$jrdt
    06: Start Batch Post : 50
    07: WALK COLLECTION : crosscoll
    08: Set:fcmpname:""+$$String:$cmpname
    09:Set:fdled:""+$$String:$dled
    10:Set:fcled:""+$$String:$cled
    11:Set:fnarr:""+$$String:$jrnarr
    12:Set:famt:$$AsAmount:$jramt
    13: Set:SVCurrentCompany:##fcmpname
    ;;13:Msg Box:"done":"hai"
    14:Set:svcurrentdate:##fdate

    /*journal saving part*/
    70 : NEW OBJECT : Voucher
    80 : SET VALUE : Date : ##fdate
    90 : SET VALUE : VoucherTypeName : "Cross journal"
    ;;$$VchTypeJournal
    99:Set Value:ventrydt:$$SysInfo:Systemdate
    100 : Set Value: Narration : ##fnarr
    120 : SET VALUE : Ledger Name : ##fdled
    140 : SET VALUE : IsDeemedPositive : "Yes"
    141 : SET VALUE : Amount : $$Negative:##famt

    ;----------------------------------------------------------------------------
    ;;Credit Entry
    160 : INSERT COLLECTION OBJECT : AllLedgerEntries
    170 : SET VALUE : Ledger Name :##fcled
    180 : SET VALUE : Amount : ##famt
    190 : SET VALUE : IsDeemedPositive : "No"
    200 : SET TARGET : ..
    210 : SET VALUE : PersistedView : ##SVViewName
    220 : CREATE TARGET
    270: END WALK
    300 : End Batch Post
    305:Msg Box:"Success":"Entries Posted:"
    ;;+ $$NumItems:crosscoll
    310:Set:SVCurrentCompany:##gcmp

    [Collection:crosscoll]
    Type:jrentagg:Company
    Format:$cmpname,40
    Format:$dled,40
    Format:$cled,40
    Format:$jrnarr,150


    [#Menu:Gateway of Tally]
    Add:Key Item:Crosss Journal:J:Create:Cross Journal


    [Report:cross journal]

    Form : First TDL Form

    [Form : First TDL Form]

    Top Parts : dtpart
    Parts:jrparttit,jrentprt
    Full Height: Yes
    Full Width:Yes
    On:Form Accept:True:Call:cross select
    [Part : dtpart]

    Lines : dtpart
    Border: Thick bottom

    [Line : dtpart]
    Fields : dtinfor,dtfld
    Local:Field:default:Style:large bold

    [Field : dtinfor]
    Use:SHORT PROMPT
    Set as:"Date :"

    [Field:dtfld]
    Use:uni Date Field
    Style:large bold
    Set as:##Svcurrentdate
    Set Always : Yes
    Storage:jrdt
    [Part:jrparttit]
    Line:jrparttit

    [Line:jrparttit]
    Local:Field:default:Style:extra large bold
    Local:Field:default:Color:Red
    Fields:cname,dled,cled,jramttit,jrnarrtit

    [Field:cname]
    Use:lONG PROMPT
    Set as:"Company Name"
    Border:Thick box
    Width: @@NameWidth
    Align: Center
    Style:large Bold
    [Field:dled]
    Use:lONG PROMPT
    Set as:"Debit led"
    Border:Thick box
    Width: 25% page
    Align: Center
    Style:large Bold

    [Field:cled]
    Use:lONG PROMPT
    Set as:"Credit led"
    Border:Thick box
    Width: 25% page
    Align: Center
    Style:large Bold
    [Field:jramttit]
    Use:lONG PROMPT
    Set as:"Amount"
    Border:Thick box
    Width: 15% page
    Align: Center
    Style:large Bold
    [Field:jrnarrtit]
    Use:lONG PROMPT
    Set as:"Narration"
    Border:Thick box
    Width: @@NarrWidth
    Align: Center
    Style:large Bold

    [Part:jrentprt]
    Line:jrent
    Repeat:jrent:jrentagg
    Break On:$$IsSysName:#cmpfld OR $$IsEmpty:#cmpfld
    Scroll:Vertical

    [Line:jrent]
    Field:cmpfld,jrdled,jrcled,jramt,jrnarr
    Local:Field:default:Style:extra large
    [Field:cmpfld]
    Use:name Field
    Table:List of Company,endoflist
    Show Table:Always
    Border:thin bottom
    Storage:cmpname
    Border:Thin box
    ;;Common Table:No
    [Field:jrcled]
    Use:name Field
    Table:ledcmpcoll
    Show Table:Always
    Border:thin bottom
    Storage:cled
    Width: 25% page
    Border:Thin box
    Skip :if $$IsSysName:#cmpfld then Yes else no
    Common Table:No
    [Field:jrdled]
    Use:name Field
    Table:LedCmpColl
    Show Table:Always
    Border:thin bottom
    Storage:dled
    Width: 25% page
    Border:Thin box
    Skip :if $$IsSysName:#cmpfld then Yes else no
    Common Table:No
    [Field:jramt]
    Use:amount Field
    Border:thin bottom
    Storage:jramt
    Width: 15% page
    Border:Thin box
    Control:chkip:$$IsEmpty:$$Value
    Skip :if $$IsSysName:#cmpfld then Yes else no
    [Field:jrnarr]
    Use:narration Field
    Width: @@narrwidth
    Border:thin bottom
    Storage:jrnarr
    Border:Thin box
    Skip :if $$IsSysName:#cmpfld then Yes else no
    [Collection : LedCmpColl]
    Title:"List of Ledgers"
    Collection : MyLed : My Company

    [Collection : My Led]
    Type : Ledger
    Fetch : $Name

    [Collection : MyCompany]
    Type:Company
    Fetch : Name, IsAggregate
    Filter : SimpleCompany
    Filter:cmpfil


    [!Collection : Dummyrefresh]

    [System:Formula]
    chkip:"Cannot be zero"
    cmpfil:$name=#cmpfld
    [System:UDF]
    ventrydt:Date:23459
    jrdt:Date:23460
    jrentagg:Aggregate:23469
    cmpname:String:23470:yes
    cled:String:23472:yes
    dled:String:23473:yes
    jramt:Amount:23474:yes
    jrnarr:String:23475:yes

    [Include:crossdb2.txt]
    [Include:refresh.txt]
     


  6. Manoj Anandan

    Manoj Anandan Member


    this is where the udf is defined
     


Share This Page