GWM : HR module

This commit is contained in:
Gowtham M 2025-02-03 14:16:50 +05:30
parent 3b8a6af038
commit a2f229e3ab
6 changed files with 84 additions and 47 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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')

View File

@ -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);
}

View File

@ -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 {

View File

@ -305,7 +305,7 @@
style="text-align:center;color:blue;"
<?php } else { ?>style="text-align:center;" <?php } ?>>
<?php if (!empty($record->Days_worked)) {
echo $record->Days_worked + $record->sunday_count;
echo $record->Days_worked;
} else {
echo "0.00";
} ?>
@ -361,7 +361,7 @@
</td>
<td style="max-width:80px;text-align:right;">
<?php $workedSalary = $perDaySalary * ($record->Days_worked + $record->sunday_count);
<?php $workedSalary = $perDaySalary * ($record->Days_worked);
echo number_format($workedSalary, 2, '.', ''); ?>
</td>