Bug 36512

Summary: Build printing into reports
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: ReportsAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Christopher Brannon 2024-04-03 22:21:12 UTC
Currently, to print a report via template, you have to export the report to an html file, then open it and print it.

I would like to suggest building the print into the report.  I currently use the following via jquery:

  //Report Printing (v23.05)
  if($('#rep_guided_reports_start #format').length) {
    $('#format').siblings('ul').append('<li><a id="mnuPrintReport" href="#">Print Report</a></li>');
    $('#mnuPrintReport').on('click', function () {
      var reportInfo = '<html><head></head><body>' + $('#ReportContent').html() + '</body></html>';
      var myWindow=window.open('','','');
      myWindow.document.write(reportInfo);
      myWindow.document.close();
      setTimeout(function(){ 
        myWindow.focus();
        myWindow.print();
        myWindow.close();
      },500);
    });
  }
  //END Report Printing

Any report I want to print must be wrapped in <div #ReportContent></div>

This works for templated reports, and might also work for regular reports.  The div could be baked into to code.