From a2f229e3ab6038aff3440d3842daf8394d246b1e Mon Sep 17 00:00:00 2001 From: Gowtham M Date: Mon, 3 Feb 2025 14:16:50 +0530 Subject: [PATCH] GWM : HR module --- app/Controllers/Payslip.php | 8 ++--- app/Controllers/User.php | 49 +++++++++++++++++++++++------ app/Models/Zohobook_api_model.php | 10 ++++++ app/Views/attendance.php | 52 +++++++++++++++---------------- app/Views/includes/new_header.php | 8 ++--- app/Views/monthlypayinputs.php | 4 +-- 6 files changed, 84 insertions(+), 47 deletions(-) diff --git a/app/Controllers/Payslip.php b/app/Controllers/Payslip.php index da5d75ab..989b3e2a 100755 --- a/app/Controllers/Payslip.php +++ b/app/Controllers/Payslip.php @@ -610,7 +610,7 @@ class Payslip extends BaseController $TotalSalary = $value->TotalSalary; $Days_worked = $value->Days_worked; // working day $Sunday = $value->sunday_count; // Sunday count - $LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day + $LOP_Days = $value->NoofDays - ($Days_worked); // not working day $Paid_leave = $value->Paid_leave; // leave day if ($value->is_management_team == 1) { @@ -661,7 +661,7 @@ class Payslip extends BaseController - $totalDaysWorked = ($Days_worked + $Sunday) + $Paid_leave; + $totalDaysWorked = $Days_worked + $Paid_leave; $dayBasic = $Basic_Pay / $NoofDays; $dayHra = $HRA_Amount / $NoofDays; @@ -747,7 +747,7 @@ class Payslip extends BaseController $TotalSalary = $value->TotalSalary; $Days_worked = $value->Days_worked; // working day $Sunday = $value->sunday_count; // Sunday count - $LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day + $LOP_Days = $value->NoofDays - ($Days_worked); // not working day $Paid_leave = $value->Paid_leave; // leave day if ($value->is_management_team == 1) { @@ -801,7 +801,7 @@ class Payslip extends BaseController - $totalDaysWorked = ($Days_worked + $Sunday) + $Paid_leave; + $totalDaysWorked = $Days_worked + $Paid_leave; $dayBasic = $Basic_Pay / $NoofDays; $dayHra = $HRA_Amount / $NoofDays; diff --git a/app/Controllers/User.php b/app/Controllers/User.php index 94112de0..f25b7b0d 100755 --- a/app/Controllers/User.php +++ b/app/Controllers/User.php @@ -1385,8 +1385,12 @@ class User extends BaseController } $insert_count = 0; $update_count = 0; + // dd($res2); + foreach ($res2 as $rs) { $gst_no = $rs['gst_no']; + $customer_id = $rs['customer_id']; + $customer_name = $rs['customer_name']; $invoice_number = $rs['invoice_number']; $invoice_date = $rs['date']; $status = $rs['status']; @@ -1400,19 +1404,41 @@ class User extends BaseController $invoice_time = $time_array[0]; $sql_invoice_chk = $Zohobook_model->ip_invoices($invoice_number, $invoice_date); + // dd($sql_invoice_chk); if ($sql_invoice_chk <= 0) { - $gst_sql = $Zohobook_model->ip_clients($gst_no); - if ($gst_sql) { - $client_id = $gst_sql[0]['client_id']; - log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id); - } else { - log_message('error', 'No data => Data fetch failed DB : ip_clients ' . $gst_no); - $gst_no_data['client_tax_code'] = $gst_no; - $gst_inserted_id = $Zohobook_model->customInsert($gst_no_data, 'ip_clients'); - $client_id = $gst_inserted_id; - log_message('error', 'New Data Created : DB : ip_clients , client_id : ' . $client_id); + //this check only for ASHOK LEYLAND LIMITED + if($customer_id == '3215000000000082604' || $customer_id == '3215000000000082724') + { + //this combination of customer_id & gst_no search only for client ASHOK LEYLAND + $gst_sql = $Zohobook_model->ip_client_ashok_leyland($gst_no,$customer_id); + if ($gst_sql) { + $client_id = $gst_sql[0]['client_id']; + log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id); + } + + }else{ + + $gst_sql = $Zohobook_model->ip_clients($gst_no); + if ($gst_sql) { + $client_id = $gst_sql[0]['client_id']; + log_message('error', 'Data fetch success DB : ip_clients , client_id : ' . $client_id); + } else { + log_message('error', 'No data => Data fetch failed DB : ip_clients ' . $gst_no); + $client_data['client_tax_code'] = $gst_no; + $client_data['customer_id'] = $customer_id; + $client_data['customer_name'] = $customer_name; + $gst_inserted_id = $Zohobook_model->customInsert($client_data, 'ip_clients'); + $client_id = $gst_inserted_id; + log_message('error', 'New Data Created : DB : ip_clients , client_id : ' . $client_id); + } + } + + + + + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; @@ -1517,6 +1543,7 @@ class User extends BaseController $item_price = $rs['line_items'][$i]['rate']; + $hsn_or_sac = $rs['line_items'][$i]['hsn_or_sac']; $item_order = $rs['line_items'][$i]['item_order']; $item_product_unit = $rs['line_items'][$i]['unit']; $item_name = $rs['line_items'][$i]['name']; @@ -1595,6 +1622,8 @@ class User extends BaseController $ip_invoice_items['item_product_unit'] = $item_product_unit; $ip_invoice_items['Sgst_item_tax_rate_id'] = $sgsttaxid; $ip_invoice_items['Cgst_item_tax_rate_id'] = $cgsttaxid; + $ip_invoice_items['hsn_or_sac'] = $hsn_or_sac; + $item_insert_id = $Zohobook_model->customInsert($ip_invoice_items, 'ip_invoice_items'); if ($item_insert_id) log_message('error', 'Data insert success DB : ip_invoice_items => Sgst_item_tax_rate_id :' . $sgsttaxid); diff --git a/app/Models/Zohobook_api_model.php b/app/Models/Zohobook_api_model.php index e88e3d8a..7edb86bf 100755 --- a/app/Models/Zohobook_api_model.php +++ b/app/Models/Zohobook_api_model.php @@ -25,6 +25,16 @@ class Zohobook_api_model extends Model return $query; } + public function ip_client_ashok_leyland($gst_no,$customer_id) + { + $builder = $this->db->table('ip_clients') + ->where('client_tax_code', $gst_no) + ->where('customer_id', $customer_id) + ->get(); + $query = $builder->getResultArray(); + return $query; + } + public function ip_products($sku) { $builder = $this->db->table('ip_products') diff --git a/app/Views/attendance.php b/app/Views/attendance.php index a08b9030..a4c608f7 100755 --- a/app/Views/attendance.php +++ b/app/Views/attendance.php @@ -761,12 +761,6 @@ $(document).ready(function () { var nextid = $(j).closest('td').next('td'); nxtid = nextid[0].attributes[2].value; - - - - - - nxtvalue = v - 8; curvalue = 8; @@ -853,23 +847,27 @@ $(document).ready(function () { if (str1 == 'W') { - sundayValidation = false; - let dateInt = +str3.replace(/\D/g, ''); - sundaysArray.forEach(element => { - if (+element == dateInt) { - sundayValidation = true; - var text = value.textContent.trim(); - var current = (text === '' || isNaN(parseFloat(text))) ? 0 : parseFloat(value.textContent); - sundayWorkingHr += current; + // sundayValidation = false; + // let dateInt = +str3.replace(/\D/g, ''); + // sundaysArray.forEach(element => { + // if (+element == dateInt) { + // sundayValidation = true; + // var text = value.textContent.trim(); + // var current = (text === '' || isNaN(parseFloat(text))) ? 0 : parseFloat(value.textContent); + // sundayWorkingHr += current; - } - }); + // } + // }); - if (sundayValidation == false) { - var text = value.textContent.trim(); - var current = (text === '' || isNaN(parseFloat(text))) ? 0 : parseFloat(value.textContent); - totalworkingHrs += current; - } + // if (sundayValidation == false) { + // var text = value.textContent.trim(); + // var current = (text === '' || isNaN(parseFloat(text))) ? 0 : parseFloat(value.textContent); + // totalworkingHrs += current; + // } + + var text = value.textContent.trim(); + var current = (text === '' || isNaN(parseFloat(text))) ? 0 : parseFloat(value.textContent); + totalworkingHrs += current; if (current == 0) { absent++; @@ -911,13 +909,13 @@ $(document).ready(function () { // paidleave = 0; // alert('else'); // } - TotalOT = totalOTHrs + sundayWorkingHr; - document.getElementById(totalhrsid).textContent = parseFloat(totalworkingHrs).toFixed( - 2); // == ''?0:parseFloat(totalworkingHrs)); - document.getElementById(totalothrsid).textContent = parseFloat(TotalOT).toFixed( - 2); // == ''?0:parseFloat(totalOTHrs)); + // TotalOT = totalOTHrs + sundayWorkingHr; + TotalOT = totalOTHrs; + TotalWH = totalworkingHrs; + document.getElementById(totalhrsid).textContent = parseFloat(TotalWH).toFixed(2); // == ''?0:parseFloat(totalworkingHrs)); + document.getElementById(totalothrsid).textContent = parseFloat(TotalOT).toFixed(2); // == ''?0:parseFloat(totalOTHrs)); document.getElementById(paidleaveid).textContent = parseFloat(publicholidays).toFixed(2); - document.getElementById(daysworkedid).textContent = parseFloat((totalworkingHrs / 8)).toFixed(2); + document.getElementById(daysworkedid).textContent = parseFloat((TotalWH / 8)).toFixed(2); absent = (absent) ? (absent - publicholidays) : 0; document.getElementById(absentid).textContent = parseFloat(absent).toFixed(2); } diff --git a/app/Views/includes/new_header.php b/app/Views/includes/new_header.php index f63bb69b..4ce942dc 100755 --- a/app/Views/includes/new_header.php +++ b/app/Views/includes/new_header.php @@ -120,15 +120,15 @@ } ::-webkit-scrollbar { - width: 8px; - height: 8px; + width: 10px; + height: 12px; background-color: #f5f5f5; } ::-webkit-scrollbar-thumb { - background-color: #797a7c; + background-color: #aaa; border-radius: 15px; - height: 5px; + height: 12px; } ::-webkit-scrollbar-track { diff --git a/app/Views/monthlypayinputs.php b/app/Views/monthlypayinputs.php index 84ff514e..6dd9af89 100755 --- a/app/Views/monthlypayinputs.php +++ b/app/Views/monthlypayinputs.php @@ -305,7 +305,7 @@ style="text-align:center;color:blue;" style="text-align:center;" > Days_worked)) { - echo $record->Days_worked + $record->sunday_count; + echo $record->Days_worked; } else { echo "0.00"; } ?> @@ -361,7 +361,7 @@ - Days_worked + $record->sunday_count); + Days_worked); echo number_format($workedSalary, 2, '.', ''); ?>