Page 143 - Action 20 --> Print!?!

ceccomilceccomil Member Posts: 25
Hi EveryBody

I just made a new report for printing "proforma invoice", so a decided to add an action in the "sales invoice list" for printing my report. I've added my action and everything works on, but when I click my print button, in the request page I have to select the number of the invoice I want to print (leave it blank will print the entire list).
Rememberring what appens on printing posted invoices (if you don't specify any number only the selected invoice will be printed) i took a look to the page 143 "Posted Sales Invoices".
Surprise!! In the action 20 (Print) "RunObject" field it's "Undefined" and I can't understand how it works...

How can I get the same behaviour for my report?

Comments

  • apankoapanko Member Posts: 70
    Hi!
    There is no surprise, just c/al code. ;)
    Press F9 key and look at the code in <Action20> - OnAction() trigger.

    Good luck.
  • ceccomilceccomil Member Posts: 25
    my C/AL Code menu it's disable!!! in pages :cry:... I think it's a license I'll try with my technet license instead of the company license
  • apankoapanko Member Posts: 70
    OK.
    There is a c/al code:
    <Action20> - OnAction()
    CurrPage.SETSELECTIONFILTER(SalesInvHeader);
    SalesInvHeader.PrintRecords(TRUE);
    
    As you can see this action call function PrintRecords from table 112 Sales Invoice Header, not report.

    Here is a listing of PrintRecords function:
    PrintRecords(ShowRequestForm : Boolean)
    WITH SalesInvHeader DO BEGIN
      COPY(Rec);
      FIND('-');
      ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Invoice");
      ReportSelection.SETFILTER("Report ID",'<>0');
      ReportSelection.FIND('-');
      REPEAT
        REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,SalesInvHeader);
      UNTIL ReportSelection.NEXT = 0;
    END;
    

    It means that for every record in table Report Selection with field Usage = S.Invoice system will call linked report.

    You can add your report to this table:
    In RTC: Departments/Administration/Application Setup/Sales & Marketing/Sales/Report Selection Sales

    Select Invoice option from Usage list.
    Add your report.

    Now if you click Print Action system propose you to print both reports (the old one, and than your report).
  • ceccomilceccomil Member Posts: 25
    Thanks for your reply my problem it's I need to print invoice as "Proforma" from the Sales Header not from the "Sales Invoice Header" which are already posted.

    Unfortunately with my license (Company end user) I can't access to the C/AL code of the pages...
    Really I think the solution it's very simple.. just add an action in the process section of Invoice List page then put this 2 lines of code and a variable (SalesHeader which is "Sales Header" record)
    CurrPage.SETSELECTIONFILTER(SalesHeader);
    REPORT.RUNMODAL(REPORT::ProformaInvoice,TRUE,TRUE,SalesHeader);
    

    I think I need to upgrade my professional msdn subscription to Premium... :-#
  • apankoapanko Member Posts: 70
    ceccomil wrote:
    Thanks for your reply my problem it's I need to print invoice as "Proforma" from the Sales Header not from the "Sales Invoice Header" which are already posted.

    Unfortunately with my license (Company end user) I can't access to the C/AL code of the pages...
    Really I think the solution it's very simple.. just add an action in the process section of Invoice List page then put this 2 lines of code and a variable (SalesHeader which is "Sales Header" record)
    CurrPage.SETSELECTIONFILTER(SalesHeader);
    REPORT.RUNMODAL(REPORT::ProformaInvoice,TRUE,TRUE,SalesHeader);
    

    I think I need to upgrade my professional msdn subscription to Premium... :-#


    Print action works same way for Sales Header and Sales Invoice Header etc.
    Select appropriate option from Usage list, for example you can select option Order.

    May be you should think about Application Builder granule.
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.