From d76fb5e16323bd648fc2b19a0f6612648714cd99 Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Fri, 31 Jan 2025 08:52:00 +0530 Subject: [PATCH] HR : GWM --- app/Controllers/Payslip.php | 16 +++++++- app/Models/Inwardgateregister_model.php | 50 ++++++++++++++----------- app/Models/Monthlypay_model.php | 3 +- app/Views/addSupplier.php | 12 +++--- app/Views/editSupplier.php | 10 ++--- 5 files changed, 54 insertions(+), 37 deletions(-) diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php index b77051e1..da5d75ab 100755 --- a/app/Controllers/Payslip.php +++ b/app/Controllers/Payslip.php @@ -612,7 +612,13 @@ class Payslip extends BaseController $Sunday = $value->sunday_count; // Sunday count $LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day $Paid_leave = $value->Paid_leave; // leave day - $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours + if ($value->is_management_team == 1) + { + $OT_Hrs_Worked = 0; //OT hours + $value->OT_Hrs_Worked = 0; + } else { + $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours + } $Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE $due_start_date = $value->DueDate; @@ -743,7 +749,13 @@ class Payslip extends BaseController $Sunday = $value->sunday_count; // Sunday count $LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day $Paid_leave = $value->Paid_leave; // leave day - $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours + if ($value->is_management_team == 1) + { + $OT_Hrs_Worked = 0; //OT hours + $value->OT_Hrs_Worked = 0; + } else { + $OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours + } $Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE $Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE $due_start_date = $value->DueDate; diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index 70901a0e..129cd233 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -379,23 +379,31 @@ class Inwardgateregister_model extends Model // Build subQuery2 dynamically for rate and tax based on POType $subQuery2 = "(CASE - WHEN PO.POType = 'revenue' THEN ( - SELECT JSON_OBJECT('total_rate', SUM(POL.Rate), 'total_tax', AVG(tax.CGST + tax.SGST + tax.IGST)) - FROM t_igr_details IGRD - LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode - LEFT JOIN t_revenue_tax tax ON tax.LineItemNo = POL.LineItemNo - WHERE IGRD.IGRNO = igr.IGRNO - ) - WHEN PO.POType = 'service' THEN ( - SELECT JSON_OBJECT('total_rate', SUM(POL.Rate), 'total_tax', AVG(tax.CGST + tax.SGST + tax.IGST)) - FROM t_igr_details IGRD - LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode - LEFT JOIN t_service_tax tax ON tax.LineItemNo = POL.LineItemNo - WHERE IGRD.IGRNO = igr.IGRNO - ) - - ELSE NULL - END)"; + WHEN PO.POType = 'revenue' THEN ( + SELECT JSON_OBJECT( + 'total_rate', SUM(POL.Rate * IGRD.QuantityAsPerInvoice), + 'total_tax', SUM((POL.Rate * IGRD.QuantityAsPerInvoice) * (tax.CGST + tax.SGST + tax.IGST) / 100) + ) + FROM t_igr_details IGRD + LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode + LEFT JOIN t_revenue_tax tax ON tax.LineItemNo = POL.LineItemNo + WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 + LIMIT 1 + ) + WHEN (PO.POType = 'service' OR (PO.POType = 'capital' AND PO.CapitalRange = '1')) THEN ( + SELECT JSON_OBJECT( + 'total_rate', SUM(POL.Rate * IGRD.QuantityAsPerInvoice), + 'total_tax', SUM((POL.Rate * IGRD.QuantityAsPerInvoice) * (tax.CGST + tax.SGST + tax.IGST) / 100) + ) + FROM t_igr_details IGRD + LEFT JOIN t_purchaseorder_lineitem POL ON PONO = POL.PONO AND IGRD.MaterialCode = POL.MaterialCode + LEFT JOIN t_service_tax tax ON tax.LineItemNo = POL.LineItemNo + WHERE IGRD.IGRNO = igr.IGRNO AND IGRD.QuantityAsPerInvoice != 0 + LIMIT 1 + ) + + ELSE NULL + END)"; // Main query @@ -406,8 +414,8 @@ class Inwardgateregister_model extends Model SUM(IGRD.NetWeight) as NetWeight, COUNT(IGRD.IGRNo) as itemCount, COALESCE(($subQuery1), 0) as remark_count, - JSON_EXTRACT(($subQuery2), '$.total_rate') as total_rate, - JSON_EXTRACT(($subQuery2), '$.total_tax') as total_tax") + JSON_EXTRACT(($subQuery2), '$.total_rate') as taxable_value, + JSON_EXTRACT(($subQuery2), '$.total_tax') as gst_amount") ->join('t_purchaseorder_master PO', 'igr.PONO = PO.PONO') ->join('t_supplierdetailsn sup', 'PO.SupplierID = sup.SupplierID') ->join('t_transporter trans', 'igr.TransporterId = trans.id', 'left') @@ -422,8 +430,8 @@ class Inwardgateregister_model extends Model $result = $query->getResult(); - // echo $this->db->getLastQuery()->getQuery();die; - // dd($result); + echo $this->db->getLastQuery()->getQuery();die; + dd($result); // old - issue in t_igr_remarkes join diff --git a/app/Models/Monthlypay_model.php b/app/Models/Monthlypay_model.php index 8e380491..569790f8 100755 --- a/app/Models/Monthlypay_model.php +++ b/app/Models/Monthlypay_model.php @@ -218,8 +218,7 @@ class Monthlypay_model extends Model return $i; } elseif ($count == 1) { $this->db->table('t_monthly_pay_inputs') - // ->where('H_date', $data['H_Date']) // ask velmurugan H_Date public hoilday table la irukku - ->where('EmpID', $data['EmpID']) // temp solution + ->where('EmpID', $data['EmpID']) ->where('Month_Year', $data['Month_Year']) ->update($data); diff --git a/app/Views/addSupplier.php b/app/Views/addSupplier.php index 7b7721ab..5065cb42 100755 --- a/app/Views/addSupplier.php +++ b/app/Views/addSupplier.php @@ -64,16 +64,16 @@
- - + +
- - + +
@@ -156,8 +156,8 @@
- - + +
diff --git a/app/Views/editSupplier.php b/app/Views/editSupplier.php index 8e3ccb4b..6eccc6b2 100755 --- a/app/Views/editSupplier.php +++ b/app/Views/editSupplier.php @@ -324,10 +324,9 @@ if (!empty($supplier)) { class="form-control" required value="">
- + @@ -341,9 +340,8 @@ if (!empty($supplier)) { onkeypress="return isNumberKey(event)">
- - Email ID +