diff --git a/app/Controllers/Jobcard.php b/app/Controllers/Jobcard.php index de2156e..0576520 100644 --- a/app/Controllers/Jobcard.php +++ b/app/Controllers/Jobcard.php @@ -545,12 +545,24 @@ class Jobcard extends BaseController // $service = $ServiceModel->where('JSON_CONTAINS(makes_id, \'' . $encodedMakeId . '\')', null, false) // ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId . '\')', null, false) // ->findAll(); - $service = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false) + $service1 = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false) ->where('models_id LIKE \'%"' . $modelId . '"%\'', null, false) ->orWhere('category', 0) ->findAll(); + + $encodedMakeId1 = 0; + $encodedModelId1 = 0; + + $common_services = $ServiceModel->where('makes_id LIKE \'%"' . $encodedMakeId1 . '"%\'', null, false) + ->where('models_id LIKE \'%"' . $encodedModelId1 . '"%\'', null, false) + ->findAll(); + $service = array_merge($common_services, $service1); + + $data['product']=$product; $data['service']=$service; + // echo "
";
+ // print_r($service);die;
$jobs_product= $JobcardCustomComplaintModel->where('job_card_id', $job_card_id)->findAll();
$data['jobs_product']=$jobs_product;
$jobs_service= $JobcardServiceModel->where('job_card_id', $job_card_id)->findAll();
@@ -1155,11 +1167,23 @@ class Jobcard extends BaseController
$ServiceModel = new ServiceModel();
// Query the database to find the service based on make_id and model_id
- $service = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
+ $service1 = $ServiceModel->where('makes_id LIKE \'%"' . $makeId . '"%\'', null, false)
->where('models_id LIKE \'%"' . $modelId . '"%\'', null, false)
- ->where('category',0)
+ ->where('category',1)
->findAll();
+ $encodedMakeId1 = 0;
+ $encodedModelId1 =0;
+
+ $common_services = $ServiceModel->where('makes_id LIKE \'%"' . $encodedMakeId1 . '"%\'', null, false)
+ ->where('models_id LIKE \'%"' . $encodedModelId1 . '"%\'', null, false)
+ ->where('category',1)
+ ->findAll();
+
+ $service2 = $ServiceModel->where('category',0)
+ ->findAll();
+ $service = array_merge($common_services, $service1, $service2);
+
$modelName = $this->BikemodelsModel->where('model_id',$modelId)->get()->getRow()->model_name;
$makeName = $this->BikemakeModel->where('make_id',$makeId)->get()->getRow()->make;
diff --git a/app/Controllers/Sales.php b/app/Controllers/Sales.php
index 5a189cf..e584780 100644
--- a/app/Controllers/Sales.php
+++ b/app/Controllers/Sales.php
@@ -97,11 +97,24 @@ class Sales extends BaseController
$productModel = new ProductModel();
// Query the database to find the product based on make_id and model_id
- $product = $productModel->select('products.*, manufacturer.manufacturer_name')
+ $makemodelproduct = $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)
->findAll();
+
+ $encodedMakeId1 = json_encode(['0']);
+ $encodedModelId1 = json_encode(['0']);
+
+ $common_product = $productModel->select('products.*, manufacturer.manufacturer_name')
+ ->join('manufacturer', 'manufacturer.manufacturer_id = products.manufacturer_id')
+ ->where('JSON_CONTAINS(make_id, \'' . $encodedMakeId1 . '\')', null, false)
+ ->where('JSON_CONTAINS(models_id, \'' . $encodedModelId1 . '\')', null, false)
+ ->where('qty_stock >',0)
+ ->findAll();
+ $product = array_merge($common_product, $makemodelproduct);
+
+
$data['product']=$product;
$SalesProductOrderModel = new SalesOrderProductModel();
$sales_product=$SalesProductOrderModel->where('sales_order_id', $sales_order_id)->findAll();
@@ -451,6 +464,12 @@ public function getProducts()
// Load the ProductModel
$productModel = new ProductModel();
+ $bikemodelsModel = new BikemodelsModel();
+ $BikemakeModel = new BikemakeModel();
+
+ $makeGeneral = $BikemakeModel->where('make' , 'General')->first();
+ $modelGeneral = $bikemodelsModel->where('model_name' , 'General')->first();
+
// Query the database to find the product based on make_id and model_id
$makeproduct = $productModel->select('products.*, manufacturer.manufacturer_name')
diff --git a/app/Views/bike_model_list.php b/app/Views/bike_model_list.php
index b534914..67f0806 100644
--- a/app/Views/bike_model_list.php
+++ b/app/Views/bike_model_list.php
@@ -234,7 +234,7 @@
$('#form_add_edit').text('Edit Models');
- var full_div = $(params).parent().parent()[0];
+ var full_div = $(params).closest('tr')[0];
$('#modelname').val($(full_div).find('.model_name').text());
}
diff --git a/app/Views/complaint_list.php b/app/Views/complaint_list.php
index c7ceb47..e08b367 100644
--- a/app/Views/complaint_list.php
+++ b/app/Views/complaint_list.php
@@ -25,7 +25,6 @@
Labour Charge
Status
Actions
-
@@ -105,22 +104,20 @@
-
-
diff --git a/app/Views/job_card_form.php b/app/Views/job_card_form.php
index 23c6978..3c3b496 100644
--- a/app/Views/job_card_form.php
+++ b/app/Views/job_card_form.php
@@ -494,7 +494,7 @@ $(document).ready(async function() {
var edit_ccomplaint_data = ;
if(edit_ccomplaint_data.length > 0) {
for (const value of edit_ccomplaint_data) {
- var newRow = ' ' +
+ var newRow = ' ' +
' ' +
' ' +
' ';
@@ -753,6 +753,7 @@ $(window).on('load', function() {
vehicle_id: vehicleId
},
success: function(response) {
+ console.log("111111111111111111");
console.log(response);
servicearray = response.service;
makeAndModel = response.makeName+' '+response.modelName;
@@ -833,8 +834,7 @@ $(window).on('load', function() {
else if(className == 'custom_complaint_lb') {
previousRow = $(this).closest('tr').prevAll(".custom_complaint_class").first();
labour_rate = previousRow.find('.labour_cost');
- // labour_rate.val(actual_amount.toFixed(2));
- labour_rate.val(parseInt(actual_amount, 10));
+ labour_rate.val(actual_amount.toFixed(2));
item_rate = previousRow.find('.item-rate1');
item_rate.val(actual_amount.toFixed(2));
@@ -1595,10 +1595,10 @@ $(window).on('load', function() {
selected_pr.push(rowProductid);
});
- if(servicearray.length == 0)
- {
- servicearray = ;
- }
+ // if(servicearray.length == 0)
+ // {
+ // servicearray = ;
+ // }
console.log(servicearray);
var newRow = '
diff --git a/app/Views/sales_order_form.php b/app/Views/sales_order_form.php
index d42d0bc..6d113d4 100644
--- a/app/Views/sales_order_form.php
+++ b/app/Views/sales_order_form.php
@@ -436,7 +436,8 @@ $(document).ready(function() {
dataType: 'json',
data: {
make_id: makeId,
- model_id: modelId
+ model_id: modelId,
+ general: 1
},
success: function(response) {
console.log(response);
@@ -444,7 +445,6 @@ $(document).ready(function() {
var makeAndModel = response.makeName + ' ' + response.modelName;
$('#makeAndModel').val(makeAndModel);
- console.log(response);
productarray = response.product;
@@ -455,6 +455,7 @@ $(document).ready(function() {
}
});
} else {
+ productarray = [];
console.error('Make ID or Model ID not found for the selected vehicle');
}
}
@@ -664,38 +665,43 @@ $(document).ready(function() {
// Event listener for "Add More Item" button
$('#addItem').click(function() {
- // console.log(productarray);
- var newRow = '' +
+ console.log(productarray.length);
+ if (productarray.length > 0) {
+ var newRow = ' ' +
' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ' +
+ ' ';
+
+
+ $('#itemTable tbody').append(newRow);
+ initializeSelect2();
+ updateCalculations();
+ initializeRowCalculations(row);
+
+ }else{
+ toastr.warning("First Choose the Vehicle!");
}
-
- newRow += '' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- ' ' +
- '';
-
-
- $('#itemTable tbody').append(newRow);
- initializeSelect2();
- updateCalculations();
- initializeRowCalculations(row);
-
+
});
// Event listener for removing item