diff --git a/app/Controllers/Rawmaterialdetails.php b/app/Controllers/Rawmaterialdetails.php index 1a1829f5..dee4db6e 100755 --- a/app/Controllers/Rawmaterialdetails.php +++ b/app/Controllers/Rawmaterialdetails.php @@ -8,6 +8,8 @@ use CodeIgniter\Validation\Exceptions\ValidationException; use App\Models\Rawmaterialdetails_model; +use App\Models\MaterialCategoriesModel; + use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; @@ -26,6 +28,7 @@ use PhpOffice\PhpSpreadsheet\Style\Alignment; class Rawmaterialdetails extends BaseController { protected $rawmaterialdetails_model; + protected $materialCategories_model; protected $session; /** @@ -34,7 +37,8 @@ class Rawmaterialdetails extends BaseController public function __construct() { parent::__construct(); - $this->rawmaterialdetails_model = new Rawmaterialdetails_model();; + $this->rawmaterialdetails_model = new Rawmaterialdetails_model(); + $this->materialCategories_model = new MaterialCategoriesModel(); $this->session = session(); helper('form'); //$this->load->library('form_validation'); // $this->load->library('pagination'); @@ -90,6 +94,7 @@ class Rawmaterialdetails extends BaseController $this->rawmaterialdetails_model = new rawmaterialdetails_model();; $data['material'] = $this->rawmaterialdetails_model->getmaterialType(); $data['materialcategory'] = $this->rawmaterialdetails_model->getmaterialCategory(); + $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); $data['UOM'] = $this->rawmaterialdetails_model->getUOM(); $data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode(); $data['costcentercode'] = $this->rawmaterialdetails_model->getcostcentercode(); @@ -241,6 +246,7 @@ class Rawmaterialdetails extends BaseController $data['currentstock'] = $this->rawmaterialdetails_model->getMaterialstock($RawMaterialID, $currentdate); $data['materialType'] = $this->rawmaterialdetails_model->getmaterialType($MaterialType); $data['materialCategory'] = $this->rawmaterialdetails_model->getmaterialCategory($MaterialCategory); + $data['materialCategoryList']= $this->materialCategories_model->where('is_active',1)->findAll(); $data['UOMList'] = $this->rawmaterialdetails_model->getUOM($UOM); $data['costcentercode'] = $this->rawmaterialdetails_model->getCostCenterCode(); $data['cfUOM'] = $this->rawmaterialdetails_model->getConversionfactorUOM(); diff --git a/app/Models/MaterialCategoriesModel.php b/app/Models/MaterialCategoriesModel.php new file mode 100644 index 00000000..ddc06640 --- /dev/null +++ b/app/Models/MaterialCategoriesModel.php @@ -0,0 +1,62 @@ + 'required|max_length[255]', + + ]; + protected $validationMessages = [ + 'category_name' => [ + 'required' => 'The category name is required.', + 'max_length' => 'The category name cannot exceed 255 characters.' + ], + + ]; + protected $skipValidation = false; + protected $cleanValidationRules = true; + + // Callbacks + protected $allowCallbacks = true; + protected $beforeInsert = []; + protected $afterInsert = []; + protected $beforeUpdate = []; + protected $afterUpdate = []; + protected $beforeFind = []; + protected $afterFind = []; + protected $beforeDelete = []; + protected $afterDelete = []; + + + //all methods starts from here + + +} + + diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 329e8161..2f6225d9 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -69,6 +69,8 @@ class Rawmaterialdetails_model extends Model return $query->getResult(); } + + //This function used to get the conversionfactor using configdetails table function getConversionfactorUOM($ConversionFactorUOM = '') { @@ -116,8 +118,6 @@ class Rawmaterialdetails_model extends Model */ function getMaterialDetails($MaterialCode) { - - $sql = " SELECT * FROM t_materialmaster WHERE MaterialCode ='$MaterialCode'"; $query = $this->db->query($sql); return $query->getResult(); diff --git a/app/Views/addRawMaterial.php b/app/Views/addRawMaterial.php index 37fdcbe3..66f53417 100755 --- a/app/Views/addRawMaterial.php +++ b/app/Views/addRawMaterial.php @@ -66,10 +66,23 @@ ?> -