This topic is locked
[SOLVED]

 Automatic printing when new record is saved

12/7/2011 11:27:34 PM
PHPRunner General questions
F
fianchetto author

Dear All,

Is it possible the newly added record to be printed automatically when the user hit the Add-New record save button ?

I am working in a cashier/front-desk part, so when the new order coming in, he or she just add that entry and get it printed as the receipt for his/her customer whenever the cashier hit the save button. There are many people stands in queue that's why they need this automatic printing to expedite the process and save the time.
thanks in advance,
fianchetto

S
stiven 12/8/2011

on the event page after record updated add this code



$id = $values['id'];/// this is the key of the table, change accordingly to your needs...
header("Location: tablename_print.php?a=print&selection[0]=$id");//replace tablename with the actual table name

exit();
F
fianchetto author 12/9/2011

Thanks a lot Stivens,

It redirect me to the printer-friendly page automatically, but it didn't print straight away. I still have to hit print button manually. Is it possible to get it printed automatically just by hitting save in the add new record dialog?
thanks

.ari



on the event page after record updated add this code



$id = $values['id'];/// this is the key of the table, change accordingly to your needs...
header("Location: tablename_print.php?a=print&selection[0]=$id");//replace tablename with the actual table name

exit();


S
stiven 12/9/2011

the only thing i can think of right now is that you can add a print button next to the save button and click it after you save the info i mean i think it will only take you 3 more seconds to click save and then print..
if you're using phprunner 6.0 you can add this on the visual editor html view next to the save button then you'll have the print button



<SPAN class=runner-btnframe><SPAN class=runner-btnleft></SPAN><SPAN class=runner-btnright></SPAN><A class=runner-button href="#" onClick="window.print();">Print</A> </SPAN>
F
fianchetto author 12/11/2011

Thanks Stivens,

Unfortunately I was forced to use version 5.3 because version 6 had some problems with my program. Is it working with older 5.3 ?
cheers

.f



the only thing i can think of right now is that you can add a print button next to the save button and click it after you save the info i mean i think it will only take you 3 more seconds to click save and then print..
if you're using phprunner 6.0 you can add this on the visual editor html view next to the save button then you'll have the print button



<SPAN class=runner-btnframe><SPAN class=runner-btnleft></SPAN><SPAN class=runner-btnright></SPAN><A class=runner-button href="#" onClick="window.print();">Print</A> </SPAN>


S
stiven 12/12/2011

i dont know but you can try it, or you can just add a simple button
<input type="button" id="print" onclick="window.print();" />

F
fianchetto author 12/20/2011

Thanks Stivens,

I've communicated this to the user, and they can accept additional click to print the receipt :-).
thanks

.ari



i dont know but you can try it, or you can just add a simple button
<input type="button" id="print" onclick="window.print();" />

L
laonian 12/20/2011

I guess you can achieve this just by one single click on Save button.
[size="3"]
header("Location: YourTableName_print.php?a=return&selection[0]=".$keys["KeyField"]."");

exit();
[size="3"][color="#0000FF"]2. add a Javascript onload event in the Printer-friendly page[/size] reference link
function PrintWindow()

{

window.print();

CheckWindowState();

}
function CheckWindowState()

{

if(document.readyState=="complete")

{

window.close();

}

else

{

setTimeout("CheckWindowState()", 2000)

}

}
PrintWindow();