Auto Sales Voucher

Discussion in 'Tally Developer' started by kosi, May 15, 2021.

    
  1. kosi

    kosi Member


    Hello Learned Programmers
    I need help.
    i want the function to create sales entry by debiting all ledgers under ' SUNDRY DEBTORS' and crediting 'SALES LEDGER ACCOUNTS' but its giving error in the calculator panel. the sales ledger is credited correctly but ledgers under sundry debtors is my problem. the codes are below.
    pictures are attached
    please help me


    [#Menu: Gateway of Tally]

    Add : Item : "Multiple Sales Entry" : Alter : MultiSaleRep

    [Report : MultiSaleRep]

    Form : MultiSaleRep
    Object : Company

    ;Fetch Collection: Sales Support Ledgers Extract, Party Ledgers Extract


    [form:MultiSaleRep]
    Height:100% Screen
    Width:100% Screen
    Button:Refresh TDL
    Part:MultiSaleRepCrPart,MultiSaleRep
    On : Form Accept : yes : Form Accept
    On : Form Accept : yes : Call : CphSale BulkAutoEntry;MultipleSalesEntryFun

    ;;first part
    [Part:MultiSaleRepCrPart]
    Background:red
    Line:MultiSaleRepLinPartoneDate,MultiSaleRepLinPartone
    [Line:MultiSaleRepLinPartoneDate]
    Right Field:DatF,DatF1
    Local:Field:DatF:Info:""

    [Field:DatF]

    [Field:DatF1]
    ;Type : Date
    Use : Short Date Field
    ;Storage : Date
    ;Width:mad:@ShortWidth
    Skip:Yes

    [Line:MultiSaleRepLinPartone]
    Field:CrF,CrF1,CrF2
    Local:Field:CrF:Info:"Date"
    Local:Field:CrF1:Info:"Dr Ledger"
    Local:Field:CrF2:Info:"Cr Ledger"

    [field:CrF]
    Skip:Yes
    Space Left:5

    [field:CrF1]
    Space Left:3

    [Field:CrF2]



    [Collection:SalesLedgersColl]
    Title:List Of Sales Ledgers
    Type:ledger
    Child Of:$$GroupSales



    [Part:MultiSaleRep]
    Line:AmtLin,DebitLin
    Repeat:DebitLin:CphSalesCollection
    Scroll:Vertical
    Break On: $$IsEndOfList:$DebitLin1Storage;$PartyLedgerName


    [Collection: CphSalesCollection]

    Title : "Bulk Sales Entry"
    Type : CphSales BulkEntry : Company
    Child Of : ##SVCurrentCompany



    [line:AmtLin]
    Right Field:AmtLin
    Local:Field:AmtLin:Info:"Amount"
    [Field:AmtLin]
    Use:Short Name Field
    Align:Right

    [Line:DebitLin]
    Border:THICK BOX
    Field:DebitLin,Datefld,DebitLin1,CrLedFld
    Right Field:AmtField
    Local:Field:DebitLin:Info:"Dr"

    [Field:DebitLin]


    [Field:Datefld]
    Type : Date
    Use : Short Date Field
    Storage : Date


    [Field:DebitLin1]
    Type:String
    Width:mad:@ShortWidth
    Table:SundDebtLedgres,EndOfList
    Show Table:Always
    Storage:DebitLin1Storage


    ;;afsdfsgvsdgssssssssssssssssssssssssssssssssssssssssssssssssssssssss

    [Field:CrLedFld]
    Type:String
    Use:Name Field
    Table:SalesLedgersColl;,Endoflist
    Show Table:Always
    Storage:CrLedFldStorage
    Inactive : $$IsEndOfList:$DebitLin1Storage

    [Field:AmtField]
    Type:Amount
    Use:Amount Field
    Storage:Amount
    Inactive : $$IsEndOfList:$DebitLin1Storage





    [System:UDF]
    CphSales BulkEntry : Aggregate : 41071
    Date:Date:41072
    CrLedgerNameFldStorage:String:41073
    DebitLin1Storage:String:41074
    CrLedFldStorage:String:41075
    Amount:Amount:41076


    [Collection:SundDebtLedgres]
    Title:"List Of Sundry Debtors"
    Type:Group;Ledger
    ;Child Of:$$GroupSundryDebtors
    ;Belongs to : yes
    ;Format : $Name,30
    Align:Center






    ;[Function:MultipleSalesEntryFun]

    [Function: CphSale BulkAutoEntry]

    ;; Procedural Block

    Variable : CphDate : Date
    Variable : CphCrLedgerName : String
    Variable : CphDrLedgerName : String
    Variable : CphAmount : Amount

    Variable : Counter : Number: 1

    001 : Start Batch Post : 10
    005 : START PROGRESS : ($$NumItems:CphSalesCollection) : "Creating Vouchers" : @@CmpMailName : "Creating Sales Vouchers ..."
    007 : WALK COLLECTION : CphSalesCollection ;;Sales Info
    ;010 : SET : CphDate : $$Date:$Date
    010 : SET : CphDate :$Date


    020 : SET : CphCrLedgerName : $CrLedFldStorage
    030 : SET : CphDrLedgerName : $DebitLin1Storage


    040 : SET : CphAmount :$Amount



    060:NEW OBJECT : Voucher
    070: SET VALUE : Date : ##CphDate
    080:SET VALUE : VoucherTypeName : $$VchTypeSales
    080a:LOG : $$String:##CphDate




    120 : SET VALUE : Ledger Name : ##CphDrLedgerName
    140 : SET VALUE : IsDeemedPositive : "Yes"
    141 : SET VALUE : Amount : ##CphAmount * (-1) ;##CphAmount
    ;150 : SET TARGET : ..

    150a : LOG : $$String:##CphDrLedgerName

    ;----------------------------------------------------------------------------
    ;;Credit Entry
    160 : INSERT COLLECTION OBJECT : AllLedgerEntries
    ;160a: SET TARGET : LedgerEntries
    170 : SET VALUE : Ledger Name : ##CphCrLedgerName
    180 : SET VALUE : Amount : ##CphAmount ;##CphAmount
    190 : SET VALUE : IsDeemedPositive : "No"
    ;200 : SET TARGET : ..
    200a : LOG : $$String:##CphCrLedgerName


    220 : CREATE TARGET
    240 : END WALK
    260 : END PROGRESS
     

    Attached Files:



  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    Instead of this......... ##CphAmount * (-1)

    Do this....... $$Negative:##CphAmount
     


  3. kosi

    kosi Member


    Thanks for the quick reply.
    I made changes as directed but it's giving error 'sundry debtors does not exist' in the calculator panel. Modified codes are bellow. I actually want all ledgers created under 'sundry debtors to be debited and sales ledger credited.
    Please help.


    [#Menu: Gateway of Tally]

    Add : Item : "Multiple Sales Entry" : Alter : MultiSaleRep

    [Report : MultiSaleRep]

    Form : MultiSaleRep
    Object : Company

    ;Fetch Collection: Sales Support Ledgers Extract, Party Ledgers Extract


    [form:MultiSaleRep]
    Height:100% Screen
    Width:100% Screen
    Button:Refresh TDL
    Part:MultiSaleRepCrPart,MultiSaleRep
    On : Form Accept : yes : Form Accept
    On : Form Accept : yes : Call : CphSale BulkAutoEntry;MultipleSalesEntryFun

    ;;first part
    [Part:MultiSaleRepCrPart]
    Background:red
    Line:MultiSaleRepLinPartoneDate,MultiSaleRepLinPartone
    [Line:MultiSaleRepLinPartoneDate]
    Right Field:DatF,DatF1
    Local:Field:DatF:Info:""

    [Field:DatF]

    [Field:DatF1]
    ;Type : Date
    Use : Short Date Field
    ;Storage : Date
    ;Width:mad:@ShortWidth
    Skip:Yes

    [Line:MultiSaleRepLinPartone]
    Field:CrF,CrF1,CrF2
    Local:Field:CrF:Info:"Date"
    Local:Field:CrF1:Info:"Dr Ledger"
    Local:Field:CrF2:Info:"Cr Ledger"

    [field:CrF]
    Skip:Yes
    Space Left:5

    [field:CrF1]
    Space Left:3

    [Field:CrF2]



    [Collection:SalesLedgersColl]
    Title:List Of Sales Ledgers
    Type:ledger
    Child Of:$$GroupSales



    [Part:MultiSaleRep]
    Line:AmtLin,DebitLin
    Repeat:DebitLin:CphSalesCollection
    Scroll:Vertical
    Break On: $$IsEndOfList:$DebitLin1Storage;$PartyLedgerName


    [Collection: CphSalesCollection]

    Title : "Bulk Sales Entry"
    Type : CphSales BulkEntry : Company
    Child Of : ##SVCurrentCompany



    [line:AmtLin]
    Right Field:AmtLin
    Local:Field:AmtLin:Info:"Amount"
    [Field:AmtLin]
    Use:Short Name Field
    Align:Right

    [Line:DebitLin]
    Border:THICK BOX
    Field:DebitLin,Datefld,DebitLin1,CrLedFld
    Right Field:AmtField
    Local:Field:DebitLin:Info:"Dr"

    [Field:DebitLin]


    [Field:Datefld]
    Type : Date
    Use : Short Date Field
    Storage : Date


    [Field:DebitLin1]
    Type:String
    Width:mad:@ShortWidth
    Table:SundDebtLedgres,EndOfList
    Show Table:Always
    Storage:DebitLin1Storage


    ;;afsdfsgvsdgssssssssssssssssssssssssssssssssssssssssssssssssssssssss

    [Field:CrLedFld]
    Type:String
    Use:Name Field
    Table:SalesLedgersColl;,Endoflist
    Show Table:Always
    Storage:CrLedFldStorage
    Inactive : $$IsEndOfList:$DebitLin1Storage

    [Field:AmtField]
    Type:Amount
    Use:Amount Field
    Storage:Amount
    Inactive : $$IsEndOfList:$DebitLin1Storage





    [System:UDF]
    CphSales BulkEntry : Aggregate : 41071
    Date:Date:41072
    CrLedgerNameFldStorage:String:41073
    DebitLin1Storage:String:41074
    CrLedFldStorage:String:41075
    Amount:Amount:41076


    [Collection:SundDebtLedgres]
    Title:"List Of Sundry Debtors"
    Type:Group;Ledger
    ;Child Of:$$GroupSundryDebtors
    ;Belongs to : yes
    ;Format : $Name,30
    Align:Center






    ;[Function:MultipleSalesEntryFun]

    [Function: CphSale BulkAutoEntry]

    ;; Procedural Block

    Variable : CphDate : Date
    Variable : CphCrLedgerName : String
    Variable : CphDrLedgerName : String
    Variable : CphAmount : Amount

    Variable : Counter : Number: 1

    001 : Start Batch Post : 10
    005 : START PROGRESS : ($$NumItems:CphSalesCollection) : "Creating Vouchers" : @@CmpMailName : "Creating Sales Vouchers ..."
    007 : WALK COLLECTION : CphSalesCollection ;;Sales Info
    ;010 : SET : CphDate : $$Date:$Date
    010 : SET : CphDate :$Date


    020 : SET : CphCrLedgerName : $CrLedFldStorage
    030 : SET : CphDrLedgerName : $DebitLin1Storage


    040 : SET : CphAmount :$Amount



    060:NEW OBJECT : Voucher
    070: SET VALUE : Date : ##CphDate
    080:SET VALUE : VoucherTypeName : $$VchTypeSales
    080a:LOG : $$String:##CphDate




    120 : SET VALUE : Ledger Name : ##CphDrLedgerName
    140 : SET VALUE : IsDeemedPositive : "Yes"
    141 : SET VALUE : Amount : $$Negative:##CphAmount
    ;150 : SET TARGET : ..

    150a : LOG : $$String:##CphDrLedgerName

    ;----------------------------------------------------------------------------
    ;;Credit Entry
    160 : INSERT COLLECTION OBJECT : AllLedgerEntries
    ;160a: SET TARGET : LedgerEntries
    170 : SET VALUE : Ledger Name : ##CphCrLedgerName
    180 : SET VALUE : Amount : ##CphAmount ;##CphAmount
    190 : SET VALUE : IsDeemedPositive : "No"
    ;200 : SET TARGET : ..
    200a : LOG : $$String:##CphCrLedgerName


    220 : CREATE TARGET
    240 : END WALK
    260 : END PROGRESS
     
    Last edited: May 16, 2021


  4. kosi

    kosi Member


    A
    Any update so far
     


  5. NAGARAJKMAR SUBRAMANIAN

    NAGARAJKMAR SUBRAMANIAN Active Member


    [Collection:SundDebtLedgres]
    Title:"List Of Sundry Debtors"
    Type:Ledger
    Child Of:$$GroupSundryDebtors
    Belongs to : yes
    Format : $Name,30
    Align:Center
     


Share This Page