diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 861406c1..de22087a 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -421,6 +421,7 @@ $routes->post('getSilicaIGR', 'Supplier::getSilicaIGR'); //Stock Module $routes->get('coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails'); +$routes->post('coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails'); $routes->post('addNewCoatingMachineDetails' , 'StockController::addNewCoatingMachineDetails'); $routes->post('updateCoatingMachineDetails','StockController::updateCoatingMachineDetails'); $routes->get('deleteCoatingMachineDetails' , 'StockController::deleteCoatingMachineDetails'); diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 6f1f2c49..b2901432 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -37,13 +37,34 @@ class StockController extends BaseController public function loadView_coatingMachineDetails(){ + if ($this->request->getMethod() === 'POST'){ + $month = $this->request->getPost('month'); + + $date = DateTime::createFromFormat('M-Y', $month); + + $formattedDate = $date->format('Y-m'); + + $month=$formattedDate; + } + else{ + $month = date('Y-m'); + // dd($month); + } + $this->global['pageTitle'] = 'Coating Machine Details '; $data['coatingMachineDetails']= $this->coatingMachineDetails_model ->where('is_active', 1) ->orderBy('created_at','DESC') + ->like('created_at', $month, 'after') ->findAll(); + $date = DateTime::createFromFormat('Y-m', $month); + + $formattedDate = $date->format('M-Y'); + + $data['month']=$formattedDate; + return $this->loadViews("CoatingMachineDetail", $this->global, $data, NULL); } diff --git a/app/Views/CoatingMachineDetail.php b/app/Views/CoatingMachineDetail.php index af5ab65d..8ae76f9e 100644 --- a/app/Views/CoatingMachineDetail.php +++ b/app/Views/CoatingMachineDetail.php @@ -64,7 +64,9 @@ } - + + + @@ -113,8 +115,27 @@