JC sub service changes : GWM

This commit is contained in:
Gowtham M 2025-10-25 11:07:59 +05:30
parent 6371290198
commit 09f138466b

View File

@ -102,7 +102,12 @@ class JobcardModel extends Model
}
public function get_jobcard_sub_service($job_id)
{
$this->select('job_card_sub_service.*, services.service_name as product_name , services.labour_cost as labour_amount');
$this->select("job_card_sub_service.*, services.service_name as product_name ,
CASE
WHEN job_card.type = 'General' THEN services.wg_labour_cost
WHEN job_card.type = 'Complaints' THEN services.wog_labour_cost
ELSE 0
END as labour_amount");
$this->join('job_card_sub_service', 'job_card_sub_service.job_card_id = job_card.job_card_id');
$this->join('services', 'services.service_id = job_card_sub_service.sub_service_id');
$this->where('job_card.isactive', 1);
@ -141,7 +146,12 @@ class JobcardModel extends Model
public function get_jobcard_labourcost($job_id)
{
$this->select('job_card.*, job_card_service.job_card_id, job_card_service.service_id, job_card_complaint.job_card_id, job_card_complaint.complaint_id, services.labour_cost, complaints.labour_charge,services.tax ,complaints.tax, services.labour_cost, complaints.labour_charge');
$this->select("job_card.*, job_card_service.job_card_id, job_card_service.service_id, job_card_complaint.job_card_id, job_card_complaint.complaint_id, complaints.labour_charge,services.tax ,complaints.tax, complaints.labour_charge ,
CASE
WHEN job_card.type = 'General' THEN services.wg_labour_cost
WHEN job_card.type = 'Complaints' THEN services.wog_labour_cost
ELSE 0
END as labour_amount");
$this->join('job_card_service', 'job_card_service.job_card_id = job_card.job_card_id');
$this->join('services', 'services.service_id = job_card_service.service_id');
$this->join('job_card_complaint', 'job_card_complaint.job_card_id = job_card.job_card_id');