diff --git a/app/Controllers/Configurationctrl.php b/app/Controllers/Configurationctrl.php index 33b81260..0bcbc51c 100755 --- a/app/Controllers/Configurationctrl.php +++ b/app/Controllers/Configurationctrl.php @@ -107,6 +107,7 @@ class Configurationctrl extends BaseController $data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID); $data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID,$isActiveFilter); + $data['ConfigID'] = $ConfigID; $this->global['pageTitle'] = 'Edit Config'; @@ -252,8 +253,10 @@ class Configurationctrl extends BaseController $configId = $data['ConfigID']; $configValue = $data['ConfigValue']; $key = $data['key']??''; + $userId = $data['userId']; - $result = $this->configmodel->saveConfigValue($key,$configId, $configValue); + + $result = $this->configmodel->saveConfigValue($key,$configId, $configValue,$userId); if($result){ return $this->response->setJSON(['status'=>true]); diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index 990f37ef..e79e5a68 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -289,7 +289,7 @@ class Rawmaterialdetails extends BaseController $data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode(); $data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID); $data['materialRateHistory'] = $this->rawmaterialdetails_model->getMaterialRateHistory($RawMaterialID); - $data['materialListPage'] = $_GET['page']; + $data['materialListPage'] = $_GET['page']??1; //print_r($data['avg_price']);die(); $this->global['pageTitle'] = 'Edit Material Master'; @@ -318,7 +318,7 @@ class Rawmaterialdetails extends BaseController $stock = $this->request->getPost('openstock'); $reorder = $this->request->getPost('reorder'); $stockdate = $this->request->getPost('Date'); - $materialListPage = $this->request->getPost('materialListPage'); + $materialListPage = $this->request->getPost('materialListPage') ?? 1; $stockdate = (empty($stockdate)) ? NULL : get_date_time_dynamical_format('d-m-Y','Y-m-d',"$stockdate"); $chked = $this->request->getPost('isactive'); diff --git a/app/Models/Config_model.php b/app/Models/Config_model.php index 32e0d7a4..9531473c 100755 --- a/app/Models/Config_model.php +++ b/app/Models/Config_model.php @@ -96,10 +96,24 @@ class Config_model extends Model { //echo $ConfigID ;die(); $builder = $this->db->table('t_configmaster COM') - ->select('*') - ->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left') - ->where('COM.Config_ID', $ConfigID) - ->where('con.isActive', $isActiveFilter); + ->select('COM.*, + con.*, + creator_emp.FirstName AS created_by, + updater_emp.FirstName AS updated_by + ') + ->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left') + + // Join for Created By + ->join('tbl_users creator', 'creator.userId = con.created_by', 'left') + ->join('t_employee_details creator_emp', 'creator_emp.EmpID = creator.EmpID', 'left') + // Join for Updated By + ->join('tbl_users updater', 'updater.userId = con.updated_by', 'left') + ->join('t_employee_details updater_emp', 'updater_emp.EmpID = updater.EmpID', 'left') + + ->where('COM.Config_ID', $ConfigID) + ->where('con.isActive', $isActiveFilter); + + $query = $builder->get(); return $query->getResult(); @@ -288,7 +302,7 @@ return $result; } - public function saveConfigValue($key,$configId, $configValue){ + public function saveConfigValue($key,$configId, $configValue,$userId){ @@ -297,7 +311,8 @@ return $result; ->where('Config_ID', $configId) ->where('key',$key) ->update([ - 'ConfigValue'=> $configValue + 'ConfigValue'=> $configValue, + 'updated_by' => $userId ]); $res = $this->db->affectedRows(); return $res; @@ -308,6 +323,7 @@ return $result; [ 'ConfigValue'=>$configValue, 'Config_ID'=>$configId, + 'created_by'=> $userId, 'isActive'=> 1]); $res = $this->db->affectedRows(); return $res; diff --git a/app/Views/attendance.php b/app/Views/attendance.php index 8d32e346..f476585e 100755 --- a/app/Views/attendance.php +++ b/app/Views/attendance.php @@ -256,16 +256,19 @@ $currentday = date('d');