From 23b24aecb79c0777871ca5e2d7b0477c6cc77c03 Mon Sep 17 00:00:00 2001 From: heama Date: Tue, 9 Apr 2024 16:45:38 +0530 Subject: [PATCH] product --- app/Controllers/Products.php | 20 +++++++++++++++----- app/Controllers/Sales.php | 4 ++-- app/Views/product_form.php | 33 ++++++++++++++++++++++++++------- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index f76fa8a..cf686d3 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -6,7 +6,7 @@ use App\Models\ProductModel; use App\Models\BikemakeModel; use App\Models\VendorModel; use App\Models\BikemodelsModel; - + class Products extends BaseController { @@ -44,14 +44,24 @@ class Products extends BaseController $data['page_name']="Add Product"; } else if ($product_id !== '0') { $data['page_name']="Edit Product"; + $ProductModel = new ProductModel(); + $products=$ProductModel->where('product_id', $product_id)->get()->getRowArray(); + + $data['products']=$products; + $BikemakeModel = new BikemakeModel(); $data['make'] = $BikemakeModel->findAll(); - $ProductModel = new ProductModel(); + $BikemodelsModel = new BikemodelsModel(); + $make_id = $products['make_id']; + $data['models'] = $BikemodelsModel->where('make_id', $make_id)->findAll(); + $tax=$ProductModel->getTax(); $data['tax']=$tax; - - $products=$ProductModel->where('product_id', $product_id)->get()->getRowArray(); - $data['products']=$products; + $VendorModel = new VendorModel(); + $data['vendors']=$VendorModel->findAll(); + + + // print_r($data);die; } $data['product_id'] = $product_id; diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php index a2b85f9..af2e330 100644 --- a/app/Controllers/Sales.php +++ b/app/Controllers/Sales.php @@ -63,7 +63,7 @@ class Sales extends BaseController $data['page_name']="Edit Sale Order"; $ClientModel = new ClientModel(); $client=$ClientModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); -$SalesOrderModel = new SalesOrderModel(); +$SalesOrderModel = new SalesOrderModel(); $sales=$SalesOrderModel->where('sales_order_id', $sales_order_id)->get()->getRowArray(); $data['sales']=$sales; $VehicleModel = new VehicleModel(); @@ -71,7 +71,7 @@ $vehicles = $VehicleModel->where('isactive',1)->where('vehicle_id',$sales['vehic ->where('branch_id',$this->session->get('logged_user_branch_id')) ->first(); $makeId = $vehicles['make']; - $modelId = $vehicles['model']; + $modelId = $vehicle['model']; // Encode the modelId before searching $encodedModelId = json_encode([$modelId]); diff --git a/app/Views/product_form.php b/app/Views/product_form.php index cc44005..8531590 100644 --- a/app/Views/product_form.php +++ b/app/Views/product_form.php @@ -1,4 +1,5 @@ +
@@ -27,18 +28,29 @@
- - -
+ + +
+
@@ -48,6 +60,13 @@