From 9d76261e8a022786ea25724c63772ba40589a3cd Mon Sep 17 00:00:00 2001 From: "johnny@pittpc.com" Date: Fri, 12 Feb 2021 13:45:59 -0500 Subject: [PATCH] Fully Transitioned to pdfmake --- guest_post.php | 1043 +++++++++++++++++++++++++++++----------- guest_view_invoice.php | 2 +- guest_view_quote.php | 2 +- invoice.php | 3 +- quote.php | 2 +- 5 files changed, 766 insertions(+), 286 deletions(-) diff --git a/guest_post.php b/guest_post.php index 5cd5f493..509981f5 100644 --- a/guest_post.php +++ b/guest_post.php @@ -52,7 +52,8 @@ if(isset($_GET['pdf_invoice'], $_GET['url_key'])){ $company_phone = substr($row['company_phone'],0,3)."-".substr($row['company_phone'],3,3)."-".substr($row['company_phone'],6,4); } $company_email = $row['company_email']; - $company_logo = $row['company_logo']; + $company_website = $row['company_website']; + $company_logo = base64_encode(file_get_contents($row['company_logo'])); $config_invoice_footer = $row['config_invoice_footer']; //Mark downloaded in history @@ -66,159 +67,415 @@ if(isset($_GET['pdf_invoice'], $_GET['url_key'])){ $amount_paid = $row['amount_paid']; $balance = $invoice_amount - $amount_paid; + $balance = number_format($balance, 2); - $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE invoice_id = $invoice_id ORDER BY item_id ASC"); + ?> - while($row = mysqli_fetch_array($sql_items)){ - $item_id = $row['item_id']; - $item_name = $row['item_name']; - $item_description = $row['item_description']; - $item_quantity = $row['item_quantity']; - $item_price = $row['item_price']; - $item_subtotal = $row['item_price']; - $item_tax = $row['item_tax']; - $item_total = $row['item_total']; - $total_tax = $item_tax + $total_tax; - $sub_total = $item_price * $item_quantity + $sub_total; + + - $invoice_items .= " - - $item_name - $item_description - $item_quantity - $$item_price - $$item_tax - $$item_total - - "; + - $mpdf = new \Mpdf\Mpdf([ - 'margin_left' => 5, - 'margin_right' => 5, - 'margin_top' => 48, - 'margin_bottom' => 25, - 'margin_header' => 10, - 'margin_footer' => 10 - ]); - - $mpdf->SetProtection(array('print')); - $mpdf->SetTitle("$company_name - Invoice"); - $mpdf->SetAuthor("$company_name"); - if($invoice_status == 'Paid'){ - $mpdf->SetWatermarkText("Paid"); - } - $mpdf->showWatermarkText = true; - $mpdf->watermark_font = 'DejaVuSansCondensed'; - $mpdf->watermarkTextAlpha = 0.1; - $mpdf->SetDisplayMode('fullpage'); - $mpdf->WriteHTML($html); - $mpdf->Output("$invoice_date-$company_name-Invoice$invoice_number.pdf",'D'); + - while($row = mysqli_fetch_array($sql_items)){ - $item_id = $row['item_id']; - $item_name = $row['item_name']; - $item_description = $row['item_description']; - $item_quantity = $row['item_quantity']; - $item_price = $row['item_price']; - $item_subtotal = $row['item_price']; - $item_tax = $row['item_tax']; - $item_total = $row['item_total']; - $total_tax = $item_tax + $total_tax; - $sub_total = $item_price * $item_quantity + $sub_total; + + + + + + Invoice History Print - Download + Download diff --git a/guest_view_quote.php b/guest_view_quote.php index 7cf5c376..29169f33 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -93,7 +93,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
Print - Download + Download
diff --git a/invoice.php b/invoice.php index d9291c83..95d27e10 100644 --- a/invoice.php +++ b/invoice.php @@ -150,8 +150,9 @@ if(isset($_GET['invoice_id'])){ Print PDF Send Email + + ">Guest URL - ">Guest URL Cancel diff --git a/quote.php b/quote.php index aadb8bca..54044fe5 100644 --- a/quote.php +++ b/quote.php @@ -130,7 +130,7 @@ if(isset($_GET['quote_id'])){ Print PDF Send Email - ">Guest URL + ">Guest URL Delete