CHANGE_add_common_product:ss
This commit is contained in:
parent
573fe1de87
commit
6b25c16edf
@ -264,15 +264,9 @@ echo $html;die;
|
||||
$data['make_model'] = $make_name['make'].' ' . $model_name['model_name'];
|
||||
// Encode the modelId before searching
|
||||
$encodedModelId = json_encode([$makeId]);
|
||||
// echo $encodedModelId;die;
|
||||
// Load the ProductModel
|
||||
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$product = $productModel
|
||||
// ->where('make_id', $makeId)
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->findAll();
|
||||
// array_push($makeId, 0);
|
||||
// array_push($modelId, 0);
|
||||
$product = $productModel->where('JSON_CONTAINS(make_id, \'' . $encodedModelId . '\')', null, false)->findAll();
|
||||
$data['product']=$product;
|
||||
|
||||
// echo json_encode($product);die;
|
||||
|
||||
@ -155,7 +155,7 @@ class Products extends BaseController
|
||||
'mfr_part_no' => $this->request->getPost('mfr_part_no'),
|
||||
|
||||
'unit_price' => $this->request->getPost('unit_price'),
|
||||
'commision_rate' => $this->request->getPost('commision_rate'),
|
||||
// 'commision_rate' => $this->request->getPost('commision_rate'),
|
||||
'sgst' => $tax,
|
||||
'cgst' => $tax,
|
||||
'purchase_cost' => $this->request->getPost('purchase_cost'),
|
||||
|
||||
@ -453,13 +453,23 @@ public function getProducts()
|
||||
$productModel = new ProductModel();
|
||||
|
||||
// Query the database to find the product based on make_id and model_id
|
||||
$product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
$makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->findAll();
|
||||
// print_r($product);die;
|
||||
|
||||
$encodedMakeId = json_encode(['0']);
|
||||
$encodedModelId = json_encode(['0']);
|
||||
|
||||
$common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
|
||||
->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
|
||||
->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId . '\')', null, false)
|
||||
->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false)
|
||||
->where('qty_stock >',0)
|
||||
->findAll();
|
||||
$product = array_merge($common_product, $makeproduct);
|
||||
|
||||
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
|
||||
$makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
|
||||
|
||||
@ -229,7 +229,7 @@ class Service extends BaseController
|
||||
|
||||
$ProductModel = new ProductModel();
|
||||
$products = [];
|
||||
|
||||
array_push($model_ids,'0');
|
||||
foreach ($model_ids as $modelId) {
|
||||
$product = $ProductModel->where('JSON_CONTAINS(models_id, \'["' . $modelId . '"]\')', null, false)
|
||||
->findAll();
|
||||
|
||||
@ -921,7 +921,7 @@ $(window).on('load', function() {
|
||||
const labourcost = async (cost,tax,tr,cls) => {
|
||||
total_wih_tax = parseInt(cost) + (parseInt(cost) * (tax / 100));
|
||||
total_tax_amt = total_wih_tax - parseInt(cost);
|
||||
var newRow = '<tr class="'+cls+'"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
||||
var newRow = '<tr class="'+cls+'"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fas fa-user-alt" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
||||
'<td style="width:10%;"><input type="text" class="form-control rate-d-only" value="'+cost+'" readonly /></td>' +
|
||||
'<td style="width:10%;" hidden><input type="text" class="form-control item-rate" name="unit-price[]" value="'+cost+'" /></td>' +
|
||||
'<td style="width:10%;"><input type="number" class="form-control item-quantity-'+cls+' item-quantity" min="0" name="quantity[]" value="'+1+'" /></td>' +
|
||||
@ -1239,7 +1239,7 @@ $(window).on('load', function() {
|
||||
'<td hidden><input type="hidden" name="id" value=""></td>' +
|
||||
'</tr>';
|
||||
|
||||
newRow += '<tr class="custom_complaint_lb"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fa fa-caret-right" style="font-size: 20px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
||||
newRow += '<tr class="custom_complaint_lb"><td hidden style="width:10%;"><input type="number" class="form-control labour_cost" name="labour_cost"></td><td style="padding-left: 40px !important;"><i class="fas fa-user-alt" style="font-size: 13px;margin-top: 8px;position: absolute;margin-left: -18px;" aria-hidden="true"></i><input type="text" class="form-control labour_cost" value="Labour Cost"></td>' +
|
||||
'<td style="width:10%;" hidden><input type="text" class="form-control rate-d-only" readonly /></td>' +
|
||||
'<td style="width:10%;"><input type="text" class="form-control item-rate item-rate_cc" name="unit-price[]" value="" readonly/></td>' +
|
||||
'<td style="width:10%;"><input type="number" class="form-control item-quantity" min="0" name="quantity[]" value="'+1+'" readonly /></td>' +
|
||||
|
||||
Loading…
Reference in New Issue
Block a user