Item Wise Report Generation

vipinkuruvillavipinkuruvilla Member Posts: 143
Hai All,

I want to print an Item wise report. The report is taken from a screen which has both header and a line.
Now whenever I click on the print button it takes me to the report, where I can see the Document No as my header No.

PLease find the code in my Print button :

RecSalesLine.RESET;
RecSalesLine.SETRANGE(RecSalesLine."Document No.","No.");
REPORT.RUNMODAL(REPORT::"PL Sticker Printing",TRUE,TRUE,RecSalesLine);


Now to get the Item No what I should do as my Rec (Sales Header) dont have item no. Please give me your valuable suggestions.

Is it possible to get item wise in this scenario?

Thanx in Advance...

Answers

  • kinekine Member Posts: 12,562
    It means you want to filter the report on the item, you have selected in the subform?

    If yes, you need to call the report from the subform (or best from the sales line table, through function on the subform).

    something like this:

    on subform create function
    function CallMyReport
    begin
      Rec.CallMyReportOnThisLine;
    end;
    

    on sales line table create function:
    function CallMyReportOnThisLine;
    begin
      RecSalesLine.RESET;
      RecSalesLine.SETRANGE("Document Type","Document Type");  //do not forget to filter on the document type!!!
      RecSalesLine.SETRANGE("Document No.","Document No.");
      RecSalesLine.SETRANGE(Type,RecSalesLine.Type::Item);
      RecSalesLine.SETRANGE("No.","No.");
      REPORT.RUNMODAL(REPORT::"PL Sticker Printing",TRUE,TRUE,RecSalesLine);
    end;
    

    and on the button on the card add code like this:
      CurrForm.Subform.FORM.CallMyReport;
    

    where Subform is name of your subform control...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vipinkuruvillavipinkuruvilla Member Posts: 143
    kine wrote:
    It means you want to filter the report on the item, you have selected in the subform?

    If yes, you need to call the report from the subform (or best from the sales line table, through function on the subform).

    something like this:

    on subform create function
    function CallMyReport
    begin
      Rec.CallMyReportOnThisLine;
    end;
    

    on sales line table create function:
    function CallMyReportOnThisLine;
    begin
      RecSalesLine.RESET;
      RecSalesLine.SETRANGE("Document Type","Document Type");  //do not forget to filter on the document type!!!
      RecSalesLine.SETRANGE("Document No.","Document No.");
      RecSalesLine.SETRANGE(Type,RecSalesLine.Type::Item);
      RecSalesLine.SETRANGE("No.","No.");
      REPORT.RUNMODAL(REPORT::"PL Sticker Printing",TRUE,TRUE,RecSalesLine);
    end;
    

    and on the button on the card add code like this:
      CurrForm.Subform.FORM.CallMyReport;
    

    where Subform is name of your subform control...

    Thanks a lot Kine......This is working fine :D
  • kinekine Member Posts: 12,562
    You are welcome! 8)

    Remmember: if I do not have enough info to run something with correct parameters, probably I am running it from wrong place... ;-) (or something like that)...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.