diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 45841cba..0a1a0c75 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -139,6 +139,8 @@ $routes->get('generate_invoice_print_preview/(:any)', 'Invoice::generate_invoice $routes->get('print_address/(:num)', 'Invoice::print_address/$1'); +$routes->get('print_address_landscape/(:num)', 'Invoice::print_address_landscape/$1'); + $routes->match(['get','post'],'/general_inv_rp','Invoice::general_inv_rp'); $routes->match(['get','post'],'/mem_inv_rp','Invoice::general_membership_inv_rp'); diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 06356499..36554c1c 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -857,6 +857,41 @@ class Invoice extends BaseController $mpdf->Output($pdfFileName, 'D'); } + //new design + public function print_address_landscape($id) + { + + $model = new InvoiceModel(); + $invoiceData = $model->getInvoiceData($id); + // print_r($invoiceData);die(); + + $config = [ + 'mode' => 'utf-8', + 'format' => 'A5-L', // Change format to A5-L for landscape + 'default_font_size' => 12, + 'default_font' => 'Arial', + 'margin_left' => 0, + 'margin_right' => 0, + 'margin_top' => 5, + 'margin_bottom' => 5, + 'margin_header' => 0, + 'margin_footer' => 0, + 'orientation' => 'L', // Change to landscape orientation + ]; + $mpdf = new Mpdf($config); + $mpdf->SetTitle('Customer Address'); + $mpdf->SetAuthor($invoiceData[0]->company_name); + $mpdf->SetCreator(''); + + // Generate the PDF content (HTML) with customer and address data + $html = view('address_pdf_landscape_template', ['invoiceData' => $invoiceData]); + // echo $html;die; + $mpdf->WriteHTML($html); + $pdfFileName = 'customer_address_' . date('Y-m-d H-i-s') . '.pdf'; + $mpdf->Output($pdfFileName, 'D'); + } + + public function general_inv_rp() { $model = new InvoiceModel(); diff --git a/app/Views/address_pdf_landscape_template.php b/app/Views/address_pdf_landscape_template.php new file mode 100644 index 00000000..5b06f94b --- /dev/null +++ b/app/Views/address_pdf_landscape_template.php @@ -0,0 +1,81 @@ + + + + + + Shipping Label Template + + + + + + +
+ +
+ From :
+ company_name; ?>
+ company_address. ","; ?>
+ company_city; ?> - company_postal_code. ","; ?>
+ company_state. "."; ?>
+ company_mobile_no; ?> +
+ +
+ Order : invoice_number; ?> +
+ +
+ To :
+ customer_name ?>
+ customer_ship_address && ($value->saddr_id !== null || $value->saddr_id !== '')){ ?> + customer_ship_address ? $value->customer_ship_address." ,
" : "" ?> + customer_ship_city ? $value->customer_ship_city." " : "" ?> + customer_ship_postal_code ? " - " . $value->customer_ship_postal_code."
" : ""; ?> + customer_ship_state ? $value->customer_ship_state. ".
" : "" ?> + saddr_id === null || $value->saddr_id === '') { + echo $value->shipping_address ? $value->shipping_address.'
' : ''; + } ?> + mobile_no ? "Mobile : ".$value->mobile_no." ." : "" ?> +
+ +
+
+ + + + diff --git a/app/Views/invoice_list.php b/app/Views/invoice_list.php index cb8f50b8..504a6dad 100644 --- a/app/Views/invoice_list.php +++ b/app/Views/invoice_list.php @@ -101,7 +101,8 @@ " class="download-pdf-button" title="Download the Invoice">  - " class="print-address-button" title="Print Address"> + " class="print-address-button" title="Print Address"> + " class="print-address-button" title="Print Address"> " data-invoice-id=""> " class="download-pdf-button" title="Download the Invoice">  - " class="print-address-button" title="Print Address"> + " class="print-address-button" title="Print Address"> + " class="print-address-button" title="Print Address"> diff --git a/app/Views/subscribers_list.php b/app/Views/subscribers_list.php index b4bf024b..4a4c3311 100644 --- a/app/Views/subscribers_list.php +++ b/app/Views/subscribers_list.php @@ -104,7 +104,8 @@ " class="edit-button" title="Edit the Invoice">  " class="download-pdf-button" title="Download the Invoice">  - " class="print-address-button" title="Print Address"> + " class="print-address-button" title="Print Address"> + " class="print-address-button" title="Print Address">