GWM : user requirement

This commit is contained in:
Gowtham M 2025-03-26 12:18:41 +05:30
parent f4c73c6bc3
commit 8ddda8bf93
5 changed files with 190 additions and 65 deletions

View File

@ -515,7 +515,7 @@ class Payslip extends BaseController
// $Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['TDS Deductions in ₹'];
$Estimate = $j['Estimate in ₹'];
$Estimate = $j['Net Salary ₹'];
$Created_By = $this->session->get('userId');
if (!is_numeric($DaysWorked) || ($DaysWorked > 31) || (strlen((string)$DaysWorked)) > 5) {
@ -618,7 +618,7 @@ class Payslip extends BaseController
$Festival_Bonus = isset($j['Festival Bonus in ₹']) ? $j['Festival Bonus in ₹'] : 0.00;
$tds_Deductions = isset($j['TDS Deductions in ₹']) ? $j['TDS Deductions in ₹'] : 0.00;
$Estimate = isset($j['Estimate in ₹']) ? $j['Estimate in ₹'] : 0.00;
$Estimate = isset($j['Net Salary ₹']) ? $j['Net Salary ₹'] : 0.00;
$Created_By = $this->session->get('userId');
if($is_driver == 0){

View File

@ -26,14 +26,16 @@ class Ipinvoice_model extends Model
ip_products.product_name, ip_invoice_items.item_price, ip_products.cgst, ip_products.sgst,
ip_invoice_items.item_quantity, ip_invoice_items.item_price, ip_invoice_items.item_name, ip_invoice_items.item_quantity,ip_invoice_items.hsn_or_sac,
ip_invoice_amounts.invoice_total, ip_invoice_amounts.invoice_item_subtotal, ip_invoice_amounts.invoice_item_tax_total
,ip_invoice_attachment.file_name , ip_invoices.received_qty')
,ip_invoice_attachment.file_name , ip_invoices.received_qty , VN.invoice_custom_fieldvalue as vehicle_no , DN.invoice_custom_fieldvalue as deiver_name')
->join('ip_payment_methods', 'ip_invoices.payment_method = ip_payment_methods.payment_method_id', 'left')
->join('ip_clients', 'ip_invoices.client_id = ip_clients.client_id', 'left')
->join('ip_users', 'ip_invoices.user_id = ip_users.user_id', 'left')
->join('ip_invoice_items', 'ip_invoices.invoice_id = ip_invoice_items.invoice_id', 'left')
->join('ip_products', 'ip_invoice_items.item_product_id = ip_products.product_id', 'left')
->join('ip_invoice_amounts', 'ip_invoices.invoice_id = ip_invoice_amounts.invoice_id', 'left')
->join('ip_invoice_attachment', 'ip_invoices.invoice_id = ip_invoice_attachment.invoice_id and ip_invoice_attachment.is_active = 1' , 'left');
->join('ip_invoice_attachment', 'ip_invoices.invoice_id = ip_invoice_attachment.invoice_id and ip_invoice_attachment.is_active = 1' , 'left')
->join('ip_invoice_custom VN', 'ip_invoices.invoice_id = VN.invoice_id and VN.invoice_custom_fieldid = 8' , 'left')
->join('ip_invoice_custom DN', 'ip_invoices.invoice_id = DN.invoice_id and DN.invoice_custom_fieldid = 58' , 'left');
$builder->where('ip_invoices.invoice_date_created >=', $fromDate );
$builder->where('ip_invoices.invoice_date_created <=', $toDate );
$builder->orderBy('ip_invoices.invoice_number', 'DESC');

View File

@ -366,12 +366,13 @@ $currentday = date('d');
$flag2 = 0;
$todayflag = 0;
} ?>
<th class="celda_encabezado_general">Total Hrs</th>
<th class="celda_encabezado_general">OT Hrs</th>
<th class="celda_encabezado_general">Paid Leave</th>
<th class="celda_encabezado_general">Days Worked</th>
<th class="celda_encabezado_general">Absent</th>
<th class="celda_encabezado_general">Total Sunday</th>
<th class="celda_encabezado_general">Paid Leave</th>
<th class="celda_encabezado_general"> Sunday</th>
<th class="celda_encabezado_general">Worked Hrs</th>
<th class="celda_encabezado_general">OT Hrs</th>
</tr>
@ -460,27 +461,8 @@ $currentday = date('d');
$flag2 = 0;
$todayflag = 0;
} ?>
<td class="celda_normal summary" id="<?php echo $row . 'TH'; ?>">
<?php if (!empty($a->Total_WHrs)) {
echo $a->Total_WHrs;
} else {
echo "0.00";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'OTH'; ?>">
<?php if (!empty($a->Total_OTHrs)) {
echo $a->Total_OTHrs;
} else {
echo "0.00";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'PL'; ?>">
<?php if (!empty($noofpublicholidays)) {
echo number_format($noofpublicholidays, 2, '.', '.');
} else {
echo "0.00";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'DW'; ?>">
<?php if (!empty($a->Days_Worked)) {
echo $a->Days_Worked;
@ -495,6 +477,13 @@ $currentday = date('d');
echo "0.00";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'PL'; ?>">
<?php if (!empty($noofpublicholidays)) {
echo number_format($noofpublicholidays, 2, '.', '.');
} else {
echo "0.00";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'TS'; ?>">
<?php if (!empty($noofsundays)) {
echo $noofsundays;
@ -502,6 +491,21 @@ $currentday = date('d');
echo "0";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'TH'; ?>">
<?php if (!empty($a->Total_WHrs)) {
echo $a->Total_WHrs;
} else {
echo "0.00";
} ?>
</td>
<td class="celda_normal summary" id="<?php echo $row . 'OTH'; ?>">
<?php if (!empty($a->Total_OTHrs)) {
echo $a->Total_OTHrs;
} else {
echo "0.00";
} ?>
</td>
</tr>
<?php } ?>

View File

@ -123,10 +123,11 @@
</div>
</div>
</div>
<div class="row">
<div class="row" >
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="card" id="fullscreenDiv">
<div class="card-body" >
<div id="successMessage" style="display: none; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);background: green; color: white; padding: 10px; border-radius: 5px; z-index: 1000;"></div>
<div class="box">
<div class="box-header">
@ -215,13 +216,20 @@
<div class="col-3 ">
<i id="exportButton" class="fas fa-download download-icon" style="font-size: x-large; margin-top:12px;" title="Export Excel"></i>
</div>
<div class="col-6 text-right" id="savebutton">
<div class="col-3 text-right" id="savebutton">
</div>
<div class="col-3 text-right d-flex" style="justify-content: end;" id="savebutton">
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;
margin-top: 5px;
font-size: 28px;"></i>
<input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();" style="margin-top:0px;">
</div>
</div>
<div class="table-responsive" style="overflow-x:scroll;">
<div class="table-responsive" id="table-responsive" style="overflow-x:scroll;">
<table id="monthlylistings" class="table table-bordered table-hover fht-table"
style="background-color:#fff;font-size:12px;white-space: nowrap;">
<thead style="background-color: #ddd;">
@ -233,7 +241,7 @@
<th class="celda_encabezado_general">DOJ</th>
<th class="celda_encabezado_general">Designation</th>
<th class="celda_encabezado_general">Total Days</th>
<th class="celda_encabezado_general">Number Of Trips</th>
<!-- <th class="celda_encabezado_general">Number Of Trips</th> -->
<th class="celda_encabezado_general">Days Worked</th>
<th class="celda_encabezado_general">LOP Days</th>
<th class="celda_encabezado_general">Paid Leave</th>
@ -252,7 +260,7 @@
<th class="celda_encabezado_general">Auto Loan Due </th>
<th class="celda_encabezado_general">TDS Deductions in </th>
<th class="celda_encabezado_general">Festival Bonus in </th>
<th class="celda_encabezado_general">Estimate in </th>
<th class="celda_encabezado_general">Net Salary </th>
</tr>
@ -295,7 +303,7 @@
</td>
<td style="max-width:80px;text-align:center;"><?php echo $record->NoofDays; ?></td>
<td style="max-width:80px;text-align:center;"><?php echo 0; ?></td>
<!-- <td style="max-width:80px;text-align:center;"><?php echo 0; ?></td> -->
<td id="dayWork<?php echo $index ?>"
<?php if (empty($record->Key)) {
echo "contenteditable='false';";
@ -352,11 +360,13 @@
} ?>
</td>
<td id="ttlsalary<?php echo $index ?>" style="max-width:80px;text-align:right;"><?php echo $record->TotalSalary; ?></td>
<td id="ttlsalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
<?php echo $record->TotalSalary; $totalsalary[] = $record->TotalSalary; ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php $perDaySalary = $record->TotalSalary / $record->NoofDays;
echo number_format($perDaySalary, 2, '.', ''); ?>
echo number_format($perDaySalary, 2, '.', ''); $totalperdaySalary[] = $perDaySalary; ?>
</td>
<td style="max-width:80px;text-align:right;">
@ -366,30 +376,38 @@
<td style="max-width:80px;text-align:right;">
<?php $perHrSalary = $perDaySalary / 8;
echo number_format($perHrSalary, 2); ?>
echo number_format($perHrSalary, 2); $totalperhrSalary[] = $perHrSalary; ?>
</td>
<td style="max-width:80px;text-align:right;"><?php echo number_format($workedSalary, 2, '.', ''); ?></td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format($workedSalary, 2, '.', ''); $totalworkedSalary[] = $workedSalary; ?>
</td>
<td id="bassalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
<?php $basicWorked = $workedSalary * 70 / 100;
echo number_format($basicWorked, 2, '.', ''); ?>
echo number_format($basicWorked, 2, '.', ''); $totalbasic[] = $basicWorked; ?>
</td>
<td id="hrasalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
<?php $hraWorked = $workedSalary * 30 / 100;
echo number_format($hraWorked, 2, '.', ''); ?>
echo number_format($hraWorked, 2, '.', ''); $totalhra[] = $hraWorked; ?>
</td>
<td id="grosalary<?php echo $index ?>" style="max-width:80px;text-align:right;">
<?php echo number_format($basicWorked + $hraWorked, 2, '.', ''); ?>
<?php echo number_format($basicWorked + $hraWorked, 2, '.', ''); $totalgross[] = $basicWorked + $hraWorked; ?>
</td>
<td id="esiAmt<?php echo $index ?>" style="max-width:80px;text-align:right;"> <?php echo $esi[$i]; ?> </td>
<td id="esiAmt<?php echo $index ?>" style="max-width:80px;text-align:right;">
<?php echo $esi[$i]; $totalesi[] = $esi[$i]; ?>
</td>
<td id="pfAmt<?php echo $index ?>" style="max-width:80px;text-align:right;"> <?php echo $pf[$i]; ?> </td>
<td id="pfAmt<?php echo $index ?>" style="max-width:80px;text-align:right;">
<?php echo $pf[$i]; $totalpf[] = $pf[$i]; ?>
</td>
<td style="max-width:80px;text-align:right;"> <?php echo $over_time[$i]; ?> </td>
<td style="max-width:80px;text-align:right;">
<?php echo $over_time[$i]; $totalovertime[] = $over_time[$i]; ?>
</td>
<td id="monthDue<?php echo $index ?>" onkeypress="return isNumber(event);" onkeyup="changeInput(event);"
<?php if ($record->is_payslip_generated == 0) { echo "contenteditable='true';"; } ?>
@ -539,9 +557,9 @@
<?php echo $record->total_cal_days; ?>
</td>
<td style="max-width:80px;text-align:center;">
<!-- <td style="max-width:80px;text-align:center;">
<?php echo $record->no_of_loads." (trip)"; ?>
</td>
</td> -->
<td id="dayWork<?php echo $inx ?>" style="text-align:center;">
<?php echo number_format($record->unique_days, 2, '.', ''); ?>
@ -559,14 +577,14 @@
<?php echo number_format(0.00, 2, '.', ''); ?>
</td>
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php echo number_format($sum_of_amount, 2, '.', ''); ?>
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;" data-empid="<?php echo $record->EmpID; ?>" onclick="openDriverLoad(this)">
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalsalary[] = $sum_of_amount; ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php
$worked_amt = $sum_of_amount / $record->total_cal_days ;
echo number_format($worked_amt, 2, '.', ''); ?>
echo number_format($worked_amt, 2, '.', ''); $totalperdaySalary[] = $worked_amt; ?>
</td>
<td style="max-width:80px;text-align:right;">
@ -575,31 +593,35 @@
<td style="max-width:80px;text-align:right;">
<?php $hr_amt = $worked_amt/8;
echo number_format($hr_amt, 2, '.', ''); ?>
echo number_format($hr_amt, 2, '.', ''); $totalperhrSalary[] = $hr_amt; ?>
</td>
<td style="max-width:80px;text-align:right;">
<!-- $record->driver_salary_amount -->
<?php echo number_format($sum_of_amount, 2, '.', ''); ?>
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalworkedSalary[] = $sum_of_amount; ?>
</td>
<td id="bassalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php
echo number_format($basic_worked, 2, '.', ''); ?>
echo number_format($basic_worked, 2, '.', ''); $totalbasic[] = $basic_worked; ?>
</td>
<td id="hrasalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php
echo number_format($hra_worked, 2, '.', ''); ?>
echo number_format($hra_worked, 2, '.', ''); $totalhra[] = $hra_worked; ?>
</td>
<td id="grosalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php echo number_format($basic_worked + $hra_worked, 2, '.', ''); ?>
<?php echo number_format($basic_worked + $hra_worked, 2, '.', ''); $totalgross[] = $basic_worked + $hra_worked; ?>
</td>
<td id="esiAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;"> <?php echo $record->esi_amount; ?> </td>
<td id="esiAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php echo $record->esi_amount; $totalesi[] = $record->esi_amount; ?>
</td>
<td id="pfAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;"> <?php echo $record->pf_amount; ?> </td>
<td id="pfAmt<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<?php echo $record->pf_amount; $totalpf[] = $record->pf_amount; ?>
</td>
<td style="max-width:80px;text-align:right;">
<?php echo number_format(0.00, 2, '.', ''); ?>
@ -683,9 +705,40 @@
<tr>
<th></th> <th></th> <th></th> <th></th> <th></th>
<th></th> <th></th> <th></th> <th></th> <th></th>
<th></th> <th></th> <th></th> <th></th> <th></th>
<th></th> <th></th> <th></th> <th></th> <th></th>
<th></th> <th>Total</th>
<th style="text-align:right;">
<?php echo isset($totalsalary) ? number_format(array_sum($totalsalary), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalperdaySalary) ? number_format(array_sum($totalperdaySalary), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalworkedSalary) ? number_format(array_sum($totalworkedSalary), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalperhrSalary) ? number_format(array_sum($totalperhrSalary), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalworkedSalary) ? number_format(array_sum($totalworkedSalary), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalbasic) ? number_format(array_sum($totalbasic), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalhra) ? number_format(array_sum($totalhra), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalgross) ? number_format(array_sum($totalgross), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalesi) ? number_format(array_sum($totalesi), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalpf) ? number_format(array_sum($totalpf), 2) : ''; ?>
</th>
<th style="text-align:right;">
<?php echo isset($totalovertime) ? number_format(array_sum($totalovertime), 2) : ''; ?>
</th>
<th id="monthloan" style="text-align:right;">
<?php echo isset($totalmonthloan) ? number_format(array_sum($totalmonthloan), 2) : ''; ?>
</th>
@ -722,7 +775,7 @@
</div> <!-- container -->
</div> <!-- content -->
</div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
@ -898,7 +951,8 @@ $(document).ready(function () {
if (data) {
$('#loader').hide();
alert(data);
// alert(data);
showMessage(data);
}
}
@ -1274,6 +1328,67 @@ $(document).ready(function () {
function openDriverLoad(element) {
var empId = $(element).data("empid"); // Get the empid from clicked element
var monthYear = $('#monthyear').val();
// Convert "03-2025" to "Mar-2025"
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var parts = monthYear.split('-');
var monthIndex = parseInt(parts[0], 10) - 1; // Convert "03" to index 2 (March)
var formattedMonthYear = monthNames[monthIndex] + '-' + parts[1];
var baseUrl = "<?= base_url(); ?>"; // Ensure this echoes the correct base URL
var requestUrl = baseUrl + "loadDriverAttendance?month_year=" + encodeURIComponent(formattedMonthYear) + "&drv_id=" + encodeURIComponent(empId);
// Open the URL in a new tab
window.open(requestUrl, "_blank");
}
function toggleDivFullscreen() {
let div = document.getElementById("fullscreenDiv");
let tableResponsive = document.getElementById("table-responsive"); // Select the table container inside div
if (!document.fullscreenElement) {
div.requestFullscreen().then(() => {
div.style.width = "100vw"; // Full viewport width
div.style.height = "100vh"; // Full viewport height
// If .table-responsive exists, set its height to 90vh
if (tableResponsive) {
tableResponsive.style.maxHeight = "90vh";
tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed
}
}).catch(err => console.log("Error enabling fullscreen:", err));
} else {
document.exitFullscreen().then(() => {
div.style.width = "100%";
div.style.height = "100%";
// Reset .table-responsive height when exiting fullscreen
if (tableResponsive) {
tableResponsive.style.height = "auto";
}
}).catch(err => console.log("Error exiting fullscreen:", err));
}
}
function showMessage(msg) {
let msgBox = document.getElementById("successMessage");
msgBox.innerText = msg; // Set API message
msgBox.style.display = "block";
// Hide message after 3 seconds
setTimeout(() => {
msgBox.style.display = "none";
}, 3000);
}

View File

@ -240,6 +240,8 @@
<th>Client Name</th>
<th>Product</th>
<th>HSN</th>
<th>Driver</th>
<th>Vehicle</th>
<th>Quantity</th>
<th> Rec Qty </th>
<th>Rate</th>
@ -283,6 +285,8 @@
<td><?php echo $invoice->client_name ?></td>
<td><?php echo $invoice->item_name ?></td>
<td><?php echo $invoice->hsn_or_sac ?></td>
<td><?php echo $invoice->deiver_name ?></td>
<td><?php echo $invoice->vehicle_no ?></td>
<td align="right"><?php echo number_format($invoice->item_quantity, 2, '.', ',') ?></td>
<td>
<a href="#"