This commit is contained in:
VE10-Sanjeev 2023-11-30 15:29:11 +05:30
parent c48258dbc2
commit b12197a9ce
2 changed files with 24 additions and 13 deletions

View File

@ -156,27 +156,36 @@ public function download_details()
if($action == 1) $pdf = new Mpdf($config);
else $pdf = new Mpdf();
$customerDetails = [];
// Iterate through selected schemes
if (!empty($selectedSchemes)) {
foreach ($selectedSchemes as $selectedScheme) {
// Call the model method to get customer details for each selected scheme
$subscriptionModel = new SubscriptionModel();
$customerDetails = $subscriptionModel->getAllCustomerDetailsBySchemeName($selectedScheme);
// Create an HTML content string for the current scheme
$details = $subscriptionModel->getAllCustomerDetailsBySchemeName($selectedScheme);
$customerDetails = array_merge($customerDetails, $details);
}
if (!empty($customerDetails)) {
$html = view('print_addresses_form', ['customerDetails' => $customerDetails , 'action' => $action ]);
// Add the current scheme's details to the PDF
// $pdf->AddPage();
$pdf->WriteHTML($html);
// Set the PDF filename
$filename = 'CustomerDetails_' . date('YmdHis') . '.pdf';
// Output the PDF for download
$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 ");
}
// Set the PDF filename
$filename = 'CustomerDetails_' . date('YmdHis') . '.pdf';
// Output the PDF for download
$pdf->Output($filename, 'D');
}

View File

@ -17,7 +17,8 @@
page-break-inside: avoid;
padding-left : 5px;
/* margin: 20px auto; */
border: 1px solid #000;
/* border: 1px solid #000; */
border: 1px solid #FFFF00
/* padding:10px; */
box-sizing: border-box;
}
@ -81,7 +82,7 @@
<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> -->
<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/>
<?= $customerDetails[$i]['address'] ?>
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>
@ -164,7 +165,8 @@
<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> -->
<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/>
<?= $customerDetails[$i]['address'] ?>
<?= $customerDetails[$i]['city'] ?> - <?= $customerDetails[$i]['postal_code'] ?></div>