Live Issues addresses are not printing fixes : ps

This commit is contained in:
VE10-Sanjeev 2024-04-02 19:00:10 +05:30
parent 85bf5336bc
commit da41a90bd9
10 changed files with 1401 additions and 1345 deletions

View File

@ -49,7 +49,7 @@ $routes->get('dashboard/', 'Home::index');
# Users Routes # Users Routes
$routes->get("user_list/", "Users::index"); $routes->get("user_list/", "Users::index");
$routes->get("user_page/(:any)", "Users::user_page/$1"); $routes->get("user_page/(:any)/(:any)", "Users::user_page/$1/$2");
$routes->post("insert_users", "Users::insert_users"); $routes->post("insert_users", "Users::insert_users");
$routes->get('users/fetch_event_names', 'Users::fetch_event_names'); $routes->get('users/fetch_event_names', 'Users::fetch_event_names');

View File

@ -742,8 +742,10 @@ class ApiIntegration extends ResourceController
$billing_addr = NULL;$shipping_addr = NULL; $billing_addr = NULL;$shipping_addr = NULL;
$lineitems_array = []; $lineitems_array = [];
$billing_array = []; $shipping_array = []; $billing_array = []; $shipping_array = [];
$lineitems_subtotal = 0; $lineitems_tax = 0; $lineitems_subtotal = 0; ## for lineitem product wise price total
$lineitems_discount = 0; $lineitems_total=0; $lineitems_tax = 0; ## for lineitem product wise tax
$lineitems_discount = 0; ## for lineitem product wise discount
$lineitems_total=0; ## for lineitem grand total
// $line_items = ; // $line_items = ;
@ -794,7 +796,8 @@ class ApiIntegration extends ResourceController
} }
} }
$subtotal = (float)$lineitems_subtotal + (float)$records['shipping_total']; // $subtotal = (float)$lineitems_subtotal + (float)$records['shipping_total'];
$subtotal = (float)$lineitems_subtotal;
$tax = $lineitems_tax + (float)$records['shipping_tax']; $tax = $lineitems_tax + (float)$records['shipping_tax'];
$total = ($lineitems_total)+(float)$records['shipping_total'] + (float)$records['shipping_tax']; $total = ($lineitems_total)+(float)$records['shipping_total'] + (float)$records['shipping_tax'];
$final_status = ''; $final_status = '';
@ -830,7 +833,8 @@ class ApiIntegration extends ResourceController
$invoice_data['subtotal']=(int)$subtotal; $invoice_data['subtotal']=(int)$subtotal;
$invoice_data['tax']=(int)$tax; $invoice_data['tax']=(int)$tax;
$invoice_data['discount']=(int)$lineitems_discount; $invoice_data['discount']=(int)$lineitems_discount;
$invoice_data['total_amount']= $records['total']; $invoice_data['total_amount']= round($records['total']);
$invoice_data['exact_total_amount']= (float)$records['total'];
$invoice_data['payment_status']=$records['status']; $invoice_data['payment_status']=$records['status'];
$invoice_data['order_number']=$records['order_key']; $invoice_data['order_number']=$records['order_key'];
$invoice_data['payment_method']=$records['payment_method_title']; $invoice_data['payment_method']=$records['payment_method_title'];

File diff suppressed because it is too large Load Diff

View File

