Browse Source

Update invoice_pdf.php

FusionPBX 7 years ago
parent
commit
102d03762c
1 changed files with 30 additions and 13 deletions
  1. 30 13
      invoices/invoice_pdf.php

+ 30 - 13
invoices/invoice_pdf.php

@@ -17,22 +17,26 @@
 
 
 	The Initial Developer of the Original Code is
 	The Initial Developer of the Original Code is
 	Mark J Crane <[email protected]>
 	Mark J Crane <[email protected]>
-	Portions created by the Initial Developer are Copyright (C) 2008-2016
+	Portions created by the Initial Developer are Copyright (C) 2008-2017
 	the Initial Developer. All Rights Reserved.
 	the Initial Developer. All Rights Reserved.
 
 
 	Contributor(s):
 	Contributor(s):
 	Mark J Crane <[email protected]>
 	Mark J Crane <[email protected]>
 */
 */
-require_once "root.php";
-require_once "resources/require.php";
-require_once "resources/check_auth.php";
-if (if_group("admin") || if_group("superadmin")) {
-	//access granted
-}
-else {
-	echo "access denied";
-	exit;
-}
+
+//includes
+	require_once "root.php";
+	require_once "resources/require.php";
+	require_once "resources/check_auth.php";
+
+//check permissions
+	if (if_group("admin") || if_group("superadmin")) {
+		//access granted
+	}
+	else {
+		echo "access denied";
+		exit;
+	}
 
 
 //add multi-lingual support
 //add multi-lingual support
 	$language = new text;
 	$language = new text;
@@ -58,10 +62,17 @@ else {
 		$contact_uuid_from = $row['contact_uuid_from'];
 		$contact_uuid_from = $row['contact_uuid_from'];
 		$contact_uuid_to = $row['contact_uuid_to'];
 		$contact_uuid_to = $row['contact_uuid_to'];
 		$invoice_date = $row['invoice_date'];
 		$invoice_date = $row['invoice_date'];
+		$invoice_purchase_order_number = $row['invoice_purchase_order_number'];
+		$invoice_currency = $row['invoice_currency'];
 		$invoice_note = $row['invoice_note'];
 		$invoice_note = $row['invoice_note'];
 		unset ($prep_statement);
 		unset ($prep_statement);
 	}
 	}
 
 
+//set the default currency
+	if (strlen($invoice_currency) == 0) {
+		$invoice_currency = 'USD';
+	}
+
 //prepare the invoice date
 //prepare the invoice date
 	$invoice_date = date("d", strtotime($invoice_date)).' '.date("M", strtotime($invoice_date)).' '.date("Y", strtotime($invoice_date));
 	$invoice_date = date("d", strtotime($invoice_date)).' '.date("M", strtotime($invoice_date)).' '.date("Y", strtotime($invoice_date));
 
 
@@ -205,6 +216,12 @@ else {
 	$pdf->Cell(150,5,'');
 	$pdf->Cell(150,5,'');
 	$pdf->Cell(40,5,$text['label-invoice_number'].' '.$invoice_number);
 	$pdf->Cell(40,5,$text['label-invoice_number'].' '.$invoice_number);
 	$pdf->Ln();
 	$pdf->Ln();
+	if (strlen($invoice_purchase_order_number) > 0) {
+		$pdf->Cell(150,5,'');
+		$pdf->Cell(40,5,$text['label-invoice_purchase_order_number'].' '.$invoice_purchase_order_number);
+		$pdf->Ln();
+	}
+
 	$pdf->Ln();
 	$pdf->Ln();
 	$pdf->Ln();
 	$pdf->Ln();
 
 
@@ -311,7 +328,7 @@ else {
 	$pdf->Cell($w[0],6,'','',0,'L','');
 	$pdf->Cell($w[0],6,'','',0,'L','');
 	$pdf->Cell($w[1],6,'','',0,'L','');
 	$pdf->Cell($w[1],6,'','',0,'L','');
 	$pdf->Cell($w[2],6,'','',0,'R','');
 	$pdf->Cell($w[2],6,'','',0,'R','');
-	$pdf->Cell($w[3],6,$text['label-invoice_total'].' $'.number_format($total,2).' USD','',0,'R','');
+	$pdf->Cell($w[3],6,$text['label-invoice_total'].' $'.number_format($total,2).' '.$invoice_currency,'',0,'R','');
 	$pdf->Ln();
 	$pdf->Ln();
 
 
 	if (strlen($invoice_note) > 0) {
 	if (strlen($invoice_note) > 0) {
@@ -328,4 +345,4 @@ else {
 //show the pdf
 //show the pdf
 	$pdf->Output();
 	$pdf->Output();
 
 
-?>
+?>