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