From 1667722bb39593bb94848d6bacbda29c6da5ab3c Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 28 May 2024 12:37:56 +0000 Subject: [PATCH] CHANGE_calculaton : ps --- app/Controllers/ApiIntegration.php | 5 ++++- app/Views/invoice_form.php | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/Controllers/ApiIntegration.php b/app/Controllers/ApiIntegration.php index 1faa7b55..c2faab9f 100644 --- a/app/Controllers/ApiIntegration.php +++ b/app/Controllers/ApiIntegration.php @@ -953,8 +953,10 @@ class ApiIntegration extends ResourceController }); $fromDate = NULL; $toDate = NULL; + $duration = 0; for ($x = 0; $x < count($result_book_category); $x++) { - $duration = $result_book_category[$x]['duration'] * 12; + $duration = isset($result_book_category[$x]['duration']) && $result_book_category[$x]['duration'] != '' && (int)$result_book_category[$x]['duration'] > 0 ? $result_book_category[$x]['duration'] * 12 : 1 * 12; + $this->logger->info("Api SaveSalesDetails : Duration - Given : " .$result_book_category[$x]['duration']." Final : ".$duration); $fromDateTimestamp = strtotime($records['date_created']); $toDateTimestamp = strtotime("+$duration months", $fromDateTimestamp); $fromDate = date("Y-m-d", strtotime($records['date_created'])); @@ -963,6 +965,7 @@ class ApiIntegration extends ResourceController $scheme_id = $result_book_category[$x]['book_id']; $dataToCheck = ['scheme_id'=>$scheme_id,'customer_id' => $local_customer_id,'invoice_id' => $invoice_id ]; $existing_subscription = $api_model->getData('subscription', $dataToCheck); + if (count($existing_subscription) > 0) { $this->logger->info("Api SaveSalesDetails : Subscription ".count($existing_subscription)." data already exists = ".json_encode($dataToCheck)); } else { diff --git a/app/Views/invoice_form.php b/app/Views/invoice_form.php index ccb40aeb..ff51cccf 100644 --- a/app/Views/invoice_form.php +++ b/app/Views/invoice_form.php @@ -173,7 +173,7 @@ " name="amount[]" value="" readonly /> - " name="discount_amount[]" oninput="calculateInvoice(this,)" value="" min="0" step="1" /> + " name="discount_amount[]" oninput="calculateInvoice(this,)" value="" min="0" step="0.001" /> @@ -216,7 +216,7 @@ - + @@ -255,16 +255,16 @@
- +
- + - > + min="0" step="0.001" >
@@ -311,22 +311,22 @@
- +
- +
- +
- +
@@ -779,10 +779,10 @@ // cell1.innerHTML = ''; cell1.innerHTML += ''; cell2.innerHTML = ''; - cell3.innerHTML = ''; - cell4.innerHTML = ''; - cell5.innerHTML = ''; - cell6.innerHTML = ''; + cell3.innerHTML = ''; + cell4.innerHTML = ''; + cell5.innerHTML = ''; + cell6.innerHTML = ''; cell7.innerHTML = ''; cell8.innerHTML = '
'; $(newRow.querySelector('.book-select')).select2();