diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 2b6be303..7f5a3ad8 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -406,5 +406,15 @@ $routes->get('deleteFactoryMachineMasterDetails' , 'FactoryMachineController $routes->get('loadView_createFactoryMachineMasterDetail','FactoryMachineController::loadView_createFactoryMachineMasterDetail'); $routes->get('loadView_updateFactoryMachineMasterDetail','FactoryMachineController::loadView_updateFactoryMachineMasterDetail'); - +//routes for getSilicaIgr $routes->post('getSilicaIGR', 'Supplier::getSilicaIGR'); + + + + +//Stock Module + +$routes->get('coatingMachineDetails' , 'StockController::loadView_coatingMachineDetails'); +$routes->post('addNewCoatingMachineDetails' , 'StockController::addNewCoatingMachineDetails'); + + diff --git a/app/Controllers/FactoryMachineController.php b/app/Controllers/FactoryMachineController.php index d6aaa4d1..467da5bc 100644 --- a/app/Controllers/FactoryMachineController.php +++ b/app/Controllers/FactoryMachineController.php @@ -81,7 +81,7 @@ class FactoryMachineController extends BaseController $this->global['pageTitle'] = 'Factory Machine Master Details'; - $data['masterData'] = $this->factoryMachineMaster_model->where('is_active', 1) + $data['masterData'] = $this->factoryMachineMaster_model ->where('is_active', 1) ->orderBy('created_at','DESC') ->findAll(); diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php new file mode 100644 index 00000000..0cf51a7b --- /dev/null +++ b/app/Controllers/StockController.php @@ -0,0 +1,119 @@ +coatingMachineDetails_model = new CoatingMachineDetailsModel(); + + $this->session = session(); + helper('form'); + + $this->isLoggedIn(); + } + + public function index() + { + // + } + + public function loadView_coatingMachineDetails(){ + + $this->global['pageTitle'] = 'Coating Machine Details '; + + $data['coatingMachineDetails']= $this->coatingMachineDetails_model + ->where('is_active', 1) + ->orderBy('created_at','DESC') + ->findAll(); + + return $this->loadViews("CoatingMachineDetail", $this->global, $data, NULL); + + } + + public function addNewCoatingMachineDetails(){ + + $postData=$this->request->getPost(); + + $machineOnTime = $postData['machineOnTime']; + $machineOffTime = $postData['machineOffTime']; + + $onTime = new DateTime($machineOnTime); + $offTime = new DateTime($machineOffTime); + + $timeDifference = $onTime->diff($offTime); + + $machineRunningInHrs = $timeDifference->h ; + + $postData['machineRunningInHrs'] = $machineRunningInHrs; + $postData['perHourGasConsumption']= (float)$postData['totalGasConsumption']/$machineRunningInHrs; + $postData['perHourCoatingSandQTY']= (float)$postData['totalCoatingSandInKg']/$machineRunningInHrs; + + //dd( $postData['perHourCoatingSandQTY']); + + $inserted= $this->coatingMachineDetails_model->insert($postData); + + if ($inserted) { + // Set flashdata for success message + return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details updated successfully'); + } else { + // Set flashdata for error message + return redirect()->back()->with('error', 'Failed to update Coating machine details'); + } + + } + + public function updateCoatingMachineDetails(){ + + $putData=$this->request->getPost(); + + $id = $this->request->getGet('id'); + + $updated= $this->coatingMachineDetails_model->update($id,$putData); + + if ($updated) { + // Set flashdata for success message + return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details updated successfully'); + } else { + // Set flashdata for error message + return redirect()->back()->with('error', 'Failed to update Coating machine details'); + } + + + } + + public function deleteCoatingMachineDetails(){ + + $id = $this->request->getGet('id'); + + $data['is_active']=0; + + $updated = $this->coatingMachineDetails_model->update($id,$data); + + if ($updated) { + // Set flashdata for success message + return redirect()->to('/coatingMachineDetails')->with('success', 'Coating Machine details deleted successfully'); + } else { + // Set flashdata for error message + return redirect()->back()->with('error', 'Failed to delete Coating machine details'); + } + } + + + + +} diff --git a/app/Models/CoatingMachineDetailsModel.php b/app/Models/CoatingMachineDetailsModel.php new file mode 100644 index 00000000..1e353d11 --- /dev/null +++ b/app/Models/CoatingMachineDetailsModel.php @@ -0,0 +1,48 @@ + + #datatable_filter { + float: inline-end; + } + + #datatable_wrapper .row .col-sm-4 { + flex-basis: 50%; + float: inline-end; + } + + #datatable_paginate .pagination { + flex-basis: 50%; + float: inline-end; + margin: 0 0 15px; + } + + #datatable_wrapper .row:nth-child(3), + #datatable_wrapper .row:nth-child(1) { + padding: 0 15px; + } + + #datatable_info { + margin-top: 5px; + } + + .dataTables_wrapper { + padding-bottom: 0; + } + + .Date-filter-form { + display: flex; + align-items: center; + gap: 10px; + /* Adjust the gap as needed */ + } + + .Date-filter-form input, + .Date-filter-form button { + padding: 5px; + font-size: 14px; + } + + .Date-filter-form button { + background-color: #007bff; + color: white; + border: none; + cursor: pointer; + } + + .Date-filter-form button:hover { + background-color: #0056b3; + } + + .icon-button { + background: none; + border: none; + cursor: pointer; + color: #007bff; + font-size: 18px; + } + + .icon-button:hover { + color: #0056b3; + } + + + + + + +
+
+ +
+ +
+ getFlashdata('error'); + if ($error) { + $type = "error"; + echo show_alert($type, $error); + } + $success = session()->getFlashdata('success'); + if ($success) { + $type = "success"; + echo show_alert($type, $success); + } + ?> +
+
+
+

+ +
+
+
+ + +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Customer NameDateShiftMachine On TimeMachine Off TimeMachine Running (hrs)Total CoatingTotal Coating Sand (kgs)Total Gas ConsumptionPer Hour Gas ConsumptionPer Hour Coating Sand QTYAction
+ + +     + + + + + + +     + + + + + +
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index a77ce46c..85e60b79 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -661,6 +661,20 @@ + + +