diff --git a/app/Controllers/Jobcard.php b/app/Controllers/Jobcard.php index 8651939..4c9527d 100644 --- a/app/Controllers/Jobcard.php +++ b/app/Controllers/Jobcard.php @@ -400,7 +400,11 @@ class Jobcard extends BaseController $VehicleModel = new VehicleModel(); $vehicle = $VehicleModel->getCustomerandVehicle($this->session->get('logged_user_branch_id')); $ProductModel = new ProductModel(); - $product=$ProductModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); + $product=$ProductModel->select('products.*, manufacturer.manufacturer_name') + ->join('manufacturer', 'products.manufacturer_id = manufacturer.manufacturer_id') + ->where('products.isactive',1) + ->where('products.branch_id',$this->session->get('logged_user_branch_id')) + ->findAll(); $ServiceModel = new ServiceModel(); // echo $this->session->get('logged_user_branch_id');die; $service=$ServiceModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); @@ -444,9 +448,11 @@ class Jobcard extends BaseController foreach ($servicedata as &$value) { // sub product datas $product_ids = !empty(json_decode($value['product_id'], true)) ? json_decode($value['product_id'], true) : [0]; - $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock') - ->join('products', 'products.product_id = job_card_product.product_id') - ->whereIn('job_card_product.job_card_product_id', $product_ids)->findAll(); + + $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock, manufacturer.manufacturer_name') + ->join('products', 'products.product_id = job_card_product.product_id') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->whereIn('job_card_product.job_card_product_id', $product_ids)->findAll(); $value['product'] = $product; // sub service data @@ -464,9 +470,11 @@ class Jobcard extends BaseController // Using '&' to reference the original array element foreach ($complaintdata as &$value) { $product_ids = !empty(json_decode($value['product_id'], true)) ? json_decode($value['product_id'], true) : [0]; - $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock') - ->join('products', 'products.product_id = job_card_product.product_id') - ->whereIn('job_card_product_id', $product_ids)->findAll(); + $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock,manufacturer.manufacturer_name') + ->join('products', 'products.product_id = job_card_product.product_id') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->whereIn('job_card_product_id', $product_ids) + ->findAll(); $value['product'] = $product; } $data['editcomplaintdata'] = $complaintdata; @@ -476,9 +484,11 @@ class Jobcard extends BaseController // Using '&' to reference the original array element foreach ($ccomplaintdata as &$value) { $product_ids = !empty(json_decode($value['product_id'], true)) ? json_decode($value['product_id'], true) : [0]; - $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock') - ->join('products', 'products.product_id = job_card_product.product_id') - ->whereIn('job_card_product_id', $product_ids)->findAll(); + $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock, manufacturer.manufacturer_name') + ->join('products', 'products.product_id = job_card_product.product_id') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->whereIn('job_card_product_id', $product_ids) + ->findAll(); $value['product'] = $product; } $data['editccomplaintdata'] = $ccomplaintdata; @@ -488,9 +498,11 @@ class Jobcard extends BaseController // Using '&' to reference the original array element foreach ($os_data as &$value) { $product_ids = !empty(json_decode($value['product_id'], true)) ? json_decode($value['product_id'], true) : [0]; - $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock') - ->join('products', 'products.product_id = job_card_product.product_id') - ->whereIn('job_card_product_id', $product_ids)->findAll(); + $product = $JobcardProductModel->select('job_card_product.* , products.product_name as pname, products.qty_stock, manufacturer.manufacturer_name') + ->join('products', 'products.product_id = job_card_product.product_id') + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') + ->whereIn('job_card_product_id', $product_ids) + ->findAll(); $value['product'] = $product; } $data['editosdata'] = $os_data; @@ -524,12 +536,14 @@ class Jobcard extends BaseController // Encode the modelId before searching $encodedModelId = json_encode([$makeId]); $encoded_make_id = json_encode(['0']); - $product1 = $productModel + $product1 = $productModel->select('products.* , manufacturer.manufacturer_name') ->where('JSON_CONTAINS(make_id, \'' . $encodedModelId . '\')', null, false) + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') ->where('qty_stock >',0) ->findAll(); - $product2 = $productModel + $product2 = $productModel->select('products.* , manufacturer.manufacturer_name') ->orWhere('JSON_CONTAINS(make_id, \'' . $encoded_make_id . '\')', null, false) + ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id') ->where('qty_stock >',0) ->findAll(); $product = array_merge($product1, $product2); diff --git a/app/Controllers/Purchase.php b/app/Controllers/Purchase.php index bc63b5a..671508d 100644 --- a/app/Controllers/Purchase.php +++ b/app/Controllers/Purchase.php @@ -219,7 +219,6 @@ class Purchase extends BaseController 'shipping_postal_code' => $this->request->getPost('shipping_postal_code'), 'bill_number' => $this->request->getPost('bill_number')? $this->request->getPost('bill_number') : '', 'return_date' => $this->request->getPost('return_date') ? $this->request->getPost('return_date') : '', - 'terms_condition' => $this->request->getPost('terms_condition'), 'branch_id'=> $this->session->get('logged_user_branch_id'), ]; @@ -249,9 +248,7 @@ class Purchase extends BaseController $unitprice=$this->request->getPost('unit-price'); $selected_items=$this->request->getPost('selected_items'); $purchase_order_child_id = $this->request->getPost('purchase_order_child_id'); - // print_r($selected_items);die; - - // print_r($status);die; + $status = $this->request->getPost('purchase_status'); foreach ($product_ids as $key => $product_id) { $qty = isset($quantities[$key]) ? $quantities[$key] : 0; diff --git a/app/Controllers/Service.php b/app/Controllers/Service.php index 1b523b5..b60b71f 100644 --- a/app/Controllers/Service.php +++ b/app/Controllers/Service.php @@ -81,8 +81,11 @@ class Service extends BaseController $service=$ServiceModel->where('isactive',1)->where('category','0')->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); // echo $this->session->get('logged_user_branch_id');die; $data['service']=$service; - $product=$ProductModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); - // echo json_encode($service);die; + $product=$ProductModel->select('products.*, manufacturer.manufacturer_name') + ->join('manufacturer', 'products.manufacturer_id = manufacturer.manufacturer_id') + ->where('products.isactive',1) + ->where('products.branch_id',$this->session->get('logged_user_branch_id')) + ->findAll(); // echo json_encode($service);die; $data['product']=$product; $data['page_name']="Add Service"; } else if ($service_id !== '0') { @@ -95,7 +98,11 @@ class Service extends BaseController $data['page_name']="Edit Service"; - $product=$ProductModel->where('isactive',1)->where('branch_id',$this->session->get('logged_user_branch_id'))->findAll(); + $product=$ProductModel->select('products.*, manufacturer.manufacturer_name') + ->join('manufacturer', 'products.manufacturer_id = manufacturer.manufacturer_id') + ->where('products.isactive',1) + ->where('products.branch_id',$this->session->get('logged_user_branch_id')) + ->findAll(); $data['product']=$product; $models = []; diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php index 651acf9..b118bc8 100644 --- a/app/Views/job_card_form.php +++ b/app/Views/job_card_form.php @@ -533,6 +533,7 @@ $(document).ready(async function() { data.labour_cost = 0; total_wih_tax = Number(data.labour_cost) + (Number(data.labour_cost) * (data.tax / 100)); total_tax_amt = Number(data.labour_cost) * (data.tax / 100); + var newRow = '