@ -49,12 +49,13 @@ class Users extends BaseController
} }
## To Load User Add/Update page ## To Load User Add/Update page
public function user_page($id) public function user_page($id,$flag)
{ {
helper('session'); helper('session');
$session_role = get_user_role(); $session_role = get_user_role();
$session_bid = get_business_id(); $session_bid = get_business_id();
$session_uid = get_logged_user_id(); $session_uid = get_logged_user_id();
$data['dummy_flag'] = $flag; // for redirect purpose.
if ($id === '0') { if ($id === '0') {
$this->logger->info("Users: In Add page"); $this->logger->info("Users: In Add page");
$data['page_name'] = 'Add User'; $data['page_name'] = 'Add User';
@ -247,7 +248,12 @@ class Users extends BaseController
$this->logger->error("Users: Err Occur =".$e->getMessage()); $this->logger->error("Users: Err Occur =".$e->getMessage());
session()->setFlashdata('error', 'Message: ' .$e->getMessage()); session()->setFlashdata('error', 'Message: ' .$e->getMessage());
} }
return redirect()->route('user_list'); // Redirect back to the user_page function or any other appropriate page
if($this->request->getPost('dummy_flag') == 1){
return redirect()->to(base_url("user_page/{$user_id}/1"));
}else{
return redirect()->route('user_list');
}
} }
## For delete the user details (Which means inactive the details) ## For delete the user details (Which means inactive the details)

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,30 @@
<style> <style>
/* CSS for modal content */ /* CSS for modal content */
#pdfPreviewModal .modal-dialog { #pdfPreviewModal .modal-dialog {
max-width: 210mm; /* A5 width */ max-width: 210mm;
/* A5 width */
width: auto; width: auto;
margin: 1.75rem auto; margin: 1.75rem auto;
} }
#pdfPreviewModal .modal-body { #pdfPreviewModal .modal-body {
font-family: 'Apple System', 'BlinkMacSystemFont', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: 'Apple System', 'BlinkMacSystemFont', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 14px; font-size: 14px;
} }
.table-responsive{
.table-responsive {
font-family: 'Apple System', 'BlinkMacSystemFont', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-family: 'Apple System', 'BlinkMacSystemFont', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
font-size: 12px; font-size: 12px;
} }
#printPdfButton .ri-printer-line { #printPdfButton .ri-printer-line {
font-size: 8px; font-size: 8px;
} }
.modal-lg, .modal-xl {
max-width: 678px; .modal-lg,
} .modal-xl {
max-width: 678px;
}
</style> </style>
@ -28,7 +33,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="float-right"> <div class="float-right">
</div> </div>
<br> <br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4> <h4 class="header-title mb-3"><?= $page_name; ?></h4>
@ -75,7 +80,7 @@
</td> </td>
<td class="preview-pdf" data-order="<?= strtotime($row['invoice_date']); ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $invoice_date; ?></td> <td class="preview-pdf" data-order="<?= strtotime($row['invoice_date']); ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $invoice_date; ?></td>
<td class="preview-pdf" data-order="<?= $row['customer_name']; ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['customer_name']; ?></td> <td class="preview-pdf" data-order="<?= $row['customer_name']; ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['customer_name']; ?></td>
<td class="preview-pdf" data-order="<?= $row['status']; ?>;" id="status-column" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['status']; ?></td> <td class="preview-pdf" data-order="<?= $row['status']; ?>;" id="status-column" data-invoice-id="<?= $row['invoice_id']; ?>"><?= $row['status']; ?></td>
<td class="preview-pdf" data-order="<?= $row['total_amount']; ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= "" . $row['total_amount']; ?></td> <td class="preview-pdf" data-order="<?= $row['total_amount']; ?>" data-invoice-id="<?= $row['invoice_id']; ?>"><?= "" . $row['total_amount']; ?></td>
<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>&nbsp; <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>&nbsp;
@ -117,19 +122,19 @@
<div class="modal fade" id="pdfPreviewModal" tabindex="-1" role="dialog" aria-labelledby="pdfPreviewModalLabel" aria-hidden="true"> <div class="modal fade" id="pdfPreviewModal" tabindex="-1" role="dialog" aria-labelledby="pdfPreviewModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg"> <div class="modal-dialog modal-lg">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title" id="pdfPreviewModalLabel"></h5> <h5 class="modal-title" id="pdfPreviewModalLabel"></h5>
<!-- Placeholder for status --> <!-- Placeholder for status -->
<a href="#" class="" id="downloadPdfButton" title="Invoice PDF" style="font-size: large;"><i class="ri-file-download-line"></i> </a> <a href="#" class="" id="downloadPdfButton" title="Invoice PDF" style="font-size: large;"><i class="ri-file-download-line"></i> </a>
<a href="#" class="ri-printer-line" id="printPdfButton" title="Print Invoice" style="font-size: large; margin-left: 8px;"></a> <a href="#" class="ri-printer-line" id="printPdfButton" title="Print Invoice" style="font-size: large; margin-left: 8px;"></a>
<button type="button" class="close" data-dismiss="modal" aria-label="Close" style="font-size: 27px; margin-bottom: 2px;"> <button type="button" class="close" data-dismiss="modal" aria-label="Close" style="font-size: 27px; margin-bottom: 2px;">
<span id="statusText"></span> <span id="statusText"></span>
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<!-- PDF content will be loaded here --> <!-- PDF content will be loaded here -->
</div> </div>
<!-- <div class="modal-footer"> <!-- <div class="modal-footer">
@ -171,48 +176,52 @@
$(document).ready(function() { $(document).ready(function() {
var actionColumnIndex = $('#action-column').index(); var actionColumnIndex = $('#action-column').index();
$('#scroll-horizontal-datatable_wrapper').DataTable({ $('#scroll-horizontal-datatable_wrapper').DataTable({
"order": [ [0, "desc"] ], // 4 is the column index of "created_on" in your table "order": [
"columnDefs": [{ "targets": [actionColumnIndex], "orderable": false }] [0, "desc"]
], // 4 is the column index of "created_on" in your table
"columnDefs": [{
"targets": [actionColumnIndex],
"orderable": false
}]
}); });
}); });
</script> </script>
<script> <script>
$(document).on('click', '.preview-pdf', function() { $(document).on('click', '.preview-pdf', function() {
var invoiceId = $(this).data('invoice-id'); var invoiceId = $(this).data('invoice-id');
// Send AJAX request to controller // Send AJAX request to controller
$.ajax({ $.ajax({
url: '<?= base_url('generate_invoice_pdf_preview/') ?>' + invoiceId, url: '<?= base_url('generate_invoice_pdf_preview/') ?>' + invoiceId,
type: 'GET', type: 'GET',
dataType: 'html', dataType: 'html',
success: function(response) { success: function(response) {
// Display the PDF content in a modal or an iframe // Display the PDF content in a modal or an iframe
$('#pdfPreviewModal .modal-body').html(response); $('#pdfPreviewModal .modal-body').html(response);
$('#downloadPdfButton').attr('href', '<?= base_url("generate_invoice_pdf/") ?>' + invoiceId); $('#downloadPdfButton').attr('href', '<?= base_url("generate_invoice_pdf/") ?>' + invoiceId);
// Get the status text
var status = $('.preview-pdf[data-invoice-id="' + invoiceId + '"]').closest('tr').find('#status-column').text().trim();
// Update the status in the modal header
$('#statusText').text('' + status);
// Hide the "Edit" button if the status is approved // Get the status text
if (status.toLowerCase() === 'approved') { var status = $('.preview-pdf[data-invoice-id="' + invoiceId + '"]').closest('tr').find('#status-column').text().trim();
$('#editInvoiceButton').hide();
} else { // Update the status in the modal header
$('#editInvoiceButton').show(); $('#statusText').text('' + status);
$('#editInvoiceButton').attr('href', '<?= base_url("new_book_invoice/") ?>' + invoiceId);
// Hide the "Edit" button if the status is approved
if (status.toLowerCase() === 'approved') {
$('#editInvoiceButton').hide();
} else {
$('#editInvoiceButton').show();
$('#editInvoiceButton').attr('href', '<?= base_url("new_book_invoice/") ?>' + invoiceId);
}
$('#pdfPreviewModal').modal('show');
},
error: function(xhr, status, error) {
console.error(error);
alert('Failed to load PDF preview.');
} }
});
$('#pdfPreviewModal').modal('show');
},
error: function(xhr, status, error) {
console.error(error);
alert('Failed to load PDF preview.');
}
}); });
});
</script> </script>
<script> <script>
// JavaScript click event handler for printing PDF // JavaScript click event handler for printing PDF
@ -240,6 +249,4 @@
}; };
}); });
}); });
</script> </script>

