This topic is locked

how to print added record when clicking save

1/13/2011 12:45:15 PM
PHPRunner General questions
L
lil33 author

hi,

How to print form data after successfully added into the database when pressing save button immediately.

I want to use this for bill printing.

A
aramuni 3/12/2011

Nobody knows?

A
aramuni 3/12/2011

I tried this but something is missing. All records are being printed.
header("Location: Abertura_de_OS_print.php?editid1=".$values["PKID"]."&editid2=".$values["Numero"]);
I saw this post: http://www.asprunner.com/forums/topic/13081-print-from-a-view
But I don't know how to put this to work...

S
smith 3/13/2011

Try this
header("Location: Abertura_de_OS_print.php?editid1=".$keys["PKID"]);
Smith



I tried this but something is missing. All records are being printed.
header("Location: Abertura_de_OS_print.php?editid1=".$values["PKID"]."&editid2=".$values["Numero"]);
I saw this post: http://www.asprunner.com/forums/topic/13081-print-from-a-view
But I don't know how to put this to work...

T
tedwilder 3/15/2011

Hello, that's exaclty what I DO.

Every time my user save an new "add record" it creates a bill that is printed with record data that has just been recorded:

just in the " after record event" , put a simple php code to print your data.

You can even automaticly save it as a .pdf and print it or just print it thanks to free class .fdpdf.php ( fdpdf.org).

very easy and effective for printing coupons, bills, shipping manifest , labels etc..

you can even use a blank template with fdpdi.php ( a pdf that contains all rows/ columms, logos for instance and fdpdf will print over it and create a pdf file) .
the cool thing is that once the pdf file is create you can also in the same event, mail it as an attachement to your customer thanks to class phpmailer (included in phprunner).

here is a sample of after record event to create the pdf and display it on screen so you can print it immediatly
define('FPDF_FONTPATH','/var/www/yourproject/font/');

require_once('/var/www/yourproject/fpdf.php');

require_once('/var/www/CTI/yourproject/fpdi.php');

$pagecount = $pdf->setSourceFile('/var/www/yourproject/template.pdf');

$tplIdx = $pdf->importPage(1,'/MediaBox');

$pdf->AddPage();

$pdf->useTemplate($tplIdx,1,1,210);

$pdf->SetFont('Arial','B',10);

$pdf->SetTextColor(0,0,0);

$pdf->SetFont('Arial','B',8);

$pdf->text(153,30,$nomreseau["reseau"]);

$pdf->SetFont('Arial','B',8);

$pdf->text(64,76,$values["numdevis"]);

$pdf->SetFont('Arial','B',10);

$pdf->image($urllogo.$fichierlogo["fichierlogo"],8,38,75);

$pdf->text(162,90,$today);

$pdf->text(135,45,$nomreseau["reseau"]);

$pdf->text(135,55,$nomcompletresponsable);

$pdf->text(135,60,$dataresponsable["adresse"]);

$pdf->text(135,65,$dataresponsable["adresse2"]);

$pdf->text(135,70,$dataresponsable["codepostal"]);

$pdf->text(150,70,$dataresponsable["ville"]);

$nomfichier= "/var/www/yourproject/devispdf/".$values["numdevis"].".pdf";

$pdf->Output($nomfichier, 'F');

$devisjoint=$pdf->Output('', 'S');