Initial commit
This commit is contained in:
60
admin/factuur.php
Normal file
60
admin/factuur.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
(defined(security_key) or defined('admin') or defined('interface')) or exit;
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('display_startup_errors', '1');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
$order_number = $_POST['txn_id'];
|
||||
|
||||
list($data,$customer_email,$order_id) = generateInvoice($pdo,$order_number);
|
||||
$dompdf->loadHtml($data);
|
||||
|
||||
// (Optional) Setup the paper size and orientation
|
||||
$dompdf->setPaper('A4', 'portrait');
|
||||
|
||||
// Render the HTML as PDF
|
||||
$dompdf->render();
|
||||
|
||||
$file_name = 'Factuur - '.$order_id;
|
||||
|
||||
// Output the generated PDF to Browser
|
||||
if (isset($_POST['email_invoice']) || $_POST['status'] == 'Paid'){
|
||||
$to = $customer_email;
|
||||
$subject = 'Factuur - '.$order_id;
|
||||
$message = $data;
|
||||
$attachment = $dompdf->output();
|
||||
$attachment_name = $file_name;
|
||||
|
||||
$header_redirect = 'Location: index.php?page=order&id='.$order_id;
|
||||
//Send to PHPMailer
|
||||
send_mail_by_PHPMailer($to, $subject, $message, $attachment, $attachment_name);
|
||||
header($header_redirect);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['email_invoice_to_admin']) || $_POST['status'] == 'Paid'){
|
||||
$to = $customer_email;
|
||||
$subject = 'Factuur - '.$order_id;
|
||||
$message = $data;
|
||||
$attachment = $dompdf->output();
|
||||
$attachment_name = $file_name;
|
||||
|
||||
$header_redirect = 'Location: index.php?page=order&id='.$order_id;
|
||||
//Send to PHPMailer
|
||||
if(invoice_bookkeeping){
|
||||
send_mail_by_PHPMailer(email_bookkeeping, $subject, $data, $attachment, $subject);
|
||||
}
|
||||
|
||||
header($header_redirect);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_POST['show_invoice'])){
|
||||
ob_end_clean();
|
||||
$dompdf->stream("Factuur.pdf", array("Attachment" => false));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user