hr module issues
This commit is contained in:
parent
2040199888
commit
4295c8207d
@ -326,7 +326,7 @@ $routes->post('getCostCenterData', 'Inwardgateregister::getCostCenterData');
|
||||
$routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
|
||||
$routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile');
|
||||
$routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile');
|
||||
$routes->get( 'download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1');
|
||||
$routes->get( 'download-files', 'Inwardgateregister::downloadFilesAsZip');
|
||||
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
|
||||
$routes->post('getIGRRemarks', 'Inwardgateregister::getIGRRemarks');
|
||||
$routes->post('saveIGRRemarks', 'Inwardgateregister::saveIGRRemarks');
|
||||
|
||||
@ -1081,24 +1081,29 @@ function updateIGRWeight(){
|
||||
$this->saveIGRLineitemHistory($igr_lineitem, $IGRNO,$IGRItemNo);
|
||||
|
||||
$requestWeightFileName =null ;
|
||||
if($WeightFile){
|
||||
if (!empty($requestWeightFileName)) {
|
||||
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||
log_message('error', 'File already exists in the database'.$requestWeightFileName);
|
||||
}
|
||||
else{
|
||||
$WeightFile->move($path, $requestWeightFileName);
|
||||
$igr_lineitem['WeightFile'] = $requestWeightFileName;
|
||||
}
|
||||
}
|
||||
$msg = null;
|
||||
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
|
||||
|
||||
$requestWeightFileName = $WeightFile->getName(); // Generate a unique name
|
||||
|
||||
// Optional: Check for duplicates in DB if needed
|
||||
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
|
||||
log_message('error', 'File already exists in the database: ' . $requestWeightFileName);
|
||||
$msg = "'File already exists in the database: ' . $requestWeightFileName";
|
||||
} else {
|
||||
$WeightFile->move($path, $requestWeightFileName);
|
||||
$igr_lineitem['WeightFile'] = $requestWeightFileName;
|
||||
$msg = "";
|
||||
}
|
||||
}else{
|
||||
log_message('error', 'File invlisd: ' . $requestWeightFileName);
|
||||
$msg = "";
|
||||
}
|
||||
|
||||
|
||||
$update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo);
|
||||
|
||||
if ($update) {
|
||||
echo "Details update successfully!";
|
||||
echo "Details updated successfully!\n".$msg;
|
||||
}
|
||||
}
|
||||
function AddOgr()
|
||||
@ -1328,75 +1333,82 @@ function updateIGRWeight(){
|
||||
}
|
||||
}
|
||||
|
||||
public function downloadFilesAsZip($igrno)
|
||||
{
|
||||
// Get all file details for the given IGR number
|
||||
$fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrno);
|
||||
|
||||
// Define the root path for files
|
||||
$rootPath = ROOTPATH . 'public/uploads/Igrfiles/';
|
||||
|
||||
// Check if the directory exists, create if it doesn't
|
||||
if (!is_dir($rootPath)) {
|
||||
if (!mkdir($rootPath, 0755, true)) {
|
||||
echo '<script>alert("Failed to create the directory.");</script>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the directory is writable
|
||||
if (!is_writable($rootPath)) {
|
||||
echo '<script>alert("Directory is not writable.");</script>';
|
||||
return;
|
||||
}
|
||||
|
||||
// Create a new ZIP archive
|
||||
$zip = new ZipArchive();
|
||||
$zipFileName = $igrno . '.zip';
|
||||
$zipFilePath = $rootPath . $zipFileName;
|
||||
|
||||
// Attempt to open the ZIP file
|
||||
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== TRUE) {
|
||||
echo '<script>alert("Failed to create ZIP file.");</script>';
|
||||
return redirect()->to('/ViewIGR');
|
||||
}
|
||||
|
||||
$filesAdded = false;
|
||||
|
||||
// Add each file to the ZIP archive
|
||||
foreach ($fileDetails as $file) {
|
||||
$filePath = $rootPath . $file->file;
|
||||
|
||||
// Ensure file exists and is not a directory
|
||||
if (file_exists($filePath) && is_file($filePath)) {
|
||||
// Sanitize filename for ZIP
|
||||
$sanitizedFilename = preg_replace('/[^a-zA-Z0-9_\-\.]/', '_', $file->file);
|
||||
if (!$zip->addFile($filePath, $sanitizedFilename)) {
|
||||
echo '<script>alert("Failed to add file: ' . $file->filename . '");</script>';
|
||||
$zip->close();
|
||||
return redirect()->to('/ViewIGR');
|
||||
}
|
||||
$filesAdded = true;
|
||||
} else {
|
||||
echo '<script> alert("File not found or is a directory: ' . $filePath . '");</script>';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Close ZIP archive if files were added
|
||||
if ($filesAdded) {
|
||||
$zip->close(); // Close ZIP only if files were added
|
||||
return $this->response->download($zipFilePath, null)->setFileName($zipFileName);
|
||||
} else {
|
||||
// Close and remove any empty ZIP file created
|
||||
$zip->close();
|
||||
if (file_exists($zipFilePath)) {
|
||||
unlink($zipFilePath);
|
||||
}
|
||||
echo '<script>alert("No files were added to the ZIP.");</script>';
|
||||
return redirect()->to('/ViewIGR');
|
||||
}
|
||||
}
|
||||
|
||||
public function downloadFilesAsZip()
|
||||
{
|
||||
// Get the IGR number from query string
|
||||
$igrno = $this->request->getGet('IGRNO');
|
||||
|
||||
// Get file details based on IGR number
|
||||
$fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrno);
|
||||
|
||||
// Define root path for original files
|
||||
$fileRootPath = ROOTPATH . 'public/uploads/Igrfiles/';
|
||||
|
||||
// Define separate directory for ZIP output
|
||||
$zipDir = ROOTPATH . 'writable/zips/';
|
||||
if (!is_dir($zipDir)) {
|
||||
if (!mkdir($zipDir, 0777, true)) {
|
||||
echo '<script>alert("Failed to create zip directory.");</script>';
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure ZIP directory is writable
|
||||
if (!is_writable($zipDir)) {
|
||||
echo '<script>alert("ZIP directory is not writable.");</script>';
|
||||
return;
|
||||
}
|
||||
|
||||
// OPTIONAL: Set PHP's temp directory if the system one is failing
|
||||
$customTemp = ROOTPATH . 'writable/tempzip/';
|
||||
if (!is_dir($customTemp)) {
|
||||
mkdir($customTemp, 0777, true);
|
||||
}
|
||||
ini_set('sys_temp_dir', $customTemp);
|
||||
|
||||
// Create ZIP archive
|
||||
$zip = new ZipArchive();
|
||||
$zipFileName = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $igrno) . '.zip'; // sanitize filename
|
||||
$zipFilePath = $zipDir . $zipFileName;
|
||||
|
||||
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== TRUE) {
|
||||
echo '<script>alert("Failed to create ZIP file.");</script>';
|
||||
return redirect()->to('/ViewIGR');
|
||||
}
|
||||
|
||||
$filesAdded = false;
|
||||
|
||||
// Add each file to ZIP
|
||||
foreach ($fileDetails as $file) {
|
||||
$filePath = $fileRootPath . $file->file;
|
||||
|
||||
if (file_exists($filePath) && is_file($filePath)) {
|
||||
$sanitizedFilename = preg_replace('/[^a-zA-Z0-9_\-\.]/', '_', $file->file);
|
||||
if (!$zip->addFile($filePath, $sanitizedFilename)) {
|
||||
echo '<script>alert("Failed to add file: ' . $file->file . '");</script>';
|
||||
$zip->close();
|
||||
return redirect()->to('/ViewIGR');
|
||||
}
|
||||
$filesAdded = true;
|
||||
} else {
|
||||
echo '<script>alert("File not found: ' . $filePath . '");</script>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($filesAdded) {
|
||||
$zip->close();
|
||||
return $this->response->download($zipFilePath, null)->setFileName($zipFileName);
|
||||
} else {
|
||||
$zip->close();
|
||||
if (file_exists($zipFilePath)) {
|
||||
unlink($zipFilePath);
|
||||
}
|
||||
echo '<script>alert("No files were added to the ZIP.");</script>';
|
||||
return redirect()->to('/ViewIGR');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -991,18 +991,19 @@ class Monthlypay extends BaseController
|
||||
|
||||
$leave_details['created_by'] = $userId;
|
||||
$affectedRows = $this->monthlypay_model->saveleaveApplicationForm($leave_details,$id);
|
||||
if ($affectedRows > 0) {
|
||||
// if ($affectedRows > 0) {
|
||||
$data = ['status' => true, 'message' => 'Leave Applicationform details created successfully.'];
|
||||
}
|
||||
// }
|
||||
} else {
|
||||
$leave_details['leave_application_id'] = $id;
|
||||
$leave_details['updated_by'] = $userId;
|
||||
$affectedRows = $this->monthlypay_model->saveleaveApplicationForm($leave_details,$id);
|
||||
if ($affectedRows > 0) {
|
||||
$data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
|
||||
}else{
|
||||
$data = ['status' => true, 'message' => 'There is no changes in Leave Applicationform details.'];
|
||||
}
|
||||
// if ($affectedRows > 0) {
|
||||
// $data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
|
||||
// }else{
|
||||
// $data = ['status' => true, 'message' => 'There is no changes in Leave Applicationform details.'];
|
||||
// }
|
||||
$data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -894,7 +894,7 @@ class Payslip extends BaseController
|
||||
|
||||
$Estimate_first = explode(".", $Estimate);
|
||||
|
||||
if (!is_numeric($Estimate) || (strlen((string)$Estimate)) > 8 || (strlen((string)$Estimate_first[0])) > 6) {
|
||||
if (!is_numeric($Estimate) || (strlen((string)$Estimate)) > 10 || (strlen((string)$Estimate_first[0])) > 8) {
|
||||
// echo $Estimate_first[0];
|
||||
// echo $EmpID . "-Estimate Invalid Data!";
|
||||
$ErrorFlag++;
|
||||
|
||||
@ -131,7 +131,8 @@ class Driver_model extends Model
|
||||
}
|
||||
|
||||
function driverAttendanceForMonthlyPayInputs($from,$to){
|
||||
// list($year,$month,$date) = explode('-', get_current_date());
|
||||
list($year,$month,$date) = explode('-', $from);
|
||||
$t_driver_monthly_pay_inputs_month_year = "$month-$year";
|
||||
// $new_date_format = "$year-$month-01";
|
||||
|
||||
$builder = $this->db->table('t_driver_attendance')
|
||||
@ -145,7 +146,11 @@ class Driver_model extends Model
|
||||
->join('t_emp_pay_data','t_emp_pay_data.EmpID=driver_details.EmpID','Left')
|
||||
->join('t_loan_master','t_loan_master.EmpID = driver_details.EmpID and t_loan_master.Remaining_Due != 0','Left')
|
||||
->join('t_loan_history','t_loan_history.Loan_ID = t_loan_master.Loan_ID','Left')
|
||||
->join('t_driver_monthly_pay_inputs','t_driver_monthly_pay_inputs.driver_id = driver_details.EmpID','Left')
|
||||
->join('t_driver_monthly_pay_inputs',
|
||||
't_driver_monthly_pay_inputs.driver_id = driver_details.EmpID AND
|
||||
t_driver_monthly_pay_inputs.month_year = "'.$t_driver_monthly_pay_inputs_month_year.'"',
|
||||
'left'
|
||||
)
|
||||
->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"')
|
||||
// ->where("t_loan_master.Due_Start_Date", $new_date_format)
|
||||
->groupBy('DATE_FORMAT(t_driver_attendance.date, "%M-%Y"),t_driver_attendance.driver_id');
|
||||
@ -156,7 +161,6 @@ class Driver_model extends Model
|
||||
}
|
||||
|
||||
|
||||
|
||||
function driverMonthlyPayInputs($monthYear){
|
||||
|
||||
$builder = $this->db->table('t_driver_monthly_pay_inputs');
|
||||
@ -221,7 +225,8 @@ class Driver_model extends Model
|
||||
->where('DATE_FORMAT(`t_driver_attendance`.`date`, "%Y-%m")',$monthyear)
|
||||
->where('t_driver_attendance.driver_id',$input_driver_id);
|
||||
$query = $builder->get()->getRow();
|
||||
// $last_query = $this->db->getLastQuery();
|
||||
// $last_query = $this->db->getLastQuery();
|
||||
// echo $last_query;die;
|
||||
return $query;
|
||||
}
|
||||
function getPayOn()
|
||||
|
||||
@ -262,7 +262,7 @@
|
||||
|
||||
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
|
||||
<?php if(($record->isIgrFilePresent)){ ?>
|
||||
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>">
|
||||
<a target="_blank" href="<?php echo base_url().'download-files?IGRNO='.$record->IGRNO; ?>">
|
||||
<i class="fa fa-download" style="text-align: center;"></i>
|
||||
</a>
|
||||
|
||||
|
||||
@ -553,7 +553,6 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
var diesel = parseFloat($('input[data-column="diesel_amount"]').val()) || 0;
|
||||
var shed = parseFloat($('input[data-column="shed_amount"]').val()) || 0;
|
||||
var row = parseInt($('#rowTotalAmount').text()) || 0;
|
||||
console.log(row);
|
||||
|
||||
var total = row + diesel + shed;
|
||||
$('#totalAmount').text(total); // Display the total with 2 decimal places
|
||||
@ -570,15 +569,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
|
||||
|
||||
let param_month_year = urlParams.get("month_year");
|
||||
let param_date = urlParams.get("date");
|
||||
|
||||
if(param_date == ""){
|
||||
let monthMap = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04","May": "05", "Jun": "06", "Jul": "07", "Aug": "08","Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12"};
|
||||
let [month, year] = param_month_year.split('-');
|
||||
input_date = `01-${monthMap[month]}-${year}`;
|
||||
|
||||
}else{
|
||||
input_date = param_date;
|
||||
}
|
||||
if (!param_date || param_date.trim() === "") {
|
||||
|
||||
let new_my = param_month_year ? param_month_year : "<?php echo date('M-Y'); ?>";
|
||||
let monthMap = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04", "May": "05", "Jun": "06", "Jul": "07", "Aug": "08", "Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12"};
|
||||
let [month, year] = new_my.split('-');
|
||||
input_date = `01-${monthMap[month]}-${year}`;
|
||||
|
||||
} else { input_date = param_date; }
|
||||
|
||||
|
||||
// Send data to the server using AJAX
|
||||
$.ajax({
|
||||
|
||||
@ -112,9 +112,9 @@
|
||||
id="drpStatus_<?php echo $d['leave_application_id'] ?>"
|
||||
onchange="callLeaveStatus('<?php echo $d['leave_application_id'] ?>', this.value, this)"
|
||||
style="width: 193px;">
|
||||
<option value="">Select</option>
|
||||
<option value="Approved">Approve</option>
|
||||
<!-- <option value="">Select</option> -->
|
||||
<option value="Draft">Draft</option>
|
||||
<option value="Approved">Approve</option>
|
||||
</select>
|
||||
<?php }else{
|
||||
echo esc($d['status']);
|
||||
@ -275,8 +275,8 @@
|
||||
$('.tooltip-trigger').tooltip();
|
||||
$(".searchabledropdown").select2();
|
||||
let today = new Date().toISOString().split("T")[0]; // Format: YYYY-MM-DD
|
||||
$("#start_date").attr("min", today);
|
||||
$("#end_date").attr("min", today);
|
||||
// $("#start_date").attr("min", today);
|
||||
// $("#end_date").attr("min", today);
|
||||
$('#start_date').change(function() {
|
||||
let start = new Date($('#start_date').val());
|
||||
let formattedStart = start.toISOString().split('T')[0]; // Convert to YYYY-MM-DD format
|
||||
|
||||
@ -413,10 +413,10 @@
|
||||
$('#MaterialRcvdDate').focus();
|
||||
return false;
|
||||
} else if (Noval == 0) {
|
||||
alert('Invoice Quantity is Empty.Please Enter the value');
|
||||
alert('Invoice Quantity is Missing. Kindly Enter the Value');
|
||||
return false;
|
||||
} else if (isExceed == 1 && formatted_IsOpenOrder == 0) {
|
||||
alert("Invoice Quantity is exceeding the Ordered Quantity.Please Contact Purchase Team for further Process ")
|
||||
alert("Invoice Quantity is exceeding the Ordered Quantity. Please Contact Purchase Team for further Process ")
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
||||
@ -567,8 +567,8 @@
|
||||
<?php echo number_format(0.00, 2, '.', ''); ?>
|
||||
</td>
|
||||
|
||||
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;" data-empid="<?php echo $record->EmpID; ?>">
|
||||
<a href="#" onclick="openDriverLoad(this)">
|
||||
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
|
||||
<a href="#" onclick="openDriverLoad('<?php echo $record->EmpID; ?>')">
|
||||
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalsalary[] = $sum_of_amount; ?>
|
||||
</a>
|
||||
</td>
|
||||
@ -620,7 +620,7 @@
|
||||
</td>
|
||||
|
||||
|
||||
<td id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);"
|
||||
<td class="monthDue" id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);"
|
||||
<?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?>
|
||||
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
|
||||
style="text-align:right;color:blue;"
|
||||
@ -640,7 +640,7 @@
|
||||
<?php echo number_format(0.00, 2, '.', ''); ?>
|
||||
</td>
|
||||
|
||||
<!-- <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?> -->
|
||||
<?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?>
|
||||
|
||||
<td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);"
|
||||
onkeyup="driverchangeInput(event);"
|
||||
@ -1265,7 +1265,7 @@ $(document).ready(function () {
|
||||
|
||||
var driverMonthSalary = driverSalaryAdd - driverSalarySub
|
||||
var driverSalary = Math.round(driverMonthSalary);
|
||||
console.log("Sal ",driverSalary);
|
||||
console.log("Driver Sal ",driverSalary);
|
||||
|
||||
|
||||
var cals = (driverSalary).toFixed(0);
|
||||
@ -1273,35 +1273,41 @@ $(document).ready(function () {
|
||||
document.getElementById("empsal" + sno).innerHTML = cals;
|
||||
|
||||
// copied from calculategrandtotal() because we need those two only thats why
|
||||
var AutoLoanDueIndex = 22;
|
||||
const td = document.querySelector('.monthDue');
|
||||
var AutoLoanDueIndex = td ? td.cellIndex : -1;
|
||||
var AutoLoanDue = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(AutoLoanDueIndex).text();
|
||||
AutoLoanDue += parseFloat(value) || 0;
|
||||
});
|
||||
$('#monthloan').text(AutoLoanDue);
|
||||
|
||||
console.log("AutoLoanDue ",AutoLoanDue);
|
||||
|
||||
var FestivalBonusIndex = 24;
|
||||
var FestivalBonusIndex = 23;
|
||||
var FestivalBonus = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FestivalBonusIndex).text();
|
||||
FestivalBonus += parseFloat(value) || 0;
|
||||
});
|
||||
$('#fest').text(FestivalBonus);
|
||||
console.log("FestivalBonus ",FestivalBonus);
|
||||
|
||||
var EstimateIndex = 25;
|
||||
var EstimateIndex = 24;
|
||||
var Estimate = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(EstimateIndex).text();
|
||||
Estimate += parseFloat(value) || 0;
|
||||
});
|
||||
$('#estsal').text(Estimate);
|
||||
console.log("Estimate ",Estimate);
|
||||
|
||||
}
|
||||
|
||||
function calculategrandtotal()
|
||||
{
|
||||
var AutoLoanDueIndex = 22;
|
||||
const td = document.querySelector('.monthDue');
|
||||
var AutoLoanDueIndex = td ? td.cellIndex : -1;
|
||||
var AutoLoanDue = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(AutoLoanDueIndex).text();
|
||||
@ -1309,7 +1315,7 @@ $(document).ready(function () {
|
||||
});
|
||||
$('#monthloan').text(AutoLoanDue);
|
||||
|
||||
var TDSDeductionsIndex = 23;
|
||||
var TDSDeductionsIndex = 22;
|
||||
var TDSDeductions = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(TDSDeductionsIndex).text();
|
||||
@ -1317,7 +1323,7 @@ $(document).ready(function () {
|
||||
});
|
||||
$('#other').text(TDSDeductions);
|
||||
|
||||
var FestivalBonusIndex = 24;
|
||||
var FestivalBonusIndex = 23;
|
||||
var FestivalBonus = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(FestivalBonusIndex).text();
|
||||
@ -1325,7 +1331,7 @@ $(document).ready(function () {
|
||||
});
|
||||
$('#fest').text(FestivalBonus);
|
||||
|
||||
var EstimateIndex = 25;
|
||||
var EstimateIndex = 24;
|
||||
var Estimate = 0;
|
||||
$('#monthlylistings tbody tr').each(function() {
|
||||
var value = $(this).find('td').eq(EstimateIndex).text();
|
||||
@ -1338,11 +1344,10 @@ $(document).ready(function () {
|
||||
|
||||
|
||||
|
||||
function openDriverLoad(element) {
|
||||
var empId = $(element).data("empid"); // Get the empid from clicked element
|
||||
function openDriverLoad(empId) {
|
||||
var monthYear = $('#monthyear').val();
|
||||
// Convert "03-2025" to "Mar-2025"
|
||||
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||
// 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];
|
||||
|
||||
@ -94,61 +94,100 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
|
||||
<script type="text/html" id="addList">
|
||||
<tr>
|
||||
<td style="text-align:left;" contenteditable="true"><%=Holiday_Name%></td>
|
||||
<td style="text-align:left;" contenteditable="false"><%=Date%></td>
|
||||
<td style="text-align:center;">
|
||||
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" id="Del"><span class="fas fa-trash"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function DeleteRow(rowid) {
|
||||
var d = '';
|
||||
//alert(rowid);
|
||||
var tr = document.getElementById(rowid);
|
||||
var Row = $('#phdays').find('tr').eq(rowid).find('td');
|
||||
|
||||
if (!tr) return; // Just in case
|
||||
|
||||
var isNew = tr.getAttribute('data-is-new');
|
||||
|
||||
if (isNew === 'true') {
|
||||
// Just remove from DOM, no backend call
|
||||
tr.parentNode.removeChild(tr);
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle DB row delete
|
||||
var d = '';
|
||||
var Row = $('#' + rowid).find('td');
|
||||
$.each(Row, function(index, value) {
|
||||
if (index == 1) {
|
||||
d = value.textContent
|
||||
d = value.textContent;
|
||||
}
|
||||
});
|
||||
// alert(d);
|
||||
// $('#content').loader('show');
|
||||
|
||||
$.ajax({
|
||||
data: {
|
||||
param1: d
|
||||
},
|
||||
data: { param1: d },
|
||||
type: "POST",
|
||||
url: "<?php echo base_url() ?>monthlypay/deletePublicHoliday",
|
||||
|
||||
success: function(data) {
|
||||
// $('#content').loader('hide');
|
||||
alert(data);
|
||||
tr.parentNode.removeChild(tr);
|
||||
}
|
||||
|
||||
});
|
||||
tr.parentNode.removeChild(tr);
|
||||
}
|
||||
|
||||
// function DeleteRow(rowid) {
|
||||
// var d = '';
|
||||
// //alert(rowid);
|
||||
// var tr = document.getElementById(rowid);
|
||||
// var Row = $('#phdays').find('tr').eq(rowid).find('td');
|
||||
// $.each(Row, function(index, value) {
|
||||
// if (index == 1) {
|
||||
// d = value.textContent
|
||||
// }
|
||||
// });
|
||||
// // alert(d);
|
||||
// // $('#content').loader('show');
|
||||
// $.ajax({
|
||||
// data: {
|
||||
// param1: d
|
||||
// },
|
||||
// type: "POST",
|
||||
// url: "<?php echo base_url() ?>monthlypay/deletePublicHoliday",
|
||||
|
||||
// success: function(data) {
|
||||
// // $('#content').loader('hide');
|
||||
// alert(data);
|
||||
// }
|
||||
|
||||
// });
|
||||
// tr.parentNode.removeChild(tr);
|
||||
// }
|
||||
|
||||
$('#Add').click(function() {
|
||||
var index = $('#phdays tr').length;
|
||||
var index = $('#phdays tbody tr').length + 1; // Better index logic
|
||||
var H_name = $('#hname').val();
|
||||
var H_date = $('#hdate').val();
|
||||
|
||||
if (H_name != '' && H_date != '') {
|
||||
var template = jQuery("#addList").html();
|
||||
$('#db').append(_.template(template)({
|
||||
index: index,
|
||||
Holiday_Name: H_name,
|
||||
Date: H_date
|
||||
}));
|
||||
$('#hname').val('');
|
||||
$('#hdate').val('');
|
||||
// Destroy DataTable if initialized
|
||||
if ($.fn.DataTable.isDataTable('#phdays')) {
|
||||
$('#phdays').DataTable().destroy();
|
||||
}
|
||||
|
||||
var template = `
|
||||
<tr id="${index}" data-is-new="true">
|
||||
<td contenteditable='true' style="text-align:left;">${H_name}</td>
|
||||
<td contenteditable='false' style="text-align:left;">${H_date}</td>
|
||||
<td style="text-align:center;">
|
||||
<a href='#' onclick="DeleteRow(${index})" id="Del"><span class="fas fa-trash"></span></a>
|
||||
</td>
|
||||
</tr>`;
|
||||
|
||||
$('#db').append(template);
|
||||
|
||||
// Clear inputs
|
||||
$('#hname').val('');
|
||||
$('#hdate').val('');
|
||||
|
||||
// Re-initialize DataTable if needed
|
||||
$('#phdays').DataTable();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('#submit').click(function() {
|
||||
var jsondata = $('#phdays').tableToJSON();
|
||||
@ -165,6 +204,7 @@
|
||||
success: function(data) {
|
||||
// $('#content').loader('hide');
|
||||
alert(data);
|
||||
location.reload(); // Refreshes the current page
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -317,11 +317,11 @@ $(document).ready(function () {
|
||||
let tableHtml = `
|
||||
<table class="table table-bordered" style="table-layout: auto; width: 100%;">
|
||||
<thead style="background-color: #539754; color: white; font-size: 13px;">
|
||||
<tr>
|
||||
<th style="text-align: center;" > Date</th>
|
||||
<th style="text-align: center;" > Supplier</th>
|
||||
<tr style="width:100%">
|
||||
<th style="text-align: center; width: 12%;" >Date</th>
|
||||
<th style="text-align: center;" >Supplier</th>
|
||||
<th style="text-align: center;" >PONO</th>
|
||||
<th style="text-align: center;" >PO Type</th>
|
||||
<th style="text-align: center; width: 12%;" >PO Type</th>
|
||||
<th style="text-align: center;" >Total Value</th>
|
||||
<th style="text-align: center;" >Action</th>
|
||||
</tr>
|
||||
@ -336,8 +336,8 @@ $(document).ready(function () {
|
||||
href = `${baseUrl}purchaseorder/CreatePOPrint?PONO=${item.PONO}&ReqType=${item.ReqType}`;
|
||||
|
||||
tableHtml += `
|
||||
<tr>
|
||||
<td style="text-align: left; padding-left: 1.5%;">${CreatedDate}</td>
|
||||
<tr style="width:100%">
|
||||
<td style="text-align: left; padding-left: 1.5%;width:12%">${CreatedDate}</td>
|
||||
<td>${item.SupplierName}</td>
|
||||
<td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #02a8b5;" onmouseover="this.style.color='#016269';">
|
||||
${item.PONO}
|
||||
|
||||
@ -177,7 +177,7 @@
|
||||
<li class="breadcrumb-item"><a href="javascript: void(0);">Sales</a></li>
|
||||
|
||||
<li class="breadcrumb-item active">
|
||||
<h4 class="page-title">Invoices List</h4>
|
||||
<h4 class="page-title">Invoice List</h4>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
@ -341,7 +341,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body" style="margin-top: 23px;">
|
||||
<div class="modal-body">
|
||||
<?php if (isset($invoice_data)) {
|
||||
foreach ($invoice_data as $key => $value) { ?>
|
||||
|
||||
@ -541,7 +541,7 @@ $(document).ready(function () {
|
||||
console.log(element);
|
||||
var fileName = element.file_name;
|
||||
var attachmentName = element.attachment_name;
|
||||
attachmentsHtml += ` <br>
|
||||
attachmentsHtml += `
|
||||
<div class="row pad">
|
||||
<div class="col-md-4">
|
||||
<span>File Name</span>
|
||||
@ -576,11 +576,11 @@ $(document).ready(function () {
|
||||
var newRowHtml = `
|
||||
<div class="row pad">
|
||||
<div class="col-md-4">
|
||||
<span for="file_name">File name</span>
|
||||
<span for="file_name">File name<span class="text-danger">*</span></span>
|
||||
<input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<span for="emp_file">File</span>
|
||||
<span for="emp_file">File<span class="text-danger">*</span></span>
|
||||
<input type="file" name="emp_file[]" class="form-control">
|
||||
</div>
|
||||
<div class="col-md-4" style="margin-top: 23px;">
|
||||
|
||||
@ -301,7 +301,7 @@
|
||||
|
||||
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
|
||||
<?php if(($record->isIgrFilePresent)){ ?>
|
||||
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>">
|
||||
<a target="_blank" href="<?php echo base_url().'download-files?IGRNO='.$record->IGRNO; ?>">
|
||||
<i class="fa fa-download" style="text-align: center;"></i>
|
||||
</a>
|
||||
|
||||
@ -630,7 +630,7 @@
|
||||
?>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); ">
|
||||
<input type="file" name="WeightFile" id="WeightFile" onchange="filenames(this.name); "><br>
|
||||
|
||||
<label id="WeightFileLabel" style="display:none;">
|
||||
<a><span></span><small></small></a>
|
||||
@ -1813,8 +1813,8 @@
|
||||
$(document).ready(function() {
|
||||
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
||||
var inx = $(e.relatedTarget).data('index');
|
||||
console.log(inx);
|
||||
var material = $(e.relatedTarget).data('material');
|
||||
// console.log(material);// toolbox
|
||||
var modal = $(this);
|
||||
|
||||
|
||||
@ -1847,7 +1847,6 @@
|
||||
modal.find('#WeightFileLabel a small').text(fileName);
|
||||
modal.find('#WeightFileLabel').show();
|
||||
}
|
||||
console.log(fileInput);
|
||||
console.log("Selected values for index:", typeof inx, inx);
|
||||
|
||||
// Set modal inputs with the retrieved values
|
||||
@ -1858,7 +1857,6 @@
|
||||
$("#NetWeight").val(v5);
|
||||
$("#CurrentInx").val(inx);
|
||||
|
||||
fileName
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
var targetInput = $("#WeightFile")[0];
|
||||
var file = fileInput.files[0];
|
||||
@ -1884,20 +1882,11 @@
|
||||
var v5 = $("#NetWeight").val();
|
||||
var inx = $("#CurrentInx").val();
|
||||
var IGRNO1 = $("#IGRNO1").val();
|
||||
var fileInput = $("#WeightFile")[0]; // Get the file input element
|
||||
var fileInput = $("#WeightFile")[0];
|
||||
|
||||
if (inx !== undefined && inx !== '') {
|
||||
console.log("Saving values for index:", inx);
|
||||
|
||||
// Set the values back to the hidden inputs
|
||||
$("#txtGrossWeight" + inx).val(v1);
|
||||
$("#txtGrossWeightDate" + inx).val(v2);
|
||||
$("#txtTareWeight" + inx).val(v3);
|
||||
$("#txtTareWeightDate" + inx).val(v4);
|
||||
$("#txtNetWeight" + inx).val(v5);
|
||||
var txtIGRLineItem = $("#txtIGRLineItem" + inx).val();
|
||||
|
||||
// Prepare FormData
|
||||
var formData = new FormData();
|
||||
formData.append('GrossWeight', v1);
|
||||
formData.append('GrossWeightDate', v2);
|
||||
@ -1906,54 +1895,32 @@
|
||||
formData.append('NetWeight', v5);
|
||||
formData.append('IGR', IGRNO1);
|
||||
formData.append('IGRlineitem', txtIGRLineItem);
|
||||
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
var file = fileInput.files[0];
|
||||
formData.append('WeightFile', file);
|
||||
console.log("File selected:", file.name);
|
||||
} else {
|
||||
console.log("No file selected or file input not found.");
|
||||
console.log("No file selected.");
|
||||
}
|
||||
// if (fileInput && fileInput.files.length > 0) {
|
||||
// var targetInput = $("#txtWeightFile" + inx)[0];
|
||||
// var file = fileInput.files[0];
|
||||
|
||||
// // Create a new DataTransfer object
|
||||
// var dataTransfer = new DataTransfer();
|
||||
// dataTransfer.items.add(file);
|
||||
|
||||
// // Set the file to the target input
|
||||
// targetInput.files = dataTransfer.files;
|
||||
// formData.append('WeightFile', file);
|
||||
|
||||
// } else {
|
||||
// console.log("No file selected or file input not found.");
|
||||
// }
|
||||
$.ajax({
|
||||
url: "<?php echo base_url() ?>updateIGRWeight",
|
||||
url: "<?php echo base_url('updateIGRWeight'); ?>",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
contentType: false, // Don't set content type header
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
alert(data);
|
||||
}
|
||||
|
||||
alert(data);
|
||||
$("#WeightCalculator").modal('hide');
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.log("Upload error:", error);
|
||||
}
|
||||
});
|
||||
// Clear modal inputs
|
||||
$("#GrossWeight").val('');
|
||||
$("#GrossWeightDate").val('');
|
||||
$("#TareWeight").val('');
|
||||
$("#TareWeightDate").val('');
|
||||
$("#NetWeight").val('');
|
||||
$("#WeightFile").val('');
|
||||
|
||||
// Close the modal
|
||||
$("#WeightCalculator").modal('hide');
|
||||
} else {
|
||||
console.log("Saving values for index: " + inx + " undefined");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
function formatDateTime(dateString, flag) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user