FIX_BUG id - 0001086
This commit is contained in:
parent
6794e9d2f3
commit
66b17fe2c7
@ -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');
|
||||
|
||||
@ -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();
|
||||
|
||||
81
app/Views/address_pdf_landscape_template.php
Normal file
81
app/Views/address_pdf_landscape_template.php
Normal file
@ -0,0 +1,81 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shipping Label Template</title>
|
||||
<style>
|
||||
body {
|
||||
font-family:Helvetica!important;
|
||||
box-sizing: border-box;
|
||||
font-size: 12px;
|
||||
|
||||
}
|
||||
.label-container {
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
border: 2px solid #000;
|
||||
position: relative;
|
||||
}
|
||||
.from-address, .to-address {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.from-address {
|
||||
text-align: left;
|
||||
float: left;
|
||||
width: 60%;
|
||||
}
|
||||
.order-number {
|
||||
text-align: right;
|
||||
float: right;
|
||||
width: 40%;
|
||||
}
|
||||
.to-address {
|
||||
text-align: left;
|
||||
float: right;
|
||||
width: 60%;
|
||||
clear: both;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
foreach ($invoiceData as $value) :
|
||||
?>
|
||||
|
||||
<div class="label-container">
|
||||
<!-- From Address on the left -->
|
||||
<div class="from-address">
|
||||
<strong>From :</strong> <br>
|
||||
<?= $value->company_name; ?><br>
|
||||
<?= $value->company_address. ","; ?><br>
|
||||
<?= $value->company_city; ?> - <?= $value->company_postal_code. ","; ?><br>
|
||||
<?= $value->company_state. "."; ?><br>
|
||||
<?= $value->company_mobile_no; ?>
|
||||
</div>
|
||||
<!-- Order Number on the right -->
|
||||
<div class="order-number">
|
||||
<b> Order : </b><?php echo $value->invoice_number; ?>
|
||||
</div>
|
||||
<!-- To Address in the center -->
|
||||
<div class="to-address">
|
||||
<strong>To :</strong> <br>
|
||||
<?= $value->customer_name ?><br>
|
||||
<?php if($value->customer_ship_address && ($value->saddr_id !== null || $value->saddr_id !== '')){ ?>
|
||||
<?= $value->customer_ship_address ? $value->customer_ship_address." , <br>" : "" ?>
|
||||
<?= $value->customer_ship_city ? $value->customer_ship_city." " : "" ?>
|
||||
<?= $value->customer_ship_postal_code ? " - " . $value->customer_ship_postal_code." <br>" : ""; ?>
|
||||
<?= $value->customer_ship_state ? $value->customer_ship_state. ". <br>" : "" ?>
|
||||
<?php }else if ($value->saddr_id === null || $value->saddr_id === '') {
|
||||
echo $value->shipping_address ? $value->shipping_address.'<br>' : '';
|
||||
} ?>
|
||||
<?= $value->mobile_no ? "Mobile : ".$value->mobile_no." ." : "" ?>
|
||||
</div>
|
||||
<!-- Clear floats to maintain layout -->
|
||||
<div style="clear: both;"></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -101,7 +101,8 @@
|
||||
<td class="preview-pdf" data-order="<?= $row['total_amount']; ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= "₹ " . $row['total_amount']; ?></td>
|
||||
<td>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['invoice_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
<a href="<?= base_url("print_address/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
||||
<a style="display: none;" href="<?= base_url("print_address/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
||||
<a href="<?= base_url("print_address_landscape/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-fill"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
|
||||
@ -131,7 +131,8 @@
|
||||
<td class="preview-pdf" data-order="<?= $row['total_amount']; ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= "₹ " . $row['total_amount']; ?></td>
|
||||
<td>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['invoice_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
<a href="<?= base_url("print_address/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
||||
<a style="display: none;" href="<?= base_url("print_address/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
||||
<a href="<?= base_url("print_address_landscape/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-fill"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; endif; endforeach; ?>
|
||||
|
||||
@ -104,7 +104,8 @@
|
||||
<td>
|
||||
<a href="<?= base_url() . "new_subscription_invoice/" . $row['invoice_id']; ?>" class="edit-button" title="Edit the Invoice"><i class="ri-pencil-line" title="Edit the Invoice"></i></a>
|
||||
<a href="<?= base_url("generate_invoice_pdf/{$row['invoice_id']}") ?>" class="download-pdf-button" title="Download the Invoice"><i class="ri-file-download-line"></i></a>
|
||||
<a href="<?= base_url("print_address/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
||||
<a style="display: none;" href="<?= base_url("print_address_/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-line"></i></a>
|
||||
<a href="<?= base_url("print_address_landscape/{$row['invoice_id']}") ?>" class="print-address-button" title="Print Address"><i class="ri-printer-fill"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user