2 Different Printout

fahdfahd Member Posts: 226
Dear Experts,
In Sales & Marketing> Posted Invoices there is only default print out.

Is there any way that i can have 2 different design for the same invoice???

Like if we click print on posted Invoice there is only one print design which is by default design. But i want another Design for the same invoice. So basically there will be 2 different print designs for the same invoice that i want to print.

Kinldy let me know if it's possible.

Thanks & Regards,
Fahd

Answers

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    In which conditions you want print them?

    or you want them every time?
  • fahdfahd Member Posts: 226
    Dear Mohana,

    I just need 2 different design because we have 2 companies. Sometimes we want the print with company 1's header details and sometimes with company 2's header design and we will always take the prints from posted invoice. Every thing will be the same the only thing will be changed is the header details of that invoice.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Why dont you create 2 headers and use
    CurrReport.SHOWOUTPUT := COMPANYNAME = 'CRONUS USA, Inc.';
    
  • fahdfahd Member Posts: 226
    Thanks for reply,


    In navision we have only one company.

    So we need different format for the design but that should be pirnted out from posted invoice only.

    By default if i click on print in Sales invoice it's taking the report (206). By using the same report i save as 50012.

    But in the header details i have changed some details. now i want system to give me both these reports when click on print button or if there is other button which could named as print 2, means either to print in 206 or 50012.
  • DevendraSharmaDevendraSharma Member Posts: 23
    fahd wrote:
    Thanks for reply,


    In navision we have only one company.

    So we need different format for the design but that should be pirnted out from posted invoice only.

    By default if i click on print in Sales invoice it's taking the report (206). By using the same report i save as 50012.

    But in the header details i have changed some details. now i want system to give me both these reports when click on print button or if there is other button which could named as print 2, means either to print in 206 or 50012.

    why you need two report ?

    you design two header and take option type variable . now you can manage which header you want to show and hide in report by managing option variable in request form.

    if you have only two format then you can also use Boolean type var
    standardformat var Boolean type

    on one header
    CurrReport.SHOWOUTPUT(standardformat);
    on other
    CurrReport.SHOWOUTPUT(not standardformat);
  • SavatageSavatage Member Posts: 7,142
    For us we needed 2 completely different report. It just wasn't a header change which would have been great.

    So In the Sales Invoice Header Table There is a function called "PrintRecords" So I added a maching function with a new name "PrintInternetRecords".

    I Added the 2nd invoice type to the Report Selections Table.
    Original Code: to print Standard Invoice
    PrintRecords(ShowRequestForm : Boolean)
    WITH SalesInvHeader DO BEGIN
      COPY(Rec);
      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;
    
    Copied Code to the new function to call the other report
    PrintInternetRecords(ShowRequestForm : Boolean)
    WITH SalesInvHeader DO BEGIN
      COPY(Rec);
      ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Wholesale");
      ReportSelection.SETFILTER("Report ID",'<>0');
      ReportSelection.FIND('-');
      REPEAT
        REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,SalesInvHeader);
      UNTIL ReportSelection.NEXT = 0;
    END;
    
    ON the Print button of the posted invoice I changed the code ONPUSH.
    It checks the type of order it is and prints the desired invoice report.
    OnPush()
    IF NOT "Internet Order"  THEN BEGIN
      CurrForm.SETSELECTIONFILTER(SalesInvHeader);
      SalesInvHeader.PrintRecords(TRUE);
    END ELSE BEGIN
      CurrForm.SETSELECTIONFILTER(SalesInvHeader);
      SalesInvHeader.PrintInternetRecords(TRUE);
    END;
    
    The above code could be on seperate buttons if you wish instead of one.
    this is the long drawn out way - so if you just need a header change then that's the way to go
  • fahdfahd Member Posts: 226
    VOILAAAA

    Thank uuuu!!!

    It worked, thanks for such a great support !! :)
  • fahdfahd Member Posts: 226
    :mrgreen:
  • fahdfahd Member Posts: 226
    edited 2011-08-24
    Dear Mr. Harry,
    With the above mentioned coding i was fine with 2 different printout.this morning i tried the same way for the 3rd invoice print out.

    I desinged the 3rd report and i did for sales invoice table.


    But now, I went to Purchase order i click on print button of Purcahse order it gave me this error.

    "THE SALES - INVOICE REPORT does not have a data item that uses the table (Table 38 Purchase Order)specified in the function settable view".

    My question is i made changes in Sales Invoice table then how come it is effecting the Purchase order table.

    Why it is mentioning the SALES-INVOICE REPORT. is there any kind of filter in Codeunit 229 or what.

    Kindly let me know ASAP.

    Thanks.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I think you are passing Purchaseheader record variable While calling the Sales Invoice Report.
  • fahdfahd Member Posts: 226
    edited 2011-08-24
    Der Mohana,
    Thanks for the reply i guess this might be the problem!!.

    Could you kindly further guide me that how can i check this where can i check this??

    Thanks & Regards,
    Fahd Liaqat
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Activate debugger and check..it will point the exact line..
  • fahdfahd Member Posts: 226
    it's stopping on the following


    REPORT.RUNMODAL(ReportSelection."Report ID",TRUE,FALSE,PurchHeader)
    UNTIL ReportSelection.NEXT = 0;
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    fahd wrote:
    REPORT.RUNMODAL(ReportSelection."Report ID",TRUE,FALSE,PurchHeader)

    Clearly it showing that you are passing PurchHeader
  • fahdfahd Member Posts: 226
    yeah but i am runnning the print on Purchase order itself.

    I am getting the error when i click on Print Button of the Purchase order.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Why do you need Sales Invoice print out from Purchase Order?
  • fahdfahd Member Posts: 226
    Nooo i don't need sales invoice from Purchase.

    I want the the default Purchase order Print out (Report 405) from purchase order.

    that's what i want. i need the purchase order print out from purchase order it self but it's not showing me.

    it's detecting sales invoice from some where instead of printing purchase order.


    It gave me the error as already stated above.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Check what filters applied to ReportSelection record..

    just above the code where you are getting error message..
  • fahdfahd Member Posts: 226
    It's stated like this..


    ReportSelection.SETFILTER("Report ID",'<>0');
    ReportSelection.FIND('-');


    that's just above of that And it is showing in codeunit (229) in Debugger.
  • FSmeetsFSmeets Member Posts: 37
    Therefore we have added an extra option on the invoice header called "Invoice Lay-out Code"
    This way the user can select which Invoice Lay-out he would like to print.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    isn't there any filter like
    ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"P.Order");
    
    If not, it will pick up the first line from Report Selections table..

    Which function is that in CU229?
  • fahdfahd Member Posts: 226
    edited 2011-08-24
    yes it was in CU 229 in Duebugger.


    I found one filter under the Trigger PrintPurchHeader(PurchHeader)


    ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.INVOICE")

    so i changed it to ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"P.Order")

    now it's working fine.
    i don't know how it changed itself. :shock:

    But it's fine now just asking if i have made this step correctly??
    Kindly let me know and thanks for a great help !
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    If you modified under this line means it is correct..
    PurchHeader."Document Type"::Order:
      ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"P.Order");
    

    And you are Welcome :D
Sign In or Register to comment.