How to fetch second and third line from sale invoice

Markandey_PandeyMarkandey_Pandey Member Posts: 178
Hi all,

I want to fetch the description of second line and third line from sales invoice line table on Integer Header and Footer Section.
I have written the following code in OnPreSection of Header but its not working

Line2Data->Text
Line3Data->Text

SalesInvoiceLine.RESET;
SalesInvoiceLine.SETRANGE("Document No.","No.");
//SalesInvoiceLine.FINDFIRST;
IF(SalesInvoiceLine."Line No."=20000) THEN
Line2data:=SalesInvoiceLine.Description;
IF(SalesInvoiceLine."Line No."=30000) THEN
Line3Data:=SalesInvoiceLine.Description;

can anybody tell me the solution
Markandey Pandey

Comments

  • JedrzejTJedrzejT Member Posts: 267
    Hi,

    I don't know the reason why you do this, so i don't know is this the best solution, but about the code
    You will never know if second line is 20000 and third is 30000 so maybe little correction:
    SalesInvoiceLine.RESET;
    SalesInvoiceLine.SETRANGE("Document No.","No.");
    SalesinvoiceLine.SETRANGE(Type,0); //only if you talk about the description lines
    If SalesInvoiceLine.FINDSET THEN
      REPEAT
         counter+=1;
         CASE counter of
            2: Line2data:=SalesInvoiceLine.Description;
            3: Line3data:=SalesInvoiceLine.Description;
        END;           
      UNTIL (SalesInvoiceLine.NEXT=0) OR (counter=4)
    
  • ssinglassingla Member Posts: 2,973
    Hi all,

    I want to fetch the description of second line and third line from sales invoice line table on Integer Header and Footer Section.
    I have written the following code in OnPreSection of Header but its not working

    Line2Data->Text
    Line3Data->Text

    SalesInvoiceLine.RESET;
    SalesInvoiceLine.SETRANGE("Document No.","No.");
    //SalesInvoiceLine.FINDFIRST;
    IF(SalesInvoiceLine."Line No."=20000) THEN
    Line2data:=SalesInvoiceLine.Description;
    IF(SalesInvoiceLine."Line No."=30000) THEN
    Line3Data:=SalesInvoiceLine.Description;

    can anybody tell me the solution

    What if the sales line has more than 1 item?
    CA Sandeep Singla
    http://ssdynamics.co.in
  • Markandey_PandeyMarkandey_Pandey Member Posts: 178
    What if the sales line has more than 1 item?[/quote]

    that is what i have written, i want to fetch the second and third line description and its clear that there cannot be more than 3 lines also here second and third line is having only description.

    People may ask why i am doing so, actually 2nd and 3rd line description is being used as comment in case the 1st line contains supplementry bill.
    Markandey Pandey
  • Markandey_PandeyMarkandey_Pandey Member Posts: 178
    Thanx

    The problem is resolved
    Markandey Pandey
Sign In or Register to comment.