Bulk Sales Entry (Pls correct My code)

Discussion in 'Free Source Codes' started by pradeep kumar dewangan, Mar 12, 2020.

    

  1. ;; Shri Ganeshay Namah ;;


    [#Menu: Gateway of Tally]

    Add : Item : "Bulk Sales Entry" : Alter : CphSales EntryRpt

    [Report : CphSales EntryRpt]

    Form : CphSales EntryFrm
    Title : $$LocaleString:"Bulk Sales Entry"
    Object : Company

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


    [Form : CphSales EntryFrm]

    Part : Form SubTitle, CphSales CrLedPrt, CphSales DrLedPrt
    Width : 70% Page
    Height : 100% Page
    Space Left : 0.25
    Space Right : 0.25
    Horizontal Align: Left

    Local : Field : Form SubTitle : Info : "Bulk Sales Entry"

    On : Form Accept : yes : Form Accept
    On : Form Accept : yes : Call : CphSale BulkAutoEntry


    ;; Sales Credit Part ;;
    ;;------------------------------------------------------------------------------------------
    [Part : CphSales CrLedPrt]

    Line : CphSales CrLedLne

    [Line : CphSales CrLedLne]

    Field : Medium Prompt, CphSales CrLedFld
    Local : Field : Medium Prompt : Info : $$LocaleString:"Credit Ledger"
    Space Bottom : 0.50


    [Field : CphSales CrLedFld]

    Type : String
    Use : Name Field
    Table : CphSales SalesLed
    Storage : LedgerName
    Show Table : Always
    Case : Title Case
    Width : 50
    Align : Left
    Border : Thin Box

    [Collection: CphSales SalesLed]

    Title : "List of Ledgers"
    Type : Ledger
    Child of : $$GroupSales
    Belongs to : yes
    Format : $Name,30
    Align : Right
    Full Height : Yes


    ;; Sales Debit Part ;;
    ;;------------------------------------------------------------------------------------------

    [Part : CphSales DrLedPrt]

    Line : CphSales DrLedTtleLne, CphSales DrLedDetlsLne
    Repeat : CphSales DrLedDetlsLne : CphSalesCollection
    Scroll : Vertical
    Common Border : Yes
    Break On : $$IsEndOfList:$PartyLedgerName


    [Line : CphSales DrLedTtleLne]

    Use : CphSales DrLedDetlsLne

    Local : Field : Default : Inactive : No
    Local : Field : Default : Delete : Storage
    Local : Field : Default : Type : String
    Local : Field : Default : Style : Normal

    Local : Field : CphSales SerialNoFld : Info : $$LocaleString:"Sno."

    Local : Field : CphSales DateFld : Info : $$LocaleString:"Date"

    Local : Field : CphSales DebitLedgerFld : Info : $$LocaleString:"Debit Ledger"

    Local : Field : CphSales DrAmountFld : Info : $$LocaleString:"Amount"

    Border : Thin TopBottom
    Delete : Space Top


    [Line : CphSales DrLedDetlsLne]

    Field : CphSales SerialNoFld, CphSales DateFld, CphSales DebitLedgerFld
    Right Field : CphSales DrAmountFld

    Space Top : 0.25


    [Field : CphSales SerialNoFld]

    Use : Short Name Field
    Width : @@SymWidth
    Set as : $$Line
    Skip : Yes



    [Field : CphSales DateFld]

    Type : Date
    Use : Short Date Field
    Storage : Date
    ;;Set as : $Date
    Width : @@ShortWidth


    [Field : CphSales DebitLedgerFld]

    Type : String
    Use : Name Field
    Table : CphSales SundryDebtorsLed, EndOfList
    Storage : PartyLedgerName
    ;;Set as : $Name
    Show Table : Always
    Case : Title Case
    Full Width : Yes
    Align : Left
    Inactive : $$IsEndOfList:$PartyLedgerName ;;$$IsEndOfList:$Name ;;$$IsEmpty:$Name


    [Collection: CphSales SundryDebtorsLed]

    Title : "List of Ledgers"
    Type : Ledger
    Child of : $$GroupSundryDebtors
    Belongs to : yes
    Format : $Name,30
    Align : Right
    Full Height : Yes



    [Field : CphSales DrAmountFld]

    Type : Amount
    Use : Amount Field
    Storage : Amount
    ;;Set as : $Amount
    Width : @@ShortWidth
    Inactive : $$IsEndOfList:$PartyLedgerName ;$$IsEndOfList:$Name;;$$IsEmpty:$Name


    [Collection: CphSalesCollection]

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




    [System: UDF]

    CphSales BulkEntry : Aggregate : 41071
    Date : Date : 41072
    PartyLedgerName : String : 41073
    Amount : Amount : 41074

    LedgerName : String : 41068




    ;; Bulk Auto Entry ;;
    ;;-----------------------------------------------------------------------------------------------------------------------

    [Function: CphSale BulkAutoEntry]

    ;; Procedural Block

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

    ;;Variable : CphNoofEntry : Number:1
    Variable : Counter : Number: 1

    001 : Start Batch Post : 10
    ;;003 : SET : Counter : 0
    005 : START PROGRESS : ($$NumItems:CphSalesCollection) : "Creating Vouchers" : @@CmpMailName : "Creating Sales Vouchers ..."
    007 : WALK COLLECTION : CphSalesCollection ;;Sales Info
    ;;000 : SET : CphNoofEntry : $$Line:##CphNoofEntry ;; Counter
    010 : SET : CphDate : $$Date:$Date
    020 : SET : CphDrLedgerName : $LedgerName
    030 : SET : CphCrLedgerName : $PartyLedgerName
    040 : SET : CphAmount : $$AsAmount:$Amount

    ;040a: WHILE : ##CphNoofEntry >= 1
    050 : SET : SVViewName : $$SysName:AcctgVchView


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

    090 : SET VALUE : Narration : $Narration
    100 : SET VALUE : Narration : "For Invoice No : " + $VoucherNumber + " Auto Receipt "

    ;;----------------------------------------------------------------------------
    ;;Debit Entry
    110 : INSERT COLLECTION OBJECT : AllLedgerEntries
    110a: SET TARGET : LedgerEntries
    120 : SET VALUE : Ledger Name : ##CphDrLedgerName
    130 : SET VALUE : Amount : ##CphAmount * (-) 1 ;##CphAmount
    140 : SET VALUE : IsDeemedPositive : "Yes"
    150 : SET TARGET : ..

    150a : LOG : $$String:##CphDrLedgerName ;+ $$String:#CphAmount + "Dr"
    ;150b : LOG : ##CphCrLedgerName + $$String:#CphAmount + "Cr"

    ;----------------------------------------------------------------------------
    ;;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 : ..


    210 : SET VALUE : PersistedView : ##SVViewName
    ;210a: CALL : CphSave Target Sales
    220 : CREATE TARGET

    ;;230 : SET : CphDate : ##CphDate
    230 : INCREMENT : Counter
    230a: SHOW PROGRESS : ##Counter
    240 : END WALK
    ;250 : MSGBOX : " Message Box " : "Successful created All the Sales Voucher"
    260 : END PROGRESS
    ;260 : DISPLAY : CphSales Daybook
    ;270 : LOG : ">>>Voucher Created on "+$$String:$$Machinedate + " @ " + $$String:$$MachineTime + ">>>>>"
    280 : RETURN
    290 : End Batch Post

    /*
    [Function: CphSave Target Sales]

    10 : Save Target
    */


    ;; End-of-File


    [Report: CphSales Daybook]

    Use : Daybook
    Set : VoucherTypeName : "Sales"
    Set : SVFromDate : $$FinYearBeg:##StartDate:$StartingFrom:Company:##SVCurrentCompany
    Set : SVToDate : $$FinYearEnd:##StartDate:$StartingFrom:Company:##SVCurrentCompany
     

    Attached Files:



  2. Sanjeev S

    Sanjeev S Active Member


    Dear Sir,

    It's not fetching Sales Ledger. Just try putting it in the transaction line

    Regards.
     


  3. chintamani

    chintamani New Member


    Dear Sir

    Thank you for your efforts. Taking a clue from the post by Shri. Sanjeev S, I have modified your code. Now it is working at my end.
    The code is attached below :
    Code:
    ;; Shri Ganeshay Namah ;;
    
    
    [#Menu: Gateway of Tally]   
       
        Add    : Item   : "Bulk Sales Entry" : Alter : CphSales EntryRpt
       
        [Report : CphSales EntryRpt]
           
            Form    : CphSales EntryFrm
            Title   : $$LocaleString:"Bulk Sales Entry"
            Object    : Company
           
            ;Fetch Collection: Sales Support Ledgers Extract, Party Ledgers Extract
           
                   
            [Form : CphSales EntryFrm]
               
                Part         : Form SubTitle, CphSales CrLedPrt, CphSales DrLedPrt
                Width        : 70% Page
                Height        : 100% Page
                Space Left    : 0.25
                Space Right    : 0.25   
                Horizontal Align: Left
               
                Local        : Field    : Form SubTitle    : Info        : "Bulk Sales Entry"
               
                On        : Form Accept : yes        : Form Accept
                On         : Form Accept : yes     : Call     : CphSale BulkAutoEntry
    
    
    ;; Sales Credit Part ;;                           
    ;;------------------------------------------------------------------------------------------           
                [Part : CphSales CrLedPrt]
                   
                    Line : CphSales CrLedLne
                   
                        [Line : CphSales CrLedLne]
       
                            Field    : Medium Prompt, CphSales CrLedFld                       
                            Local    : Field    : Medium Prompt    : Info    : $$LocaleString:"Credit Ledger"
                            Space Bottom    : 0.50
                           
    
                            [Field    : CphSales CrLedFld]
                               
                                Type        : String
                                Use            : Name Field
                                Table        : CphSales SalesLed
                                Storage        : LedgerName
                                Show Table    : Always
                                Case        : Title Case
                                Width        : 50
                                Align        : Left
                                Border        : Thin Box
                               
                                    [Collection: CphSales SalesLed]
       
                                        Title         : "List of Ledgers"
                                        Type         : Ledger
                                        Child of     : $$GroupSales
                                        Belongs to     : yes
                                        Format         : $Name,30
                                        Align         : Right
                                        Full Height : Yes
                               
    
    ;; Sales Debit Part ;;                           
    ;;------------------------------------------------------------------------------------------                       
    
                [Part : CphSales DrLedPrt]
                   
                    Line     : CphSales DrLedTtleLne, CphSales DrLedDetlsLne
                    Repeat    : CphSales DrLedDetlsLne : CphSalesCollection
                    Scroll            : Vertical
                    Common Border    : Yes
                    Break On        : $$IsEndOfList:$PartyLedgerName
                   
                   
                        [Line : CphSales DrLedTtleLne]
                           
                            Use        : CphSales DrLedDetlsLne       
                           
                            Local    : Field    : Default                    : Inactive    : No
                            Local    : Field    : Default                    : Delete    : Storage
                            Local    : Field    : Default                    : Type        : String                       
                            Local    : Field    : Default                    : Style        : Normal
                           
                            Local    : Field    : CphSales SerialNoFld        : Info        : $$LocaleString:"Sno."
                           
                            Local    : Field    : CphSales DateFld            : Info        : $$LocaleString:"Date"
                           
                            Local    : Field    : CphSales DebitLedgerFld    : Info        : $$LocaleString:"Debit Ledger"
                           
                            Local    : Field    : CphSales DrAmountFld        : Info        : $$LocaleString:"Amount"
    
                            Local    : Field    : CphSales SALESLEDNAME        : Info        : $$LocaleString:"Sales Ledger"
                            Border    : Thin TopBottom
                            Delete    : Space Top
                                                   
    
                    [Line    : CphSales DrLedDetlsLne]
                       
                        Field        : CphSales SerialNoFld, CphSales DateFld, CphSales DebitLedgerFld, CphSales SalesLedName
                        Right Field    : CphSales DrAmountFld
                       
                        Space Top    : 0.25
                       
    
                        [Field    : CphSales SerialNoFld]
                           
                            Use          : Short Name Field
                            Width        : @@SymWidth
                            Set as       : $$Line
                            Skip         : Yes
                                               
                           
    
                        [Field    : CphSales DateFld]
                           
                            Type        :     Date
                            Use            :    Short Date Field
                            Storage        :    Date
                            ;;Set as        :    $Date
                            Width        :     @@ShortWidth
                           
    
                        [Field    : CphSales DebitLedgerFld]
                           
                            Type        :     String
                            Use            :     Name Field
                            Table        :     CphSales SundryDebtorsLed, EndOfList       
                            Storage        :     PartyLedgerName
                            ;;Set as        :     $Name
                            Show Table    :     Always
                            Case        :     Title Case
                            Full Width    :     Yes
                            Align        :     Left
                            Inactive    :     $$IsEndOfList:$PartyLedgerName        ;;$$IsEndOfList:$Name    ;;$$IsEmpty:$Name
                           
    
                            [Collection: CphSales SundryDebtorsLed]
       
                                Title         : "List of Ledgers"
                                Type         : Ledger
                                Child of     : $$GroupSundryDebtors
                                Belongs to     : yes
                                Format         : $Name,30
                                Align         : Right
                                Full Height : Yes
                               
                           
    
                        [Field    : CphSales DrAmountFld]
                           
                            Type        :     Amount
                            Use            :    Amount Field
                            Storage        :    Amount
                            ;;Set as        :   $Amount
                            Width        :     @@ShortWidth
                            Inactive    :     $$IsEndOfList:$PartyLedgerName        ;$$IsEndOfList:$Name;;$$IsEmpty:$Name
                               
                           
    
    
                        [Field    : CphSales SALESLEDNAME]   
    
                            Type        :     String
                            Table        : CphSales SalesLed
                            Storage        :     SalesLedgerName
                            ;;Set as        :     $LedgerName
                            Show Table    :     Always
                            ;;Case        :     Title Case
                            Full Width    :     Yes
                            ;; Skip        :     Yes
                            Align        :     Left
                            Inactive    :     $$IsEndOfList:$PartyLedgerName        ;;$$IsEndOfList:$Name    ;;$$IsEmpty:$Name
                           
       
    
    
    
    
    
    [Collection: CphSalesCollection]
           
        Title         : "Bulk Sales Entry"
        Type        : CphSales BulkEntry : Company
        Child Of    : ##SVCurrentCompany
                       
                           
                           
    
    [System: UDF]
    
        CphSales BulkEntry             : Aggregate : 41071
        Date                    : Date        : 41072
        PartyLedgerName            : String    : 41073
        Amount                : Amount    : 41074
        SalesLedgerName            : String    : 41075
    
    [System: UDF]
        LedgerName                : String    : 41068
    
    
    
    ;;  ---------------------------------------
    [System: Variable]
        [Variable : Counter]
           Type: Number
    
    
    ;; Bulk Auto Entry ;;
    ;;-----------------------------------------------------------------------------------------------------------------------
    
    [Function: CphSale BulkAutoEntry]
    
    ;; Procedural Block
       
        Variable : CphDate             : Date   
        Variable : CphDrLedgerName     : String
        Variable : CphCrLedgerName     : String
        Variable : CphAmount        : Amount
       
        ;;Variable : CphNoofEntry        : Number:1   
        Variable     : Counter         : Number: 1
       
        001 :     Start Batch Post        : 10
        ;;003 :     SET : Counter           : 0 
        005 :     START PROGRESS          : ($$NumItems:CphSalesCollection)   : "Creating Vouchers" : @@CmpMailName : "Creating Sales Vouchers ..."
        007 :     WALK COLLECTION         : CphSalesCollection    ;;Sales Info
        ;;000 :   SET : CphNoofEntry         : $$Line:##CphNoofEntry ;; Counter
        010 :     SET : CphDate            : $$Date:$Date
        ;; 020 :     SET : CphDrLedgerName   : $LedgerName
        ;; 030 :     SET : CphCrLedgerName   : $SalesLedgerName                    ;; $PartyLedgerName
       
        020 :     SET : CphDrLedgerName   : $PartyLedgerName
        030 :     SET : CphCrLedgerName   : $SalesLedgerName
    
        040 :     SET : CphAmount            : $$AsAmount:$Amount   
       
        ;040a:   WHILE : ##CphNoofEntry >= 1
        050    :     SET             :     SVViewName            : $$SysName:AcctgVchView
       
       
        060    :     NEW OBJECT        :     Voucher   
        070    :     SET VALUE         :    Date                   : ##CphDate   
        080    :     SET VALUE        :     VoucherTypeName        : $$VchTypeSales
       
        090    :    SET VALUE         :    Narration             : $Narration
        100    :    SET VALUE         :    Narration             : "For Invoice No : " + $VoucherNumber + " Auto Receipt  "
    
    ;;----------------------------------------------------------------------------
    ;;Debit Entry
        110    :    INSERT COLLECTION OBJECT : AllLedgerEntries
        ;;110a  :    SET TARGET        : LedgerEntries
        120    :    SET VALUE         : Ledger Name            : ##CphDrLedgerName
    ;;    130    :   
        140    :    SET VALUE         : IsDeemedPositive         : "Yes"   
            141     :     SET VALUE         : Amount                : ##CphAmount * (-1)     ;##CphAmount
        150    :     SET TARGET        : ..
    
        150a  :    LOG : $$String:##CphDrLedgerName ;+ $$String:#CphAmount + "Dr"
        ;150b  :    LOG : ##CphCrLedgerName + $$String:#CphAmount + "Cr"
       
    ;----------------------------------------------------------------------------
    ;;Credit Entry
        160    :    INSERT COLLECTION OBJECT :  AllLedgerEntries
    ;;    161    :    SET TARGET        : LedgerEntries
        160a:     SET TARGET        : LedgerEntries
        170    :    SET VALUE         : Ledger Name              :   ##CphCrLedgerName
        180    :    SET VALUE         : Amount                :     ##CphAmount   ;##CphAmount
        190    :    SET VALUE         : IsDeemedPositive         :   "No"   
        200    :     SET TARGET        : ..
       
       
        210    :   SET VALUE         : PersistedView : ##SVViewName
        ;210a:     CALL             : CphSave Target Sales
        220    :   CREATE TARGET
       
        ;;230    :     SET             : CphDate            : ##CphDate
        230 :     INCREMENT         : Counter
        230a:     SHOW PROGRESS     : ##Counter
        240    :     END WALK   
        ;250    :     MSGBOX             : " Message Box " : "Successful created All the Sales Voucher"
        260 :     END PROGRESS
        ;260 :   DISPLAY            : CphSales Daybook
        ;270    :     LOG : ">>>Voucher Created on "+$$String:$$Machinedate + " @ " + $$String:$$MachineTime + ">>>>>"
        280    :   RETURN
        290 :    End Batch Post
    
    /*
    [Function: CphSave Target Sales]
       
        10 : Save Target
    */
    
    
    ;; End-of-File
    
    
    [Report: CphSales  Daybook]
    
        Use        : Daybook
        Set        : VoucherTypeName    : "Sales"
        Set        : SVFromDate        : $$FinYearBeg:##StartDate:$StartingFrom:Company:##SVCurrentCompany
        Set        : SVToDate            : $$FinYearEnd:##StartDate:$StartingFrom:Company:##SVCurrentCompany
               
    
       
       
                           
               
                
     


  4. chintamani

    chintamani New Member


    Dear All

    I have following queries in respect of the above -

    1) Is there any way, date validation can be put so that a date earlier than the beginning of the current period and later than the end of the current period can not be entered in the date column ?

    2) Is it possible to have a fixed value to be stored in every record for a particular field (e.g. credit ledger in the above example) ?

    Thanking you
     


  5. transparent

    transparent New Member


    Replacements, additions and modifications to be made

    Modifies: LedgerName1 ;replace Storage : LedgerName


    [Variable: LedgerName1] ;;;;add
    Type:String ;;;;;;add
    [System: Variables] ;;;;;;;;add
    LedgerName1 : "" ;;;add


    020 : SET : CphCrLedgerName : ##LedgerName1 ;;;Modify
    030 : SET : CphDrLedgerName : $PartyLedgerName ;;;Modify
     


  6. Umashankar

    Umashankar Member


    error in Field: CphSales DateFld incorrect storage
    How should be recetified?
    Please help
     


  7. Sanjeev S

    Sanjeev S Active Member


    Dear Chintamani Ji,

    Please try small changes in 2 fields as below......

    Code:
                        [Field    : CphSales DateFld]
                            Type        :     Date
                            Use            :    Short Date Field
                            Storage        :    Date                                     
                            Set as        :    $$PrevObj:$Date                       ; Line added
                            Set Always    :    Yes                       ; Line added
                            Width        :     @@ShortWidth
                          
    
                        [Field    : CphSales SALESLEDNAME]  
                            Type        :     String
                            Table        : CphSales SalesLed
                            Storage        :     SalesLedgerName
                            Set as        :    #CphSalesCrLedFld                        ; Line added
                            Set Always    :    Yes                       ; Line added
                            Show Table    :     Always
                            ;;Case        :     Title Case
                            Full Width    :     Yes
                            ;; Skip        :     Yes
                            Align        :     Left
                            Inactive    :     $$IsEndOfList:$PartyLedgerName        ;;$$IsEndOfList:$Name    ;;$$IsEmpty:$Name
                           
    You won't be reqired to insert data and sales ledger again and again. If you wish you can very well change it.

    Regards,
     


  8. Umashankar

    Umashankar Member


    error in Field: CphSales CrLedFld incorrect storage
     
    BizVim IT Solutions likes this.



  9. A lot of Thank you, All of Members ....
     


  10. Jay kumar tailor

    Jay kumar tailor Well-Known Member


    For Bulk Sales Entries See This.

     


  11. chintamani

    chintamani New Member


    Ref. to Post No. 8 - "error in Field: CphSales CrLedFld incorrect storage"

    Dear Sir
    Please provide more details regarding above error
     


  12. Anuj Mittal

    Anuj Mittal New Member


    Please Provide TDL Code
     





  13. great efforts, but still could not figure out error, why it is not picking up credit side amount... i have review prevision voucher creation sample file in tally developer...
    will please any one explain the same
     


Share This Page