FIX_FONT_SIZE_AND_STYLE_IN_PRINT_INVOICE

This commit is contained in:
Srinivas-Saravanan 2024-12-26 12:03:34 +05:30
parent 7300c82017
commit 942d6dd763
6 changed files with 60 additions and 22 deletions

View File

@ -1036,7 +1036,6 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
// Load view with data // Load view with data
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems, 'invoice_type' => $invoice_type,'business' => $business, 'invoiceTerms' => $data, 'status' => $status]); $html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems, 'invoice_type' => $invoice_type,'business' => $business, 'invoiceTerms' => $data, 'status' => $status]);
// Return HTML content // Return HTML content
echo $html; echo $html;
} }
@ -1061,10 +1060,9 @@ public function create_or_update_subscription($invoice_id,$invoice_status, $msg_
// Get status data // Get status data
$status = $data[0]->status; $status = $data[0]->status;
// Load view with data // Load view with data
// $html = view('invoice_print_preview_template', ['data' => $data, 'invoiceItems' => $invoiceItems,'business'=>$business, 'invoice_type' => $invoice_type, 'invoiceTerms' => $data, 'status' => $status]); // $html = view('invoice_print_preview_template', ['data' => $data, 'invoiceItems' => $invoiceItems,'business'=>$business, 'invoice_type' => $invoice_type, 'invoiceTerms' => $data, 'status' => $status]);
$html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems,'business'=>$business, 'invoice_type' => $invoice_type, 'invoiceTerms' => $data, 'status' => $status]); $html = view('invoice_pdf_template', ['data' => $data, 'invoiceItems' => $invoiceItems, 'invoice_type' => $invoice_type,'business' => $business, 'invoiceTerms' => $data, 'status' => $status]);
// Return HTML content // Return HTML content
echo $html; echo $html;

View File

@ -289,18 +289,20 @@ public function getJoinedData($where, $orderby = [])
public function getMembershipListForCustomer($category, $id) public function getMembershipListForCustomer($category, $id)
{ {
return $this->db->table('subscription as S') $result = $this->db->table('subscription as S')
->join('customers as C', 'C.customer_id = S.customer_id', 'left') ->join('customers as C', 'C.customer_id = S.customer_id', 'left')
->join('books as BK', 'BK.book_id = S.scheme_id', 'left') ->join('books as BK', 'BK.book_id = S.scheme_id', 'left')
->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left') ->join('book_categories as BC', 'BC.book_id = S.scheme_id', 'left')
->join('category as CM', 'CM.id = BC.category_id', 'left') ->join('category as CM', 'CM.id = BC.category_id', 'left')
->select('S.customer_id,BK.short_code,S.membership_id,S.status ,CONCAT_WS(" ", C.first_name, C.last_name) as customer_name, S.sub_id, S.scheme_id, DATE_FORMAT(S.from_subscription, "%d/%m/%Y") AS formatted_from_subscription, DATE_FORMAT(S.to_subscription, "%d/%m/%Y") AS formatted_to_subscription, S.from_subscription, S.to_subscription,S.isactive,S.is_renew, S.created_on, CM.name ,BK.title, BK.book_id') ->join('invoice as I', 'I.invoice_id = S.invoice_id', 'left')
->select('S.customer_id,BK.short_code,S.membership_id,S.status,I.status as invoice_status ,CONCAT_WS(" ", C.first_name, C.last_name) as customer_name, S.sub_id, S.scheme_id, DATE_FORMAT(S.from_subscription, "%d/%m/%Y") AS formatted_from_subscription, DATE_FORMAT(S.to_subscription, "%d/%m/%Y") AS formatted_to_subscription, S.from_subscription, S.to_subscription,S.isactive,S.is_renew, S.created_on, CM.name ,BK.title, BK.book_id,(SELECT is_renew FROM subscription as sub WHERE S.sub_id = sub.is_renew LIMIT 1)as renewed')
->where('LOWER(CM.name)', strtolower($category)) ->where('LOWER(CM.name)', strtolower($category))
->where('S.customer_id', $id) ->where('S.customer_id', $id)
->orderBy('S.to_subscription', 'ASC') ->orderBy('S.to_subscription', 'ASC')
->groupBy('S.sub_id') ->groupBy('S.sub_id')
->get() ->get()
->getResultArray(); ->getResultArray();
return $result;
} }
public function getProductImgs($productId) public function getProductImgs($productId)

View File

