diff --git a/app/Controllers/Invoice.php b/app/Controllers/Invoice.php index 352ced82..d301457f 100644 --- a/app/Controllers/Invoice.php +++ b/app/Controllers/Invoice.php @@ -1202,7 +1202,7 @@ class Invoice extends BaseController ## Invoice Line Item.. $invoice_child_id = $requestData['invoice_child_id']; - $count = count($invoice_child_id); + $count = count($invoice_child_id); if ($count > 0) { for ($x = 0; $x < $count; $x++) { if (!empty($requestData['item_details'][$x])) { @@ -1249,7 +1249,7 @@ class Invoice extends BaseController $subscription_where = [ 'customer_id' => $customer_id, 'invoice_id' => $invoice_id, - 'scheme_id' => $product_id + 'isactive' => 1 ]; } $subs_aff_row = $model->updateData('subscription', $subscription_data, $subscription_where); diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index 6fbf975c..bfb9767d 100644 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -1287,7 +1287,13 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d var fromDateValue = "= isset($invoice_item_details[0]['from_subscription']) ? $invoice_item_details[0]['from_subscription'] : ""; ?>"; if (fromDateValue != '') { - updateToDateMinDate(fromDateValue) + fromDateValue = formatDate(fromDateValue); + updateToDateMinDate(fromDateValue); + } + + function formatDate(dateString) { + const dateParts = dateString.split('-'); + return `${dateParts[2]}/${dateParts[1]}/${dateParts[0]}`; } $("#editAddressesCheckbox").on("change", function() { @@ -1555,14 +1561,22 @@ if (isset($invoice_item_details[0]['to_subscription']) && !empty($invoice_item_d invoiceDateInput.setAttribute("min", minDate); invoiceDateInput.setAttribute("max", maxDate); - const fromsubcriptionDateInput = document.getElementById("fromsubcription"); - fromsubcriptionDateInput.setAttribute("max", maxDate); + // const fromsubcriptionDateInput = document.getElementById("fromsubcription"); + // fromsubcriptionDateInput.setAttribute("max", maxDate); + + document.getElementById("fromsubcription").onchange = function() { + const toDateInput = document.getElementById('tosubcription'); + toDateInput.value = ''; // Clear the value of the "To Subscription" field + + const fromDateValue = this.value; + updateToDateMinDate(fromDateValue); + }; function updateToDateMinDate(fromDateValue) { const toDateInput = document.getElementById('tosubcription'); - toDateInput.min = fromDateValue; - // toDateInput.setAttribute('data-date-end-date', fromDateValue); - toDateInput.setAttribute('data-date-start-date', fromDateValue); + toDateInput.setAttribute('data-date-start-date', fromDateValue); // Optional if you're using this attribute for something else + + // Update the minimum date for the datepicker $(toDateInput).datepicker('setStartDate', fromDateValue); } @@ -1993,7 +2007,34 @@ function saveInvoiceCustomer() { }); diff --git a/app/Views/invoice_pdf_template.php b/app/Views/invoice_pdf_template.php index 2fceb7be..e0e5e23f 100644 --- a/app/Views/invoice_pdf_template.php +++ b/app/Views/invoice_pdf_template.php @@ -390,7 +390,7 @@
|
- |