From 456eb596eeceea70e641664cbd660acfa8de4e35 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 11 Feb 2025 12:14:29 +0530 Subject: [PATCH] stock module latest today vadivel J 11-02-2025 --- app/Controllers/StockController.php | 36 ++++++++++++++++++++++-- app/Views/stock/CoatingMachineDetail.php | 9 ++++-- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index fe8173f9..3fc57845 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -1973,7 +1973,37 @@ class StockController extends BaseController { - $currentMonth = $this->request->getPost('month') ? $this->request->getPost('month') : date('M-Y'); + //drier will be processing different method than other stock in case of session stock month and date format for generating + //dummy data and updating the data . be cautious while updating the code..!! + + if ($this->request->getMethod() === 'POST') { + + $currentMonth = $this->request->getPost('month'); + + $date = DateTime::createFromFormat('M-Y', $currentMonth); //in M-Y format + + $formattedDate = $date->format('Y-m'); //in Y-m format + + + $session = session (); + + $session->set('stock_month',$formattedDate); + + + } else { + + $session = session(); + + $currentMonth = $session->get('stock_month'); + + if (empty($currentMonth)) { + $currentMonth = date('M-Y'); // Default to the current month + }else{ + $currentMonth = DateTime::createFromFormat('Y-m', $currentMonth); // in Y-m format + + $currentMonth = $currentMonth->format('M-Y'); // in M-Y format + } + } $monthData = $this->getMonthDatesFromInput($currentMonth); @@ -2139,9 +2169,9 @@ class StockController extends BaseController $month = $this->request->getPost('month'); - $date = DateTime::createFromFormat('M-Y', $month); + $date = DateTime::createFromFormat('M-Y', $month); //in M-Y format - $formattedDate = $date->format('Y-m'); + $formattedDate = $date->format('Y-m'); //in Y-m format $month = $formattedDate; diff --git a/app/Views/stock/CoatingMachineDetail.php b/app/Views/stock/CoatingMachineDetail.php index f9e667b6..4ff0b62b 100644 --- a/app/Views/stock/CoatingMachineDetail.php +++ b/app/Views/stock/CoatingMachineDetail.php @@ -947,7 +947,7 @@ @@ -1704,8 +1704,13 @@ data: { id: batchId }, success: function (response) { if(response.status == "200"){ - alert("Batch file deleted successfully!"); + alert("Batch File Deleted Successfully!"); $(this).closest('.batch-container').remove(); // Remove from UI + location.reload(); // Reload the page + + } else{ + alert("Removed Empty batch file"); + // alert("Error deleting batch file: " + response.message); } }, error: function (xhr, status, error) {