@ -253,7 +253,7 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
$result = $query->getResultArray(); $result = $query->getResultArray();
$lastQuery = $this->db->getLastQuery(); $lastQuery = $this->db->getLastQuery();
$finalQueryString = $lastQuery->getQuery(); $finalQueryString = $lastQuery->getQuery();
// echo(count($result));die; // dd($result);
return $result; return $result;
} }
public function getSubscriptionDetailsBySchemeName($selectedScheme, $downloadType){ public function getSubscriptionDetailsBySchemeName($selectedScheme, $downloadType){
@ -265,14 +265,17 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
$result1 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.to_subscription >=', $currentDate,$selectedScheme); $result1 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.to_subscription >=', $currentDate,$selectedScheme);
$result2 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.isactive', 1,$selectedScheme); $result2 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.isactive', 1,$selectedScheme);
$result3 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.from_subscription <=', $currentDate,$selectedScheme); $result3 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.from_subscription <=', $currentDate,$selectedScheme);
$approvedResult = $this->getQueryforSubscriptionDetailsBySchemeName(1,'i.status','Approved',$selectedScheme);
// Flatten the arrays for comparison // Flatten the arrays for comparison
$flattened1 = array_map('serialize', $result1); $flattened1 = array_map('serialize', $result1);
$flattened2 = array_map('serialize', $result2); $flattened2 = array_map('serialize', $result2);
$flattened3 = array_map('serialize', $result3); $flattened3 = array_map('serialize', $result3);
$flattened4 = array_map('serialize',$approvedResult);
// Find common elements // Find common elements
$commonElements0 = array_intersect($flattened1, $flattened2); $commonElements0 = array_intersect($flattened1, $flattened2);
$commonElements = array_intersect($commonElements0, $flattened3); $commonElements1 = array_intersect($commonElements0, $flattened3);
$commonElements = array_intersect($commonElements1, $flattened4);
// Unserialize to get back the original array format // Unserialize to get back the original array format
$result = array_map('unserialize', $commonElements); $result = array_map('unserialize', $commonElements);
@ -292,17 +295,21 @@ public function getQueryforSubscriptionDetailsBySchemeName($flag,$condition, $va
if ($downloadType === 'both') { if ($downloadType === 'both') {
$result0 = $this->getQueryforSubscriptionDetailsBySchemeName(0,'','',$selectedScheme); $result0 = $this->getQueryforSubscriptionDetailsBySchemeName(0,'','',$selectedScheme);
$result1 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.from_subscription <=', $currentDate,$selectedScheme); $result1 = $this->getQueryforSubscriptionDetailsBySchemeName(1,'s.from_subscription <=', $currentDate,$selectedScheme);
$approvedResult = $this->getQueryforSubscriptionDetailsBySchemeName(1,'i.status','Approved',$selectedScheme);
$flattened1 = array_map('serialize', $result0); $flattened1 = array_map('serialize', $result0);
$flattened2 = array_map('serialize', $result1); $flattened2 = array_map('serialize', $result1);
$flattened3 = array_map('serialize', $approvedResult);
$commonElements = array_intersect($flattened1, $flattened2); $commonElements0 = array_intersect($flattened1, $flattened2);
$commonElements = array_intersect($commonElements0, $flattened3);
$result = array_map('unserialize', $commonElements); $result = array_map('unserialize', $commonElements);
// dd($this->db->getLastQuery());
} }
$customerDetails = []; $customerDetails = [];
$processedCustomerIDs = []; $processedCustomerIDs = [];
$subscriptionIDs = []; $subscriptionIDs = [];

View File

@ -1652,8 +1652,8 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
let messages = "Earlier Membership : <br>"; let messages = "Earlier Membership : <br>";
for (let i = 0; i < cm.length; i++) { for (let i = 0; i < cm.length; i++) {
let text1 = cm[i].is_renew > 1 ? " - Renewed" : ""; let text1 = cm[i].is_renew > 1 ? " - Renewed" : "";
let text2 = cm[i].isactive != 1 ? " - Draft" : ""; let text2 = cm[i].invoice_status != 'Approved' ? " - Draft" : "";
let text3 = cm[i].status == 0 ? ' - Expired ': " - Active"; let text3 = cm[i].status == 0 ? ' - Expired ': " - Active";
messages += cm[i].title + "<br> ( From: " + cm[i].formatted_from_subscription + " To: " + cm[i].formatted_to_subscription + " )" + text1 + text2 + text3+ " <br>"; messages += cm[i].title + "<br> ( From: " + cm[i].formatted_from_subscription + " To: " + cm[i].formatted_to_subscription + " )" + text1 + text2 + text3+ " <br>";
} }
@ -1667,9 +1667,12 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d
for(i=0;i<cm.length;i++){ for(i=0;i<cm.length;i++){
membership_id = cm[i].membership_id; membership_id = cm[i].membership_id;
if(cm[i].renewed == null){
console.log(cm[i]); console.log(cm[i]);
$('#membership_id').append('<option value="' + membership_id+i + '">' +cm[i].short_code + ' - '+ membership_id+' ' +cm[i].formatted_from_subscription + " To: " + cm[i].formatted_to_subscription +'</option>'); $('#membership_id').append('<option value="' + membership_id+i + '">' +cm[i].short_code + ' - '+ membership_id+' ' +cm[i].formatted_from_subscription + " To: " + cm[i].formatted_to_subscription +'</option>');
}
}
}
}else{ }else{
$('#membership_id_div').hide(); $('#membership_id_div').hide();
} }

