PDF : ps
This commit is contained in:
parent
c48258dbc2
commit
b12197a9ce
@ -156,27 +156,36 @@ public function download_details()
|
|||||||
|
|
||||||
if($action == 1) $pdf = new Mpdf($config);
|
if($action == 1) $pdf = new Mpdf($config);
|
||||||
else $pdf = new Mpdf();
|
else $pdf = new Mpdf();
|
||||||
|
$customerDetails = [];
|
||||||
// Iterate through selected schemes
|
// Iterate through selected schemes
|
||||||
|
if (!empty($selectedSchemes)) {
|
||||||
foreach ($selectedSchemes as $selectedScheme) {
|
foreach ($selectedSchemes as $selectedScheme) {
|
||||||
// Call the model method to get customer details for each selected scheme
|
// Call the model method to get customer details for each selected scheme
|
||||||
$subscriptionModel = new SubscriptionModel();
|
$subscriptionModel = new SubscriptionModel();
|
||||||
$customerDetails = $subscriptionModel->getAllCustomerDetailsBySchemeName($selectedScheme);
|
$details = $subscriptionModel->getAllCustomerDetailsBySchemeName($selectedScheme);
|
||||||
|
$customerDetails = array_merge($customerDetails, $details);
|
||||||
|
}
|
||||||
|
|
||||||
// Create an HTML content string for the current scheme
|
|
||||||
if (!empty($customerDetails)) {
|
if (!empty($customerDetails)) {
|
||||||
$html = view('print_addresses_form', ['customerDetails' => $customerDetails , 'action' => $action ]);
|
$html = view('print_addresses_form', ['customerDetails' => $customerDetails , 'action' => $action ]);
|
||||||
// Add the current scheme's details to the PDF
|
// Add the current scheme's details to the PDF
|
||||||
// $pdf->AddPage();
|
// $pdf->AddPage();
|
||||||
$pdf->WriteHTML($html);
|
$pdf->WriteHTML($html);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the PDF filename
|
// Set the PDF filename
|
||||||
$filename = 'CustomerDetails_' . date('YmdHis') . '.pdf';
|
$filename = 'CustomerDetails_' . date('YmdHis') . '.pdf';
|
||||||
|
|
||||||
// Output the PDF for download
|
// Output the PDF for download
|
||||||
$pdf->Output($filename, 'D');
|
$pdf->Output($filename, 'D');
|
||||||
|
$this->logger->info("Print Addresses (Scheme) : Downloaded = ".$filename);
|
||||||
|
} else {
|
||||||
|
echo "<script>alert('Customer Details Not Available.');</script>";
|
||||||
|
$this->logger->info("Print Addresses (Scheme) : Details Not Available ");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "<script>alert('Schemes Not Choosen.');</script>";
|
||||||
|
$this->logger->info("Print Addresses (Scheme) : Schemes Not Choosen ");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
page-break-inside: avoid;
|
page-break-inside: avoid;
|
||||||
padding-left : 5px;
|
padding-left : 5px;
|
||||||
/* margin: 20px auto; */
|
/* margin: 20px auto; */
|
||||||
border: 1px solid #000;
|
/* border: 1px solid #000; */
|
||||||
|
border: 1px solid #FFFF00
|
||||||
/* padding:10px; */
|
/* padding:10px; */
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
@ -81,7 +82,7 @@
|
|||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
|
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
|
||||||
<div style="float:left; width:80px;margin-right:10px;"><img src="<?= base_url('public/uploads/vijayabharathampdf.png') ?>" alt="Business Logo" class="business-logo"/></div>
|
<div style="float:left; width:80px;margin-right:10px;"><img src="https://vbp.venbait.in/wp-content/uploads/2023/05/1111.png" alt="Business Logo" class="business-logo"/></div>
|
||||||
<div style="text-align:left;font-size:12px;">From<br/>
|
<div style="text-align:left;font-size:12px;">From<br/>
|
||||||
<?= $customerDetails[$i]['address'] ?>
|
<?= $customerDetails[$i]['address'] ?>
|
||||||
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
|
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
|
||||||
@ -164,7 +165,8 @@
|
|||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
|
<!-- <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"><br> -->
|
||||||
<div style="float:left; width:80px;margin-right:10px;"><img src="<?= base_url('public/uploads/vijayabharathampdf.png') ?>" alt="Business Logo" class="business-logo"/></div>
|
<!-- <div style="float:left; width:80px;margin-right:10px;"><img src="<?= base_url('public/uploads/vijayabharathampdf.png') ?>" alt="Business Logo" class="business-logo"/></div> -->
|
||||||
|
<div style="float:left; width:80px;margin-right:10px;"><img src="https://vbp.venbait.in/wp-content/uploads/2023/05/1111.png" alt="Business Logo" class="business-logo"/></div>
|
||||||
<div style="text-align:left;font-size:12px;">From<br/>
|
<div style="text-align:left;font-size:12px;">From<br/>
|
||||||
<?= $customerDetails[$i]['address'] ?>
|
<?= $customerDetails[$i]['address'] ?>
|
||||||
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
|
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user