View File

@ -1,26 +1,30 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<style> <style>
/* Add your CSS styles here to format the invoice for mPDF */ /* Add your CSS styles here to format the invoice for mPDF */
body { body {
font-family: 'Times New Roman', Times, sans-serif;
font-size: 12px; /* Change this value to your desired font size */ font-family: 'Times New Roman', Times, sans-serif;
font-size: 12px;
/* Change this value to your desired font size */
} }
/* Style for the main table with border */ /* Style for the main table with border */
table.main-table { table.main-table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
border: -0.5px solid black; /* Add a border around the entire invoice */ border: -0.5px solid black;
/* Add a border around the entire invoice */
} }
table.main-table th, table.main-table th,
table.main-table td { table.main-table td {
border: none; /* Remove borders from all cells inside the main table */ border: none;
/* Remove borders from all cells inside the main table */
padding: 8px; padding: 8px;
} }
@ -41,7 +45,8 @@
} }
img.business-logo { img.business-logo {
max-width: 200px; /* Adjust the size of the logo */ max-width: 200px;
/* Adjust the size of the logo */
} }
/* Style for the business name */ /* Style for the business name */
@ -71,70 +76,83 @@
} }
/* Style for the billing and shipping addresses */ /* Style for the billing and shipping addresses */
.billing-address, .shipping-address { .billing-address,
.shipping-address {
width: 50%; width: 50%;
} }
/* Style for the invoice-related table */ /* Style for the invoice-related table */
table.invoice-related-table { table.invoice-related-table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
} }
table.invoice-related-table th, table.invoice-related-table th,
table.invoice-related-table td { table.invoice-related-table td {
border: none; /* Remove borders from all cells in the invoice items table */ border: none;
padding: 8px; /* Remove borders from all cells in the invoice items table */
text-align: center; /* Center-align text in cells */ padding: 8px;
} text-align: center;
/* Center-align text in cells */
}
table.invoice-related-table th { table.invoice-related-table th {
background-color: #f2f2f2; background-color: #f2f2f2;
font-weight: bold; font-weight: bold;
} }
/* Style for the business stamp and terms */ /* Style for the business stamp and terms */
.business-stamp, .terms { .business-stamp,
.terms {
text-align: center; text-align: center;
margin-top: 20px; margin-top: 20px;
} }
.subtotal-table { .subtotal-table {
width: 100%; width: 100%;
margin-top: 20px; margin-top: 20px;
} }
.subtotal-table table { .subtotal-table table {
width: 100%; width: 100%;
border-collapse: collapse; border-collapse: collapse;
border: 1px solid black; /* Add a border around the subtotal table */ border: 1px solid black;
} /* Add a border around the subtotal table */
}
.subtotal-table th, .subtotal-table th,
.subtotal-table td { .subtotal-table td {
border: none; /* Remove borders from cells inside the subtotal table */ border: none;
padding: 8px; /* Remove borders from cells inside the subtotal table */
text-align: right; padding: 8px;
} text-align: right;
}
.subtotal-table th { .subtotal-table th {
background-color: #f2f2f2; background-color: #f2f2f2;
font-weight: bold; font-weight: bold;
} }
.subtotal-table td:last-child { .subtotal-table td:last-child {
font-weight: bold; /* Make the last column (total values) bold */ font-weight: bold;
} /* Make the last column (total values) bold */
td.invoice-number { }
font-size: 18px; /* Increase font size to your desired value */
/* Highlight background color */ td.invoice-number {
font-weight: bold; /* Make the text bold */ font-size: 18px;
} /* Increase font size to your desired value */
p { /* Highlight background color */
margin-top: 0; font-weight: bold;
margin-bottom: 0rem; /* Make the text bold */
} }
p {
margin-top: 0;
margin-bottom: 0rem;
}
</style> </style>
</head> </head>
<body> <body>
<table class="main-table"> <table class="main-table">
<tr> <tr>
@ -144,15 +162,15 @@ p {
<tr> <tr>
<td class="business-logo-container"> <td class="business-logo-container">
<img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo"> <img src="https://vijayabharathambooks.com/wp-content/uploads/2021/09/vijaya-bharatham-logo-8pt.png" alt="Business Logo" class="business-logo">
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<p><?= $value->company_address ?>,<br> <p><?= $value->company_address ?>,<br>
<?= $value->company_city ?>, <?= $value->company_city ?>,
<?= $value->company_state ?> <?= $value->company_state ?>
<?= $value->company_postal_code ? " - ".$value->company_postal_code:"" ?>.</p> <?= $value->company_postal_code ? " - " . $value->company_postal_code : "" ?>.</p>
<p><?= $value->company_email ?></p> <p><?= $value->company_email ?></p>
<p><?= $value->company_mobile_no ?></p> <p><?= $value->company_mobile_no ?></p>
</td> </td>
@ -161,29 +179,29 @@ p {
</table> </table>
</td> </td>
<td> <td>
<table class="invoice-info-table"> <table class="invoice-info-table">
<?php foreach ($data as $value) : ?> <?php foreach ($data as $value) : ?>
<tr> <tr>
<th><?php echo ($value->wp_api_order_id) ? 'Order # ' . $value->invoice_number : 'Invoice # ' . $value->invoice_number; ?></th> <th><?php echo ($value->wp_api_order_id) ? 'Order # ' . $value->invoice_number : 'Invoice # ' . $value->invoice_number; ?></th>
</tr> </tr>
<tr> <tr>
<th>Invoice Date : <?= $value->formatted_invoice_date ?></th> <th>Invoice Date : <?= $value->formatted_invoice_date ?></th>
</tr> </tr>
<?php if ($value->due_date) : ?> <?php if ($value->due_date) : ?>
<tr> <tr>
<th>Due Date : <?= $value->formatted_due_date ?></th> <th>Due Date : <?= $value->formatted_due_date ?></th>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php if ($invoice_type === '2') : ?> <?php if ($invoice_type === '2') : ?>
<?php foreach ($invoiceItems as $item) : ?> <?php foreach ($invoiceItems as $item) : ?>
<tr> <tr>
<th>From Subscription : <?= date('d/m/y', strtotime($item->from_subscription)) ?></th> <th>From Subscription : <?= date('d/m/y', strtotime($item->from_subscription)) ?></th>
</tr> </tr>
<tr> <tr>
<th>To Subscription : <?= date('d/m/y', strtotime($item->to_subscription)) ?></th> <th>To Subscription : <?= date('d/m/y', strtotime($item->to_subscription)) ?></th>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
@ -200,30 +218,35 @@ p {
<tr> <tr>
<td class="billing-address"> <td class="billing-address">
<?php foreach ($data as $value) : ?> <?php foreach ($data as $value) : ?>
<?= $value->customer_name ?><br> <?= $value->customer_name ?><br>
<?= $value->customer_ship_address." ," ?><br> <?php if($value->customer_bill_address){ ?>
<?= $value->customer_ship_city ?>&nbsp;<?= $value->customer_ship_state ? $value->customer_bill_state :""?> <?= $value->customer_bill_address ? $value->customer_bill_address." ," : ""?><br>
<?= $value->customer_ship_postal_code ? " - ".$value->customer_ship_postal_code :""; ?> <?= $value->customer_bill_city ? $value->customer_bill_city : "" ?>&nbsp;<?= $value->customer_bill_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_ship_country ? $value->customer_ship_country . "." : $value->scountry ?><br> <?= $value->customer_bill_postal_code ? " - " . $value->customer_bill_postal_code : ""; ?>
<?= $value->customer_bill_country ? $value->customer_bill_country . "." : $value->bcountry ?><br>
<?= $value->mobile_no." ." ?> <?= $value->mobile_no ? $value->mobile_no." ." : "" ?>
<?php }else{
<?php endforeach; ?> echo $value->billing_address;
echo "<br>";
echo $value->mobile_no ? $value->mobile_no." ." : ""; } endforeach; ?>
</td> </td>
<td class="shipping-address"> <td class="shipping-address">
<?php foreach ($data as $value) : ?> <?php foreach ($data as $value) : ?>
<?= $value->customer_name ?><br> <?= $value->customer_name ?><br>
<?= $value->customer_bill_address." ," ?><br> <?php if($value->customer_ship_address){ ?>
<?= $value->customer_bill_city ?>&nbsp;<?= $value->customer_bill_state ? $value->customer_bill_state : "" ?> <?= $value->customer_ship_address ? $value->customer_ship_address." ," : "" ?><br>
<?= $value->customer_bill_postal_code ? " - ".$value->customer_bill_postal_code :""; ?> <?= $value->customer_ship_city ? $value->customer_ship_city : "" ?>&nbsp;<?= $value->customer_ship_state ? $value->customer_bill_state : "" ?>
<?= $value->customer_bill_country ? $value->customer_bill_country . "." : $value->bcountry ?><br> <?= $value->customer_ship_postal_code ? " - " . $value->customer_ship_postal_code : ""; ?>
<?= $value->customer_ship_country ? $value->customer_ship_country . "." : $value->scountry ?><br>
<?= $value->mobile_no." ." ?> <?= $value->mobile_no ? $value->mobile_no." ." : "" ?>
<?php endforeach; ?> <?php }else{
echo $value->shipping_address;
echo "<br>";
echo $value->mobile_no ? $value->mobile_no." ." : ""; } endforeach; ?>
</td> </td>
</tr> </tr>
</table> </table>
<br> <br> <br> <br>
<table class="invoice-related-table"> <table class="invoice-related-table">
<thead> <thead>
<tr> <tr>
@ -231,72 +254,72 @@ p {
<th>Item Name</th> <th>Item Name</th>
<th>Qty</th> <th>Qty</th>
<th>Rate</th> <th>Rate</th>
<th>Total</th> <th>Total</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $serialNumber = 1; ?> <?php $serialNumber = 1; ?>
<?php foreach ($invoiceItems as $item) : ?> <?php foreach ($invoiceItems as $item) : ?>
<tr> <tr>
<td> <td>
<?= $serialNumber++; ?> <?= $serialNumber++; ?>
</td> </td>
<td><?= $item->title ?></td> <td><?= $item->title ?></td>
<td><?= $item->quantity ?></td> <td><?= $item->quantity ?></td>
<td><?= number_format($item->unit_price, 2, '.', ',') ?></td> <td><?= number_format($item->unit_price, 2, '.', ',') ?></td>
<td><?= number_format($item->subtotal, 2, '.', ',') ?></td> <td><?= number_format($item->subtotal, 2, '.', ',') ?></td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</tbody> </tbody>
</table> </table>
<table class="subtotal-table"> <table class="subtotal-table">
<?php foreach ($data as $value) : ?> <?php foreach ($data as $value) : ?>
<tr> <tr>
<td colspan="5" align="right">Subtotal : &nbsp;&nbsp;<?= number_format($value->subtotal, 2, '.', ',') ?></td> <td colspan="5" align="right">Subtotal : &nbsp;&nbsp;<?= number_format($value->subtotal, 2, '.', ',') ?></td>
</tr> </tr>
<tr> <tr>
<td colspan="5" align="right">Discount : &nbsp;&nbsp;<?= $value->discount ? "(-)".number_format($value->discount, 2, '.', ','): number_format(0, 2, '.', ',') ?></td> <td colspan="5" align="right">Discount : &nbsp;&nbsp;<?= $value->discount ? "(-)" . number_format($value->discount, 2, '.', ',') : number_format(0, 2, '.', ',') ?></td>
</tr> </tr>
<!-- -->
<?php if ($value->shipping_label != '') : ?>
<tr>
<td colspan="5" align="right"><?= $value->shipping_label?> : &nbsp;&nbsp;₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
</tr>
<?php endif; ?>
<tr>
<?php <!-- -->
$sign = ($value->total_amount >= $value->exact_total_amount) ? '+' : '-'; <?php if ($value->shipping_label != '') : ?>
$difference = abs($value->exact_total_amount - $value->total_amount); <tr>
?> <td colspan="5" align="right"><?= $value->shipping_label ?> : &nbsp;&nbsp;₹<?= number_format($value->shipping_charge, 2, '.', ',') ?></td>
</tr>
<?php endif; ?>
<tr>
<td colspan="5" align="right"> Rounding : &nbsp;&nbsp;<?= $sign.number_format($difference, 2, '.', ',') ?></td> <?php
</tr> $sign = ($value->total_amount >= $value->exact_total_amount) ? '+' : '-';
<tr> $difference = abs($value->exact_total_amount - $value->total_amount);
<td colspan="5" align="right">Total : &nbsp;&nbsp;<?= number_format($value->total_amount, 2, '.', ',') ?></td> ?>
</tr>
<?php if ($value->status === 'Draft'): ?> <td colspan="5" align="right"> Rounding : &nbsp;&nbsp;<?= $sign . number_format($difference, 2, '.', ',') ?></td>
<!-- Set Balance if status is draft and paid is 0 --> </tr>
<tr> <tr>
<td colspan="5" align="right">Balance : &nbsp;&nbsp;<?= number_format($value->total_amount, 2, '.', ',') ?></td> <td colspan="5" align="right">Total : &nbsp;&nbsp;<?= number_format($value->total_amount, 2, '.', ',') ?></td>
</tr> </tr>
<?php endif; ?> <?php if ($value->status === 'Draft') : ?>
<?php if ($value->status === 'Approved'): ?> <!-- Set Balance if status is draft and paid is 0 -->
<tr> <tr>
<td colspan="5" align="right">Paid : &nbsp;&nbsp;<?= number_format($value->total_amount, 2, '.', ',') ?></td> <td colspan="5" align="right">Balance : &nbsp;&nbsp;<?= number_format($value->total_amount, 2, '.', ',') ?></td>
</tr> </tr>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php if ($value->status === 'Approved') : ?>
</table> <tr>
<td colspan="5" align="right">Paid : &nbsp;&nbsp;<?= number_format($value->total_amount, 2, '.', ',') ?></td>
</tr>
<?php endif; ?>
<?php endforeach; ?>
</table>
<div class="business-stamp"> <div class="business-stamp">
</div> </div>
<?php foreach ($data as $value) : ?> <?php foreach ($data as $value) : ?>
@ -305,27 +328,30 @@ p {
<!-- <if(!empty($value->notes)){ <!-- <if(!empty($value->notes)){
<br><p style="text-align: left !important;"><b>Notes:</b> $value->notes; ?></p> <br><p style="text-align: left !important;"><b>Notes:</b> $value->notes; ?></p>
} ?> --> } ?> -->
<?php if(!empty($value->reason)){ ?> <?php if (!empty($value->reason)) { ?>
<br><p style="text-align: left !important;"><b>Reason:</b> <?= $value->reason; ?></p> <br>
<p style="text-align: left !important;"><b>Reason:</b> <?= $value->reason; ?></p>
<?php } ?> <?php } ?>
<?php foreach ($invoiceTerms as $row) : <?php foreach ($invoiceTerms as $row) :
if (!empty($row->terms)) { ?> if (!empty($row->terms)) { ?>
<br><pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;"> <br>
<pre style="font-family: 'Times New Roman', Times, sans-serif; font-size: 12px; text-align: left;">
<?= $row->terms ?> <?= $row->terms ?>
</pre> </pre>
<?php } <?php }
endforeach; ?> endforeach; ?>
</div> </div>
<?php endforeach; ?> <?php endforeach; ?>
<!-- ... (your existing HTML template) --> <!-- ... (your existing HTML template) -->
<!-- Add this to the end of your HTML template --> <!-- Add this to the end of your HTML template -->
<!-- <img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png" /> --> <!-- <img src="https://cdn.pixabay.com/photo/2012/04/26/14/17/blue-42596_960_720.png" /> -->
</body> </body>
</html>
</html>

View File

@ -70,7 +70,7 @@
</div> </div>
<!-- item--> <!-- item-->
<a href="<?= base_url()."user_page/".$loggedin_person_id; ?>" class="dropdown-item notify-item"> <a href="<?= base_url()."user_page/".$loggedin_person_id."/1"; ?>" class="dropdown-item notify-item">
<i class="ri-account-circle-line"></i> <i class="ri-account-circle-line"></i>
<span>My Account</span> <span>My Account</span>
</a> </a>

View File

@ -42,7 +42,7 @@
<input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required> <input type="text" class="form-control" id="mobile_no" name="mobile_no" placeholder="Mobile Number (Enter only numbers)" data-toggle="input-mask" data-mask-format="0000000000" value="<?= isset($details['mobile_no']) ? $details['mobile_no'] : '' ?>" autofocus required>
</div> </div>
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="role" class="col-form-label">Role<span class="text-danger">*</span></label> <label for="role" class="col-form-label" id="role_label">Role<span class="text-danger">*</span></label>
<select id="role" name="role" class="form-control" required> <select id="role" name="role" class="form-control" required>
<option value="">Select Role</option> <option value="">Select Role</option>
<option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option> <option value="admin" <?= isset($details['role']) && $details['role'] === 'admin' ? 'selected' : '' ?>>Admin</option>
@ -126,6 +126,7 @@
<?php } ?> <?php } ?>
</div> </div>
<input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" /> <input type="hidden" id="user_id" name="user_id" placeholder="hidden for user id" value="<?= isset($details['user_id']) ? $details['user_id'] : '' ?>" />
<input type="hidden" id="dummy_flag" name="dummy_flag" placeholder="hidden for dummy flag redirect purpose" value="<?= isset($dummy_flag) ? $dummy_flag : '' ?>" />
<?php if (!empty($details) && $loggedin_person_role !== 'manager') { ?> <?php if (!empty($details) && $loggedin_person_role !== 'manager') { ?>
<div class="form-group text-right m-b-0 checkbox checkbox-purple"> <div class="form-group text-right m-b-0 checkbox checkbox-purple">
@ -250,6 +251,11 @@
<!-- Modify the existing JavaScript code --> <!-- Modify the existing JavaScript code -->
<script> <script>
$(document).ready(function () { $(document).ready(function () {
var flag_for_validations = "<?= isset($dummy_flag) ? $dummy_flag : '' ?>";
if (flag_for_validations == '1') {
$('#role_label').html('Role');
$('#role').removeAttr("required").prop('disabled', true);
}
// Function to show/hide the event name container based on the selected role // Function to show/hide the event name container based on the selected role
function toggleEventNameContainer() { function toggleEventNameContainer() {
var selectedRole = $('#role').val(); var selectedRole = $('#role').val();

View File

@ -3,7 +3,7 @@
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="float-right"> <div class="float-right">
<a href="<?= base_url()."user_page/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a> <a href="<?= base_url()."user_page/0/0"; ?>" class="btn btn-primary"><i class="ri-user-add-line"></i> Add User </a>
</div><!-- end col--> </div><!-- end col-->
<br> <br>
<h4 class="header-title mb-3"><?= $page_name; ?></h4> <h4 class="header-title mb-3"><?= $page_name; ?></h4>
@ -52,7 +52,7 @@
$class = 'badge badge-soft-danger'; $class = 'badge badge-soft-danger';
$message = 'In-Active'; $message = 'In-Active';
} }
$edit_page_route = base_url()."user_page/".$row['user_id']; $edit_page_route = base_url()."user_page/".$row['user_id']."/0";
$addressParts = array( $addressParts = array(
$row['address'], $row['address'],
$row['city'], $row['city'],