diff --git a/app/Config/Routes.php b/app/Config/Routes.php index e1720c0..e3e8baa 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -214,4 +214,6 @@ $routes->get('dashboard', 'Users::dashboard'); $routes->get('outsourcing_index', 'Outsourcing::outsourcing_index'); $routes->post('create_os', 'Outsourcing::create_os'); $routes->get('edit_os/(:any)', 'Outsourcing::edit_OS/$1'); + $routes->get("delete_outsource/(:any)", "Outsourcing::delete_outsource/$1"); + // Complaint End's diff --git a/app/Controllers/Outsourcing.php b/app/Controllers/Outsourcing.php index fe5b66b..f9d744c 100644 --- a/app/Controllers/Outsourcing.php +++ b/app/Controllers/Outsourcing.php @@ -75,5 +75,21 @@ class Outsourcing extends BaseController return json_encode($data); } + public function delete_outsource($id) + { + + if (!empty($id)) { + $OutsourceModel = new OutsourceModel(); + $data['is_active'] = 0; + if ($OutsourceModel->update($id, $data)) { + // Return success response + return redirect()->to('outsourcing_index'); + } + } + + // Return error response if deletion fails + return $this->response->setJSON(['success' => false]); + } + } ?> \ No newline at end of file diff --git a/app/Controllers/Products.php b/app/Controllers/Products.php index 3f63340..d7b3dd0 100644 --- a/app/Controllers/Products.php +++ b/app/Controllers/Products.php @@ -429,7 +429,12 @@ class Products extends BaseController public function product_list_for_service(){ $ProductModel = new ProductModel(); - $products = $ProductModel->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); + // Assuming you have a model for products and one for manufacturers + $products = $ProductModel + ->select('products.*, manufacturer.manufacturer_name') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->where('products.branch_id', $this->session->get('logged_user_branch_id')) + ->findAll(); return $this->response->setJSON($products); } diff --git a/app/Controllers/ReturnOrder.php b/app/Controllers/ReturnOrder.php index b5baf98..70ba8fe 100644 --- a/app/Controllers/ReturnOrder.php +++ b/app/Controllers/ReturnOrder.php @@ -37,6 +37,7 @@ class ReturnOrder extends BaseController $return = $this->returnModel->findAll(); $data['return']=$return; + // echo "
";
// dd($data);
return view('return_order_liist',$data);
}
@@ -97,7 +98,7 @@ class ReturnOrder extends BaseController
$purchase_product=$PurchaseOrderChildModel->where('purchase_order_id', $purchase_order_id)->where('received_qty >', 0)->where('is_selected', 1)->findAll();
$data['purchase_product'] = $purchase_product;
-
+
echo view('return_order_form',$data);
}
diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php
index e584780..5b0f9c6 100644
--- a/app/Controllers/Sales.php
+++ b/app/Controllers/Sales.php
@@ -60,6 +60,7 @@ class Sales extends BaseController
->join('manufacturer', 'products.manufacturer_id = manufacturer.manufacturer_id')
->where('products.isactive', 1)
->where('products.branch_id', $this->session->get('logged_user_branch_id'))
+ ->where('products.isactive', 1)
->findAll();
// echo "";
// print_r($product);die;
@@ -111,6 +112,7 @@ class Sales extends BaseController
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId1 . '\')', null, false)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId1 . '\')', null, false)
->where('qty_stock >',0)
+ ->where('products.isactive',1)
->findAll();
$product = array_merge($common_product, $makemodelproduct);
@@ -477,6 +479,7 @@ public function getProducts()
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->where('qty_stock >',0)
+ ->where('products.isactive', 1)
->findAll();
$encodedMakeId = json_encode(['0']);
@@ -487,6 +490,7 @@ public function getProducts()
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
->where('qty_stock >',0)
+ ->where('products.isactive', 1)
->findAll();
$product = array_merge($common_product, $makeproduct);
diff --git a/app/Controllers/Service.php b/app/Controllers/Service.php
index b60b71f..8932f83 100644
--- a/app/Controllers/Service.php
+++ b/app/Controllers/Service.php
@@ -239,8 +239,15 @@ class Service extends BaseController
$products = [];
array_push($model_ids,'0');
foreach ($model_ids as $modelId) {
- $product = $ProductModel->where('JSON_CONTAINS(models_id, \'["' . $modelId . '"]\')', null, false)
- ->findAll();
+ // Assuming $ProductModel is your Product model class
+ // and you have a Manufacturer model class for the manufacturers table
+
+ $product = $ProductModel->select('products.*, manufacturer.manufacturer_name AS manufacturer_name')
+ ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
+ ->where('products.isactive', 1)
+ ->where('JSON_CONTAINS(products.models_id, \'["' . $modelId . '"]\')', null, false)
+ ->findAll();
+
$products = array_merge($products, $product);
}
@@ -282,7 +289,7 @@ class Service extends BaseController
}
}
}
-
+ // print_r($formatted_models);die;
// Send the formatted models as JSON response back to the client
return $this->response->setJSON($formatted_models);
}
diff --git a/app/Controllers/Vehicle.php b/app/Controllers/Vehicle.php
index 560d9db..6ce20e8 100644
--- a/app/Controllers/Vehicle.php
+++ b/app/Controllers/Vehicle.php
@@ -62,8 +62,9 @@ class Vehicle extends BaseController
$client=$ClientModel->where('branch_id', $this->session->get('logged_user_branch_id'))->findAll();
$data['client']=$client;
}
+ // dd($vehicle);
$data['vehicle_id'] = $vehicle_id;
- $data['makeData'] =$this->bikeMakeModel->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
+ $data['makeData'] =$this->bikeMakeModel->where('make_id', $vehicle['make'])->where('business_id', $this->session->get('logged_user_business_id'))->findAll();
return view('vehicle_form',$data);
}
diff --git a/app/Models/PurchaseOrderModel.php b/app/Models/PurchaseOrderModel.php
index aab9f6e..61d920f 100644
--- a/app/Models/PurchaseOrderModel.php
+++ b/app/Models/PurchaseOrderModel.php
@@ -10,7 +10,7 @@ class PurchaseOrderModel extends Model
public function getPurchaseOrdersWithProducts($logged_user_branch_id)
{
// Select required fields from both tables
- $this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name,SUM(purchase_order_child.qty) AS purchase_qty ');
+ $this->select('purchase_order.*, COUNT(purchase_order_child.purchase_order_id) AS product_count,vendor.vendor_name,SUM(purchase_order_child.qty) AS purchase_qty, purchase_order_child.received_qty');
// Join the sales_order_product table based on sales_order_id
$this->join('purchase_order_child', 'purchase_order_child.purchase_order_id = purchase_order.purchase_order_id');
diff --git a/app/Views/edit_return_order.php b/app/Views/edit_return_order.php
index bd03259..633d53d 100644
--- a/app/Views/edit_return_order.php
+++ b/app/Views/edit_return_order.php
@@ -125,7 +125,7 @@
@@ -70,7 +70,7 @@
Add Outsourcing
-