diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 0ac0388..940a4f5 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -6,6 +6,7 @@ use App\Models\ProductModel; use App\Models\BikemakeModel; use App\Models\VendorModel; use App\Models\BikemodelsModel; + use App\Models\ManufacturerModel; class Products extends BaseController @@ -60,6 +61,8 @@ class Products extends BaseController $data['make'] = $BikemakeModel->findAll(); $VendorModel = new VendorModel(); $data['vendors']=$VendorModel->findAll(); + $ManufacturerModel = new ManufacturerModel(); + $data['manufacturers']=$ManufacturerModel->findAll(); $data['page_name']="Add Product"; } else if ($product_id !== '0') { $data['page_name']="Edit Product"; @@ -78,9 +81,12 @@ class Products extends BaseController $data['tax']=$tax; $VendorModel = new VendorModel(); $data['vendors']=$VendorModel->findAll(); - - // print_r($data);die; - + $ManufacturerModel = new ManufacturerModel(); + $data['manufacturers']=$ManufacturerModel->findAll(); + $preferredVendorId = $products['prefered_vendor']; + // Pass the preferred vendor ID to the view + $data['preferredVendorId'] = $preferredVendorId; // print_r($data);die; + // print_r($data);die; } $data['product_id'] = $product_id; @@ -99,7 +105,7 @@ class Products extends BaseController 'product_name' => $this->request->getPost('productname'), 'product_category' => $this->request->getPost('productcategory'), 'mfr_part_no' => $this->request->getPost('mfr_part_no'), - 'serial_no' => $this->request->getPost('serial_no'), + 'unit_price' => $this->request->getPost('unit_price'), 'commision_rate' => $this->request->getPost('commision_rate'), 'sgst' => $tax, @@ -114,11 +120,14 @@ class Products extends BaseController 'quality' => $this->request->getPost('quality'), 'make_id' => $this->request->getPost('make'), 'models_id' => json_encode($this->request->getPost('model')), + 'rack_number' => $this->request->getPost('rack_number'), + 'manufacturer_id' => $this->request->getPost('manufacturer'), + 'prefered_vendor' => $this->request->getPost('prefered_vendor'), 'isactive' => 1 , 'branch_id' => $this->session->get('logged_user_branch_id') ]; -// print_r($data);die; - + + // print_r($data);die; $product_id = $this->request->getPost('product_id'); @@ -131,7 +140,7 @@ class Products extends BaseController $product_id = $ProductModel->getInsertID(); } - $orderNumber = 'SKU-' . date('md') . '-' . str_pad($product_id, 5, '0', STR_PAD_LEFT); + $orderNumber = 'TM' . str_pad($product_id, 8, '0', STR_PAD_LEFT); // print_r($orderNumber);die; // Update sales order with generated order number $ProductModel->update($product_id, ['sku_id' => $orderNumber]); diff --git a/app/Models/ManufacturerModel.php b/app/Models/ManufacturerModel.php index 4ce777f..174e858 100644 --- a/app/Models/ManufacturerModel.php +++ b/app/Models/ManufacturerModel.php @@ -5,7 +5,7 @@ class ManufacturerModel extends Model { protected $table = 'manufacturer'; protected $primaryKey = 'manufacturer_id'; - protected $allowedFields = ['manufacturer_id','manufacturer_name','isactive','quantity']; + protected $allowedFields = ['manufacturer_id','manufacturer_name','isactive','quality']; } \ No newline at end of file diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index d7f0ae2..2c7de1f 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -5,7 +5,7 @@ class ProductModel extends Model { protected $table = 'products'; protected $primaryKey = 'product_id'; - protected $allowedFields = ['sku_id','product_id','manufacturer_id','make_id','models_id','quality','product_name','branch_id','search_tag','product_category','mfr_part_no','purchase_order_level','serial_no','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive']; + protected $allowedFields = ['sku_id','product_id','rack_number','manufacturer_id','make_id','models_id','quality','product_name','branch_id','prefered_vendor','product_category','mfr_part_no','purchase_order_level','unit_price','commision_rate','sgst','cgst','purchase_cost','usage_unit','vendor','qty_stock','reorder_level','handler','qty_in_demand','product_image','description','isactive']; public function getTax() diff --git a/app/Views/product_form.php b/app/Views/product_form.php index c42505b..62f3159 100644 --- a/app/Views/product_form.php +++ b/app/Views/product_form.php @@ -56,6 +56,28 @@
+ + +
+
+ + +
+ +
+ + +
+
- - -
- + + + + +
- - + +
- - -
-
- - + +
@@ -282,4 +302,82 @@ document.addEventListener('DOMContentLoaded', function() { font-weight: 500; border-bottom: 1px solid #747474; } - \ No newline at end of file + + + + + + diff --git a/app/Views/product_list.php b/app/Views/product_list.php index f69d39b..9741f8f 100644 --- a/app/Views/product_list.php +++ b/app/Views/product_list.php @@ -30,9 +30,9 @@ + SKU Id Product Name Category - Serial Number Unit Price Qty in Stock Sgst @@ -46,10 +46,10 @@ + - - + % %