Print Selected line(s) of a Ledger Report --similar to "Passbook Printing by banks"

Discussion in 'Free Source Codes' started by Devendra_Rawat, Feb 2, 2020.

    
  1. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    This code tries to print selected line of a ledger voucher report.. similar to Passbook printing

    This TDL can be easily MODIFIED to print the line(s) by using Ctrl+space key to select multiple lines and then print it.


    STEPS

    CHOOSE THE LINE IN THE LEDGER REPORT TO BE PRINTED SELECTIVELY AND ADD THE FOLLOWING OPTION TO IT
    ---------------------------------------------------------------------------------------------------------------------

    Code:
    
    [#Line : YourLineinTheReportToBePrintedSelectively]
             Option : WhiteLine : $$InPrintMode and @@WhiteLine
    
    [!Line : WhiteLine]
            Field    : default
            Local : Field : default :Print FG: White
    
    [System : Formulae]
            WhiteLine : NOT ( $$Line  BETWEEN ##SvLineFromPrint   AND  ##SvLineToPrint )
    
    
    

    Variables and Keys

    Code:
    
    [System    : Variables]
            SVLinetoPrint     : 0
            SVLineFromPrint : 0
            SvNGLastLine    : 0
         
        [Variable: SVLineFromPrint]
            Type        : Number
            Persistent    : Yes
            Volatile    : Yes
    
         
        [Variable: SVLinetoPrint]
            Type        : Number
            Persistent    : Yes
            Volatile    : Yes
         
        [Variable: SvNGLastLine]
            Type        : Number
            ;Persistent    : Yes
            ;Volatile    : Yes
    
    
        [Key    :  NGSetPrint]
                Key        : Alt + S
                Action    : Alter: LineNumberToPrint
                 
        [Key    :  NGPrintReport]
                Key        : Alt + S
                Action    : Print Report
    
    
    MODIFY YOUR FORM DEFINITION TO INVOKE PRINT LINE SELECTION BEFORE PRINT COMMAND
    -------------------------------------------------------------------------------------------------------------------------------

    Code:
    [Form : LStatement Form]
           
            Local        : Button: Print Button : Delete: Action
            Local        : Button: Print Button : Add : Action List:  NGSetPrint, NGPrintReport
            On            : Focus: Yes:    Set            : SvNGLastLine : $$LastLineNumber
         
    

    FUNCTION AND UDFS TO STORE LAST PRINTED LINES FOR GIVEN LEDGER
    ---------------------------------------------------------------------------------------------------------
    Code:
    [Function: RBC_NG_FillRecords]
    
        Parameter    :     pLedgerName        : String
        Parameter    :     pPrintedUpTO    : Number
     
     
        0030    : Set Object: (Ledger , ##pLedgerName).
        0050    : Set Target: (Ledger , ##pLedgerName).
     
     
        2380    :        Insert CollectionObject    : UDF_LinesRecords
        2400    :         Set Target    : UDF_LinesRecords
     
        2500    :        Set Value    :    uLedgerName        : ##pLedgerName
        2550    :        Set Value    :    uPrintedUpTo    : ##pPrintedUpTO
        2555    : Log:  ##pLedgerName
        2556    : Log: $$String:##pPrintedUpTO
        5650    :     SET TARGET         :..
     
        5800    :    Accept Alter
     
        6700    : Return
    
     
    [Collection    : NG_PrintRecords]
        Type    :    UDF_LinesRecords: Ledger
        Child Of: ##GroupName
     
        Fetch    : Name, uLedgerName, uPrintedUpto
     
        Compute    : LedgerName     : $uLedgerName
        Compute    : PrintedUpTO     : $uPrintedUpto
     
        Format    : $LedgerName , 15
        Format    : $PrintedUpTO, 8
    
        Search Key    : $LedgerName
     
    
    [System        : UDF]
        UDF_LinesRecords : Aggregate: 2100
        uLedgerName        : String    : 2110
        uPrintedUpTo    : Number    : 2120
    
    
    OUR REPORT TO SELECT PRINT LINE RANGE
    -----------------------------------------------------------------
    Code:
     
    [Report    : LineNumberToPrint]
        Form: LineNumberToPrint
    
    [Form: LineNumberToPrint]
        Width    : 20 % Screen
        Height    : 20 % Screen
        No Confirm    : Yes
        Part: LineNumberToPrint
        On    : Form Accept: Yes: Call:RBC_NG_FillRecords:##GroupName:##SvLineToPrint
        On    : Form Accept: Yes: Form Accept
    
     
    [Part: LineNumberToPrint]
            Local    : Field: FormSubTitle : Set as: "Print Options"
            Line    : Form SubTitle,  LineNumberFromPrint, LineNumberToPrint
     
        [Line    : LineNumberFromPrint]
            Fields: LongPrompt , LineNumberFromPrint
            Local: Field:LongPrompt : Info: "Line number to Print From "
            Space Top: 1
         
            [Field: LineNumberFromPrint]
                Use: Number Field
                Set Always: Yes
                Set as        : @LastPrintedNumber
                LastPrintedNumber : $$CollectionFieldByKey:$PrintedUpTO:##GroupName:NG_PrintRecords
                Modifies: SVLineFromPrint
                ;Variable: SVLineFromPrint
                Alignment: Right
                Validate : $$Value < = #LineNumberFromPrint ;AND $$Value <= ##SvNGLastLine
               
        [Line    : LineNumberToPrint]
            Fields: LongPrompt , LineNumberToPrint
            Local: Field:LongPrompt : Info: "Line number to Print upTo"
            Space Top: 1
         
            [Field: LineNumberToPrint]
                Use: Number Field
                Set as        : @LastPrintedNumber
                LastPrintedNumber : $$CollectionFieldByKey:$PrintedUpTO:##GroupName:NG_PrintRecords
             
                Set Always: Yes
                Modifies: SVLinetoPrint
                ; Variable: SVLinetoPrint
                Alignment: Right
                Validate : $$Value > = #LineNumberFromPrint ;AND $$Value <= ##SvNGLastLine
               
    
     
    Last edited: Feb 12, 2020



  2. Great & Good Work
     


  3. Rohit Khedar

    Rohit Khedar Member


    sir hear not work
     


  4. Rohit001

    Rohit001 Member


    here when a value of totalamount column is debit (dr) and outstanding balance column is credit (cr) then the value of remaining balance column is minus (-)of these two column.
    And when a value of totalamount column is debit (dr) and outstanding balance column is also debit(dr) then the value of remaining balance column is plus(+) these column....here my code pls help maam,
    ..
    [Field: PENDVALUE]
    Use : amount Field
    Set as: $VchAmt
    Width : 10% Page
    Style : Small
    Set Always:Yes
    Align : Center
    Border: thin right
    Format:"DrCr,Nozero,"


    [Field: PENDVALUET]
    Use : AMOUNT FIELD
    Set as: $$ToValue:$date:$ClosingBalance:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries
    Width : 14% Page
    Style : Small
    Format:"DrCr"
    Set Always:Yes
    Align : Center
    Border: thin right
    [Field: PENDVALUafter]
    Use : amount Field

    Set as:($ClosingBalance:Ledger:$$CollectionField:$LedgerName:1:LedgerEntries+$VchAmt )
    Width : 14% Page
    Style : Small
    Set Always:Yes
    Align : Center
    Color : blue
    Format:"DrCr"
     


  5. Devendra_Rawat

    Devendra_Rawat Well-Known Member



  6. Rajsrisrimal

    Rajsrisrimal Member


    Great Work Garima
     
    Frz likes this.


  7. Devendra_Rawat

    Devendra_Rawat Well-Known Member



  8. rmraja

    rmraja Active Member


    Nice work
     


  9. anish

    anish Member


    Great Work and thanks for sharing innovative ideas
     


  10. Devendra_Rawat

    Devendra_Rawat Well-Known Member


    :) Idea comes when someone faces the issue..
     
    panam and Vikram Bhat like this.


  11. Jenny

    Jenny Active Member


    its showing error .......????? Untitled.png
     
    panam likes this.


  12. Devendra_Rawat

    Devendra_Rawat Well-Known Member



    ha ha..

    you have to mention Line in your report ( e.g. Ledger Voucher ) that is printed selectively ..

    it is not ready to use code.. but it is in the form of Tutorial

    For example you want to use this feature in Default Tally Report " Ledger Voucher", in that report DSP VchDetail is the line which is repeated..

    you have to add this option to line DSP VchDetail

    then proceed as under


    [#Line : DSP VchDetail]
    Option : WhiteLine : $$InPrintMode and @@WhiteLine



    [#Form : Ledger Voucher]

    Local : Button: Print Button : Delete: Action
    Local : Button: Print Button : Add : Action List: NGSetPrint, NGPrintReport
    On : Focus: Yes: Set : SvNGLastLine : $$LastLineNumber
     
    Last edited: Feb 12, 2020
    Jenny likes this.


  13. anish

    anish Member


    Great work and great share
     


Share This Page