Multi Voucher Print - Different Voucher Types - Selected

Discussion in 'Free Source Codes' started by Devendra_Rawat, Aug 12, 2022.

    
  1. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    [​IMG] This code tries to print multiple selected vouchers (of Different Voucher Types).. Improvement needed in Print Settings of the pages


    Code By :
    Tax Office


    Code:
    ; Print - Selected Vouchers ;;
    ;;--------------------------------------------------------------------------------------------------
    
    [#Form : DayBook]
    
    Add : Button : RkcPrnt SelectedVch
    
    [#Form : Ledger Vouchers]
    
    Add : Button : RkcPrnt SelectedVch
    
    
    [Button : RkcPrnt SelectedVch]
    Key : Ctrl + 2
    Title : "Print Voucher"
    Action : Call: FnListMasterId
    Scope : Selected Lines
    
    
    
    
    
    [Collection : RkcPrntSelectedVchColl]
    Data Source : Report : Selected
    
    Fetch : MasterId, VoucherNumber, Date, Amount, VoucherTypeName
    
    
    [Function : FnListMasterId]
    10 : Log: " Work Hard Dear... "
    20 : List Delete Ex: LvMasterIds
    30 : List Fill : LvMasterIds : RkcPrntSelectedVchColl : $MasterId : $MasterId
    40 : Print: SPV Multi Voucher Print
    
    [Report: SPV Multi Voucher Print]
    
    Variable : VoucherId, SVVoucherType
    Set : SVVoucherType : $$GetMultiAccPrnVchType
    Family : $$Translate:##SVVoucherType
    Object : Voucher
    Use : Multi Voucher Print
    Delete : Form
    Add : Form : SPV Multi Voucher Print
    
    Delete : Print
    Add : Print : SPV MultiVoucherPrintConfig
    Delete : Collection
    Add : Collection : SPV Specific Vouchers of Company
    Local : Collection : SPV Specific Vouchers of Company : Add : Filter : spvFltrMasterId
    
    
    [System : Variables]
    List Variable : LvMasterIds
    
    [Variable : LvMasterIds]
    Variable: MasterId : Number
    
    [Collection: SPV Specific Vouchers of Company]
    
    
    Type : Voucher
    Compute Var : Index : Number : ##Index + (If @@IsOfSVVoucherType AND $MasterId != ##MasterIdVar Then 1 Else 0)
    Compute Var : MasterIdVar : Number : $MasterId
    Compute : MasterIdV : $MasterId
    Compute Var : MasteIdContains : Logical : @@spvMasterId
    
    Compute : ExcelSheetName: $VoucherTypeName + " - " + $$String:##Index
    
    Switch : VType : SJournal Voucher of Company : $$IsStockJrnl:$VoucherTypeName
    Switch : VType : Material Voucher of Company : $$IsJobMaterialIssue:$VoucherTypeName OR $$IsJobMaterialReceive:$VoucherTypeName
    Switch : VType : Others Voucher of Company : NOT ($$IsStockJrnl:$VoucherTypeName OR $$IsJobMaterialIssue:$VoucherTypeName OR $$IsJobMaterialReceive:$VoucherTypeName)
    
    Filter : OptionalVch
    Is ODBC Table : Yes
    
    [System : Formula]
    
    spvMasterId : $$ListValueFind:LvMasterIds:1:($$Number:$MasterId):MasterId; $$FullList:RkcPrntSelectedVchColl:$MasterId
    
    spvFltrMasterId : ##MasteIdContains = True
    
    
    [Form: SPV Multi Voucher Print]
    
    ; Set Always : SVVoucherType : $(Voucher,##VoucherID).VoucherTypeName
    Set Always : SVVoucherType : $VoucherTypeName
    Set Always : ReportTitle : $VoucherTypeName
    
    Switch : VoucherExport : ExportVoucher : ##SVExport
    Switch : VoucherExport : SPV Multi Vch Print : Not ##SVExport
    
    Option : GST MV Vch Print : @@IsGSTRegularCompositeOn
    Option : GVAT Multi Vch Print : @@IsGCCCountriesVATOn
    
    [!Form: SPV Multi Vch Print]
    
    
    
    ;Set Always : SVVoucherType : $(Voucher,##VoucherID).VoucherTypeName
    Set Always : SVVoucherType : $VoucherTypeName
    Set Always : ReportTitle : $VoucherTypeName
    
    Option : MFormal Receipt: ($VoucherTypeName = "Receipt" AND ##MVPPrintFormal)
    Option : MNormalPRPrint : ($VoucherTypeName = "Payment" OR ($VoucherTypeName = "Receipt" AND NOT ##MVPPrintFormal))
    
    Option : MaterialInvoice: $$IsJobMaterialIssue:$VoucherTypeName OR $$IsJobMaterialReceive:$VoucherTypeName
    
    Option : MInvoice : (($VoucherTypeName = "Sales" AND NOT $UseForPOSInvoice) OR +
    $VoucherTypeName = "Purchase" OR +
    $VoucherTypeName = "Sales Order" OR +
    $VoucherTypeName = "Purchase Order" OR +
    ($VoucherTypeName = "Delivery Note" OR $VoucherTypeName = "Receipt Note") OR +
    ($VoucherTypeName = "Rejections In" OR $VoucherTypeName = "Rejections Out")) OR $VoucherTypeName ="Job Work In Order" OR $VoucherTypeName ="Job Work Out Order"
    
    Option : MJournal :$VoucherTypeName ="Journal" OR $VoucherTypeName ="Contra" OR $VoucherTypeName ="Memorandum" OR $VoucherTypeName ="Reversing Journal" OR +
    $VoucherTypeName ="Payroll"
    Option : MDCNote : (($VoucherTypeName ="Debit Note") OR ($VoucherTypeName="Credit Note" ))
    Option : NormalPSPrint : $VoucherTypeName ="Physical Stock"
    Option : NormalSJPrint : $VoucherTypeName ="Stock Journal"
    Option : NrmlAttdPrint : $VoucherTypeName ="Attendance"
    Option : MPOSPrint : ($VoucherTypeName = "Sales" AND $UseForPOSInvoice)
    
    Option : MIndent : $IsIndentVch
    
    Excel Sheet Name : $ExcelSheetName
    
    Fetch Object : VoucherType : ##SVVoucherType : IsDeemedPositive
    
    
    
    
    
    
    [Report: SPV MultiVoucherPrintConfig] ;;Auto Report
    
    Use : SV Print Configuration
    Form : sPV MultiVoucherPrintConfig
    Variable : SVCurrentUILanguageId, SVCurrentKBLanguageId
    
    
    
    Set : ORIGVchType :$VoucherTypeName
    Set : ReportTitle :""
    Set : ReportSubTitle :""
    Set : DSP Title Refresh : No
    Set : SALogoPath : $Logopath:Company:##SvCurrentCompany
    
    Set : SVCurrentUILanguageId : If @@VATGCCArabicPrintLang Then 1025 Else ##SVCurrentUILanguageId
    Set : SVCurrentKBLanguageId : If @@VATGCCArabicPrintLang Then 1025 Else ##SVCurrentKBLanguageId
    
    [Form: SPV MultiVoucherPrintConfig]
    
    USe : SV Print Configuration
    Set Always : SVVoucherType : $VoucherTypeName
    Delete : Option
    Add : Option : JV STExportConfig : $$InExportAction
    Add : Option : JV STPrintConfig : $$InPrintAction AND NOT $$InExportAction
    Add : Option : SV MailConfig : $$InMailAction
    Add : Option : SV UploadConfig : $$InUploadAction
    Add : Option : Small Size Form
    
    Add : Parts : SPV Print Common
    Local : Field : Form SubTitle : Set as : $$Sprintf:@@VouchersActionFormat:@@OutputAction
    Local : Field : DSP PrintSize : Modifies : PrinterPaperSize : Yes
    
    Add : Option : GVAT MultiVoucherPrintConfig : @@IsGCCCountriesVATOn
    On : Form Accept : Yes : Form Accept
    On : Form Accept : @@IswithinPrintArea : Call : FittoPaperSize
    On : Form Accept : @@IsInvoiceFormatMode : Call : SetInvoiceArea
    
    
    
    [Part: SPV Print Common]
    
    SpaceTop : 1
    Lines : SPV VoucherTypeName,SPV VoucherRange; FromDate, SVToDate
    Local : Field : VoucherTypeName : Delete : Table
    Local : Field : VoucherTypeName : Table : Multi Voucher Type
    Local : Field : VoucherTypeName : Modifies: SVVoucherType
    Local : Field : VoucherTypeName : Set as : "All Itmes"
    Local : Field : VoucherTypeName : Skip : Yes
    Local : Field : VoucherTypeName : Validate: $$SetVarValue:"SVIsRptHasPrintCopies":@@IsVchTypeForPrintCopies
    HorizontalAlign : Centre
    
    
    
    
    [Line: SPV VoucherTypeName]
    
    Fields : Medium Prompt, VoucherTypeName
    Local : Field : Medium Prompt : Info : $$LocaleString:"Name of Voucher Type"
    ;Invisible : Yes
    
    [Line: SPV VoucherRange]
    
    Fields : Medium Prompt, SpvVoucherRange
    Local : Field : Medium Prompt : Info : $$LocaleString:"Range"
    
    [Field: SpvVoucherRange]
    
    Use : Name Field
    Table : SpvVoucherRange
    Set as : "Selected Range"
    Set Always :Yes
    Show Table : Always
    CommonTable : No
    
    [Collection: SpvVoucherRange]
    
    Title : $$LocaleString:"Voucher Range"
    List Name : "Selected Range"
    Fetch : Name
    
    
    If Debit note and credit note do not work properly try the following code instead

    Code:
    ; Print - Selected Vouchers ;;
    ;;--------------------------------------------------------------------------------------------------
    
    [#Form : DayBook]
    
    Add : Button : RkcPrnt SelectedVch
    
    [#Form : Ledger Vouchers]
    
    Add : Button : RkcPrnt SelectedVch
    
    
    [Button : RkcPrnt SelectedVch]
    Key : Ctrl + 2
    Title : "Print Voucher"
    Action : Call: FnListMasterId
    Scope : Selected Lines
    
    
    
    
    
    [Collection : RkcPrntSelectedVchColl]
    Data Source : Report : Selected
    
    Fetch : MasterId, VoucherNumber, Date, Amount, VoucherTypeName
    
    
    [Function : FnListMasterId]
    Variable : IsMultiPage : Logical
    Variable : InNewPages : Logical
    
    10 : Log: " Work Hard Dear... "
    20 : List Delete Ex: LvMasterIds
    30 : SET : IsMultiPage : Yes
    35 : SET : InNewPages : Yes
    40 : List Fill : LvMasterIds : RkcPrntSelectedVchColl : $MasterId : $MasterId
    45 : Print: SPV Multi Voucher Print
    
    [Report: SPV Multi Voucher Print]
    
    Use : Multi Voucher Print
    
    Variable : VoucherId, SVVoucherType
    Variable : IsMultiPage, InNewPages
    Set : SVVoucherType : $$GetMultiAccPrnVchType
    Family : $$Translate:##SVVoucherType
    Object : Voucher
    
    Delete : Form
    Add : Form : SPV Multi Voucher Print
    
    Delete : Print
    Add : Print : SPV MultiVoucherPrintConfig
    Delete : Collection
    Add : Collection : SPV Specific Vouchers of Company
    Local : Collection : SPV Specific Vouchers of Company : Add : Filter : spvFltrMasterId
    
    
    [System : Variables]
    List Variable : LvMasterIds
    
    [Variable : LvMasterIds]
    Variable: MasterId : Number
    
    [Collection: SPV Specific Vouchers of Company]
    
    
    Type : Voucher
    Compute Var : Index : Number : ##Index + (If @@IsOfSVVoucherType AND $MasterId != ##MasterIdVar Then 1 Else 0)
    Compute Var : MasterIdVar : Number : $MasterId
    Compute : MasterIdV : $MasterId
    Compute Var : MasteIdContains : Logical : @@spvMasterId
    
    Compute : ExcelSheetName: $VoucherTypeName + " - " + $$String:##Index
    
    Switch : VType : SJournal Voucher of Company : $$IsStockJrnl:$VoucherTypeName
    Switch : VType : Material Voucher of Company : $$IsJobMaterialIssue:$VoucherTypeName OR $$IsJobMaterialReceive:$VoucherTypeName
    Switch : VType : Others Voucher of Company : NOT ($$IsStockJrnl:$VoucherTypeName OR $$IsJobMaterialIssue:$VoucherTypeName OR $$IsJobMaterialReceive:$VoucherTypeName)
    
    Filter : OptionalVch
    Is ODBC Table : Yes
    
    [System : Formula]
    
    spvMasterId : $$ListValueFind:LvMasterIds:1:($$Number:$MasterId):MasterId; $$FullList:RkcPrntSelectedVchColl:$MasterId
    
    spvFltrMasterId : ##MasteIdContains = True
    
    
    [Form: SPV Multi Voucher Print]
    
    ; Set Always : SVVoucherType : $(Voucher,##VoucherID).VoucherTypeName
    Set Always : SVVoucherType : $VoucherTypeName
    Set Always : ReportTitle : $VoucherTypeName
    
    Switch : VoucherExport : ExportVoucher : ##SVExport
    Switch : VoucherExport : SPV Multi Vch Print : Not ##SVExport
    
    Option : GST MV Vch Print : @@IsGSTRegularCompositeOn
    Option : GVAT Multi Vch Print : @@IsGCCCountriesVATOn
    
    [!Form: SPV Multi Vch Print]
    
    
    
    ;Set Always : SVVoucherType : $(Voucher,##VoucherID).VoucherTypeName
    Set Always : SVVoucherType : $VoucherTypeName
    Set Always : ReportTitle : $VoucherTypeName
    
    Option : MFormal Receipt: ($VoucherTypeName = "Receipt" AND ##MVPPrintFormal)
    Option : MNormalPRPrint : ($VoucherTypeName = "Payment" OR ($VoucherTypeName = "Receipt" AND NOT ##MVPPrintFormal))
    
    Option : MaterialInvoice: $$IsJobMaterialIssue:$VoucherTypeName OR $$IsJobMaterialReceive:$VoucherTypeName
    
    Option : MInvoice : (($VoucherTypeName = "Sales" AND NOT $UseForPOSInvoice) OR +
    $VoucherTypeName = "Purchase" OR +
    $VoucherTypeName = "Sales Order" OR +
    $VoucherTypeName = "Purchase Order"+
    OR $VoucherTypeName ="Debit Note"+
    OR $VoucherTypeName ="Credit Note" OR +
    ($VoucherTypeName = "Delivery Note" OR $VoucherTypeName = "Receipt Note") OR +
    ($VoucherTypeName = "Rejections In" OR $VoucherTypeName = "Rejections Out")) OR $VoucherTypeName ="Job Work In Order" OR $VoucherTypeName ="Job Work Out Order"
    
    Option : MJournal :$VoucherTypeName ="Journal" OR $VoucherTypeName ="Contra" OR $VoucherTypeName ="Memorandum" OR $VoucherTypeName ="Reversing Journal" OR +
    $VoucherTypeName ="Payroll"
    ; Option : MDCNote : (($VoucherTypeName ="Debit Note") OR ($VoucherTypeName="Credit Note" ))
    Option : NormalPSPrint : $VoucherTypeName ="Physical Stock"
    Option : NormalSJPrint : $VoucherTypeName ="Stock Journal"
    Option : NrmlAttdPrint : $VoucherTypeName ="Attendance"
    Option : MPOSPrint : ($VoucherTypeName = "Sales" AND $UseForPOSInvoice)
    
    Option : MIndent : $IsIndentVch
    
    Excel Sheet Name : $ExcelSheetName
    
    Fetch Object : VoucherType : ##SVVoucherType : IsDeemedPositive
    
    
    
    
    
    
    [Report: SPV MultiVoucherPrintConfig] ;;Auto Report
    
    Use : SV Print Configuration
    Form : sPV MultiVoucherPrintConfig
    Variable : SVCurrentUILanguageId, SVCurrentKBLanguageId
    
    
    
    Set : ORIGVchType :$VoucherTypeName
    Set : ReportTitle :""
    Set : ReportSubTitle :""
    Set : DSP Title Refresh : No
    Set : SALogoPath : $Logopath:Company:##SvCurrentCompany
    
    Set : SVCurrentUILanguageId : If @@VATGCCArabicPrintLang Then 1025 Else ##SVCurrentUILanguageId
    Set : SVCurrentKBLanguageId : If @@VATGCCArabicPrintLang Then 1025 Else ##SVCurrentKBLanguageId
    
    [Form: SPV MultiVoucherPrintConfig]
    
    USe : SV Print Configuration
    Set Always : SVVoucherType : $VoucherTypeName
    Delete : Option
    Add : Option : JV STExportConfig : $$InExportAction
    Add : Option : JV STPrintConfig : $$InPrintAction AND NOT $$InExportAction
    Add : Option : SV MailConfig : $$InMailAction
    Add : Option : SV UploadConfig : $$InUploadAction
    Add : Option : Small Size Form
    
    Add : Parts : SPV Print Common
    Local : Field : Form SubTitle : Set as : $$Sprintf:@@VouchersActionFormat:@@OutputAction
    Local : Field : DSP PrintSize : Modifies : PrinterPaperSize : Yes
    
    Add : Option : GVAT MultiVoucherPrintConfig : @@IsGCCCountriesVATOn
    On : Form Accept : Yes : Form Accept
    On : Form Accept : @@IswithinPrintArea : Call : FittoPaperSize
    On : Form Accept : @@IsInvoiceFormatMode : Call : SetInvoiceArea
    
    
    
    [Part: SPV Print Common]
    
    SpaceTop : 1
    Lines : SPV VoucherTypeName,SPV VoucherRange; FromDate, SVToDate
    Local : Field : VoucherTypeName : Delete : Table
    Local : Field : VoucherTypeName : Table : Multi Voucher Type
    Local : Field : VoucherTypeName : Modifies: SVVoucherType
    Local : Field : VoucherTypeName : Set as : "All Itmes"
    Local : Field : VoucherTypeName : Skip : Yes
    Local : Field : VoucherTypeName : Validate: $$SetVarValue:"SVIsRptHasPrintCopies":@@IsVchTypeForPrintCopies
    HorizontalAlign : Centre
    
    
    
    
    [Line: SPV VoucherTypeName]
    
    Fields : Medium Prompt, VoucherTypeName
    Local : Field : Medium Prompt : Info : $$LocaleString:"Name of Voucher Type"
    ;Invisible : Yes
    
    [Line: SPV VoucherRange]
    
    Fields : Medium Prompt, SpvVoucherRange
    Local : Field : Medium Prompt : Info : $$LocaleString:"Range"
    
    [Field: SpvVoucherRange]
    
    Use : Name Field
    Table : SpvVoucherRange
    Set as : "Selected Range"
    Set Always :Yes
    Show Table : Always
    CommonTable : No
    
    [Collection: SpvVoucherRange]
    
    Title : $$LocaleString:"Voucher Range"
    List Name : "Selected Range"
    Fetch : Name
    
    
     
    Last edited: Aug 19, 2022
    jagdish tiwari likes this.


  2. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    User "Aliya Jabeen" has been banned. User went by earlier name of "Sseema" , "Barbie Doll", "Dolly" and many others, all of which has been banned/blocked.

    User "Aliya Jabeen" has been found using very foul language with another old and well documented member - H V Patel, who has been kind enough to send proof of chats and exchanges.

    Forum Users are requested to report such bad and abusive members and also submit proof of chats and any other documents, so that such undesirable members are weeded out from the forum.

    We have no problems with people learning, but there is need to maintain decorum and respect towards the Seniors as well as other knowledgeable TDL programmers. There is NO place for abusers and Code collectors who keep hounding and disturbing serious coders and seniors.

    Capture.PNG

    sseema IP -- 2.PNG

    sseema IP -- 3.PNG
     
    Bipin Damania and Devendra_Rawat like this.


  3. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    Hey Bhagwan mere sath aisa kyun hota hai ??:eek::eek:

    Code Delete kar deta hun uske online aane se pehle.. :cool::cool:

     


  4. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    If you delete.....yours is the 1st post....so it will delete this message also........

    The offending member has been banned so cannot login anymore , so you can just edit the POST and remove the code, if you want to. :);)
     


  5. Bipin Damania

    Bipin Damania Active Member


    Yes Amitji
    You are right.
    Please maintain decipline in forum and avoid fake identity. Purpose of this forum is learning & helping each other.
     


  6. Himanshu-2002

    Himanshu-2002 Active Member


    Hi, I have one doubt which I am not able to resolve... While importing any big data Tally gets hang... I want to do pagination but Still that Error comes up.
     


  7. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    There will be a error file generated in tally.........tally.err ......... check that file for the cause.
     


  8. Himanshu-2002

    Himanshu-2002 Active Member


    Actually Error is "Out of memory"... Upgrade RAM
     


  9. Himanshu-2002

    Himanshu-2002 Active Member


    Some Vouchers gets imported successfully around 500-600 but After that It gets hang and Out of memory error comes up
     


  10. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    I had a client with massive and humongous data .....i faced the same problem..........
    so this is how I did it.....
    Import all vouchers except sales and purchase in quarterly installments.
    Import Sales in quarterly installments.
    Import Purchases in quarterly installments.

    a bit time consuming but it did the work perfectly........
     


  11. Amit Kamdar

    Amit Kamdar Administrator Staff Member


    I was told some years back by geek experts.... to make a virtual RAM partition on the HDD ...but that was beyond my capacity to understand and implement.
     


  12. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    Use Save Variable to multiple pvf files to hold data for import. Each PvF should contain a suitable number of records

    Restart tally application, load saved variables and then import
     


  13. NainaSiraj

    NainaSiraj Member


    is this code working in tally erp9
     


  14. jagdish tiwari

    jagdish tiwari New Member


    gggg
     


  15. jagdish tiwari

    jagdish tiwari New Member


    Good TDL but only inventory invoice export not without inventory invoice not export or pdf. kindly fix it.
     


  16. subash pal

    subash pal Member


    Purchase voucher does not print[​IMG]
     


  17. NainaSiraj

    NainaSiraj Member


    how i can set delivery note date in my codes plzz
    $date or $machine date

    guide me kindly
     


  18. NainaSiraj

    NainaSiraj Member



Share This Page