fixes : ps

This commit is contained in:
VE10-Sanjeev 2025-02-25 11:50:03 +00:00
parent 5673d4bed6
commit 5c0fdef4a7
2 changed files with 41 additions and 32 deletions

View File

@ -40,42 +40,49 @@ class Service extends BaseController
public function service_index()
{
$services = $this->ServiceModel->where('branch_id',$this->session->get('logged_user_branch_id'))->orderBy('service_name','ASC')->findAll();
$services = $this->ServiceModel->select('services.*,cubic_capacity.value')
->join('cubic_capacity', 'cubic_capacity.id = services.cubic_capacity_id','left')
->where('services.branch_id',$this->session->get('logged_user_branch_id'))
->orderBy('services.service_name','ASC')->findAll();
foreach ($services as &$service) {
// Convert JSON strings to arrays
$makes_ids = json_decode($service['makes_id'], true) ?? [];
$models_ids = json_decode($service['models_id'], true) ?? [];
// Fetch make names
$makeNames = [];
foreach ($makes_ids as $make_id) {
if (!empty($make_id)) { // Check if $make_id is not null or empty
$make = $this->BikemakeModel->find($make_id);
if ($make) {
$makeNames[] = $make['make'];
}
}
}
// foreach ($services as &$service) {
// // Convert JSON strings to arrays
// $makes_ids = json_decode($service['makes_id'], true) ?? [];
// $models_ids = json_decode($service['models_id'], true) ?? []; -->
// Fetch model names
$modelNames = [];
// // Fetch make names
// $makeNames = [];
foreach ($models_ids as $model_id) {
if (!empty($model_id)) { // Check if $model_id is not null or empty
$model = $this->BikemodelsModel->find($model_id);
if ($model) {
$modelNames[] = $model['model_name'];
}
}
}
// foreach ($makes_ids as $make_id) {
// if (!empty($make_id)) { // Check if $make_id is not null or empty
// $make = $this->BikemakeModel->find($make_id);
// if ($make) {
// $makeNames[] = $make['make'];
// }
// }
// }
// Replace IDs with names
$service['makes_names'] = implode(', ', $makeNames);
$service['models_names'] = implode(', ', $modelNames);
}
// // Fetch model names
// $modelNames = [];
// foreach ($models_ids as $model_id) {
// if (!empty($model_id)) { // Check if $model_id is not null or empty
// $model = $this->BikemodelsModel->find($model_id);
// if ($model) {
// $modelNames[] = $model['model_name'];
// }
// }
// }
// // Replace IDs with names
// $service['makes_names'] = implode(', ', $makeNames);
// $service['models_names'] = implode(', ', $modelNames);
// }
$data['services']=$services;
return view('service_list',$data);

View File

@ -36,9 +36,11 @@
$color = '';
if($value['isactive'] == 0){
$color ='red';
}?>
}
$name = $value['value'] ? " ( ". $value['value']." ) " : ""
?>
<tr class="service_tr_<?php echo $index+1; ?>" style="color:<?php echo $color; ?>" >
<td><?= $value['service_name']; ?></td>
<td><?= $value['service_name'].$name ; ?></td>
<td><?= $value['labour_cost']; ?></td>
<td><?= $value['price']; ?></td>
<td><?= $value['cgst'] + $value['sgst']; ?></td>