print report page error

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
creat015
User
Posts: 79

print report page error

Post by creat015 »

Hello sir

i want to ask

why print (button print) in report page (Example Report1Report.php) show white blank page

whereas the data that appears slightly just 5 Data

but the print feature on the report page does not appear at all

is there a special setting on the report page?
or indeed an error?
how to fix it?

thank you


arbei
User
Posts: 9359

Post by arbei »

Uncomment the code in the function ExportReportHtml() in the generated file and try again.

function ExportReportHtml($html) {

	//global $gsExportFile;
	//header('Content-Type: text/html' . (EW_CHARSET <> '' ? '; charset=' . EW_CHARSET : ''));
	//header('Content-Disposition: attachment; filename=' . $gsExportFile . '.html');
	echo $html;  // <-- ***uncomment this line***

}

The function ExportReportHtml() is in the generated report page

e.g. Report1Report.php

You can also update the same in the template file (in report-html.php).


saleh
User
Posts: 470

Post by saleh »

Thank you for finding the code
Now work
It's all for you so much

Modified here:
phpv20180/report-html.php

Removal //
//echo $html;

// Export report to HTML
function ExportReportHtml($html) {

	//global $gsExportFile;
	//header('Content-Type: text/html' . (EW_CHARSET <> '' ? '; charset=' . EW_CHARSET : ''));
	//header('Content-Disposition: attachment; filename=' . $gsExportFile . '.html');
	echo $html;

}

saleh
User
Posts: 470

Post by saleh »

hello

Is there an export code to the printer directly ?


arbei
User
Posts: 9359

Post by arbei »

In Startup Script, add your condition to use windows.print() to print the document.

<?php if (<Condition>) { ?>
window.print();
<?php } ?>


saleh
User
Posts: 470

Post by saleh »

Have tried this code to print but prints directly without pressing the print button

window.print(); // show print dialog the moment the print page loaded.
setTimeout(function(){window.close(),100}); // automatically close window when print dialog dismissed (either by Print or Cancel).

I tried to work this way and failed:
Print link:
rvstudents_rewardreport.php?showmaster=users&fk_SchSharingNum=161338

Code : in Table-spedific Report page startup script
if ($SESSION["users&fk_SchSharingNum"]) {
window.open(<table>rvstudents_rewardreport.php?export=print=$
SESSION["users&fk_SchSharingNum"]);
unset($_SESSION["users&fk_SchSharingNum"]);
}

window.print(); // show print dialog the moment the print page loaded.
setTimeout(function(){window.close(),100}); // automatically close window when print dialog dismissed (either by Print or Cancel).

I took the code from here

http://www.hkvforums.com/viewtopic.php? ... 1&p=127120


saleh
User
Posts: 470

Post by saleh »

Can anyone help me?

I want to press after the print in the report goes straight to the printer

Of course, what is meant by reports with PHPMaker 2018

I need the code and its place


sangnandar
User
Posts: 980

Post by sangnandar »

Please note that:

  1. some_url.php
  2. some_url.php?export=print
    Are two different pages. Meaning: table specific startup on (1) will, of course, not working on (2).

Also note that phpmaker has no specific place to put startup for (2).
The workaround idea is to put it as Client Global Code.

$(function() {
if (ew_Get("export") == "print") {
if ($(<unique-element>).length) {
window.print();
setTimeout(function () {
window.close();
},100);
}
};
});

This code will run on all *.php?export=print pages so the selector $(<unique-element>) is crucial to only target your intended-page, in this case: rvstudents_rewardreport.php?export=print.
You need to carefully decide what element to use to identify that specific page. For example, for a standard View Page the unique element would be: $("#f<tablename>view").


saleh
User
Posts: 470

Post by saleh »

hello
Put the code here and nothing changed
Code : in Table-spedific Report page startup script:
$(function() {
if (ew_Get("export") == "print") {
if ($(<unique-element>).length) {
window.print();
setTimeout(function () {
window.close();
},100);
}
};
});


saleh
User
Posts: 470

Post by saleh »

Put the code here Global code Error
Parse error: syntax error, unexpected '(', expecting variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\t\userfn14.php on line 21

$(function() {
if (ew_Get("export") == "print") {
if ($(<unique-element>).length) {
window.print();
setTimeout(function () {
window.close();
},100);
}
};
});


Post Reply