View File

@ -3,6 +3,9 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&display=swap" rel="stylesheet">
<style> <style>
@page { @page {
size: 148mm 210mm; size: 148mm 210mm;
@ -16,9 +19,11 @@
/* align-items: flex-start; */ /* align-items: flex-start; */
/* } */ /* } */
body { body {
/* font-family: 'Times New Roman', Times, sans-serif; */ /* font-family: 'Times New Roman', Times, sans-serif; */
font-family: Nunito Sans;
font-size: 10px; font-size: 10px;
color: black !important; color: black !important;
/* font-size: 8pt; */ /* font-size: 8pt; */
@ -58,7 +63,6 @@
left: 320px; left: 320px;
gap: 0px; gap: 0px;
opacity: 0px; opacity: 0px;
font-family: Nunito Sans;
font-size: 10px; font-size: 10px;
font-weight: 400; font-weight: 400;
line-height: 13.64px; line-height: 13.64px;
@ -75,7 +79,6 @@
/* Style for the table containing - addresses details */ /* Style for the table containing - addresses details */
table.addresses-table { table.addresses-table {
width: 100%; width: 100%;
font-family: Nunito Sans;
font-size: 10px; font-size: 10px;
font-weight: 400; font-weight: 400;
line-height: 13.64px; line-height: 13.64px;
@ -125,6 +128,8 @@
border: none; border: none;
/* Remove borders from all cells in the invoice items table */ /* Remove borders from all cells in the invoice items table */
padding: 8px; padding: 8px;
font-size: 10px;
} }
/* Style for the table containing - invoice-related details header */ /* Style for the table containing - invoice-related details header */
@ -157,18 +162,42 @@
} }
/* Style for the table containing - footer-table details */ /* Style for the table containing - footer-table details */
table.footer-table { table.footer-table {
font-family: Nunito Sans;
font-size: 10px; font-size: 10px;
font-weight: 400; font-weight: 400;
line-height: 13.64px; line-height: 13.64px;
color: #989898; color: #989898;
} }
table td{
font-size: 10px;
}
table h4{
font-size: 12px;
}
table small{
font-size: 10px;
}
/* Common Style for all */ /* Common Style for all */
p { p {
margin-top: 0; margin-top: 0;
margin-bottom: 0rem; margin-bottom: 0rem;
} }
@media screen {
body, .business-address-container,table.addresses-table, table.footer-table, table td, table.invoice-related-table th, table.invoice-related-table td {
font-family:Nunito Sans;
}
}
@media print {
body{
font-family:"Times New Roman", Times, serif;
}
table td, table.invoice-related-table th, table.invoice-related-table td{
font-family:"Times New Roman", Times, serif;
}
}
</style> </style>
</head> </head>
@ -262,7 +291,7 @@
<td style="display:flex;align-items:flex-start"> <td style="display:flex;align-items:flex-start">
<?= $serialNumber++; ?> <?= $serialNumber++; ?>
</td> </td>
<td><span style="font-size:10pt"><?= $item->title ?></span><br> <td><?= $item->title ?><br>
<span><?php if ($item->description != '') { ?><span style="font-size:6pt"><?php echo $item->description ?></span><?php } ?></span> <span><?php if ($item->description != '') { ?><span style="font-size:6pt"><?php echo $item->description ?></span><?php } ?></span>
</td> </td>
<td style="align-content: flex-start;text-align: start;"><?= $item->quantity ?></td> <td style="align-content: flex-start;text-align: start;"><?= $item->quantity ?></td>

View File

@ -71,7 +71,6 @@
if ($currentDate > $toDateTime) { if ($currentDate > $toDateTime) {
$daysRemaining = -$daysRemaining; $daysRemaining = -$daysRemaining;
} }
log_message('info',json_encode($row['renewed']));
if ($daysRemaining < 0) { if ($daysRemaining < 0) {
$class = 'text-danger'; $class = 'text-danger';
$message = "Expired" . ($row['renewed'] != null ? " " . '(Renewed)' : ''); $message = "Expired" . ($row['renewed'] != null ? " " . '(Renewed)' : '');