diff --git a/app/Controllers/Subscription.php b/app/Controllers/Subscription.php index 7986edd0..2711f7de 100644 --- a/app/Controllers/Subscription.php +++ b/app/Controllers/Subscription.php @@ -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 ""; + $this->logger->info("Print Addresses (Scheme) : Details Not Available "); } + } else { + echo ""; + $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'); + } diff --git a/app/Views/print_addresses_form.php b/app/Views/print_addresses_form.php index a5b44db0..ce271627 100644 --- a/app/Views/print_addresses_form.php +++ b/app/Views/print_addresses_form.php @@ -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 @@
-
+
From
-
@@ -164,7 +165,8 @@
-
+ +
From
-