Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Gowtham M 2025-04-21 14:40:15 +05:30
commit 8f3b86a161
85 changed files with 8994 additions and 4999 deletions

View File

@ -90,5 +90,5 @@ class Autoload extends AutoloadConfig
*
* @var list<string>
*/
public $helpers = ['cias','datetime','image','alert','excel'];
public $helpers = ['cias','datetime','image','alert'];
}

View File

@ -41,6 +41,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'editUser', 'User::editUser');
$routes->post('user/Deleteuserdepartment', 'User::Deleteuserdepartment');
$routes->get('user/deleteUser', 'User::deleteUser');
$routes->get('user/reActivateUser', 'User::reActivateUser');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'isEmailExists', 'User::isEmailExists');
// Supplier Routes
$routes->match(["GET","POST"],'supplierlisting', 'Supplier::index'); // list supplier
@ -203,6 +204,9 @@ $routes->get('deleteLeaveApplicationForm', 'Monthlypay::deleteLeaveApplicationFo
$routes->post('validateDateRange', 'Monthlypay::validateDateRange');
$routes->match(['GET', 'POST'], 'leaveApplicationPDF/(:any)', 'Monthlypay::leaveApplicationPDF/$1');
$routes->match(['GET', 'POST'], 'overTimeDetails', 'Monthlypay::overTimeDetails');
$routes->get('exportMonthlyPayInputs/(:any)', 'Payslip::exportMonthlyPayInputs/$1');
$routes->get('leaveStatus/(:any)/(:any)', 'Monthlypay::leaveStatus/$1/$2');
$routes->get('emppaydate/addemppaydate', 'Emppaydate::addemppaydate');
$routes->post('emppaydate/addNewemppay', 'Emppaydate::addNewemppay');
@ -248,6 +252,7 @@ $routes->post('EditRequisition', 'Requisitionform::EditRequisition');
$routes->post('addNewRequisition', 'Requisitionform::addNewRequisition');
$routes->post('getMaterialCode', 'Requisitionform::getMaterialCode');
$routes->post('getMaterialDetails', 'Requisitionform::getMaterialDetails');
$routes->post('getCategoryDetails', 'Requisitionform::getCategoryDetails');
$routes->post('DeleteRequistionForm', 'Requisitionform::DeleteRequistionForm'); // recheck it used or not.
$routes->post('requisitionform/ApproveRequest', 'Requisitionform::ApproveRequest');
$routes->post('requisitionform/DeleteReqNo', 'Requisitionform::DeleteReqNo');
@ -322,7 +327,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');
@ -330,6 +335,7 @@ $routes->post('updateGasShortage','Inwardgateregister::updateGasShortage');
$routes->get('gasCylinderEntered','Inwardgateregister::gasCylinderEntered');
$routes->get('gasCylinderPending','Inwardgateregister::gasCylinderPending');
$routes->get('gasCylinderReturned','Inwardgateregister::gasCylinderReturned');
$routes->post('gasCylindersByIgr','Inwardgateregister::gasCylindersByIgr');
$routes->post('getGasShortageDetail',"Inwardgateregister::getGasShortageDetail");

View File

@ -87,6 +87,7 @@ class Configurationctrl extends BaseController
$isActiveFilter = 1 ; // default flag for active data
$showArchive = 0 ; // default flag for inactive data
$page = 1; // default page number
if ($this->request->getMethod() === 'POST') {
@ -100,6 +101,7 @@ class Configurationctrl extends BaseController
if ($this->request->getMethod() === 'GET') {
$ConfigID = $this->request->getVar('ConfigID');
$page = $this->request->getVar('page');
}
$data['showArchive'] = $showArchive;
@ -107,7 +109,10 @@ class Configurationctrl extends BaseController
$data['master'] = $this->configmodel->GetConfigCenterMaster($ConfigID);
$data['child'] = $this->configmodel->GetConfigCenterDetails($ConfigID,$isActiveFilter);
$data['ConfigID'] = $ConfigID;
$data['page'] = $page;
$this->global['pageTitle'] = 'Edit Config';
$this->loadViews("editconfig", $this->global, $data, NULL);
@ -121,6 +126,7 @@ class Configurationctrl extends BaseController
$ConfigName = $this->request->getPost('ConfigName');
$Comments = $this->request->getPost('Remarks');
$Rowcount = $this->request->getPost('txtRowCount');
$page = $this->request->getGet('page')??1;
$config = array('Config_ID' => $ConfigId, 'ConfigName' => $ConfigName, 'Comments' => $Comments);
$result = $this->configmodel->updateconfig($config, $ConfigId);
@ -142,7 +148,7 @@ class Configurationctrl extends BaseController
$this->session->setFlashdata('success', 'Configuration Updated successfully!');
return redirect()->route('configlisting');
return redirect()->to('/configlisting?page=' . $page);
}
@ -252,8 +258,10 @@ class Configurationctrl extends BaseController
$configId = $data['ConfigID'];
$configValue = $data['ConfigValue'];
$key = $data['key']??'';
$userId = $data['userId'];
$result = $this->configmodel->saveConfigValue($key,$configId, $configValue);
$result = $this->configmodel->saveConfigValue($key,$configId, $configValue,$userId);
if($result){
return $this->response->setJSON(['status'=>true]);

View File

@ -561,7 +561,6 @@ class Driver extends BaseController
$html = view("driverPayslipGeneratePrint", $Data);
}
$mpdf = new Mpdf([
'mode' => 'utf-8',
'format' => 'A4-P',

View File

@ -926,108 +926,145 @@ class Employeedetails extends BaseController
function exportemployee()
{
$exportData = $this->employeedetails_model->export_excel();
$companyName = $this->companydetailsmodel->companylisting();
$companyName = isset($companyName[0]->CompanyName) ? $companyName[0]->CompanyName : "Resico India Pvt Ltd";
$file_name = 'Employee_Details' . ' ' . '.xls'; //save our workbook as this file name
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->mergeCells('L3:S3');
$sheet->getStyle('L3')->getAlignment()->setHorizontal('center');
$sheet->setTitle('Employee details');
$sheet->mergeCells('A1:AN1');
$sheet->getStyle('A1')->getAlignment()->setHorizontal('center');
$sheet->setTitle('Employee Details');// Sheet 1 replaced
$headers = [
'L3' => 'RESICO Employee Details',
'A5' => 'EmpID',
'B5' => 'FirstName-LastName',
'C5' => 'FatherName',
'D5' => 'Gender',
'E5' => 'Date of Birth',
'F5' => 'ContactNumber',
'G5' => 'EmailId',
'H5' => 'BloodGroup',
'I5' => 'MartialStatus',
'J5' => 'DateofJoining',
'K5' => 'PreviousYearsOfExp',
'L5' => 'Designation',
'M5' => 'DepartmentName',
'N5' => 'PresentAddress',
'O5' => 'PermanentAddress',
'P5' => 'EmergencyContactName',
'Q5' => 'EmergencyContactNumber',
'R5' => 'Edu_Qualification',
'S5' => 'Additional_Qualification',
'T5' => 'Reference_Name',
'U5' => 'Reference_ContactNumber',
'V5' => 'BankStatemant',
'W5' => 'AadharNo',
'X5' => 'PANNo',
'Y5' => 'PassportNo',
'Z5' => 'Passport_Valid_till',
'AA5' => 'Voter ID',
'AB5' => 'Driving License',
'AC5' => 'Driving License Expiry Date',
'AD5' => 'Official Email ID',
'AE5' => 'IsActive',
'AF5' => 'PFNO',
'AG5' => 'ESI',
'AH5' => 'Nominee Details',
// 'AI5'=>'PF_Balance',
// 'AJ5'=>'PF_Bal_On',
'AI5' => 'Remarks',
'AJ5' => 'CreatedBy',
'AK5' => 'UpdatedBY'
'A1' => $companyName.' - Employee Details',
'A2' => 'EmpID',// personal
'B2' => 'Name',
'C2' => 'Father / Husband Name',
'D2' => 'Gender',
'E2' => 'Date of Birth',
'F2' => 'ContactNumber',
'G2' => 'MartialStatus',
'H2' => 'Date of Joining',
'I2' => 'Previous Years of Experience',
'J2' => 'Designation',
'K2' => 'DepartmentName',
'L2' => 'PresentAddress',
'M2' => 'PermanentAddress',
'N2' => 'Qualification',
'O2' => 'Work_Location',
'P2' => 'Management Team',
'Q2' => 'Driver',
'R2' => 'Bank Name', // bank & Work related
'S2' => 'Account Number',
'T2' => 'IFSC',
'U2' => 'Bank Address',
'V2' => 'Total Salary',
'W2' => 'Basic Pay',
'X2' => 'HRA Rate(%)',
'Y2' => 'HRA Amount',
'Z2' => 'UAN',
'AA2' => 'PF Applicable',
'AB2' => 'PF Rate(%)',
'AC2' => 'ESI Applicable',
'AD2' => 'ESI Rate(%)',
'AE2' => 'ESI Number',
'AF2' => 'TDS Applicable',
'AG2' => 'TDS Rate(%)',
'AH2' => 'Aadhar Number', //IDentity
'AI2' => 'PAN Number',
'AJ2' => 'Passport Number',
'AK2' => 'Active / Inactive',// Others
'AL2' => 'Reason',
'AM2' => 'Created By',
'AN2' => 'Updated By'
];
foreach ($headers as $cell => $value) {
$sheet->setCellValue($cell, $value);
$sheet->getStyle($cell)->getFont()->setSize($cell == 'L3' ? 14 : 12);
$sheet->getStyle($cell)->getFont()->setSize($cell == 'A1' ? 14 : 12);
$sheet->getStyle($cell)->getFont()->setBold(true);
}
$sheet->getStyle("A2:AN2")->applyFromArray([
'font' => [
'bold' => true,
'size' => 12,
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
]
]);
// $sheet->getRowDimension(5)->setRowHeight(25);
foreach (range('A', 'Z') as $col) {
$sheet->getColumnDimension($col)->setAutoSize(true);
}
foreach (range('A', 'N') as $col) {
$sheet->getColumnDimension('A' . $col)->setAutoSize(true);
}
if ($exportData) {
$i = 6;
$i = 3;
$s = 1;
foreach ($exportData as $data) {
;
// $dob = get_date_time_dynamical_format("Y-m-d H:i:s","d-m-Y","$data['DateofBirth']");
$rowData = [
'A' . $i,
$data['EmpID'],
'B' . $i => $data['FirstName'] . '-' . $data['LastName'],
'A' . $i => $data['EmpID'],
'B' . $i => $data['Name'],
'C' . $i => $data['FatherName'],
'D' . $i => $data['Gender'],
'E' . $i => $data['DateofBirth'],
'E' . $i => get_date_time_dynamical_format("Y-m-d H:i:s","d-m-Y",$data['DateofBirth']),
'F' . $i => $data['ContactNumber'],
'G' . $i => $data['EmailId'],
'H' . $i => $data['BloodGroup'],
'I' . $i => $data['MartialStatus'],
'J' . $i => $data['DateofJoining'],
'K' . $i => $data['PreviousYearsOfExp'],
'L' . $i => $data['Designation'],
'M' . $i => $data['DepartmentName'],
'N' . $i => $data['PresentAddress'],
'O' . $i => $data['PermanentAddress'],
'P' . $i => $data['EmergencyContactName'],
'Q' . $i => $data['EmergencyContactNumber'],
'R' . $i => $data['Edu_Qualification'],
'S' . $i => $data['Additional_Qualification'],
'T' . $i => $data['Reference_Name'],
'U' . $i => $data['Reference_ContactNumber'],
'V' . $i => $data['BankAccountNo'] . '-' . $data['IFSCCode'] . '-' . $data['BankBranchName'] . $data['BankAddress'],
'W' . $i => $data['AadharNo'],
'X' . $i => $data['PANNo'],
'Y' . $i => $data['PassportNo'],
'Z' . $i => $data['Passport_Valid_till'],
'AA' . $i => $data['VoterID'],
'AB' . $i => $data['DriverLicense'],
'AC' . $i => $data['LicenseValidtill'],
'AD' . $i => $data['personalEmailId'],
'AE' . $i => $data['IsActive'],
'AF' . $i => $data['PFNO'],
'AG' . $i => $data['ESI'],
'AH' . $i => $data['NomineeDetails'],
// 'AI'. $i=>$data['PF_Balance'],
// 'AJ'. $i=>$data['PF_Bal_On'],
'AI' . $i => $data['Remarks'],
'AJ' . $i => $data['CreatedByName'],
'AK' . $i => $data['UpdatedByName'],
'G' . $i => $data['MartialStatus'],
'H' . $i => get_date_time_dynamical_format("Y-m-d H:i:s","d-m-Y",$data['DateofJoining']),
'I' . $i => $data['PreviousYearsOfExp'] ? $data['PreviousYearsOfExp'] : 0,
'J' . $i => $data['Designation'],
'K' . $i => $data['DepartmentName'],
'L' . $i => $data['PresentAddress'],
'M' . $i => $data['PermanentAddress'],
'N' . $i => $data['Edu_Qualification'],
'O' . $i => $data['work_location'],
'P' . $i => $data['is_management_team'] ? $data['is_management_team'] : '-',
'Q' . $i => $data['is_driver'] ? $data['is_driver'] : '-',
'R' . $i => $data['BankBranchName'],//bank related
'S' . $i => $data['BankAccountNo'],
'T' . $i => $data['IFSCCode'],
'U' . $i => $data['BankAddress'],
'V' . $i => $data['TotalSalary'], //'Total Salary',
'W' . $i => $data['Basic_Pay'], //'Basic Pay',
'X' . $i => $data['HRA_Rate'], //'HRA Rate(%)',
'Y' . $i => $data['HRA_Amount'], //'HRA Amount',
'Z' . $i => $data['UANO'], //'UAN',
'AA' . $i => $data['pf_applicable'] ? $data['pf_applicable'] : 0, //'PF Applicable',
'AB' . $i => $data['PF_Rate'], //'PF Rate(%)',
// 'AC' . $i => $data['PFNO'],
'AC' . $i => $data['esi_applicable'] ? $data['esi_applicable'] : 0 , //'ESI Applicable',
'AD' . $i => $data['ESI_Rate'], //'ESI Rate(%)',
'AE' . $i => $data['ESI'], //'ESI Number',
'AF' . $i => $data['tds_applicable'] ? $data['tds_applicable'] : 0, //'TDS Applicable',
'AG' . $i => $data['TDS_Rate'], //'TDS Rate(%)',
'AH' . $i => $data['AadharNo'] ? $data['AadharNo'] : '-', //IDentity
'AI' . $i => $data['PANNo'] ? $data['PANNo'] : '-',
'AJ' . $i => $data['PassportNo'] ? $data['PassportNo'] : '-',
'AK' . $i => $data['IsActive'] == 1 ? 'Active' : "In-active",//others
'AL' . $i => $data['reason'] ? $data['reason'] : '-',
'AM' . $i => $data['CreatedByName'],
'AN' . $i => $data['UpdatedByName'],
];
foreach ($rowData as $cell => $value) {

View File

@ -150,8 +150,28 @@ class Emppaydate extends BaseController
function downloadEmpLoanData($paydataid = "")
{
$data['emppay'] = $this->emppaydate_model->getUserInfo($paydataid);
$emppay = $this->emppaydate_model->getUserInfo($paydataid);
$monthYear = get_date_time_dynamical_format('Y-m-d','m-Y',get_current_date());
// $monthYear = "02-2025";
foreach ($emppay as $index => $value) {
if($value->is_driver) {
$info = $this->emppaydate_model->driverPayInfo($value->PAYEMPID, $monthYear);
foreach ($info as $i => $v) {
$hra = $v->HRA; // => 885.60
$esi = $v->ESI; // => 0.00
$pf = $v->PF; // => 0.00
$basic = $v->BASIC;
$TotalSalary = ($basic + $hra + $v->Festival_Bonus) - ($value->Monthly_Due+$esi + $pf);
$emppay[$index]->TotalSalary = $TotalSalary;
$emppay[$index]->Basic_Pay = $basic;
}
}
}
$data['emppay'] = $emppay;
$data['loan_histoty'] = $this->emppaydate_model->getUserLoanHistoryInfo($data['emppay'][0]->Loan_ID);

View File

@ -299,8 +299,9 @@ class Inwardgateregister extends BaseController
$PO = $this->request->getPost('id');
$CreatedBy = $this->session->get('userId');
$this->inwardgateregister_model->UpdatePOMaster($PO, $CreatedBy,IGR_CREATED);
// $this->inwardgateregister_model->UpdatePOMaster($PO, $CreatedBy,IGR_CREATED);
$data = $this->inwardgateregister_model->viewpurchaseorder($PO);
// echo "<pre>"; print_r($data);die;
echo json_encode($data);
}
@ -1080,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()
@ -1327,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');
}
}
@ -1696,6 +1709,26 @@ function updateIGRWeight(){
]);
}
}
public function gasCylindersByIgr(){
$IGRNO = $this->request->getPost('IGRNO');
$gasMaterialCodes = $this->rawMaterialDetails_model->getAllGasMaterialCode();
$gasMaterialCodes = array_column($gasMaterialCodes,'MaterialCode');
$cylinderDetails = $this->inwardgateregister_model->gasCylindersByIgr($IGRNO , $gasMaterialCodes);
$response = [
'status' => 'success',
'message' => 'Gas cylinders retrieved successfully.',
'data' => $cylinderDetails
];
return $this->response->setJSON($response);
}
/*
********************************************************* sec_gas_shortage_ends **************************************************************

View File

@ -970,7 +970,7 @@ class Monthlypay extends BaseController
$this->global['pageTitle'] = 'Employee Leave Application Form';
$data['leave_info'] = $this->monthlypay_model->getheringleaveApplicationForm();
$data['employee_info'] = $this->monthlypay_model->getheringemployeeinformation();
$data['status_info'] = ["Draft","Approved"];
$data['status_info'] = ["Draft","Approved","Cancel"];
$this->loadviews('employeeLeaveApplicationForm', $this->global, $data, NULL);
}
@ -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.'];
}
@ -1041,6 +1042,26 @@ class Monthlypay extends BaseController
}
public function leaveStatus($leave_application_id, $status)
{
if (!empty($leave_application_id)) {
$data = [
'status' => $status,
'updated_by' => session()->get('userId')
];
$affectedRows = $this->monthlypay_model->saveleaveApplicationForm($data, $leave_application_id);
$message = ($affectedRows > 0)
? "Leave Application updated successfully."
: "No changes were made.";
return $this->response->setJSON(['status' => true, 'message' => $message]);
} else {
return $this->response->setJSON(['status' => false, 'message' => 'Invalid leave application ID.']);
}
}
public function leaveApplicationPDF($leave_application_id){

View File

@ -287,14 +287,7 @@ class Payslip extends BaseController
$empSalarySub = $esiAmount + $pfAmount + $loan;
$salaryInCurrentday = $empSalaryAdd - $empSalarySub;
// echo $esiAmount .'</br>';
// echo $pfAmount .'</br>';
// echo $loan .'</br>';
// echo $empSalarySub .'</br>';
// echo $empSalaryAdd .'</br>';
// echo $salaryInCurrentday .'</br>';
// die;
$employeeSalary[] = round($salaryInCurrentday);
$esi[] = number_format($esiAmount,2, '.', '');
$pf[] = number_format($pfAmount,2, '.', '');
@ -309,6 +302,331 @@ class Payslip extends BaseController
$this->loadViews("monthlypayinputs", $this->global, $data, NULL);
}
public function exportMonthlyPayInputs1($value)
{
$headlines = [
'company_name' => 'Resico Solutions',
'file_name' => 'Resico_Salary_'.$value.'.xls',
'type' => 1,
'header1' => ['Emp ID', 'Name', 'Department', 'Salary'], // example headers
'header2' => [],
'footer' => false,
];
$xldata = [
['E001', 'Arun', 'HR', 25000],
['E002', 'Meena', 'Finance', 28000],
];
helper('excel');
generate_excel($headlines, $xldata);
}
public function exportMonthlyPayInputs($value){
helper('excel');
$monthyear = get_date_time_dynamical_format('n-Y','m-Y',"$value");
$employee = [];$i=0; $j=0;
$company_info = $this->payroll_model->getCompanyInformation();
$employee_monthinputs_info = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($monthyear);
$driver_monthinputs_info = $this->driverMonthlyPayInputs($monthyear);
// $headlines_main = ['S. No','Emp ID','Employees Name','Date of Joining','Destingnation','Total Days' ,'Days Worked','Leave','Basic Salary','Per day Salary','Worked Salary','Per Hours Salary','Earned Salary', '70% BASIC','30% HRA','Gross Salary','Esi 0.75%','Pf 12%','Esi + Pf (Ee`s)' ,'Over Time','Feb-25 Advance','TDS 92B','Refuned PF Nov24','Net Salary','Gross Salary','Over Time','Gross Net Salary','Esi (0)','Pf (0)','Sep-24 Advance','TDS 92B','Refuned PF Nov24','Net Salary','Diff'];
$headlines_main = ['S. No','Emp ID','Employees Name','Date of Joining','Destingnation','Total','Days','Leave','Basic','Per day','Worked','Per Hours','Earned','70%','30%','Gross','Esi','Pf','Esi + Pf','Over Time','Feb-25 Advance','TDS 92B','Refuned PF Nov24','Net Salary','Gross','Over Time','Gross Net','Esi','Pf','Sep-24 Advance','TDS 92B','Refuned PF Nov24','Net Salary','Diff'];
$headlines_sub = ['', '', '', '', '', 'Days','Worked','', 'Salary','Salary','Salary','Salary','Salary', 'BASIC','HRA','Salary','0.75%','12%','Ee`s','','','','','','Salary','','Salary',' 0','0','','','','',''];
$dum = [];
foreach ($employee_monthinputs_info as $key => $rec) {
// echo $rec->EmpID;
// print_r($dum);die;
$dum[$rec->EmpID] = $rec;
}
$employee_monthinputs_info = array_values($dum);
foreach ($employee_monthinputs_info as $value) {
$employee[$i]['SNO'] = $i+1;
$employee[$i]['ID'] = $value->EmpID;
$employee[$i]['Name'] = $value->FirstName;
$employee[$i]['DOJ'] = get_date_time_dynamical_format('Y-m-d H:i:s','d-m-Y',"$value->DateofJoining");
$employee[$i]['Designation'] = $value->Designation ;
$NoofDays = $value->NoofDays; // Month day 30,31,28
$employee[$i]['NoofDays'] = round($NoofDays);
$Days_worked = $value->Days_worked; // Work day
$employee[$i]['Days_worked'] = round($Days_worked);
$employee[$i]['Leave'] = round($value->NoofDays - ($Days_worked)); // Absent Days LOP
$Basic_Pay = $value->Basic_Pay;
// $employee[$i]['Basic_Pay'] = $Basic_Pay;
$TotalSalary = $value->TotalSalary;
$employee[$i]['TotalSalary'] = number_format($TotalSalary, 2, '.', '');
$PerDaySalary = $value->TotalSalary / $NoofDays;
$employee[$i]['PerDaySalary'] = number_format($PerDaySalary, 2, '.', '');
$WorkedSalary = $PerDaySalary * ($Days_worked);
$employee[$i]['WorkedSalary'] = number_format($WorkedSalary, 2, '.', '');
$PerHrSalary = $PerDaySalary / 8;
$employee[$i]['PerHrSalary'] = number_format($PerHrSalary, 2, '.', '');
$employee[$i]['EarnedSalary'] = number_format($WorkedSalary, 2, '.', '');
$BasicWorked = $WorkedSalary * 70 / 100;
$employee[$i]['BasicWorked'] = number_format($BasicWorked, 2, '.', '');
$HraWorked = $WorkedSalary * 30 / 100;
$employee[$i]['HraWorked'] = number_format($HraWorked, 2, '.', '');
$employee[$i]['GrossSalary'] = number_format($BasicWorked + $HraWorked, 2, '.', '');
if ($value->is_management_team == 1)
{
$OT_Hrs_Worked = 0; //OT hours
$value->OT_Hrs_Worked = 0;
} else {
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
}
$totSalayOT = ($OT_Hrs_Worked != 0) ? $OT_Hrs_Worked * $PerHrSalary : 0;
$HRA_Amount = $value->HRA_Amount;
$Paid_leave = $value->Paid_leave; // leave day
$Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE
$Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
$due_start_date = $value->DueDate;
if (strlen((string)$monthyear) == 6) {
$monthyear = '0' . $monthyear;
}
$pmonth = substr($monthyear, 0, 2);
$pyear = substr($monthyear, -4);
$pmonth = substr($monthyear, 0, 2);
$pyear = substr($monthyear, -4);
$pday = cal_days_in_month(CAL_GREGORIAN, $pmonth, $pyear);
$payfulldate = $pyear . '-' . $pmonth . '-' . $pday;
$totalDaysWorked = $Days_worked + $Paid_leave;
$Loan_amount = $value->Loan_Amount;
$Paid_Amount = $value->Paid_Amount;
$Balance_Amount = $Loan_amount - $Paid_Amount;
$loan = 0;
if ($Loan_Recovered == 'NA') {
$loan = 0.00;
} else if ($Loan_Recovered == 0.00) {
if (strtotime($due_start_date) <= strtotime($payfulldate)) {
$loan = $Monthly_Due;
}
} else if ($Loan_Recovered >= 0.00) {
if (strtotime($due_start_date) <= strtotime($payfulldate)) {
$loan = $Loan_Recovered;
}
}
if ($Monthly_Due > $Balance_Amount) {
$loan = $Balance_Amount;
}
$PF_Rate = $value->PF_Rate;
$ESI_Rate = $value->ESI_Rate;
$dayHra = $HRA_Amount / $NoofDays;
$dayBasic = $Basic_Pay / $NoofDays;
//current day basic and hra salary
if ($value->is_management_team == 1)
{
$currentDayBasic = $dayBasic * $NoofDays;
$currentDayHra = $dayHra * $NoofDays;
} else {
$currentDayBasic = $dayBasic * $totalDaysWorked;
$currentDayHra = $dayHra * $totalDaysWorked;
}
if ($value->esi_applicable == 1) { $esiAmount = ($currentDayBasic + $currentDayHra) * $ESI_Rate / 100; } else { $esiAmount = 0; }
if ($value->pf_applicable == 1) { $pfAmount = $currentDayBasic * $PF_Rate / 100; } else { $pfAmount = 0; }
/** pf amount per day**/
//echo $totalothour;die;
$empSalaryAdd = $currentDayBasic + $currentDayHra + $totSalayOT;
$empSalarySub = $esiAmount + $pfAmount + $loan;
$salaryInCurrentday = $empSalaryAdd - $empSalarySub;
$employee[$i]['ESI'] = number_format($esiAmount, 2, '.', '');
$employee[$i]['PF'] = number_format($pfAmount, 2, '.', '');
$employee[$i]['ESI_PF'] = number_format($esiAmount + $pfAmount, 2, '.', '');
$employee[$i]['OT'] = number_format($totSalayOT, 2, '.', '');
$employee[$i]['Feb_25_Advance'] = "-";
$employee[$i]['TDS_92B'] ="-";
$employee[$i]['Refuned_PF_Nov24'] ="-";
$employee[$i]['NetSalary'] = round($salaryInCurrentday);
$employee[$i]['GrossSalary2'] = "-";
$employee[$i]['OT2'] = "-";
$employee[$i]['GrossNetSalary'] = "-";
$employee[$i]['ESI2'] ="-";
$employee[$i]['PF2'] ="-";
$employee[$i]['Sep_24_Advance'] = "-";
$employee[$i]['TDS_92B'] = "-";
$employee[$i]['Refuned_PF_Nov24'] = "-";
$employee[$i]['Net_Salary'] = "-";
$employee[$i]['Diff'] = "-";
$employee[$i]['work_location'] = $value->work_location;
$employee[$i]['tds_applicable'] = $value->tds_applicable;
$employee[$i]['pf_applicable'] = $value->pf_applicable;
$employee[$i]['esi_applicable'] = $value->esi_applicable;
$i++;
}
$j = $i;
foreach($driver_monthinputs_info as $record ){
$hra_worked = $record->hra_worked;
$basic_worked = $record->basic_worked;
$sum_of_amount = ($record->driver_salary+$record->driver_shed+$record->driver_diesel);
$employee[$j]['SNO'] = $j+1;
$employee[$j]['ID'] = $record->EmpID;
$employee[$j]['Name'] = $record->FirstName;
$employee[$j]['DOJ'] = get_date_time_dynamical_format('Y-m-d H:i:s','d-m-Y',"$record->DateofJoining");
$employee[$j]['Designation'] = $record->Designation;
$employee[$j]['NoofDays'] = round($record->total_cal_days);
$employee[$j]['Days_worked'] = round($record->unique_days);
$employee[$j]['Leave'] = round($record->total_cal_days - $record->unique_days);
// number_format(0.00, 2, '.', ''); // paid leave
// number_format(0.00, 2, '.', ''); //ot hours
$employee[$j]['TotalSalary'] = number_format($sum_of_amount, 2, '.', '');
$worked_amt = $sum_of_amount / $record->total_cal_days ;
$employee[$j]['PerDaySalary'] = number_format($worked_amt, 2, '.', '');
$employee[$j]['WorkedSalary'] = number_format($worked_amt, 2, '.', '');
$hr_amt = $worked_amt/8;
$employee[$j]['PerHrSalary'] = number_format($hr_amt, 2, '.', '');
$employee[$j]['EarnedSalary'] = number_format($sum_of_amount, 2, '.', '');
$employee[$j]['BasicWorked'] = number_format($basic_worked, 2, '.', '');
$employee[$j]['HraWorked'] = number_format($hra_worked, 2, '.', '');
$employee[$j]['GrossSalary'] = number_format($basic_worked + $hra_worked, 2, '.', '');
$employee[$j]['ESI'] = number_format($record->esi_amount, 2, '.', '');
$employee[$j]['PF'] = number_format($record->pf_amount, 2, '.', '');
$employee[$j]['ESI_PF'] = number_format($record->esi_amount + $record->pf_amount, 2, '.', '');
$employee[$j]['OT'] = number_format(0, 2, '.', '');
$estTotal = ($basic_worked + $hra_worked + $record->Festival_Bonus)-($record->Monthly_Due+$record->esi_amount+$record->pf_amount);
$employee[$j]['Feb_25_Advance'] = "-";
$employee[$j]['TDS_92B'] ="-";
$employee[$j]['Refuned_PF_Nov24'] ="-";
$employee[$j]['NetSalary'] = round($estTotal);
$employee[$j]['GrossSalary2'] = "-";
$employee[$j]['OT2'] = "-";
$employee[$j]['GrossNetSalary'] = "-";
$employee[$j]['ESI2'] ="-";
$employee[$j]['PF2'] ="-";
$employee[$j]['Sep_24_Advance'] = "-";
$employee[$j]['TDS_92B'] = "-";
$employee[$j]['Refuned_PF_Nov24'] = "-";
$employee[$j]['Net_Salary'] = "-";
$employee[$j]['Diff'] = "-";
$employee[$j]['work_location'] = $record->work_location;
$employee[$j]['tds_applicable'] = $record->tds_applicable;
$employee[$j]['pf_applicable'] = $record->pf_applicable;
$employee[$j]['esi_applicable'] = $record->esi_applicable;
$j++;
}
$finalFooter[] = $employee;
// do not try chatgpt please.
$location_info = [];
foreach ($employee as $key => $value)
{
if (isset($value['work_location']) && $value['work_location'] == "Thiruvenkadu") {
array_push($location_info,$value);
unset($employee[$key]);
}
}
$tds_info = [];
foreach ($employee as $key => $value)
{
if (isset($value['tds_applicable']) && (int)$value['tds_applicable'] == 1) {
array_push($tds_info,$value);
unset($employee[$key]);
}
}
$esi_or_pf_info = [];
foreach ($employee as $key => $value)
{
if (isset($value['pf_applicable']) && (int)$value['pf_applicable'] == 1 || isset($value['esi_applicable']) && (int)$value['esi_applicable'] == 1) {
array_push($esi_or_pf_info,$value);
unset($employee[$key]);
}
}
$keysToRemove = ['work_location','tds_applicable','pf_applicable','esi_applicable'];
foreach ($tds_info as &$t_item) {
foreach ($keysToRemove as $key) {
unset($t_item[$key]);
}
}
unset($t_item);
foreach ($esi_or_pf_info as &$e_item) {
foreach ($keysToRemove as $key) {
unset($e_item[$key]);
}
}
unset($e_item);
foreach ($location_info as &$l_item) {
foreach ($keysToRemove as $key) {
unset($l_item[$key]);
}
}
unset($l_item);
foreach ($employee as &$o_item) {
foreach ($keysToRemove as $key) {
unset($o_item[$key]);
}
}
unset($o_item);
foreach ($finalFooter as &$topLevelArray) {
if (is_array($topLevelArray)) {
foreach ($topLevelArray as &$employeeArray) { // Changed from $finalFooter to $employeeArray
if (is_array($employeeArray)) { // Check $employeeArray instead of $x
foreach ($keysToRemove as $key) {
if (array_key_exists($key, $employeeArray)) {
unset($employeeArray[$key]);
}
}
}
}
unset($employeeArray); // Break the reference
}
}
unset($topLevelArray); // Break the reference
$xl[] = array_values($tds_info);
$xl[] = array_values($esi_or_pf_info);
$xl[] = array_values($location_info);
$xl[] = array_values($employee);
// dd($xl);
$headlines['company_name'] = isset($company_info[0]->CompanyName) ? $company_info[0]->CompanyName : "Resico India Pvt Ltd";
$headlines['header1'] = $headlines_main;
$headlines['header2'] = $headlines_sub;
$headlines['type'] = 2;
$headlines['header2'] = $headlines_sub;
$headlines['merge_end_column'] = 7;
$headlines['file_name'] = 'ResicoSalary'.$pmonth.'-'.$pyear.'.xls';
$headlines['final_Footer'] = $finalFooter;
generate_excel($headlines,$xl);
// dd($employee);
}
public function driverMonthlyPayInputs($current)
{
@ -576,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++;
@ -602,7 +920,7 @@ class Payslip extends BaseController
$EmpID = $j['Emp ID'];
$is_driver = $this->driver_model->getDriverName($EmpID,1);
$DaysWorked = $j['Days Worked'];
$NoTrips = isset($j['Number Of Trips']) ? $j['Number Of Trips'] : 0.00 ;
// $NoTrips = isset($j['Number Of Trips']) ? $j['Number Of Trips'] : 0.00 ;
$TotalCalDays = isset($j['Total Days']) ? $j['Total Days'] : 0.00 ;
$ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ;
$WorkedSalary = isset($j['Worked Salary']) ? $j['Worked Salary'] : 0.00 ;
@ -659,12 +977,11 @@ class Payslip extends BaseController
$Food = isset($load_driver_data[0]->monthly_food_amount) ? (int)$load_driver_data[0]->monthly_food_amount : 0;
$Shed = isset($load_driver_data[0]->shed_amount) ? (int)$load_driver_data[0]->shed_amount : 0;
$Diesel = isset($load_driver_data[0]->diesel_amount) ? (int)$load_driver_data[0]->diesel_amount : 0;
$drivermonthlypaydata = array(
'month_year'=>$month,
'driver_id'=>$EmpID,
'TotalCalDays' => $TotalCalDays,
'no_of_loads'=>(strpos($NoTrips, "(trip)") !== false) ? explode(" ", $NoTrips)[0] : 0,
'monthly_food_amount'=>$Food,
'total_diesel_amount'=>$Diesel,
'total_shed_amount'=>$Shed,
@ -681,7 +998,6 @@ class Payslip extends BaseController
);
// print_r($drivermonthlypaydata);die;
$result = $this->driver_model->saveMonthlyData($drivermonthlypaydata);
}
@ -845,7 +1161,6 @@ class Payslip extends BaseController
// print_r($is_driver);die;
if($is_driver == "1"){
$Data['PayDetails'] = $this->driver_model->GetPayslipdata($Payon, $EmpID);
// print_r($Data['PayDetails']);die;
$name = $Data['PayDetails'][0]->driver_name;
$filename = 'PayslipFor-' . $EmpID . ' ' . $name . ' ' . $m . ' ' . $y;
@ -878,7 +1193,7 @@ class Payslip extends BaseController
}
}
// echo $html;die;
$mpdf = new Mpdf([
'mode' => 'utf-8',
@ -899,7 +1214,7 @@ class Payslip extends BaseController
$mpdf->WriteHTML($html);
$mpdf->SetTitle('Resico:Payslip');
$mpdf->Output("Payslip-" . $filename . ".pdf", 'D');
$mpdf->Output($filename . ".pdf", 'D');
}

View File

@ -289,6 +289,7 @@ class Rawmaterialdetails extends BaseController
$data['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID);
$data['materialRateHistory'] = $this->rawmaterialdetails_model->getMaterialRateHistory($RawMaterialID);
$data['materialListPage'] = $_GET['page']??1;
//print_r($data['avg_price']);die();
$this->global['pageTitle'] = 'Edit Material Master';
@ -317,6 +318,7 @@ class Rawmaterialdetails extends BaseController
$stock = $this->request->getPost('openstock');
$reorder = $this->request->getPost('reorder');
$stockdate = $this->request->getPost('Date');
$materialListPage = $this->request->getPost('materialListPage') ?? 1;
$stockdate = (empty($stockdate)) ? NULL : get_date_time_dynamical_format('d-m-Y','Y-m-d',"$stockdate");
$chked = $this->request->getPost('isactive');
@ -329,11 +331,15 @@ class Rawmaterialdetails extends BaseController
$result = $this->rawmaterialdetails_model->editRawmaterial($RawMaterial, $MaterialCode);
if ($result == true) {
if ($result == true) {
$this->session->setFlashdata('success', 'RawMaterial Updated successfully!');
$this->session->setFlashdata('materialListPage', "$materialListPage");
} else {
echo "<script>alert('RawMaterial Record Not updated!');</script>";
$this->session->setFlashdata('error', 'RawMaterial Record Not updated!');
$this->session->setFlashdata('materialListPage', "$materialListPage");
}
return redirect()->route('rawmaterialListing');

View File

@ -130,18 +130,7 @@ class Requisitionform extends BaseController
// echo 'ReqType'.$ReqPOType;
$data['ReqPOType'] = $ReqPOType == '' ? $ReqType : $ReqPOType;
$data['LineItem'] = $this->requistion_model->getEditRequistItemList($ReqNo);
$data['description'] = '';
foreach ($data['LineItem'] as $key => $line) {
$description = isset($line->MaterialDescription) ? $line->MaterialDescription : null;
$data['LineItem'][$key]->CategoryName = $line->MaterialCode
? $this->requistion_model->getCategoryName($line->MaterialCode)
: "";
}
$data['CostCenter'] = $this->requistion_model->getCostCenterUserID($userID);
// $data['MaterialCode'] = $this->requistion_model->EditMaterialCode($ReqNo, $ReqType); // Old Based on Type..
$data['MaterialCode'] = $this->requistion_model->EditMaterialCode($ReqNo);
@ -163,7 +152,7 @@ class Requisitionform extends BaseController
}
$this->requistion_model->DeleteRequistionLineItem($ReqNo, $MaterialCode);
return $this->response->setJSON("Successfully Deleted the Line item" . $ReqNo);
return $this->response->setJSON("Successfully Deleted the Line item " . $ReqNo);
}
/**
@ -215,49 +204,6 @@ class Requisitionform extends BaseController
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL);
}
/**
* This function used to load the Employee details based on the EmpID selection
*/
function GetSelectedEmpDetails()
{
$ReqType = $_GET['ReqType'];
$EmpID = $this->request->getPost('id');
$empDetails = $this->requistion_model->GetEmployeeDetails($EmpID);
$DeptCode = $empDetails[0]['DEPCode'];
$CostList = $this->requistion_model->GetCostCenterByDept($DeptCode);
$HTML = "<option value='-1'>Select Cost center</option>";
$BudAmount = "";
if (count($CostList) > 0) {
for ($j = 0; $j < count($CostList); $j++) {
$Code = $CostList[$j]['CostCenterCode'];
$Name = $CostList[$j]['CostCenterName'];
$HTML .= "<option value='" . $Code . "'>" . $Code . "-" . $Name . "</option>";
}
}
if (count($CostList) == 1) {
$FYStart = '';
$FYEnd = '';
$FiscalYear = $this->costcenter_model->getFiscalYear();
if (!empty($FiscalYear)) {
foreach ($FiscalYear as $Fy) {
$FYStart = $Fy->StartYear;
$FYEnd = $Fy->EndYear;
}
}
$FYdt = $FYStart . " - " . $FYEnd;
$result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType);
//print_r($result);
$AvilBudAmt = '0';
if (count($result) > 0) {
$BudAmount = $result[0]['BudgetAmount'] - $result[0]['Totalvalue'];
}
}
die(json_encode(array('emp' => $empDetails, 'Cost' => $HTML, 'AvlAmount' => $BudAmount)));
}
function getAvailableBudAmount()
{
@ -288,6 +234,7 @@ class Requisitionform extends BaseController
{
$ReqType = $this->request->getPost('id');
$CatType = $this->request->getPost('cid');
$MaterialCode = $this->requistion_model->GetMaterialCode($ReqType);
$MaterialName = "";
@ -298,7 +245,9 @@ class Requisitionform extends BaseController
for ($j = 0; $j < count($MaterialCode); $j++) {
$Code = $MaterialCode[$j]['MaterialCode'];
$Name = $MaterialCode[$j]['MaterialName'];
$HTML .= "<option value='" . $Code . "'>" . $Code . "-" . $Name . "</option>";
$HSN = $MaterialCode[$j]['HSNCODE'] ? $MaterialCode[$j]['HSNCODE']." - " : "";
// $HTML .= "<option value='" . $Code . "'>" . $HSN . "-" . $Name . "</option>";
$HTML .= "<option value='" . $Code . "'>" . $HSN . $Name . " ( ".$Code." ) "."</option>";
}
$MaterialName = $MaterialCode[0]['MaterialName'];
$UOM = $MaterialCode[0]['UOM'];
@ -319,6 +268,28 @@ class Requisitionform extends BaseController
return $this->response->setJSON(['MatDetail' => $MaterialDetails]);
}
function getCategoryDetails()
{
$CategoryDetails = $this->requistion_model->getmaterialCategory();
$HTML = "<option value='-1'>Select Category</option>";
if (count($CategoryDetails) > 0) {
for ($j = 0; $j < count($CategoryDetails); $j++) {
$Code = $CategoryDetails[$j]['Key'];
$Name = $CategoryDetails[$j]['ConfigValue'];
$HTML .= "<option value='" . $Code . "'>" . $Name . "</option>";
}
}
$response = ['Category' => $HTML];
return $this->response->setJSON($response);
}
/**
* To Insert the Requistion Details to Database
*/
@ -399,9 +370,13 @@ class Requisitionform extends BaseController
}
if ($Status == REQ_DRAFT) {
$display_message = 'Successfully Saved the Requistion details.Requistion No is ' . $ReqNumber;
} else {
$display_message = 'Successfully Created the Requistion details.Requistion No is ' . $ReqNumber;
$display_message = "Successfully Saved the Requisition details in Draft!\nRequistion Number Is: ". $ReqNumber;
// $display_message = "Requistion Saved as Draft!\nRequistion Number Is: ". $ReqNumber;
} else if($Status == REQ_APPROVED) {
$display_message = "Successfully Updated the Requistion details as Approved!\nRequistion Number Is: ". $ReqNumber;
// $display_message = "Requistion Created Successfully!\nRequistion Number Is: ". $ReqNumber;
}else{
$display_message = "Successfully Created the Requistion details!\nRequistion Number Is: ". $ReqNumber;
}
return $this->response->setJSON([$display_message]);
@ -468,7 +443,8 @@ class Requisitionform extends BaseController
}
}
}
$display_message = 'Successfully Updated the Requistion details.Requistion No is ' . $ReqNumber;
$display_message = "Successfully Updated the Requistion details!\nRequistion Number Is: ". $ReqNumber;
return $this->response->setJSON([$display_message]);
}
@ -601,7 +577,8 @@ class Requisitionform extends BaseController
$Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy);
$this->requistion_model->UpdateRequistion($Request, $ReqNo);
return $this->response->setJSON(['message' => "Successfully Updated the Requisition No: " . $ReqNo]);
return $this->response->setJSON(['message' => "Requistion Updated Successfully!\nRequistion Number Is: ".$ReqNo]);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1020,15 +1020,11 @@ class User extends BaseController
// Validation passed
$EmpID = $this->request->getPost('EmpList');
$roleId = !empty($this->request->getPost('role')) ? $this->request->getPost('role') : '2' ;
$roleId = $this->request->getPost('role');
$password = (string)$this->request->getPost('password');
$Createddt = date('Y-m-d H:i:s');
$email = $this->request->getPost('MailID');
$SelectedDepartment = (string)$this->request->getPost('txtSelectedDepartment');
$comma_separated = explode(':', $SelectedDepartment);
if (count($comma_separated) == 1 && in_array('DEP27', $comma_separated)) {
$roleId = '6';
}
$userInfo = [
'email' => $email,
'EmpID' => $EmpID,
@ -1040,16 +1036,7 @@ class User extends BaseController
$result = $this->user_model->addNewUser($userInfo);
if ($SelectedDepartment != '') {
foreach ($comma_separated as $DeptCode) {
$userdept = [
'EmpID' => $EmpID,
'Departmentcode' => $DeptCode
];
$access = $this->user_model->addAccess($userdept);
}
}
if ($result > 0) {
// return redirect()->to('userListing')->with('success', 'New user created successfully!');
$this->session->setFlashdata('success', 'New user created successfully!');
@ -1072,6 +1059,27 @@ class User extends BaseController
};
}
function isEmailExists(){
$MailID = $this->request->getPost('MailID');
$empID = $this->request->getPost('EmpID');
if (!$MailID) {
return $this->response->setJSON(['success' => false, 'message' => 'Mail ID not provided']);
}
$isEmailExists = $this->user_model->isEmailExists($MailID,$empID);
if ($isEmailExists) {
return $this->response->setJSON(['success' => true, 'message' => 'Email Already Exsiting']);
} else {
return $this->response->setJSON(['success' => false, 'message' => '']);
}
}
function Deleteuserdepartment()
{

View File

@ -3,47 +3,412 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Color;
use PhpOffice\PhpSpreadsheet\Style\Font;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Border;
use PhpOffice\PhpSpreadsheet\Style\Borders;
if (!function_exists('generate_excel')) {
/*
This function generates an Excel file using the given headers and data and saves it with the specified filename.
It utilizes the PhpSpreadsheet library to create and manipulate Excel files.
Parameters:
- $headers: An array containing the column headers for the Excel sheet.
- $data: An array containing the data to be inserted into the Excel sheet.
- $filename: The name of the file to be saved.
- $totals (optional): A flag indicating whether to include total calculations in the Excel sheet.
*/
function generate_excel($headers, $data, $filename)
function generate_excel($headlines, $xldata)
{
$headersMain = $headlines['header1'];
$headersSub = $headlines['header2'];
$company = $headlines['company_name'];
$filename = $headlines['file_name'];
$type = $headlines['type'];
$footer = false;
$mergeEndCol = $headlines['merge_end_column'];
// $type = 1 means $data is single
// $type = 2 means $data is multiple array
// Create new Spreadsheet object
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// Set worksheet title
$sheet->setTitle('Sheet 1');
// Set worksheet title
$spreadsheet->getActiveSheet()->setTitle('Sheet 1');
// A1 Start here... should be compnay name ....
$sheet->setCellValue('A1', $company);
// Set headers into the spreadsheet
$spreadsheet->getActiveSheet()->fromArray([$headers], null, 'A1');
// Get last column letter based on headers count
// $lastColumnLetter = getExcelColumnName(count($headers) - 1);
$colCount = count($headersMain);
// Calculate end column by character math (works up to 'ZZ')
$lastColumnLetter = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($colCount);
// Set data into the spreadsheet
$spreadsheet->getActiveSheet()->fromArray($data, null, 'A2');
$sheet->mergeCells("A1:{$lastColumnLetter}1");
// Style A1
$sheet->getStyle("A1")->getFill()
->setFillType(Fill::FILL_SOLID)
->getStartColor()->setRGB('ADD8E6'); // Light blue
$sheet->getStyle("A1")->getAlignment()
->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER)
->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
$sheet->getStyle("A1")->getFont()->setBold(true)->setSize(14);
$sheet->getStyle("A1")->getFont()
->getColor()
->setRGB(Color::COLOR_WHITE);
// /. A1 ends here
$currentRow = 2; // Start at row 2
if($type == 1){
$startCell = 'A' . $currentRow;
$lastcolrow = callHeader($sheet, $headersMain, $startCell,$headersSub);
$lastcolrow2 = callSkipRow($lastcolrow);
$lastcolrow3 = callData($sheet,$headersMain,$xldata,$lastcolrow2,$mergeEndCol);
$lastcolrow4 = callSkipRow($lastcolrow3);
if($footer){
$lastcolrow5 = callFooter($sheet, $headersMain, $xldata, $lastcolrow4,'','',$mergeEndCol);
}
}else if($type == 2){
// $final_Footer=[];
// foreach($xldata as $i => $xl){
// echo $i;
// echo "<pre>";
// print_r($xl[$i]);
// echo "</pre>";
// // echo count($xl[$i])."**";
// // $forFinalFooter
// }
// foreach ($xldata as $i => $xl) {
// $forFinalFooter[] = $xl[$i];
// }
$final_Footer = isset($headlines['final_Footer']) && !empty($headlines['final_Footer']) ? $headlines['final_Footer'] : [];
foreach ($xldata as $index => $data) {
if (!empty($data)) {
$startCell = 'A' . $currentRow;
$lastcolrow = callHeader($sheet, $headersMain, $startCell,$headersSub);
$lastcolrow2 = callSkipRow($lastcolrow);
$lastcolrow3 = callData($sheet, $headersMain, $data, $lastcolrow2);
$lastcolrow4 = callSkipRow($lastcolrow3);
$lastcolrow5 = callFooter($sheet, $headersMain, $data, $lastcolrow4,'Total Amount Rs','228B22',$mergeEndCol);
$lastcolrow6 = callSkipRow($lastcolrow5);
// Update currentRow for next iteration
$currentRow = (int) filter_var($lastcolrow6, FILTER_SANITIZE_NUMBER_INT);
} else {
$startCell = 'A' . $currentRow;
$lastcolrow = callHeader($sheet, $headersMain, $startCell,$headersSub);
$lastcolrow2 = callSkipRow($lastcolrow);
$currentRow = (int) filter_var($lastcolrow2, FILTER_SANITIZE_NUMBER_INT);
}
}
if(!empty($final_Footer)){
$startCell = 'A' . $currentRow;
callFooter($sheet, $headersMain, $final_Footer[0], $startCell,'Final Net Salary Amount Rs','DC143C',$mergeEndCol);
// echo "cr".$currentRow;die;
}
// $final_Footer
}
// Create Excel writer
$writer = new Xlsx($spreadsheet);
$columnCount = count($headersMain);
for ($col = 1; $col <= $columnCount; $col++) {
$columnLetter = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($col);
$sheet->getColumnDimension($columnLetter)->setAutoSize(true);
}
$highestColumn = $sheet->getHighestColumn(); // e.g., 'E'
$highestRow = $sheet->getHighestRow(); // e.g., 10
// Build the full range (e.g., 'A1:E10')
$range = 'A1:' . $highestColumn . $highestRow;
// Apply border to that range
$sheet->getStyle($range)->applyFromArray([
'borders' => [
'allBorders' => [
'borderStyle' => Border::BORDER_THIN,
'color' => ['argb' => 'FF000000'],
],
],
]);
try {
// Save Excel file to the specified path
$writer->save($filename);
return true; // Return true if file was successfully saved
ob_clean();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition: attachment; filename=\"$filename\"");
header('Cache-Control: max-age=0');
$writer->save('php://output'); // stream to browser
exit; // Return true if file was successfully saved
} catch (\Exception $e) {
// Log or handle the exception
return false; // Return false if there was an error saving the file
}
}
}
function callHeader($sheet, $headersMain, $startCell, $headersSub = []) {
$rowNumber = (int) filter_var($startCell, FILTER_SANITIZE_NUMBER_INT);
$startCol = 'A';
$colCount = count($headersMain);
// Calculate end column by character math (works up to 'ZZ')
$endCol = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($colCount);
// Check if sub-header has any non-empty value
$hasSubHeader = !empty(array_filter($headersSub, function ($val) {
return trim($val) !== '';
}));
// 1. Write Main Header
$sheet->fromArray([$headersMain], null, $startCell);
$mainHeaderRange = "{$startCol}{$rowNumber}:{$endCol}{$rowNumber}";
// Style Main Header
$sheet->getStyle($mainHeaderRange)->applyFromArray([
'font' => [
'bold' => true,
'color' => ['rgb' => 'FF0000'],
'size' => 12,
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
]
]);
if ($hasSubHeader) {
// 2. Write Sub Header
$subHeaderRow = $rowNumber + 1;
$sheet->fromArray([$headersSub], null, "A{$subHeaderRow}");
$subHeaderRange = "{$startCol}{$subHeaderRow}:{$endCol}{$subHeaderRow}";
$sheet->getStyle($subHeaderRange)->applyFromArray([
'font' => [
'bold' => true,
'color' => ['rgb' => 'FF0000'],
'size' => 12,
],
'alignment' => [
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
]
]);
return 'A' . ($subHeaderRow + 1);
} else {
return 'A' . ($rowNumber + 1);
}
}
function callData($sheet, $headers, $data, $startCell) {
$startRow = (int) filter_var($startCell, FILTER_SANITIZE_NUMBER_INT);
$startCol = 'A';
$sheet->fromArray($data, null, $startCell);
$dataRowCount = count($data);
$lastDataRow = $startRow + $dataRowCount;
// $dataColCount = count($headers);
// $lastDataColumn = getExcelColumnName($dataColCount - 1);
// $dataRange = "{$startCol}{$startRow}:{$lastDataColumn}{$lastDataRow}";
// Set font color to black
// $sheet->getStyle($dataRange)->getFont()->getColor()->setRGB('000000');
return 'A' . ($lastDataRow + 1); // return next row
}
function callSkipRow($startCell){
$row = (int) filter_var($startCell, FILTER_SANITIZE_NUMBER_INT);
return 'A' . ($row + 1); // just skip a line
}
// function callFooter($sheet, $headers, $data, $startCell,$mergeEndindex) {
// $row = (int) filter_var($startCell, FILTER_SANITIZE_NUMBER_INT);
// $startCol = preg_replace('/[0-9]/', '', $startCell);
// // Determine numeric columns dynamically
// // $numericIndexes = [];
// // foreach ($data as $index => $val) {
// // foreach ($data as $rowData) {
// // if (isset($rowData[$index]) && is_numeric($rowData[$index])) {
// // $numericIndexes[] = $index;
// // break;
// // }
// // }
// // }
// if (!empty($data)) {
// // Look at the first row
// $firstRow = $data[0];
// foreach ($firstRow as $key => $value) {
// foreach ($data as $row) {
// if (isset($row[$key]) && is_numeric($row[$key])) {
// $numericIndexes[] = $key; // use the key (could be column name)
// break;
// }
// }
// }
// }
// // Get first numeric column index for placing totals
// if (empty($numericIndexes)) return 'A' . ($row + 1); // Nothing to total
// sort($numericIndexes);
// $firstNumericIndex = $numericIndexes[0];
// $colCount = count($headers);
// // Calculate end column by character math (works up to 'ZZ')
// if($mergeEndindex == ''){
// $mergeEndCol = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($colCount - 1);
// }else{
// $mergeEndCol = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex((int)$mergeEndindex);
// }
// // echo gettype($row);die;
// // Merge from A to column before first numeric column (for "TOTAL" label)
// $sheet->mergeCells("A{$row}:{$mergeEndCol}{$row}");
// $sheet->setCellValue("A{$row}", 'TOTAL');
// // Style for TOTAL label
// $sheet->getStyle("A{$row}:{$mergeEndCol}{$row}")->applyFromArray([
// 'font' => [
// 'bold' => true,
// 'size' => 14,
// 'color' => ['rgb' => '228B22']
// ],
// 'alignment' => [
// 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
// 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER
// ]
// ]);
// // Total each numeric column and write to corresponding cell
// foreach ($numericIndexes as $index) {
// $total = 0;
// foreach ($data as $rowData) {
// $value = $rowData[$index] ?? 0;
// if (is_numeric($value)) {
// $total += $value;
// }
// }
// $colLetter = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex((int)$index);
// $sheet->setCellValue("{$colLetter}{$row}", $total);
// }
// return 'A' . ($row + 1); // Return next available row
// }
function callFooter($sheet, $headers, $data, $startCell,$label,$code,$mergeEndIndex = null) {
$row = (int) filter_var($startCell, FILTER_SANITIZE_NUMBER_INT);
$startCol = preg_replace('/[0-9]/', '', $startCell);
$numericKeys = [];
$columnKeys = array_keys($data[0] ?? []);
$columnKeyToIndex = array_flip($columnKeys); // key => index
// Detect numeric columns
foreach ($columnKeys as $key) {
foreach ($data as $rowData) {
if (isset($rowData[$key]) && is_numeric($rowData[$key])) {
$numericKeys[] = $key;
break;
}
}
}
// If no numeric columns, skip total row
if (empty($numericKeys)) {
return $startCol . ($row + 1);
}
// Determine where to end the merge for the TOTAL label
if ($mergeEndIndex === null || $mergeEndIndex === '') {
$firstNumericKey = $numericKeys[0];
$firstNumericIndex = $columnKeyToIndex[$firstNumericKey];
$mergeEndIndex = $firstNumericIndex > 0 ? $firstNumericIndex - 1 : 0;
}
// Write totals for each numeric column
foreach ($numericKeys as $colKey) {
$total = 0;
foreach ($data as $rowData) {
$val = $rowData[$colKey] ?? 0;
if (is_numeric($val)) {
$total += $val;
}
}
$colIndex = $columnKeyToIndex[$colKey];
$colLetter = Coordinate::stringFromColumnIndex($colIndex + 1);
$sheet->setCellValue("{$colLetter}{$row}", $total);
$sheet->getStyle("{$colLetter}{$row}")->getNumberFormat()->setFormatCode('#,##0.00');
$sheet->getStyle("{$colLetter}{$row}")->applyFromArray([
'font' => [
'bold' => true,
'size' => 12
],
'alignment' => [
'horizontal' => Alignment::HORIZONTAL_CENTER,
'vertical' => Alignment::VERTICAL_CENTER
]
]);
}
$mergeEndCol = Coordinate::stringFromColumnIndex((int)$mergeEndIndex + 1);
$mergeRange = "{$startCol}{$row}:{$mergeEndCol}{$row}";
// Merge cells and write $label name = "TOTAL"
$sheet->mergeCells($mergeRange);
$sheet->setCellValue("{$startCol}{$row}", $label);
// Style "TOTAL" label
$sheet->getStyle($mergeRange)->applyFromArray([
'font' => [
'bold' => true,
'size' => 14,
'color' => ['rgb' => $code]
],
'alignment' => [
'horizontal' => Alignment::HORIZONTAL_CENTER,
'vertical' => Alignment::VERTICAL_CENTER
]
]);
// Return next row cell reference
return $startCol . ($row + 1);
}

View File

@ -0,0 +1,32 @@
<?php
use CodeIgniter\HTTP\IncomingRequest;
/**
* Retrieve and store stock month based on request method.
*
* @param IncomingRequest $request
* @return string
*/
function getStockMonth(IncomingRequest $request): string
{
$session = session();
if ($request->getMethod() === 'POST') {
$monthInput = $request->getPost('month');
$date = DateTime::createFromFormat('d-M-Y', '01-' . $monthInput);
$formattedDate = $date ? $date->format('Y-m') : date('Y-m');
$session->set('stock_month', $formattedDate);
$month = $formattedDate;
} else {
$month = $session->get('stock_month');
if (empty($month)) {
$month = date('Y-m');
}
}
return $month;
}

View File

@ -45,4 +45,47 @@ class CoatingMachineDetailsModel extends Model
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function coatingMachineDetails($startDate,$endDate){
$result = $this->db->table('t_coatingmachinedetails')
->select('t_coatingmachinedetails.*,
JSON_ARRAYAGG(
JSON_OBJECT(
"client_given_name", t_batchcard_files.client_file_name,
"filename", t_batchcard_files.filename,
"batchCardId" , t_batchcard_files.id,
"coating_id", t_batchcard_files.coating_id
)
) as batchcard_files')
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingmachinedetails.id', 'left')
->where('t_coatingmachinedetails.date >=', $startDate)
->where('t_coatingmachinedetails.date <=', $endDate)
->groupBy('t_coatingmachinedetails.id')
->orderBy('t_coatingmachinedetails.date', 'asc')
->get()
->getResultArray();
return $result;
}
public function isShiftExists($date, $shift)
{
$result = $this->db->table('t_coatingmachinedetails')
->where('date', $date)
->where('shift', $shift)
->where('is_active', 1)
->get()
->getResultArray();
return $result;
}
}

View File

@ -96,10 +96,25 @@ class Config_model extends Model
{
//echo $ConfigID ;die();
$builder = $this->db->table('t_configmaster COM')
->select('*')
->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left')
->where('COM.Config_ID', $ConfigID)
->where('con.isActive', $isActiveFilter);
->select('COM.*,
con.*,
creator_emp.FirstName AS created_by,
updater_emp.FirstName AS updated_by
')
->join('t_configdetails con', 'con.Config_ID = COM.Config_ID', 'left')
// Join for Created By
->join('tbl_users creator', 'creator.userId = con.created_by', 'left')
->join('t_employee_details creator_emp', 'creator_emp.EmpID = creator.EmpID', 'left')
// Join for Updated By
->join('tbl_users updater', 'updater.userId = con.updated_by', 'left')
->join('t_employee_details updater_emp', 'updater_emp.EmpID = updater.EmpID', 'left')
->where('COM.Config_ID', $ConfigID)
->where('con.isActive', $isActiveFilter)
->orderBy('con.Key', 'desc');
$query = $builder->get();
return $query->getResult();
@ -288,7 +303,7 @@ return $result;
}
public function saveConfigValue($key,$configId, $configValue){
public function saveConfigValue($key,$configId, $configValue,$userId){
@ -297,7 +312,8 @@ return $result;
->where('Config_ID', $configId)
->where('key',$key)
->update([
'ConfigValue'=> $configValue
'ConfigValue'=> $configValue,
'updated_by' => $userId
]);
$res = $this->db->affectedRows();
return $res;
@ -308,6 +324,7 @@ return $result;
[
'ConfigValue'=>$configValue,
'Config_ID'=>$configId,
'created_by'=> $userId,
'isActive'=> 1]);
$res = $this->db->affectedRows();
return $res;
@ -320,6 +337,7 @@ return $result;
$result = $this->db->table('t_configdetails')
->where('Config_ID','C023')
->where('isActive',1)
->get()
->getResultArray();

View File

@ -131,12 +131,14 @@ 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')
->select('t_driver_attendance.driver_id,driver_details.FirstName as driver_name,driver_details.is_driver,COUNT(DISTINCT t_driver_attendance.date) AS unique_days,
DATE_FORMAT(date, "%M-%Y") AS month_year,COUNT(t_driver_attendance.load_type) AS no_of_loads,driver_details.*,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate')
DATE_FORMAT(date, "%M-%Y") AS month_year,driver_details.*,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,
COUNT(t_driver_attendance.load_type) AS no_of_loads')
->select('SUM(t_driver_attendance.salary_amount) as monthly_salary_amount,
SUM(t_driver_attendance.food_amount) as monthly_food_amount,
diesel_amount,shed_amount,CONCAT_WS(" ", driver_details.FirstName, driver_details.LastName) AS FullName')
@ -145,18 +147,21 @@ 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');
$query = $builder->get();
// $last_query = $this->db->getLastQuery();
// echo $last_query;die;
// echo $last_query;
return $query->getResult();
}
function driverMonthlyPayInputs($monthYear){
$builder = $this->db->table('t_driver_monthly_pay_inputs');
@ -221,7 +226,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()
@ -317,13 +323,14 @@ class Driver_model extends Model
$builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*')
->select('Emp.EmpID,CONCAT_WS(" ", Emp.FirstName, Emp.LastName) as driver_name,Emp.DateofBirth as Dob,Emp.PANNo as Pan,Emp.BankBranchName as BankName,Emp.BankAccountNo as BankAccountNumber,Emp.IFSCCode as IFSCCode,Emp.DateofJoining as DOJ,Emp.AadharNo,Emp.Designation as Designation,Dep.DepartmentName as DeptName,Emp.esi_applicable,Emp.pf_applicable')
->select('t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate')
->select('t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,COUNT(t_driver_attendance.load_type) AS no_of_load')
->select('month.Festival_Bonus,month.BASIC,month.HRA,month.Loan_Recovered,month.total_diesel_amount,month.total_shed_amount')
// ->select('month.monthly_salary_amount,month.monthly_food_amount,month.Festival_Bonus,month.final_payment,month.HRA,month.ESI,month.PF,month.Loan_Recovered,month.total_diesel_amount,month.total_shed_amount')
->join('t_employee_details Emp', 'Pay.driver_id = Emp.EmpID')
->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode')
->join('t_emp_pay_data','t_emp_pay_data.EmpID=Emp.EmpID','Left')
->join('t_driver_monthly_pay_inputs month', 'month.driver_id = Emp.EmpID');
->join('t_driver_monthly_pay_inputs month', 'month.driver_id = Emp.EmpID')
->join('t_driver_attendance','t_driver_attendance.driver_id = Emp.EmpID');
if ($PayOn != '') {
$builder->where('Pay.PayOn', $PayOn);
}

View File

@ -256,13 +256,18 @@ class Employeedetails_model extends Model
function export_excel()
{
$builder = $this->db->table('t_employee_details as det')
->select(' det.*,Dep.DepartmentName as DepartmentName,det.firstname,emp1.firstname as UpdatedByName,emp1.firstname as CreatedByName')
->join('t_departmentdetails Dep', 'det.Departmentcode = Dep.DEPCode', 'left')
->join('tbl_users as tbl', ' det.createdby = tbl.userid', 'left')
$builder = $this->db->table('t_employee_details as ed')
->select('CONCAT_WS(" ", ed.FirstName, ed.LastName) as Name, ed.*,Dep.DepartmentName as DepartmentName,CONCAT_WS(" ", emp1.FirstName, emp1.LastName) as UpdatedByName,CONCAT_WS(" ", emp.FirstName, emp.LastName) as CreatedByName')
->select('t_emp_pay_data.Pay_Data_ID,t_emp_pay_data.EmpID,t_emp_pay_data.Basic_Pay,t_emp_pay_data.HRA_Rate,t_emp_pay_data.Allowances,t_emp_pay_data.Food_Allowances,t_emp_pay_data.Incentives,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,t_emp_pay_data.HRA_Amount,t_emp_pay_data.TotalSalary')
->join('t_departmentdetails Dep', 'ed.Departmentcode = Dep.DEPCode', 'left')
->join('tbl_users as tbl', ' ed.createdby = tbl.userid', 'left')
->join('t_employee_details as emp', 'emp.empid=tbl.empid', 'left')
->join('tbl_users as tbl1', ' det.UpdatedBy = tbl1.userid', 'left')
->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid', 'left');
->join('tbl_users as tbl1', ' ed.UpdatedBy = tbl1.userid', 'left')
->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid', 'left')
->join('t_emp_pay_data', 'ed.EmpID=t_emp_pay_data.EmpID', 'left')
->groupBy('ed.EmpID');
return $builder->get()->getResultArray();
}
}

View File

@ -68,7 +68,7 @@ class Emppaydate_model extends Model
}
function getUserInfo($paydataid)
{
$sql = 'select t_emp_pay_data.Pay_Data_ID,t_emp_pay_data.EmpID as PAYEMPID,t_emp_pay_data.Basic_Pay,t_emp_pay_data.HRA_Rate,t_emp_pay_data.Allowances,t_emp_pay_data.Food_Allowances,t_emp_pay_data.Incentives,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,t_emp_pay_data.HRA_Amount,t_emp_pay_data.TotalSalary,t_employee_details.FirstName,t_employee_details.LastName,t_loan_master.*from t_emp_pay_data
$sql = 'select t_emp_pay_data.Pay_Data_ID,t_emp_pay_data.EmpID as PAYEMPID,t_emp_pay_data.Basic_Pay,t_emp_pay_data.HRA_Rate,t_emp_pay_data.Allowances,t_emp_pay_data.Food_Allowances,t_emp_pay_data.Incentives,t_emp_pay_data.PF_Rate,t_emp_pay_data.ESI_Rate,t_emp_pay_data.HRA_Amount,t_emp_pay_data.TotalSalary,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.is_driver,t_loan_master.*from t_emp_pay_data
join t_employee_details on t_emp_pay_data.EmpID=t_employee_details.EmpID
left join t_loan_master on t_emp_pay_data.EmpID=t_loan_master.EmpID and t_loan_master.is_Active = 1
where t_emp_pay_data.Pay_Data_ID = ?;';
@ -76,6 +76,23 @@ class Emppaydate_model extends Model
return $query->getResult();
}
function driverPayInfo($EmpID,$monthYear){
$builder = $this->db->table('t_driver_monthly_pay_inputs');
$builder->select('t_driver_monthly_pay_inputs.*, t_driver_payroll.id as payroll_id');
$builder->join('t_driver_payroll', 't_driver_payroll.driver_id = t_driver_monthly_pay_inputs.driver_id', 'left');
$builder->where('t_driver_monthly_pay_inputs.driver_id', $EmpID);
$builder->where('t_driver_monthly_pay_inputs.month_year', $monthYear);
$builder->groupBy('t_driver_monthly_pay_inputs.driver_id, t_driver_monthly_pay_inputs.month_year');
$query = $builder->get();
$result = $query->getResult();
return $result;
}
function getUserLoanHistoryInfo($loan_id)
{
$sql = 'select * from t_loan_history where Loan_ID = ?;';

View File

@ -45,4 +45,57 @@ class GasStockModel extends Model
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
public function gasStockDetails($startDate,$endDate){
$result = $this->db->table('t_gasstockdetails')
->select(
't_gasstockdetails.*,
drier_summary.drierMachineGasconsumption AS drierMachineGasConsumption,
drier_summary.driedSand AS sandDried,
coating_summary.coatingMachineGasconsumption,
coating_summary.coatedSand'
)
// Subquery with early date filtering
->join(
'(SELECT date,
SUM(totalGasconsumption) AS coatingMachineGasconsumption,
SUM(totalCoatingSandInKg) AS coatedSand
FROM t_coatingmachinedetails
WHERE is_active = 1
AND date >= ' . $this->db->escape($startDate) . '
AND date <= ' . $this->db->escape($endDate) . '
GROUP BY date
) AS coating_summary',
'coating_summary.date = t_gasstockdetails.date',
'left'
)
->join(
'(SELECT date,
SUM(total_gas_consumption) AS drierMachineGasconsumption,
SUM(sand_dried_qty) AS driedSand
FROM t_driermachinedetails
WHERE date >= ' . $this->db->escape($startDate) . '
AND date <= ' . $this->db->escape($endDate) . '
GROUP BY date
) AS drier_summary',
'drier_summary.date = t_gasstockdetails.date',
'left'
)
->where('t_gasstockdetails.date >=', $startDate)
->where('t_gasstockdetails.date <=', $endDate)
->groupBy('t_gasstockdetails.date')
->get()
->getResultArray();
return $result;
}
}

View File

@ -195,7 +195,7 @@ class Inwardgateregister_model extends Model
function viewpurchaseorder($PO)
{
$subQuery = 'SELECT distinct POM.PONO, POL.MaterialCode, POL.Quantity, POL.ReceivedQuantity, (POL.Quantity - POL.ReceivedQuantity) as PendingQty, QuantityRejected, POL.PONO, MM.MaterialName, MM.UOM,POL.Rate
$subQuery = 'SELECT distinct POM.PONO, POL.MaterialCode, POL.Quantity, POL.ReceivedQuantity, (POL.Quantity - POL.ReceivedQuantity) as PendingQty, QuantityRejected, POL.PONO, MM.MaterialName, MM.UOM,MM.HSNCODE,POL.Rate
FROM t_purchaseorder_master POM
LEFT JOIN t_purchaseorder_lineitem POL ON POL.PONO = POM.PONO
LEFT JOIN t_igr_master IGM ON IGM.PONO = POL.PONO
@ -568,7 +568,7 @@ class Inwardgateregister_model extends Model
->distinct()
->select("
igr.IGRNO,igr.*,igrd.*,
MM.MaterialName,MM.UOM,
MM.MaterialName,MM.UOM,MM.HSNCODE,
sup.Address,sup.SupplierName,
POL.Rate,
POM.ServiceDescription,POL.Quantity,POM.POType,POM.IsOpenOrder,
@ -1515,4 +1515,41 @@ class Inwardgateregister_model extends Model
return $result;
}
public function gasCylindersByIgr($IGRNO, $gasMaterialCodes) {
$builder = $this->db->table('t_igr_master as t_igrm')
->select("
t_igrm.IGRNO,
tgsd.fullCylinderDate,
tgsd.cylinderNo,
tgsd.grossWeight,
tgsd.emptyCylinderDate,
tgsd.tareWeight,
tgsd.netWeight,
tgsd.actualWeight,
tgsd.shortage,
tgsd.invoiceNo,
t_igrm.DeliveryChellanDate,
t_igrm.DriverName,
t_igrm.VehicleNo
")
->join('t_igr_details tigrd', 'tigrd.IGRNO = t_igrm.IGRNO')
->join('t_purchaseorder_master tpom', 'tpom.PONO = t_igrm.PONO', 'left')
->join('t_supplierdetailsn tsd', 'tsd.SupplierID = tpom.SupplierID')
->join('t_gasshortagedetails tgsd', 'tgsd.IGRNO = t_igrm.IGRNO', 'left')
->whereIn('tigrd.MaterialCode', $gasMaterialCodes)
->where("DATE(tigrd.CreatedDate) >= '2025-04-01'")
->where('tgsd.gas_cylinder_status', 'gas_returned')
->where('t_igrm.IGRNO', $IGRNO); // Direct where clause on IGRNO in master table
$result = $builder->get()->getResultArray();
return $result;
}
}

View File

@ -103,7 +103,7 @@ class Monthlypay_model extends Model
//echo $lastdate;
//left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and month(t_payroll.PayOn) = month(?) and year(t_payroll.PayOn) = year(?)
$sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Id,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_monthly_pay_inputs.is_payslip_generated,t_loan_history .Balance_Amount,t_employee_details.is_driver
$sql = "select t_emp_pay_data.EmpID,t_emp_pay_data.*,t_employee_details.work_location,t_employee_details.tds_applicable,t_employee_details.FirstName,t_employee_details.DateofJoining,t_employee_details.Designation,t_employee_details.esi_applicable,t_employee_details.pf_applicable,t_employee_details.is_management_team,t_attendance.Days_Worked as Days_worked,t_attendance.Absent as LOP_Days,t_attendance.Paid_Leave as Paid_leave,t_attendance.Total_OTHrs as OT_Hrs_Worked,t_attendance.NoofDays,t_attendance.sunday_count,t_loan_master.Loan_ID,t_loan_master.Monthly_Due,t_loan_master.Due_Start_Date as DueDate,t_loan_master.Loan_Amount,t_loan_master.Paid_Amount,t_payroll.Id,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_monthly_pay_inputs.is_payslip_generated,t_loan_history .Balance_Amount,t_employee_details.is_driver
from t_emp_pay_data
left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID
left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and t_payroll.PayOn = ?
@ -119,7 +119,7 @@ class Monthlypay_model extends Model
$query = $this->db->query($sql, array($month, $month, $lastdate, $current, $current));
// Get the last executed query
// $last_query = $this->db->getLastQuery();
// echo $last_query;
// echo $last_query;die;
return $query->getResult();
}

View File

@ -1096,7 +1096,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
{
$subQuery = 'SELECT distinct LineItem.LineitemAuditorNotes,LineItem.LineItemNo,LineItem.ReqNo,LineItem.Per,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,LineItem.Quantity,ReceivedQuantity,Rate,LineItem.Status,(LineItem.Quantity *Rate) as BasicValue ,(After_CGST + After_SGST + After_IGST) as Taxamount,Dept.DepartmentName
,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription
,TotalValue,CGST,After_CGST,SGST,After_SGST,IGST,After_IGST,otherallowance,LineItem.CostCenterCode,LineItem.ServiceFrequency,LineItem.ServiceMaterialDescription,Req.Schedule_Type,Req.NumberOfService,Req.Service_Period,ReqDet.MaterialDescription,Mat.HSNCODE
FROM t_purchaseorder_lineitem LineItem
left join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join t_service_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
@ -1142,7 +1142,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
{
$subQuery = 'SELECT distinct LineItem.LineitemAuditorNotes,LineItem.LineItemNo,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,Mat.UOM,Quantity,Per,ServiceMaterialDescription,ReceivedQuantity,Rate,Req.Status,(Quantity *Rate) as BasicValue , (( AfterSGST + AfterCGST +
AfterIGST )) as Taxamount ,TotalValue,Tax.*,Req.CostCenterCode,Dept.DepartmentName,LineItem.LineitemAuditorNotes
AfterIGST )) as Taxamount ,TotalValue,Tax.*,Req.CostCenterCode,Dept.DepartmentName,LineItem.LineitemAuditorNotes,Mat.HSNCODE
FROM t_purchaseorder_lineitem LineItem
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join t_revenue_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
@ -1337,7 +1337,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
ExciseDutySHCess, AfterCustomEdCess, ROUND((Quantity * Rate), 2) AS TotalOrderValue,
ROUND((POMast.ExchangeRate * BasicPriceInMTon), 2) AS BasicINRValue, TotalValue, CurrencyType,
ReceivedQuantity, Tax.*, LineItem.ServiceMaterialDescription, Req.CostCenterCode,
Dept.DepartmentName
Dept.DepartmentName,Mat.HSNCODE
FROM t_purchaseorder_lineitem LineItem
LEFT JOIN t_purchaseorder_master POMast ON POMast.PONO = LineItem.PONO
@ -1743,7 +1743,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
$subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.ServiceMaterialDescription,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency,
Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,Tax.*,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,Tax.FreightType,Tax.NoOfTrip,Tax.FreightValue,Tax.AfterFreightValue,POMast.CurrencyType,
LineItem.LineitemAuditorNotes,
LineItem.LineitemAuditorNotes,Mat.HSNCODE,
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
@ -1802,7 +1802,7 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath,
Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,ROUND((ServiceTax.After_CGST + ServiceTax.After_SGST + ServiceTax.After_IGST),2) as ServiceTaxamount
,ServiceTax.TotalValue,ServiceTax.CGST,ServiceTax.After_CGST,ServiceTax.SGST,ServiceTax.After_SGST,ServiceTax.IGST,ServiceTax.After_IGST,ServiceTax.otherallowance,ServiceTax.discount,ServiceTax.discountval,ServiceTax.Afterdiscountval,
POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,ROUND((POMast.TotalOrderValue),2) as BasicINRValue,POMast.CurrencyType,FreightType as Ftype,NoOfTrip as NoTrip,FreightValue as Fvalue,AfterFreightValue as Afvalue,
LineItem.LineitemAuditorNotes,
LineItem.LineitemAuditorNotes,Mat.HSNCODE,
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode

View File

@ -74,16 +74,16 @@ class Rawmaterialdetails_model extends Model
}
//This function used to get the material category using configdetails table
function getmaterialCategory($MaterialCategory = '')
function getmaterialCategory()
{
$Config_ID = 'C023';
$builder = $this->db->table('t_configdetails')
->select('Key,Config_ID,ConfigValue')
->where('isActive', 1)
->where('Config_id', $Config_ID);
if ($MaterialCategory != '') {
$builder->where('ConfigValue !=', $MaterialCategory);
}
// if ($MaterialCategory != '') {
// $builder->where('ConfigValue !=', $MaterialCategory);
// }
$query = $builder->get();
return $query->getResult();
@ -143,6 +143,7 @@ class Rawmaterialdetails_model extends Model
return $query->getResult();
}
function getAllSilicaRawMaterialCode(){
$builder = $this->db->table('t_materialmaster')
@ -444,7 +445,7 @@ where (CurrentStock+OpeningStock)<reorder";
$builder = $this->db->table('t_materialmaster MM')
->select('MM.MaterialCode,MM.MaterialName,MM.MaterialType,MM.Category,MM.IsActive,MM.UOM')
->select('MM.MaterialCode,MM.MaterialName,MM.MaterialType,MM.Category,MM.IsActive,MM.UOM,MM.HSNCODE')
->where('MM.Category' , $configKey);
$query = $builder->get();

View File

@ -155,7 +155,7 @@ class Requistion_model extends Model
// This function also called in store req. also $reqType not removed.....
function EditMaterialCode($ReqNo, $ReqType = NULL){
$subQuery = 'SELECT Mat.MaterialCode, Mat.MaterialName, Mat.UOM FROM t_materialmaster Mat
$subQuery = 'SELECT Mat.MaterialCode, Mat.MaterialName, Mat.UOM,Mat.HSNCODE FROM t_materialmaster Mat
WHERE Mat.MaterialCode NOT IN (
SELECT Req.MaterialCode FROM t_requestion_details Req
JOIN t_requestion_master mast ON Req.ReqNo = mast.ReqNo
@ -175,7 +175,7 @@ class Requistion_model extends Model
function GetMaterialCode($ReqType,$NotArray='')
{
$builder = $this->db->table('t_materialmaster')
->select('MaterialCode, MaterialName,UOM,material_rate')
->select('MaterialCode, MaterialName,UOM,material_rate,HSNCODE')
->where('IsActive',1);
//->where('MaterialType',$ReqType );
@ -190,6 +190,7 @@ class Requistion_model extends Model
return $query->getResult();
}
}
/**
* This function is used to get the Raw Material information
* @return array $result : This is result of the query
@ -197,7 +198,7 @@ class Requistion_model extends Model
function getRawMaterialList($MaterialCode)
{
$builder = $this->db->table('t_materialmaster MM')
->select('MM.MaterialName,MM.UOM,MM.Category,CD.ConfigValue as CategoryName')
->select('MM.MaterialName,MM.UOM,MM.Category,CD.ConfigValue as CategoryName,MM.HSNCODE')
->join('t_configdetails CD', 'CD.Key = MM.Category', 'left')
->where('MM.MaterialCode',$MaterialCode );
$query = $builder->get();
@ -587,13 +588,24 @@ class Requistion_model extends Model
function getCategoryName($materialCode){
$subQuery ='SELECT MM.MaterialCode,MM.MaterialName,MM.MaterialType,MM.Category,MM.IsActive,CD.ConfigValue
from t_materialmaster as MM
left join t_configdetails as CD on CD.Key = MM.Category
left join t_configdetails as CD on CD.Key = MM.Category
where MM.MaterialCode = '.$materialCode;
$categoryName = $this->db->query($subQuery)->getRow()->ConfigValue;
return $categoryName;
}
function getmaterialCategory()
{
$Config_ID = 'C023';
$builder = $this->db->table('t_configdetails')
->select('Key,Config_ID,ConfigValue')
->where('isActive', 1)
->where('Config_id', $Config_ID);
$query = $builder->get();
return $query->getResultArray();
}
}

View File

@ -13,7 +13,8 @@ class TrpProductionModel extends Model
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['id','date', 'gasReceiptBg', 'gasReceiptPg', 'physicalGasConsumption', 'trpPlusDrierGasConsumption',
protected $allowedFields = ['id','date', 'gasReceiptBg', 'gasReceiptPg', 'physicalGasConsumption',
'drierGasConsumption','trpPlusDrierGasConsumption',
'trpPhysicalGasPerTon', 'panelGasConsumption','panelGasPerTon','edRunningHours','edProduction','edUsage',
'trpProduction', 'trpProductionPerHour', 'waterReceipt', 'waterConsumption' ,'ebReading',
'ebReadingPerUnitTon'];
@ -88,8 +89,8 @@ class TrpProductionModel extends Model
tpd.physicalGasConsumption,
IFNULL(tdmd.totalGasConsumption, 0) AS drierGasConsumption,
IFNULL(tcmd.totalGasConsumption, 0) AS coatingGasConsumption,
tpd.drierGasConsumption As drierGasConsumption,
tpd.trpPlusDrierGasConsumption,
tpd.trpPhysicalGasPerTon,
tpd.panelGasConsumption,
@ -143,13 +144,15 @@ class TrpProductionModel extends Model
$builder->join("({$subquery1}) tcmd", 'tcmd.date = tpmd.date', 'left');
// Subquery: Drier Machine Gas Consumption
$subquery2 = $this->db->table('t_driermachinedetails')
->select('date, SUM(total_gas_consumption) AS totalGasConsumption')
->groupBy('date')
->getCompiledSelect(false); // Convert Query Builder to raw SQL;
//client requirement change from auto entry to manual entry from drier gas consumption
$builder->join("({$subquery2}) tdmd", 'tdmd.date = tpmd.date', 'left');
// Subquery: Drier Machine Gas Consumption
// $subquery2 = $this->db->table('t_driermachinedetails')
// ->select('date, SUM(total_gas_consumption) AS totalGasConsumption')
// ->groupBy('date')
// ->getCompiledSelect(false); // Convert Query Builder to raw SQL;
// $builder->join("({$subquery2}) tdmd", 'tdmd.date = tpmd.date', 'left');

View File

@ -340,4 +340,20 @@ GROUP BY financial_year ";
return $query->getResult();
}
public function isEmailExists($email, $excludeEmpID = null)
{
$builder = $this->db->table('tbl_users');
$builder->select('email');
$builder->where('email', $email);
if (!empty($excludeEmpID)) {
$builder->where('EmpID !=', $excludeEmpID);
}
$query = $builder->get();
return $query->getNumRows() > 0;
}
}

View File

@ -276,7 +276,12 @@ if (!empty($getlogpodtl)) {
menubar: false,
statusbar: false,
toolbar: false
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
});
tinymce.init({
selector: "textarea#txtSpcialInstruction", // Add model SpcialInstruction
@ -861,7 +866,7 @@ if (!empty($getlogpodtl)) {
$('#EditAfterServiceTax').val('');
$('#EditAfterKrishiTax').val('');
$('#EditAfterSwachhTax').val('');
$('#EditTotalOrderValue ').val('');
$('#EditTotalOrderValue').val('');
$('#EditRate').val('');
$("#EditItemName").val('');
@ -1256,7 +1261,7 @@ if (!empty($getlogpodtl)) {
<input type="checkbox" id="IsOpenOrder" name="IsOpenOrder" value="1" <?php echo $isChecked ? 'checked' : ''; ?>> IS THIS OPEN ORDER FORMAT
<?php } ?>
<?php if(!$isChecked){ ?>
<a data-toggle="modal"><button type="submit" onclick="myFunction();" class="btn btn-success" id="abcd">Select Line Item</button> </a>
<a data-toggle="modal"><button type="submit" onclick="myFunction();" class="btn btn-success auditor-restricted-btn" id="abcd">Select Line Item</button> </a>
<?php } ?>
<?php } ?>
</div>
@ -1274,6 +1279,7 @@ if (!empty($getlogpodtl)) {
<th style="text-align:center !important; white-space: nowrap !important;">Requisition No</th>
<th style="text-align:left !important; white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="text-align:center !important; white-space: nowrap !important;">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="text-align: left; white-space: nowrap !important;">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -1309,6 +1315,7 @@ if (!empty($getlogpodtl)) {
<td style="text-align:left !important;"><?php echo $record->MaterialCode ?></td>
<td style="text-align:left !important;"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:center !important;"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
@ -1393,7 +1400,7 @@ if (!empty($getlogpodtl)) {
if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED || $PONOStatus == PO_APPROVED || $PONOStatus == SPECIAL_PO) { ?>
<td> <a data-target='#EDITSERVICE' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#EDITSERVICE"><i class="ri-pencil-fill" title="Click here to view/Edit the . <?php echo $record->ReqNo; ?> .Requisition details"></i></a>
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" class="link" data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" class="link auditor-restricted-btn" data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
<?php
} else { ?>
<td> <a data-target='#VIEWSERVICE' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#VIEWSERVICE"><i class="fa fa-eye" title="<?php echo $record->ReqNo; ?> - Click here to view Requistion details"></i>&nbsp;&nbsp;&nbsp;</a> </td>
@ -1494,7 +1501,7 @@ if (!empty($getlogpodtl)) {
<label>Scope Of Work</label>
<?php
$ServiceDescription = html_entity_decode($ServiceDescription);
$ServiceDescription = strip_tags($ServiceDescription);
// $ServiceDescription = strip_tags($ServiceDescription);
$data = array('name' => 'ScopeofWork', 'value' => set_value('ScopeofWork', $ServiceDescription), 'id' => 'ScopeofWork', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
@ -1657,7 +1664,7 @@ if (!empty($getlogpodtl)) {
<label for="deletePreviousPurchaseOrderFile"><a title="Previous Upload PO File"
href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>Previous Upload - </span><small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
<button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
</div>
<?php } ?>
@ -1699,21 +1706,21 @@ if (!empty($getlogpodtl)) {
<div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == PO_CREATED) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == SPECIAL_PO) { ?>
<a class="btn btn-success" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-success auditor-restricted-btn" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<?php } else if($PONOStatus == REQITEM_Emergency_PO_CREATED) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else { ?>
<a class="btn btn-success" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<?php } ?>
@ -1966,7 +1973,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:10px;">Cancel</a>
<a class="btn btn-success font AddService" ID="AddService"><span class="bold">Add Service</span></a>
<a class="btn btn-success font AddService auditor-restricted-btn" ID="AddService"><span class="bold">Add Service</span></a>
</div>
</form>
@ -2260,7 +2267,7 @@ if (!empty($getlogpodtl)) {
<div class="modal-footer">
<div class="form-row">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin:10px;">Cancel</a>
<a class="btn btn-success font EditService" ID="Edit">&nbsp;&nbsp;<span class="bold">Update Service</span></a>
<a class="btn btn-success font auditor-restricted-btn EditService" ID="Edit">&nbsp;&nbsp;<span class="bold">Update Service</span></a>
</div>
</div>
@ -2547,7 +2554,7 @@ if (!empty($getlogpodtl)) {
$('input[type="file"], input[type="radio"], input[type="checkbox"]').attr('disabled', true);
$("#PaymentTerms,#drpSupplier,#insuranceStatus,#PoTypeOptions,#workstatus").prop("disabled", true);
}
var openOrder = <?php echo $IsOpenOrder; ?>;
var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0 ; ?>;
if(openOrder){
$('#Quantity').val(0);
$('#Quantity').removeAttr('required');
@ -2583,7 +2590,7 @@ if (!empty($getlogpodtl)) {
$('#EditotherDescription').hide();
$('#otherdescription').hide()
$('#otherdescription').hide();
@ -2597,6 +2604,14 @@ if (!empty($getlogpodtl)) {
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
var addPer = '';
@ -2666,8 +2681,9 @@ if (!empty($getlogpodtl)) {
<td align="left">${temp}</td>
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
<td align="left">${shorten}</td>
<td align="center">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
@ -2781,8 +2797,13 @@ if (!empty($getlogpodtl)) {
var FrequencyValue = $("#EditFrequencyNo").val();
var ServiceDescription = $('#EdittxtSpcialInstruction').val();
var OtherAmt = $('#EditOtherAllowances').val();
var TotalOrderValue = $("#EditTotalOrderValue ").val();
var TotalOrderValue = $("#EditTotalOrderValue").val();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var basicval = $("#txtEditBasicValue").val();
@ -2795,12 +2816,13 @@ if (!empty($getlogpodtl)) {
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[11].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode);
@ -3118,7 +3140,7 @@ if (!empty($getlogpodtl)) {
$('#txtSpcialInstruction').focus();
return false;
} else {
var openOrder = <?php echo $IsOpenOrder; ?>;
var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0; ?>;
if(!openOrder){
if ($('#Quantity').val() == '') {
alert('Please Enter the Quantity value');
@ -3356,6 +3378,7 @@ if (!empty($getlogpodtl)) {
//If others is the payment terms to display mandatory field
$(document).ready(function() {
$('#otherdescription').hide();
$("#PaymentTerms").change(function() {
var otherPayment = '<?php echo $otherPayment; ?>';
if ($('#PaymentTerms').val().trim() == 'PT08') {
@ -3417,8 +3440,8 @@ if (!empty($getlogpodtl)) {
if (obj.materialCode == materialCode) {
$("#MaterialCode").val('');
} else {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
@ -3469,8 +3492,9 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
@ -3514,7 +3538,7 @@ if (!empty($getlogpodtl)) {
RateValue = $('#itemRate' + userid).val();
RateValue = parseFloat(RateValue).toFixed(2)
$('#EditRate').val(RateValue);
$('#txtEditBasicValue').val(cellval[8].innerHTML);
$('#txtEditBasicValue').val(cellval[9].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val());
$('#EditIgst').val($('#Igst' + userid).val());
@ -3544,7 +3568,7 @@ if (!empty($getlogpodtl)) {
$("#EditFrequencyNo").val($('#FrequencyValue' + userid).val());
}
$('#EditTotalOrderValue').val(cellval[10].innerHTML);
$('#EditTotalOrderValue').val(cellval[11].innerHTML);
$('#EditOtherAllowances').val($('#OtherAmt' + userid).val());
tinyMCE.get('EdittxtSpcialInstruction').setContent($('#ItemDescription' + userid).val());
RequistQuantity = $('#quantity' + userid).val();
@ -3552,9 +3576,14 @@ if (!empty($getlogpodtl)) {
$("#EditMaterialCode").empty();
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val())
.html(P3)
.prop('selected', true)
);
// Make the select element read-only (disable it)
@ -3589,8 +3618,9 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
// $("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -3627,7 +3657,7 @@ if (!empty($getlogpodtl)) {
RateValue = $('#itemRate' + userid).val();
RateValue = parseFloat(RateValue).toFixed(2)
$('#ViewRate').val(RateValue);
$('#txtViewBasicValue').val(cellval[8].innerHTML);
$('#txtViewBasicValue').val(cellval[9].innerHTML);
$('#ViewCgst').val($('#Cgst' + userid).val());
$('#ViewSgst').val($('#Sgst' + userid).val());
$('#ViewIgst').val($('#Igst' + userid).val());
@ -3654,7 +3684,7 @@ if (!empty($getlogpodtl)) {
$("#ViewFrequencyNo").val($('#FrequencyValue' + userid).val());
}
$('#ViewTotalOrderValue').val(cellval[10].innerHTML);
$('#ViewTotalOrderValue').val(cellval[11].innerHTML);
$('#ViewOtherAllowances').val($('#OtherAmt' + userid).val());
tinyMCE.get('ViewtxtSpcialInstruction').setContent($('#ItemDescription' + userid).val());

View File

@ -193,13 +193,13 @@
?>
<td>
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<a data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Edit Purchase Order details"
<a data-toggle="tooltip" title="<?php echo $record->PONO; ?> - Click here to Edit Purchase Order details" class="auditor-restricted-btn"
href="<?php echo base_url() . 'EditPO?PONO=' . $record->PONO . '&ReqType=' . $record->ReqType. '&CapitalRange=' . $record->CapitalRange; ?>">
<i class="fa fa-pencil-alt" data-toggle="tooltip"> </i>
&nbsp;&nbsp;&nbsp;
</a>
<?php } ?>
</td>
<?php
} else if ($statusCode == PO_AMENDED ) { ?>

View File

@ -209,7 +209,7 @@
if(!empty($draft)){
?>
<tr id="<?php echo $index ?>" >
<td align="right"><?php echo $date; ?></td>
<td align="left" style="padding-left:0.4%;"><?php echo $date; ?></td>
<td style="cursor:pointer; color:#0bb2b5" ><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>">
<?php echo $record->IGRNO ?></a>
</td>
@ -218,7 +218,7 @@
</td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
<td align="left" style="padding-left:0.4%;"><?php
$invdate = $record->DeliveryChellanDate;
if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){
echo "";
@ -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>
&nbsp;
@ -427,6 +427,7 @@
<th style="width: 50px;">SNo</th>
<th style="width: 100px;">Item Code</th>
<th style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">Item Description</th>
<th style="width: 50px;">HSN/SAC</th>
<th style="width: 50px;">UOM</th>
<th style="width: 100px;">Ordered Qty</th>
<th style="width: 100px;">Received Qty</th>
@ -435,7 +436,7 @@
<th style="width: 50px;">Tax (%)</th>
<th style="width: 50px;">Taxable Amt</th>
<th style="width: 50px;">Total Amt</th>
<th style="width: 150px;">Remarks</th>
<th style="width: 150px;">Remarks <span class="text-danger">*</span></th>
<th style="width: 50px;"></th>
</tr>
</thead>
@ -804,14 +805,15 @@
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="HSNCODE">' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>';
'<td style="width: 150px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
@ -843,14 +845,15 @@
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="HSNCODE">' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>';
'<td style="width: 150px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
@ -878,13 +881,14 @@
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="HSNCODE">' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" name="Quantity">' + item.Quantity + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>';
'<td style="width: 150px;">' + item.Remarks + '</td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +

View File

@ -18,8 +18,8 @@
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="p-2">
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewUser" method="post">
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewUser" method="post">
<div class="p-2">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
@ -63,7 +63,7 @@
<input type="text" class="form-control required digits" readonly id="ContactNo" name="ContactNo" minlength="10" maxlength="10">
</div>
<div class="col-md-3">
<label for="Role">Role</label>
<label for="Role">Role<span class="badge">*</span></label>
<select class="form-control required" id="role" name="role" required>
<option value="0">Select Role</option>
<?php
@ -90,7 +90,7 @@
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
</div>
</div>
</div>
</form>
</div>
</div>
@ -181,58 +181,67 @@
$("#ContactNo").val('');
}
});
$('#MailID').change(function() {
var mailID = $(this).val();
var empID = ''// $('#EmpList').val();
if (mailID) {
$('#loader').show();
$.ajax({
url: "<?php echo base_url() ?>isEmailExists",
type: 'POST',
data: { EmpID:empID,MailID:mailID },
success: function(data) {
if (data.success) {
$('#loader').hide();
alert(data.message);
$("#MailID").val('');
} else {
$('#loader').hide();
}
},
error: function() {
$('#loader').hide();
alert('An Error Occur in this email address');
$("#MailID").val('');
}
});
}else{
alert("Invalid email address");
}
});
});
$('#addPop').click(function() {
if ($('#distriList option:selected').val() != null) {
if ($('#distriList option:selected').val() == 0) {} else {
var tempSelect = $('#distriList option:selected').val();
var tempText = $('#distriList option:selected').text();
var o = new Option(tempText, tempSelect);
var hidval = tempSelect;
var Selectedval = ''
if (orgVal != '') {
Selectedval = orgVal + ':' + hidval;
} else {
Selectedval = hidval
}
$(o).html(tempText);
$("#selectDistriList").append(o);
$('#distriList option:selected').remove();
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
$("#selectDistriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
tempSelect = '';
tempText = '';
Selectedval = '';
}
} else {
alert("Before add please select any position.");
}
});
</script>
<script>
function Validate() {
var isValid = true;
var isValid;
var fname = document.getElementById('FirstName').value;
var role = document.getElementById('role').value;
var email = document.getElementById('MailID').value;
var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
var password = document.getElementById('password').value;
var cpassword = document.getElementById('cpassword').value;
if (!fname) {
alert('First Name is required');
isValid = false;
}
var email = document.getElementById('MailID').value;
var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(email)) {
}else if (!emailPattern.test(email)) {
alert('Invalid email address');
isValid = false;
}
var password = document.getElementById('password').value;
var cpassword = document.getElementById('cpassword').value;
if (password !== cpassword) {
}else if (role === "0") {
alert('Role is required');
isValid = false;
}else if(!password){
alert('Missing Passwords');
isValid = false;
}else if (password !== cpassword) {
alert('Passwords do not match');
isValid = false;
}else{
isValid = true;
$('#loader').show();
}
return isValid;

View File

@ -2083,8 +2083,11 @@ if (!empty($INRSYMBOL)) {
}
$(document).ready(function () {
$('#ServiceMaterialCode').change(function () {
var selectedMaterialCode = '';
selectedMaterialCode = $("#ServiceMaterialCode").val();
selectedMaterialCode = $("#ServiceMaterialCode").val(); // First I have get the data from materialcode dropdown
// clearServiceModalFields(); // then Clear All Fields
$("#ServiceMaterialCode").val(selectedMaterialCode); // again i fetched the materialcode in that dropdown // konjam loose thaan
$.each(JSON.parse(materialData), function (index, value) {
if (selectedMaterialCode == value.MaterialCode) {
$("#ServiceDescription").val(value.MaterialName);
@ -2222,8 +2225,8 @@ if (!empty($INRSYMBOL)) {
$("#ServiceMaterialCode").append($('<option></option>').val("0").html("Select Item Code"));
$.each(JSON.parse(data), function (index, value) {
$("#ServiceMaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = value.HSNCODE ? value.HSNCODE+" - " : "";
$("#ServiceMaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
});
} else if (input == 'REVENUE') {
@ -2233,9 +2236,8 @@ if (!empty($INRSYMBOL)) {
$("#MaterialCode").append($('<option></option>').val("0").html("Select Item Code"));
$.each(JSON.parse(data), function (index, value) {
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = value.HSNCODE ? value.HSNCODE+"-" : "";
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
});
} else {
@ -2293,17 +2295,17 @@ if (!empty($INRSYMBOL)) {
*/
$('#MaterialCode').on('change', function () {
console.log("111111111111");
// $('#MaterialCode').change(function() {
var selectedRevenueMaterialCode = '';
selectedRevenueMaterialCode = $("#MaterialCode").val();
console.log(materialData);
console.log("materialData - 1111111");
selectedRevenueMaterialCode = $("#MaterialCode").val();// First I have get the data from materialcode dropdown
// clearRevenueModalFields();// then Clear All Fields
// $('#MaterialCode').change(function() {
$("#MaterialCode").val(selectedRevenueMaterialCode); // again i fetched the materialcode in that dropdown // konjam loose thaan
$.each(JSON.parse(materialData), function (index, value) {
if (selectedRevenueMaterialCode == value.MaterialCode) {
$("#ItemName").val(value.MaterialName);
$("#UOM").val(value.UOM);
$("#Rate").val(value.material_rate);
$("#Quantity").val(0);
}
});
@ -2366,7 +2368,8 @@ if (!empty($INRSYMBOL)) {
//This function is used to add material list after delete
$.each(JSON.parse(materialData), function (index, value) {
if (value.MaterialCode == materialCode) {
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = value.HSNCODE ? value.HSNCODE+"-" : "";
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
}
});
@ -2940,31 +2943,44 @@ if (!empty($INRSYMBOL)) {
</div>
</div>
<table class="table table-bordered ">
<style>
.table-responsive::-webkit-scrollbar {
display: none;
}
</style>
<div class="box-body">
<table id="serviceTax" class="table table-bordered table-hover"
style="background-color:#fff;">
<thead>
<tr>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important;" class="text-right">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important;" class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
<tbody id="ServiceAppend"></tbody>
<tbody id="RevenueAppend"></tbody>
</table>
<div class="table-responsive" style="padding-bottom: 30px;
overflow: auto;
-ms-overflow-style: none; /* IE/Edge */
scrollbar-width: none; /* Firefox */
">
<table id="serviceTax" class="table table-bordered table-hover mb-0"
style="background-color:#fff; font-size:12px;">
<thead>
<tr>
<th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important;" class="text-right">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
<th style="white-space: nowrap !important;" class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;" class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th style="white-space: nowrap !important;">Action</th>
</tr>
</thead>
<tbody id="ServiceAppend"></tbody>
<tbody id="RevenueAppend"></tbody>
</table>
</div>
</div>
</table>
<div class="row px-3" id="potaxes" style="display:none;">
@ -3598,7 +3614,7 @@ if (!empty($INRSYMBOL)) {
<br>
<div class="col-12 text-right">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin:10px;">Cancel</a>&nbsp;&nbsp;
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin:10px;" onclick="clearRevenueModalFields()">Cancel</a>&nbsp;&nbsp;
<a class="btn btn-success font AddRevenue" ID="AddRevenue">&nbsp;&nbsp;<span class="bold">Add Revenue</span></a>&nbsp;&nbsp;
</div>
@ -3892,7 +3908,7 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel">Cancel</a>
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" onclick="clearServiceModalFields()">Cancel</a>
&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn btn-success font AddService" ID="AddService"> &nbsp;&nbsp;<span class="bold">Add Service</span></a>
</div>
@ -6080,6 +6096,12 @@ if (!empty($INRSYMBOL)) {
// $('#ReqNo').val(Reqnumber).remove();
// $('#ReqNo option[value='+Reqnumber+']').remove();
var selectedRText = $('#MaterialCode option:selected').text();
var Rparts = selectedRText.split('-');
var RHSN = selectedRText.includes('-') && /^\d+$/.test(Rparts[0].trim())
? Rparts[0].trim()
: '';
$('#MaterialCode option[value=' + materialCode + ']').remove();
@ -6100,6 +6122,7 @@ if (!empty($INRSYMBOL)) {
<td style="text-align:center !important">${Reqnumber}</td>
<td>${materialCode}</td>
<td>${rshorten}</td>
<td style="text-align:center !important">${RHSN}</td>
<td><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
@ -6114,15 +6137,7 @@ if (!empty($INRSYMBOL)) {
<td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td>
<td align="right">${TotalOrderValue}</td>
<td>
<a data-target='#EDITREVENUE' data-id="${temp}" data-index="${index}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE">
<i class="ri-pencil-fill"></i>
&nbsp;&nbsp;&nbsp;
</a>
<a href='#' onclick="DeleteRevenueRow('${temp}')" class="link" data-id="${temp}" data-index="${index}" data-userid="${temp}" id="Del">
<span class="ri-delete-bin-7-fill"></span>
</a>
</td>
<td><a data-target='#EDITREVENUE' data-id="${temp}" data-index="${index}" data-userid="${temp}" data-toggle="modal" href="#EDITREVENUE"><i class="ri-pencil-fill"></i></a> &nbsp;&nbsp;&nbsp;<a href='#' onclick="DeleteRevenueRow('${temp}')" class="link" data-id="${temp}" data-index="${index}" data-userid="${temp}" id="Del"><span class="ri-delete-bin-7-fill"></span></a></td>
</tr>
`;
$('#RevenueAppend').append(html);
@ -6240,7 +6255,7 @@ if (!empty($INRSYMBOL)) {
$('#deptName').val('');
$('#CostCenter').val("0");
$('#AvlBudAmt').val(0);
$('#MaterialCode').val('');
$('#MaterialCode').val("").select2();
$("#ItemName").val('');
$('#UOM').val('');
$("#Rate").val('');
@ -6748,6 +6763,12 @@ if (!empty($INRSYMBOL)) {
var AvilBudget = $('#AvalBuget').val();
var costCode = $('#CostCenterName').val();
var materialCode = $('#ServiceMaterialCode').val();
var SselectedText = $('#ServiceMaterialCode option:selected').text();
var Sparts = SselectedText.split('-');
var SHSN = SselectedText.includes('-') && /^\d+$/.test(Sparts[0].trim())
? Sparts[0].trim()
: '';
var materialName = $("#ServiceDescription").val();
var uom = $("#ServiceUOM").val();
var addPer = '';
@ -6804,6 +6825,7 @@ if (!empty($INRSYMBOL)) {
<td style="text-align:center !important">${Reqnumber}</td>
<td>${materialCode}</td>
<td>${sshorten}</td>
<td style="text-align:center !important">${SHSN}</td>
<td><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
@ -6818,15 +6840,7 @@ if (!empty($INRSYMBOL)) {
<td align="right">${basicval}</td>
<td align="right">${TotalTaxValue}</td>
<td align="right">${TotalOrderValue}</td>
<td>
<a data-target='#EDITSERVICE' data-id="${temp}" data-index="${index}" data-userid="${temp}" data-toggle="modal" href="#EDITSERVICE">
<i class="ri-pencil-fill"></i>
&nbsp;&nbsp;&nbsp;
</a>
<a href='#' onclick="DeleteRow('${temp}')" class="link" data-id="${temp}" data-index="${index}" data-userid="${temp}" id="Del">
<span class="ri-delete-bin-7-fill"></span>
</a>
</td>
<td><a data-target='#EDITSERVICE' data-id="${temp}" data-index="${index}" data-userid="${temp}" data-toggle="modal" href="#EDITSERVICE"><i class="ri-pencil-fill"></i></a> &nbsp;&nbsp;&nbsp;<a href='#' onclick="DeleteRow('${temp}')" class="link" data-id="${temp}" data-index="${index}" data-userid="${temp}" id="Del"><span class="ri-delete-bin-7-fill"></span></a></td>
</tr>
`;
console.log("index = " + index);
@ -7007,14 +7021,14 @@ if (!empty($INRSYMBOL)) {
$('#EditEmergPer').val($('#Serviceper' + userid).val());
$('#EditQuantity').val($('#quantity' + userid).val());
$('#EditRate').val($('#itemRate' + userid).val());
$('#txtEditBasicValue').val(cellval[8].innerHTML);
$('#txtEditBasicValue').val(cellval[9].innerHTML);
$('#EditAfterCgst').val($('#AfterCgst' + userid).val());
$('#EditAfterSgst').val($('#AfterSgst' + userid).val());
$('#EditAfterIgst').val($('#AfterIgst' + userid).val());
$('#EditCgst').val($('#Cgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val());
$('#EditIgst').val($('#Igst' + userid).val());
$('#EditTotalOrderValue').val(cellval[10].innerHTML);
$('#EditTotalOrderValue').val(cellval[11].innerHTML);
$('#EditOtherAllowances').val($('#OtherAmt' + userid).val());
tinyMCE.get('EdittxtSpcialInstructionSingle').setContent($('#ItemServiceDescription' + userid).val());
@ -7026,7 +7040,11 @@ if (!empty($INRSYMBOL)) {
$("#EditMaterialCode").empty();
// $('#EditMaterialCode').val("").select2();
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html(P3));
if (typeof materialData !== 'undefined' && materialData !== null && materialData !== '') {
var parsedMaterialData = JSON.parse(materialData);
@ -7034,7 +7052,9 @@ if (!empty($INRSYMBOL)) {
$.each(parsedMaterialData, function (index, value) {
// Assuming userid is defined somewhere in your code
if ($('#materialCode' + userid).val() != value.MaterialCode) {
$("#EditMaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
// $("#EditMaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
}
});
} else {
@ -7127,17 +7147,23 @@ if (!empty($INRSYMBOL)) {
var TotalTaxValue = calculateEditTaxValue();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = basicval;
cellval[9].innerHTML = TotalTaxValue;
cellval[10].innerHTML = TotalOrderValue;
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = basicval;
cellval[10].innerHTML = TotalTaxValue;
cellval[11].innerHTML = TotalOrderValue;
$('#materialCode' + userid).val(editMaterialCode);
@ -7268,7 +7294,7 @@ if (!empty($INRSYMBOL)) {
$.each(JSON.parse(materialData), function (index, value) {
if (value.MaterialCode == materialCode) {
// $("#ServiceMaterialCode").append( $('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName) );
$("#ServiceMaterialCode").append( $('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName) );
}
@ -7674,7 +7700,7 @@ if (!empty($INRSYMBOL)) {
$('#EditRevenueQuantity').val($('#quantity' + userid).val());
$('#EditRevenueRate').val($('#itemRate' + userid).val());
$('#editrevenueEmergPer').val($('#per' + userid).val());
$('#txtEditRevenueBasicValue').val(cellval[8].innerHTML);
$('#txtEditRevenueBasicValue').val(cellval[9].innerHTML);
RequistQuantity = $('#quantity' + userid).val();
$('#txtEditDiscount').val($('#DisVal' + userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal' + userid).val());
@ -7708,14 +7734,18 @@ if (!empty($INRSYMBOL)) {
$("#EditRevenueMaterialCode").empty();
$("#EditRevenueMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditRevenueMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html(P3));
if (typeof materialData !== 'undefined' && materialData !== null && materialData !== '') {
var parsedMaterialData = JSON.parse(materialData);
$.each(parsedMaterialData, function (index, value) {
if ($('#materialCode' + userid).val() != value.MaterialCode) {
$("#EditRevenueMaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = value.HSNCODE ? value.HSNCODE+" - " : "";
$("#EditRevenueMaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
});
} else {
@ -7733,6 +7763,12 @@ if (!empty($INRSYMBOL)) {
var editselectedMaterialCode = '';
editselectedMaterialCode = $("#EditRevenueMaterialCode").val();
var selectedRevenuText = $('#EditRevenueMaterialCode option:selected').text();
var editRevenuparts = selectedRevenuText.split('-');
var editRevenueHSN = editselectedText.includes('-') && /^\d+$/.test(editRevenuparts[0].trim())
? editRevenuparts[0].trim()
: '';
$.each(JSON.parse(materialData), function (index, value) {
if (editselectedMaterialCode == value.MaterialCode) {
@ -7806,15 +7842,23 @@ if (!empty($INRSYMBOL)) {
var userid = $("#hiddenRevenueuserid").val();
var tr = document.getElementById(userid);
var editRselectedText = $('#EditRevenueMaterialCode option:selected').text();
var editRparts = editRselectedText.split('-');
var editRHSN = editRselectedText.includes('-') && /^\d+$/.test(editRparts[0].trim())
? editRparts[0].trim()
: '';
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = parseFloat(editQuantity).toFixed(2);
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
cellval[4].innerHTML = editRHSN;
cellval[6].innerHTML = parseFloat(editQuantity).toFixed(2);
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[11].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode);

View File

@ -54,7 +54,7 @@
</li>
</ol>
</div>
<a href="<?php echo base_url(); ?>addasset" class="btn btn-success">Add New
<a href="<?php echo base_url(); ?>addasset" class="btn btn-success auditor-restricted-btn">Add New
Asset</a>
</div>
</div>
@ -171,6 +171,7 @@
<a onclick="confirmDeleteAsset(event)"
href="<?php echo base_url() . 'assetdetails/deleteAsset/?AssetID=' . $record->AssetCode ?>"
data-toggle="tooltip"
class="auditor-restricted-btn"
title="<?php echo $record->AssetCode; ?> - Click here to Delete Asset Details">
<i class="fa fa-trash"></i>
</a>

View File

@ -256,16 +256,19 @@ $currentday = date('d');
<div class="col-9 text-right d-flex" style="justify-content: end;" id="savebutton">
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
<input type="text" id="searchInput" placeholder="Search..."
style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;
cursor:pointer;
border-radius: 5px;margin-right:15px;">
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;" title="Export Excel"></i>
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px; cursor:pointer;" title="Export Excel"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;" title="Full screen view"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px; cursor:pointer;" title="Full screen view"></i>
<i class="fas fa-save" id="c" style="margin-right: 15px;margin-top: 5px;font-size:28px;" title="Save"></i>
<i class="fas fa-save auditor-restricted-btn" id="c" style="margin-right: 15px;margin-top: 5px;font-size:28px; cursor:pointer;" title="Save"></i>
</div>
@ -633,7 +636,6 @@ $currentday = date('d');
});
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
@ -670,25 +672,12 @@ $(document).ready(function () {
function exportTableToExcel(tableId, filename = 'attendance.xlsx') {
var table = document.getElementById(tableId);
var rows = table.rows;
var data = [];
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cols = row.querySelectorAll('td, th');
var rowData = [];
for (var j = 0; j < cols.length; j++) {
rowData.push(cols[j].innerText);
}
data.push(rowData);
}
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename);
let ws = XLSX.utils.table_to_sheet(table); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
// Add click event listener to the export button

View File

@ -804,6 +804,7 @@ if (!empty($INRSYMBOL)) {
<th style="white-space: nowrap !important;" align="center">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important;" align="right">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -2643,8 +2644,9 @@ if (!empty($INRSYMBOL)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
@ -3443,6 +3445,11 @@ if (!empty($INRSYMBOL)) {
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
$('#MaterialCode option[value=' + materialCode + ']').remove();
@ -3484,6 +3491,7 @@ if (!empty($INRSYMBOL)) {
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${shorten}</td>
<td align="center">${HSN}</td>
<td align="left">
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
@ -3992,8 +4000,8 @@ if (!empty($INRSYMBOL)) {
if (value.MaterialCode == materialCode) {
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = value.HSNCODE ? value.HSNCODE+"-" : "";
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
}
@ -4298,7 +4306,7 @@ if (!empty($INRSYMBOL)) {
console.log($('#Igst' + userid).val());
$('#EdittxtTotalOrderValue').val(cellval[10].innerHTML);
$('#EdittxtTotalOrderValue').val(cellval[11].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val());
$('#EditAfterCgst').val($('#AfterCgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val());
@ -4375,13 +4383,23 @@ if (!empty($INRSYMBOL)) {
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").empty();
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
// $("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
$('#EditRateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/' + EditUOM + ')');
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
});
@ -4923,6 +4941,12 @@ if (!empty($INRSYMBOL)) {
$('#ClearingCharges' + userid).val(Clearing);
$('#Subtotal' + userid).val(Subtotal);
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
if (capitalType == 'International') {
TotalTaxValue = 0.00;
Total = basicval;
@ -4930,13 +4954,14 @@ if (!empty($INRSYMBOL)) {
cellval[2].innerHTML = materialCode;
cellval[3].innerHTML = materialName;
cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = quantity;
cellval[6].innerHTML = uom;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = basicval;
cellval[9].innerHTML = TotalTaxValue;
cellval[10].innerHTML = Total;
cellval[6].innerHTML = quantity;
cellval[7].innerHTML = uom;
cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = basicval;
cellval[10].innerHTML = TotalTaxValue;
cellval[11].innerHTML = Total;
$('#EDITCAPITAL').modal('hide');

View File

@ -57,6 +57,10 @@
</style>
<?php
$page = session()->getFlashdata('page') ?? $_GET['page'] ?? 1;
?>
<div class="content-page">
<div class="content">
@ -146,9 +150,9 @@
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr
class="<?php if ($record->isActive == 0) {
echo "deactivatedRow";
@ -168,7 +172,9 @@
<td><?= $record->isActive == 1 ? 'Active' : 'InActive'; ?></td>
<td>
<a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"
<a
onclick="editConfig(event)"
href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"
data-toggle="tooltip"
title="<?php echo $record->Config_ID ?> - Click here to Edit Config Details">
<i class="fas fa-edit"></i>
@ -225,6 +231,30 @@
}
});
// Ensure the saved page is a valid number
let savedPage =<?= $page ?? 0 ?>; // Default to 1 if not set
savedPage = savedPage -1 ;
// Check if the saved page is a number and not NaN
if (!isNaN(savedPage)) {
// Check if the DataTable is initialized
if ($.fn.DataTable.isDataTable('#config_list_table')) {
var dataTable = $('#config_list_table').DataTable();
// Get the total number of pages in DataTable
var totalPages = dataTable.page.info().pages;
// Ensure the page number is within range
if (savedPage >= totalPages) {
savedPage = totalPages > 0 ? totalPages - 1 : 0;
}
// Set DataTable to the saved page
dataTable.page(savedPage).draw(false);
}
}
// Date range filter function
$.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) {
@ -287,6 +317,30 @@
}
});
});
</script>
<script>
function editConfig(event) {
event.preventDefault();
const targetElement = event.currentTarget;
let href = $(targetElement).attr('href');
let paginationNumber = $('#config_list_table').DataTable().page.info().page + 1; // Get the current page number from dataTable
href += '&page=' + paginationNumber;
// Update the 'href' attribute of the target element
$(targetElement).attr('href', href);
window.location.href = href;
}
</script>

View File

@ -53,7 +53,7 @@
</li>
</ol>
</div>
<a data-toggle="modal" href="#ccwizard" data-id="0" data-name="" class="btn btn-success">Add Cost
<a data-toggle="modal" href="#ccwizard" data-id="0" data-name="" class="btn btn-success auditor-restricted-btn">Add Cost
Details </a>
</div>
</div>
@ -137,7 +137,7 @@
<a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>"
data-name="<?php echo $record->CostCenterName; ?>"><i
class="fas fa-edit"></i>&nbsp;&nbsp;</a>
<a onclick="confirmDelete(event)" style="cursor:pointer;"
<a onclick="confirmDelete(event)" style="cursor:pointer;" class="auditor-restricted-btn"
href="<?php echo base_url() . 'deleteCostCenter?CostCenterCode=' . $record->code; ?>"><i
class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?>
@ -187,7 +187,7 @@
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</button>
<button type="button" class="btn btn-info waves-effect waves-light tempClick"
<button type="button" class="btn btn-info waves-effect waves-light auditor-restricted-btn tempClick"
id="tempClick">Submit</button>
</div>
</div>

View File

@ -60,7 +60,7 @@
</li>
</ol>
</div>
<a class="btn btn-success" href="<?php echo base_url(); ?>adddepartment">Add New department</a>
<a class="btn btn-success auditor-restricted-btn" href="<?php echo base_url(); ?>adddepartment">Add New department</a>
@ -159,6 +159,7 @@
<a
onclick="confirmReActivateDepartment(event)"
class="auditor-restricted-btn"
href="<?php echo base_url() . 'reActivateDepartment/?SID=' . $record->DEPCode ?>"
data-toggle="tooltip"
title="<?php echo $record->DEPCode ?> - Click here to Re activate Department Details"><i
@ -179,6 +180,7 @@
onclick="confirmDeleteDepartment(event)"
href="<?php echo base_url() . 'deleteDepartment/?SID=' . $record->DEPCode ?>"
data-toggle="tooltip"
class="auditor-restricted-btn"
title="<?php echo $record->DEPCode ?> - Click here to Delete Department Details"><i
class="fas fa-trash"></i>
</a>

View File

@ -76,7 +76,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<?php if($payslip_id == 0){ ?>
<button type="button" style="margin-top:0px;" class="btn btn-success" data-target="#attendanceModal" data-id="0" data-toggle="modal">
<button type="button" style="margin-top:0px;" class="btn btn-success auditor-restricted-btn" data-target="#attendanceModal" data-id="0" data-toggle="modal">
Add Trip details
</button>
<?php }else { ?>
@ -130,7 +130,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<i class="fas fa-edit"></i>&nbsp;&nbsp;&nbsp;
</a>
<a onclick="confirmDelete(event)" style="cursor:pointer;" href="<?php echo base_url() . 'deleteDriverAttendance?driverAttendanceId=' . esc($record['driver_attendance_id']).'&drv_id='.esc($record['driver_id']).'&month_year='.esc($datefordropdown); ?>">
<a onclick="confirmDelete(event)" class="auditor-restricted-btn" style="cursor:pointer;" href="<?php echo base_url() . 'deleteDriverAttendance?driverAttendanceId=' . esc($record['driver_attendance_id']).'&drv_id='.esc($record['driver_id']).'&month_year='.esc($datefordropdown); ?>">
<i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a>
@ -165,7 +165,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th></th>
<th></th>
<th>Diesel</th>
<th><input type="text" class="editable" data-column="diesel_amount" <?php echo ($payslip_id != 0) ? 'readonly' : ''; ?> ></th>
<th><input type="text" class="editable auditor-restricted-field" data-column="diesel_amount" <?php echo ($payslip_id != 0) ? 'readonly' : ''; ?> ></th>
<th></th>
<th></th>
</tr>
@ -179,7 +179,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th></th>
<th></th>
<th>Shed Amount</th>
<th><input type="text" class="editable" data-column="shed_amount" <?php echo ($payslip_id != 0) ? 'readonly' : ''; ?> ></th>
<th><input type="text" class="editable auditor-restricted-field" data-column="shed_amount" <?php echo ($payslip_id != 0) ? 'readonly' : ''; ?> ></th>
<th></th>
<th></th>
</tr>
@ -234,32 +234,19 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!--first row -->
<input type="hidden" class="form-control" id="driver_attendance_id" name="driver_attendance_id">
<input type="hidden" class="form-control" id="driver_id" name="driver_id">
<input type="hidden" class="form-control" id="driver_name" name="driver_name" readonly>
<?php $calendarStartDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('first day of this month')->format('Y-m-d');?>
<?php $calendarEndDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('last day of this month')->format('Y-m-d');?>
<?php $calendarCurrDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('today')->format('Y-m-d');?>
<div class="row">
<div class="col-md-4">
<label class="form" for="date">Date</label>
<input type="date" class="form-control" id="date" name="date" value="<?= $calendarCurrDate?>" min="<?= $calendarStartDate?>" max="<?= $calendarEndDate?>" required>
</div>
<div class="col-md-4">
<label class="form" for="driver_name">Driver Name</label>
<input type="text" class="form-control" id="driver_name" name="driver_name" readonly>
</div>
<div class="col-md-4">
<label class="form" for="category_type">Category</label>
<select class="form-control" id="category_type" name="category_type" onchange="resetthefields();">
<option value="">Select</option>
<option value="IGR">IGR</option>
<option value="INVOICE">INVOICE</option>
<option value="IGR">IGR</option>
</select>
</div>
</div>
<!-- second row -->
<div class="row mt-2">
<div class="col-md-4">
<label class="form" for="invoice_number">Invoice Number</label>
<input type="text" class="form-control" id="invoice_number" name="invoice_number" onchange="customerandquantity();">
@ -271,11 +258,20 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</select> -->
</div>
<div class="col-md-4">
<label class="form" for="date">Date</label>
<input type="date" class="form-control" id="date" name="date" value="<?= $calendarCurrDate?>" min="<?= $calendarStartDate?>" max="<?= $calendarEndDate?>" required>
</div>
</div>
<!-- second row -->
<div class="row mt-2">
<div class="col-md-6">
<label class="form" for="customer">Customer</label>
<input type="text" class="form-control" id="customer" name="customer" readonly>
</div>
<div class="col-md-4">
<div class="col-md-6">
<label class="form" for="quantity">Quantity</label>
<input type="text" class="form-control" id="quantity" name="quantity" readonly>
</div>
@ -323,7 +319,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</button>
<button type="button" class="btn btn-info waves-effect waves-light tempClick"
<button type="button" class="btn btn-info waves-effect waves-light auditor-restricted-btn tempClick"
id="tempClick">Submit</button>
</div>
</div><!-- /.modal-content -->
@ -385,16 +381,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$("#attendanceModal").on("shown.bs.modal", function (e) {
var dname = "<?php echo $page_driver_name;?>";
var id = $(e.relatedTarget).data('id');
let fields = ['invoice_number', 'vehicle_number', 'load_type', 'salary_amount', 'food_amount','customer','quantity','total_amount'];
let fields = ['invoice_number', 'vehicle_number', 'load_type', 'salary_amount', 'food_amount','customer','quantity','total_amount','category_type'];
fields.forEach(function(field) {
$("#" + field).val("");
});
if (id == 0) {
$('#attendanceTitle').html("Add Driver Trip");
$('#attendanceTitle').html("Add "+dname+" Trip Details");
$("#driver_attendance_id").val(0);
} else {
$("#driver_attendance_id").val(id);
@ -408,6 +405,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
if(field == 'driver_id'){
$("#driver_id").val(arr && arr['driver_id']);
}
if(field == 'category_type'){
$("#category_type").val(arr && arr['type']);
}
var salary = arr['salary_amount'] ? parseFloat(arr['salary_amount']) : 0;
var food = arr['food_amount'] ? parseFloat(arr['food_amount']) : 0;
@ -421,7 +421,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$('#total_amount').val(ttl.toFixed(2));
});
$('#attendanceTitle').html("Edit Driver Trip");
$('#attendanceTitle').html("Edit "+dname+" Trip Details");
}
});
$('#tempClick').click(function () {
@ -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({

View File

@ -19,65 +19,88 @@
</tr>
<tr>
<td colspan="11">
<table>
<tbody>
<tr >
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Name </td>
<td width="200px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->driver_name; ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Employee ID </td>
<td width="152px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->EmpID ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Designation </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" > <?php echo ':&nbsp;'.$PayDetails[0]->Designation ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Department </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->DeptName ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Date Of Joining </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.date('d-m-Y', strtotime($PayDetails[0]->DOJ)) ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">No Of Loads </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->no_of_loads ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank Name </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->BankName ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">PAN Number </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->Pan;?> </td>
</tr>
<tr>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank Acc No </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->BankAccountNumber ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> Aadhar Number</td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.str_replace(' ', '', $PayDetails[0]->AadharNo);?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank IFSC </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo ':&nbsp;'.$PayDetails[0]->IFSCCode ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Loan Balance </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->BalanceAdvance ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo '&nbsp;' ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Diesel </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->diesel_amount; ?></td>
</tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo '&nbsp;'; ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Shed Duty Amount </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->shed_amount; ?></td>
</tr>
</tbody>
<table style="width: 100%; border-collapse: collapse;">
<tbody>
<tr>
<td style="width: 14%; border: none; white-space: nowrap;">Name</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->driver_name; ?></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Employee ID</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->EmpID ?></td>
</tr>
<tr>
<td style="width: 14%; border: none; white-space: nowrap;">Designation</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->Designation ?></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Department</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->DeptName ?></td>
</tr>
<tr>
<td style="width: 14%; border: none; white-space: nowrap;">Date Of Joining</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo date('d-m-Y', strtotime($PayDetails[0]->DOJ)) ?></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">No Of Loads</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->no_of_load ?></td>
</tr>
<tr>
<td style="width: 14%; border: none; white-space: nowrap;">Bank Name</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->BankName ?></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">PAN Number</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->Pan; ?></td>
</tr>
<tr>
<td style="width: 14%; border: none; white-space: nowrap;">Bank Acc No</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->BankAccountNumber ?></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Aadhar Number</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo str_replace(' ', '', $PayDetails[0]->AadharNo); ?></td>
</tr>
<tr>
<td style="width: 14%; border: none; white-space: nowrap;">Bank IFSC</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->IFSCCode ?></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Loan Balance</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;">&#8377;<?php echo '&nbsp;' . $PayDetails[0]->BalanceAdvance ?></td>
</tr>
<tr>
<td style="width: 14%; border: none;"></td>
<td style="width: 1%; border: none;"></td>
<td style="width: 34%; border: none;"></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Diesel Amount</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;">&#8377;<?php echo '&nbsp;' . $PayDetails[0]->diesel_amount; ?></td>
</tr>
<tr>
<td style="width: 14%; border: none;"></td>
<td style="width: 1%; border: none;"></td>
<td style="width: 34%; border: none;"></td>
<td style="width: 2%;border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Shed Duty Amount</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;">&#8377;<?php echo '&nbsp;' . $PayDetails[0]->shed_amount; ?></td>
</tr>
</tbody>
</table>
</td>
</tr>
@ -85,7 +108,7 @@
<table style="border-collapse: collapse;border-top:#fff;" cellpadding="0" cellspacing="0" border="1" width="100%" >
<tr><th>Earnings</th><th>Amount <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></th><th>Deductions</th><th>Amount <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></th></tr>
<tr>
<td width="25%;">&nbsp;BASIC</td>
<td width="25%;">&nbsp;BASIC</td>
<td width="20%;" style="text-align: right;" ><?php echo $PayDetails[0]->BASIC; ?>&nbsp;</td>
<td width="25%;">&nbsp;PF</td>
<td width="30%;" style="text-align: right;" ><?php echo $pf_amount; ?>&nbsp;</td>

View File

@ -337,7 +337,12 @@ if (!empty($POItem) && $CapitalRange == '1') {
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $scopeofwork; ?>`);
});
}
// plugins: "link image"
});
tinymce.init({
@ -888,6 +893,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
<th style="white-space: nowrap !important; text-align:left !important">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
@ -913,6 +919,7 @@ if (!empty($POItem) && $CapitalRange == '1') {
<td style="text-align:center !important"><?php echo $record->ReqNo ?></td>
<td style="text-align:left !important"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;">
<a href="#"
class="editable-field"
@ -1681,10 +1688,11 @@ if (!empty($POItem) && $CapitalRange == '1') {
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($scopeofwork)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
<label>Special Instructions </label>
<textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="10" cols="40">
<?php echo $scopeofwork ? html_entity_decode($scopeofwork) : "" ; ?>
<!-- strip_tags($scopeofwork) -->
</textarea>
</div>
</div><!-- /.Special Instructions section -->
@ -1757,9 +1765,9 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div>
<div class="col-md-7 text-right">
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
</div>
</div>
@ -2444,8 +2452,8 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel" style="margin-right:10px">Cancel</a>
<a class="btn btn-success font EditCapital" ID="UpdateCapital"> &nbsp;&nbsp;<span
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:10px">Cancel</a>
<a class="btn btn-success font auditor-restricted-btn EditCapital" ID="UpdateCapital"> &nbsp;&nbsp;<span
class="bold">Update Capital</span></a>
</div>
</form>
@ -2681,8 +2689,9 @@ if (!empty($POItem) && $CapitalRange == '1') {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
@ -3345,7 +3354,7 @@ Calculate Landing charge
$('#EditOtherAllowances').val($('#otherallowance' + userid).val());
//$('#Editservicetotalordervaue').val($('#totalservicevalue'+userid).val());
$('#Editservicetotalordervaue').val(cellval[9].innerHTML);
$('#Editservicetotalordervaue').val(cellval[10].innerHTML);
@ -3433,12 +3442,22 @@ Calculate Landing charge
$("#EditMaterialCode").empty();
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[3].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSN = (obj.HSNCODE) ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(HSN + obj.MaterialName + " ( "+obj.MaterialCode+" ) "));
}
});
@ -4056,19 +4075,26 @@ Calculate Landing charge
$('#DisVal' + userid).val(DisVal);
$('#AfterDisVal' + userid).val(AfterDisVal);
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
cellval[2].innerHTML = shorten;
//alert(materialName);
cellval[4].innerHTML = parseFloat(quantity).toFixed(2);
cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = parseFloat(quantity).toFixed(2);
//alert(quantity);
cellval[5].innerHTML = uom;
cellval[6].innerHTML = uom;
//alert(uom);
cellval[6].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
//alert(itemRate);
cellval[7].innerHTML = parseFloat(basicval).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
//alert(basicval);
cellval[8].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
//alert(TotalTaxValue);
cellval[9].innerHTML = parseFloat(totalservicevalue).toFixed(2);
cellval[10].innerHTML = parseFloat(totalservicevalue).toFixed(2);
//alert(basicval);

View File

@ -343,7 +343,12 @@ if (!empty($getlogpodtl)) {
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
});
tinymce.init({
selector: "textarea#ItemDescription",
@ -926,7 +931,7 @@ $(document).ready(function () {
<!-- </div> -->
<div class="form-group col-md-12" align=" right">
<?php if ($POStatus == PO_DRAFT || $POStatus == PO_CREATED) { ?>
<a data-toggle="modal"><button type="submit" onclick="myFunction();" class="btn btn-success"
<a data-toggle="modal" class="auditor-restricted-btn"><button type="submit" onclick="myFunction();" class="btn btn-success"
id="abcd">Select Line Item</button> </a>
<?php } ?>
</div>
@ -943,6 +948,7 @@ $(document).ready(function () {
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -976,6 +982,7 @@ $(document).ready(function () {
<td><?php echo $record->MaterialCode ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td>
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
@ -1269,7 +1276,7 @@ $(document).ready(function () {
data-userid="<?php echo $index; ?>" data-toggle="modal" href="#EDITCAPITAL"><i
class="ri-pencil-fill" data-toggle="tooltip"></i>&nbsp;&nbsp;&nbsp;</a> <a href='#'
onclick="DeleteRow(<?php echo $index; ?>)" class="link" data-id="<?php echo $index; ?>"
data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill auditor-restricted-btn"></span></a>
<?php
} else { ?>
<td>
@ -1587,10 +1594,11 @@ $(document).ready(function () {
<!-- S p e c i a l I n s t r u c t i o n s r o w -->
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
<label>Special Instructions </label>
<textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="10" cols="40">
<?php echo $ServiceDescription ? html_entity_decode($ServiceDescription) : "" ; ?>
<!-- strip_tags($ServiceDescription) -->
</textarea>
</div>
</div><!-- S p e c i a l I n s t r u c t i o n s r o w 1539-->
@ -1608,7 +1616,7 @@ $(document).ready(function () {
<label for="deletePreviousPurchaseOrderFile"><a title="Previous Upload PO File"
href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>Previous Upload - </span><small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
<button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
</div>
@ -1658,17 +1666,17 @@ $(document).ready(function () {
<div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == PO_CREATED) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == SPECIAL_PO) { ?>
<a class="btn btn-success" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<?php } else { ?>
<a class="btn btn-success" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<?php } ?>
@ -2448,7 +2456,7 @@ $(document).ready(function () {
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:20px;">Cancel</a>
<a class="btn btn-success font AddCapital" ID="AddCapital"> &nbsp;&nbsp;<span class="bold">Add
<a class="btn btn-success font AddCapital auditor-restricted-btn" ID="AddCapital"> &nbsp;&nbsp;<span class="bold">Add
Capital</span></a>
</div>
</form>
@ -3096,7 +3104,7 @@ $(document).ready(function () {
</div><!-- /.body -->
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right: 10px;">Cancel</a>
<a class="btn btn-success font EditCapital" ID="UpdateCapital">&nbsp;&nbsp;<span class="bold">Update
<a class="btn btn-success font auditor-restricted-btn EditCapital" ID="UpdateCapital">&nbsp;&nbsp;<span class="bold">Update
Capital</span></a>
</div><!-- /.footer -->
</form>
@ -4061,8 +4069,8 @@ $(document).ready(function () {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -4802,6 +4810,14 @@ $(document).ready(function () {
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
var materialName = $("#CapitalItemName").val();
var uom = $("#CPUOM").val();
var addPer = '';
@ -4942,8 +4958,9 @@ $(document).ready(function () {
<td align="left">${temp}</td>
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
<td align="left">${shorten}</td>
<td align="center">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
@ -5466,9 +5483,8 @@ $(document).ready(function () {
if (value.MaterialCode == materialCode) {
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
var HSNCODE = value.HSNCODE ? value.HSNCODE+"-" : "";
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
}
@ -5835,7 +5851,7 @@ $(document).ready(function () {
$('#EditCustomDutyExpenses').val($('#CustomDutyExpenses' + userid).val());
//$('#txtEditInsurance').val($('#RMCIncludingCustomers'+userid).val());
$('#EdittxtTotalOrderValue').val(cellval[10].innerHTML);
$('#EdittxtTotalOrderValue').val(cellval[11].innerHTML);
@ -5887,13 +5903,25 @@ $(document).ready(function () {
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").empty();
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
// $("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
// $("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSN = (obj.HSNCODE) ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(HSN + obj.MaterialName + " ( "+obj.MaterialCode+" ) "));
}
});
@ -5942,7 +5970,7 @@ $(document).ready(function () {
$('#ViewAfterSgst').val($('#AfterSgst' + userid).val());
$('#ViewAfterIgst').val($('#AfterIgst' + userid).val());
$('#ViewOtherAllowances').val($('#OtherAmt' + userid).val());
$('#ViewTotalAmountlocal').val(cellval[10].innerHTML);
$('#ViewTotalAmountlocal').val(cellval[11].innerHTML);
$('#drpFreightviewloc').val($("#Ftype" + userid).val());
@ -6555,12 +6583,12 @@ $(document).ready(function () {
var itemRate = parseFloat(convertRate).toFixed(2);
var basicval = $("#EditCPTotalAmount").val();
var Cgst = $("#EditCgst").val();
var AfterCgst = $("#EditAfterCgst").val();
var AfterCgst = $("#EditAfterCgst").val() == '' ? 0 : $("#EditAfterCgst").val();
var Sgst = $("#EditSgst").val();
var AfterSgst = $("#EditAfterSgst").val();
var AfterSgst = $("#EditAfterSgst").val() == '' ? 0 : $("#EditAfterSgst").val();
var Igst = $("#EditIgst").val(); //Dom Caps
var AfterIgst = $("#EditAfterIgst").val(); //Dom Caps
var OtherAmt = parseFloat($("#EditOtherAllowances").val() == '' ? "0.00" : $('#EditOtherAllowances').val()).toFixed(2);
var AfterIgst = $("#EditAfterIgst").val() == '' ? 0 :$("#EditAfterIgst").val(); //Dom Caps
var OtherAmt = parseFloat($("#EditOtherAllowances").val() == '' ? 0 : $('#EditOtherAllowances').val()).toFixed(2);
var TotalTaxValue = EditcalculateTaxValue();
@ -6601,7 +6629,7 @@ $(document).ready(function () {
var NoOfTrip = $("#EditNOOfTrips").val();
var DisType = $("#EditDiscountType").val();
var DisVal = $("#txtEditDiscount").val();
var AfterDisVal = $("#txtEditAfterDiscount").val();
var AfterDisVal = $("#txtEditAfterDiscount").val() == '' ? 0 : $("#txtEditAfterDiscount").val();
@ -6618,13 +6646,10 @@ $(document).ready(function () {
var FreightTypeloc = $('#drpFreighteditloc').val();
var FreightRateloc = $('#txtFreightlocedit').val();
var FreightRateAmountloc = $('#txtAfterFreightlocedit').val();
var FreightRateAmountloc = $('#txtAfterFreightlocedit').val() == '' ? 0 : $('#txtAfterFreightlocedit').val();
var Nooftriploc = $('#NOOfTripslocedit').val();
var Total = (parseFloat(basicval) + parseFloat(AfterCgst) + parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(OtherAmt) - parseFloat(AfterDisVal) + parseFloat(FreightRateAmountloc)).toFixed(2);
if (capital == 0) {
@ -6715,19 +6740,24 @@ $(document).ready(function () {
$('#DutyImpact' + userid).val(DutyImpact);
$('#NetValue' + userid).val(Nett);
$('#ClearingCharge' + userid).val(ClearingCharges);
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
cellval[2].innerHTML = materialCode;
cellval[3].innerHTML = shorten;
cellval[5].innerHTML = quantity;
cellval[6].innerHTML = uom;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2); // what should i display here ?? if international means
cellval[10].innerHTML = parseFloat(Total).toFixed(2);
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = quantity;
cellval[7].innerHTML = uom;
cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2); // what should i display here ?? if international means
cellval[11].innerHTML = parseFloat(Total).toFixed(2);

View File

@ -1307,7 +1307,7 @@ if (!empty($EmpDetails)) {
</li>
<li class="next list-inline-item float-right">
<button type="submit"
class="btn btn-primary submit float-right">Submit</button>
class="btn btn-primary submit float-right auditor-restricted-btn">Submit</button>
</li>
</ul>
</div>

View File

@ -302,11 +302,23 @@ if (!empty($RequistionDetails)) {
<script src="<?php echo base_url() ?>public/assets/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script>
<script type="text/javascript">
// tinymce.init({
// selector: "textarea#txtSpcialInstruction",
// menubar: false,
// statusbar: false,
// toolbar: false
// });
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
});
@ -1258,7 +1270,7 @@ if (!empty($RequistionDetails)) {
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:15px">Cancel</a>
<a class="btn btn-success font EditImport" ID="EditImport"> &nbsp;&nbsp;<span class="bold">Edit Import</span></a>
<a class="btn btn-success font auditor-restricted-btn EditImport" ID="EditImport"> &nbsp;&nbsp;<span class="bold">Edit Import</span></a>
<!--<a class="btn btn-success font AddService" ID="AddService" ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add Service</span></a>-->
</div>
</form>
@ -1279,6 +1291,7 @@ if (!empty($RequistionDetails)) {
<th style="white-space: nowrap !important; text-align:left !important">SNo</th>
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
@ -1304,6 +1317,7 @@ if (!empty($RequistionDetails)) {
<td style="text-align:center !important"><?php echo $record->ReqNo ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;">
<a href="#"
class="editable-field"
@ -1587,10 +1601,13 @@ if (!empty($RequistionDetails)) {
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label>
<?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
<!-- <?php
// $data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', html_entity_decode($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
// echo form_textarea($data);
?> -->
<textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="10" cols="40">
<?php echo html_entity_decode($ServiceDescription); ?>
</textarea>
</div>
</div>
@ -1608,7 +1625,7 @@ if (!empty($RequistionDetails)) {
<span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<!-- <button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i> </button> -->
<!-- <button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i> </button> -->
</div>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br>
@ -1663,9 +1680,9 @@ if (!empty($RequistionDetails)) {
</div>
<div class="col-md-7 text-right">
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<br />
</div>
</div>
@ -1998,8 +2015,8 @@ if (!empty($RequistionDetails)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -2678,10 +2695,19 @@ if (!empty($RequistionDetails)) {
$('#EditTotalOrderValue').val(cellval[6].innerHTML);
$('#EditTotalOrderValue').val(cellval[7].innerHTML);
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[3].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
@ -2724,6 +2750,13 @@ if (!empty($RequistionDetails)) {
var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").val();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var edititemname = $("#EditItemName").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
@ -2799,11 +2832,11 @@ if (!empty($RequistionDetails)) {
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[4].innerHTML = editQuantity;
cellval[5].innerHTML = editUOM;
cellval[6].innerHTML = itemRate;
cellval[7].innerHTML = BasicValue;
cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname);

View File

@ -92,8 +92,8 @@ if (!empty($EmpList)) {
</div>
<div class="form-group text-right mt-3">
<input type="hidden" name="txtEmpid" id="txtEmpid" value="<?php echo $EmpId ?>">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white;margin-right: 15px;" value="Reset">
<input type="submit" class="btn btn-success" value="Submit">
<input type="reset" id="reset" class="btn btn-reset auditor-restricted-btn" style="background-color: red;color: white;margin-right: 15px;" value="Reset">
<input type="submit" class="btn btn-success auditor-restricted-btn" value="Submit">
</div>
</form>
@ -133,7 +133,7 @@ if (!empty($EmpList)) {
</div>
<!-- Change Password Form -->
<div class="row">
<div class="row auditor-restricted-btn">
<div class="col-12">
<div class="card">
<div class="card-body">
@ -285,4 +285,32 @@ if (!empty($EmpList)) {
alert("Before remove please select any position.");
}
});
$('#MailID').change(function() {
var mailID = $(this).val();
var empID = ''// $('#EmpList').val();
if (mailID) {
$('#loader').show();
$.ajax({
url: "<?php echo base_url() ?>isEmailExists",
type: 'POST',
data: { EmpID:empID,MailID:mailID },
success: function(data) {
if (data.success) {
$('#loader').hide();
alert(data.message);
$("#MailID").val('');
} else {
$('#loader').hide();
}
},
error: function() {
$('#loader').hide();
alert('An Error Occur in this email address');
$("#MailID").val('');
}
});
}else{
alert("Invalid email address");
}
});
</script>>

View File

@ -272,7 +272,7 @@ if (!empty($assetList)) {
<div class="form-row mt-4 text-right">
<div class="col-md-12">
<a href="<?php echo base_url() ?>assetListing" class="btn btn-secondary">Cancel</a>
<button type="button" id="editAssetBtnId" class="btn btn-success">Submit</button>
<button type="button" id="editAssetBtnId" class="btn btn-success auditor-restricted-btn">Submit</button>
</div>
</div>
</form>

View File

@ -113,7 +113,7 @@ if ($total <= $reorder) {
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Material - <?php echo $MaterialCode; ?> Details</h4>
<button type="button" class="btn btn-secondary" onclick="window.location.href='<?= base_url() ?>rawmaterialListing'">
<button type="button" class="btn btn-secondary" onclick="window.location.href='<?= base_url() ?>rawmaterialListing?materialListPage=<?= $materialListPage ?>'">
<span class="bold">Cancel</span>
</button>
</div>
@ -361,10 +361,12 @@ if ($total <= $reorder) {
</div>
</div>
<div class="box-footer text-right">
<button type="button" class="btn btn-secondary" onclick="window.location.href='<?= base_url() ?>rawmaterialListing'">
<button type="button" class="btn btn-secondary" onclick="window.location.href='<?= base_url() ?>rawmaterialListing?materialListPage=<?= $materialListPage ?>'">
<span class="bold">Cancel</span>
</button>
<input type="button" id="editRawMaterialBtnId" class="btn btn-success" value="Submit" />
<input type="button" id="editRawMaterialBtnId" class="btn btn-success auditor-restricted-btn" value="Submit" />
<input type="hidden" id="materialListPage" name="materialListPage" value="<?php echo $materialListPage; ?>" />
</div>
</form>
</div><!-- /.card-body -->

View File

@ -234,6 +234,11 @@ if (!empty($INRSYMBOL)) {
menubar: false,
statusbar: false,
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
//plugins: "link image"
});
tinymce.init({
@ -1316,6 +1321,7 @@ if (!empty($INRSYMBOL)) {
<th style="white-space: nowrap !important;">SNo</th>
<th class="text-center" style="white-space: nowrap !important;">Requisition No</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th class="text-center" style="white-space: nowrap !important;">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th class="text-right" style="white-space: nowrap !important;">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -1341,6 +1347,7 @@ if (!empty($INRSYMBOL)) {
<td class="text-center"><?php echo $record->ReqNo ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;">
<a href="#"
class="editable-field"
@ -1652,10 +1659,10 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'id' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'rows' => '8', 'class' => 'form-control');
echo form_textarea($data);
?>
<label>Special Instructions </label>
<textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="8" cols="40">
<?php echo $ServiceDescription ? html_entity_decode($ServiceDescription) : '' ; ?>
</textarea>
<input type="hidden" name="SpcialInstruction" id="SpcialInstruction" value=" ">
</div>
</div>
@ -1679,7 +1686,7 @@ if (!empty($INRSYMBOL)) {
<span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
<button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
</div>
@ -1733,9 +1740,9 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="col-md-7 text-right">
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
</div>
</div>
@ -2163,7 +2170,7 @@ if (!empty($INRSYMBOL)) {
</div>
<div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel" style="margin:10px;">Cancel</a>
<a class="btn btn-success EditRevenue" ID="EditRevenue">&nbsp;&nbsp;<span class="bold">Edit
<a class="btn btn-success EditRevenue auditor-restricted-btn" ID="EditRevenue">&nbsp;&nbsp;<span class="bold">Edit
Revenue</span></a>
</div>
</form>
@ -2344,16 +2351,16 @@ if (!empty($INRSYMBOL)) {
$(document).ready(function () {
var tempUserId = 0;
var index = '1';
var userid = '';
var userid = '';
$("#EDITREVENUE").on("shown.bs.modal", function (e) {
var AvlBudAmt = '<?php echo $AvlAmount ?>';
AvlBudAmt = '<?php echo number_format($AvlAmount + $totBasicAmt - $totDiscountAmt, 2, '.', '') ?>';
userid = $(e.relatedTarget).data('userid');
$('#isEdit').val(1);
$('#isEdit').val(1);
if (tempUserId == 0) {
var tr = document.getElementById(userid);
var cellval = tr.cells;
var id = $('#Reqnumber' + userid).val();
@ -2364,6 +2371,7 @@ if (!empty($INRSYMBOL)) {
$('#EditAvlBudAmt').val(AvlBudAmt);
$('#EditMaterialCode').val($('#materialCode' + userid).val());
$('#EditItemName').val($('#materialName' + userid).val());
$('#EditUOM').val($('#uom' + userid).val());
$('#EditQuantity').val($('#quantity' + userid).val());
@ -2372,7 +2380,7 @@ if (!empty($INRSYMBOL)) {
var EdititemRate = parseFloat($('#itemRate' + userid).val()).toFixed(2);
$('#EditRate').val(EdititemRate);
$('#txtEditBasicValue').val(parseFloat(cellval[7].innerHTML).toFixed(2));
$('#txtEditBasicValue').val(parseFloat(cellval[8].innerHTML).toFixed(2));
RequistQuantity = $('#quantity' + userid).val();
$('#txtEditDiscount').val($('#DisVal' + userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal' + userid).val());
@ -2400,7 +2408,16 @@ if (!empty($INRSYMBOL)) {
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[3].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) {
@ -2416,7 +2433,8 @@ if (!empty($INRSYMBOL)) {
}
});
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
});
@ -2428,7 +2446,7 @@ if (!empty($INRSYMBOL)) {
$("input:radio[name='optExcise'][value='" + $('#ExciseOption' + userid).val() + "']").prop('checked', 'checked');
$("input:radio[name='optVat'][value='" + $('#VatOption' + userid).val() + "']").prop('checked', 'checked');
$("input:radio[name='optCST'][value='" + $('#CSTOption' + userid).val() + "']").prop('checked', 'checked');
}
if (userid) {
tempUserId = userid;
@ -2487,18 +2505,23 @@ if (!empty($INRSYMBOL)) {
var TotalOrderValue = $("#txtEditTotalOrderValue").val();
var Service_Description = $("#Edit_Service_Description").val();
var TotalTaxValue = calculateEditTaxValue();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = document.getElementById(userid);
var cellval = tr.cells;
var shorten = editDescription.length > 13 ? editDescription.slice(0, 13) + "..." : editDescription;
cellval[2].innerHTML = shorten;
cellval[4].innerHTML = parseFloat(editQuantity).toFixed(2);
cellval[5].innerHTML = editUOM;
cellval[6].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[7].innerHTML = parseFloat(basicval).toFixed(2);
cellval[8].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
cellval[3].innerHTML = editHSN;
cellval[5].innerHTML = parseFloat(editQuantity).toFixed(2);
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(editDescription);
@ -2865,7 +2888,7 @@ if (!empty($INRSYMBOL)) {
<script>
$(document).ready(function () {
var openOrder = <?php echo $IsOpenOrder; ?>;
var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0 ; ?>;
if(openOrder){
$('#EditQuantity').removeAttr('required');
$('#EditQuantity').attr('readonly', true);

View File

@ -331,7 +331,12 @@ if (!empty($getlogpodtl)) {
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
});
tinymce.init({
@ -379,7 +384,7 @@ if (!empty($getlogpodtl)) {
var InsuranceNumber = '<?php echo $insurenceno; ?>';
var statuscheck = '<?php echo $PONOStatus; ?>';
$(document).ready(function () {
var openOrder = <?php echo $IsOpenOrder; ?>;
var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0 ; ?>;
if(openOrder){
$('#Quantity').val(0);
$('#Quantity').removeAttr('required');
@ -2359,7 +2364,7 @@ if (!empty($getlogpodtl)) {
<?php } ?>
<?php if(!$isChecked){ ?>
<a data-toggle="modal"><button type="submit" onclick="myFunction();"
class="btn btn-success" id="abcd">Select Line Item</button> </a>
class="btn btn-success auditor-restricted-btn" id="abcd">Select Line Item</button> </a>
<?php } ?>
<?php } ?>
</div>
@ -2375,6 +2380,7 @@ if (!empty($getlogpodtl)) {
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Code</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
@ -2409,6 +2415,7 @@ if (!empty($getlogpodtl)) {
<td align="left"><?php echo $record->MaterialCode ?></td>
<td align="left"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td align="left">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
@ -2573,7 +2580,7 @@ if (!empty($getlogpodtl)) {
data-userid="<?php echo $index; ?>" data-toggle="modal"
href="#EDITREVENUE"><i class="ri-pencil-fill"></i></a>
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" class="link"
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" class="link auditor-restricted-btn"
data-id="<?php echo $index; ?>"
data-userid="<?php echo $index; ?>" id="Del"><span
class="ri-delete-bin-7-fill"></span></a>
@ -2710,10 +2717,10 @@ if (!empty($getlogpodtl)) {
<div class="form-row">
<div class="form-group col-md-12">
<label>Special Instructions </label> <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control');
echo form_textarea($data);
?>
<label>Special Instructions </label>
<textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="8" cols="40">
<?php echo $ServiceDescription ? html_entity_decode($ServiceDescription) : '' ; ?>
</textarea>
<input type="hidden" name="SpcialInstruction" id="SpcialInstruction" value="">
</div>
</div>
@ -2945,7 +2952,7 @@ if (!empty($getlogpodtl)) {
<span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
<button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
</div>
<?php } ?>
@ -3000,21 +3007,21 @@ if (!empty($getlogpodtl)) {
<div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == PO_CREATED) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == SPECIAL_PO) { ?>
<a class="btn btn-success" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<a class="btn btn-success" ID="Viewsave" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-success auditor-restricted-btn" ID="Viewsave" onclick="Save(2)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<?php } else if($PONOStatus == REQITEM_Emergency_PO_CREATED) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger Save auditor-restricted-btn" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit auditor-restricted-btn" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit auditor-restricted-btn" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else { ?>
<a class="btn btn-success" ID="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<?php } ?>
@ -3379,7 +3386,7 @@ if (!empty($getlogpodtl)) {
<div class="modal-footer">
<a class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn btn-info waves-effect waves-light font AddRevenue" ID="AddRevenue">&nbsp;&nbsp;<span
<a class="btn btn-info waves-effect waves-light font AddRevenue auditor-restricted-btn" ID="AddRevenue">&nbsp;&nbsp;<span
class="bold">Add Revenue</span></a>
</div>
</form>
@ -3747,7 +3754,7 @@ if (!empty($getlogpodtl)) {
<div class="modal-footer">
<a class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</a>&nbsp;&nbsp;&nbsp;&nbsp;
<a class="btn btn-info waves-effect waves-light EditRevenue" ID="EditRevenue">&nbsp;&nbsp;<span
<a class="btn btn-info waves-effect waves-light EditRevenue auditor-restricted-btn" ID="EditRevenue">&nbsp;&nbsp;<span
class="bold">Edit Revenue</span></a>
</div>
</form>
@ -4465,6 +4472,13 @@ if (!empty($getlogpodtl)) {
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
var quantity = parseFloat($("#Quantity").val()).toFixed(2);
@ -4545,8 +4559,10 @@ if (!empty($getlogpodtl)) {
<td align="left">${temp}</td>
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
<td align="left">${shorten}</td>
<td align="left">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td align="left"><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
@ -4568,7 +4584,7 @@ if (!empty($getlogpodtl)) {
<i class="ri-pencil-fill"></i>
</a>
<a href='#' onclick="DeleteRow('${temp}')" class="link" data-id="${temp}" data-userid="${temp}" id="Del">
<a href='#' onclick="DeleteRow('${temp}')" class="link auditor-restricted-btn" data-id="${temp}" data-userid="${temp}" id="Del">
<span class="ri-delete-bin-7-fill"></span>
</a>
</td>
@ -4669,21 +4685,24 @@ if (!empty($getlogpodtl)) {
var TotalOrderValue = $("#txtEditTotalOrderValue").val();
var Service_Description = $("#Edit_Service_Description").val();
var TotalTaxValue = calculateEditTaxValue();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = document.getElementById(userid);
var cellval = tr.cells;
var shorten = editDescription.length > 13 ? editDescription.slice(0, 13) + "..." : editDescription;
cellval[2].innerHTML = shorten;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = basicval;
cellval[9].innerHTML = TotalTaxValue;
cellval[10].innerHTML = TotalOrderValue;
cellval[3].innerHTML = shorten;
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = basicval;
cellval[10].innerHTML = TotalTaxValue;
cellval[11].innerHTML = TotalOrderValue;
$('#materialCode' + userid).val(editMaterialCode);
@ -4756,7 +4775,7 @@ if (!empty($getlogpodtl)) {
var cellval = tr.cells;
cellval[9].innerHTML = TotalOrderValue;
cellval[10].innerHTML = TotalOrderValue;
@ -5371,8 +5390,8 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -5514,7 +5533,7 @@ if (!empty($getlogpodtl)) {
} else {
$('#EditPer').val($('#per' + userid).val());
}
$('#txtEditBasicValue').val(parseFloat(cellval[8].innerHTML).toFixed(2));
$('#txtEditBasicValue').val(parseFloat(cellval[9].innerHTML).toFixed(2));
RequistQuantity = $('#quantity' + userid).val();
$('#txtEditDiscount').val($('#DisVal' + userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal' + userid).val());
@ -5548,7 +5567,16 @@ if (!empty($getlogpodtl)) {
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) {
@ -5573,8 +5601,8 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -5616,7 +5644,7 @@ if (!empty($getlogpodtl)) {
$('#ViewQuantity').val($('#quantity' + userid).val());
$('#ViewRate').val($('#itemRate' + userid).val());
$('#ViewPer').val($('#per' + userid).val());
$('#txtViewBasicValue').val(parseFloat(cellval[8].innerHTML).toFixed(2));
$('#txtViewBasicValue').val(parseFloat(cellval[9].innerHTML).toFixed(2));
RequistQuantity = $('#quantity' + userid).val();
$('#txtViewDiscount').val($('#DisVal' + userid).val());
$('#txtViewAfterDiscount').val($('#AfterDisVal' + userid).val());

View File

@ -217,6 +217,11 @@ foreach ($PaymentTerms as $TER) {
menubar: false,
statusbar: false,
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
// plugins: "link image"
});
tinymce.init({
@ -390,7 +395,9 @@ foreach ($PaymentTerms as $TER) {
if (obj.materialCode == materialCode) {
$("#MaterialCode").val('');
} else {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
@ -441,8 +448,8 @@ foreach ($PaymentTerms as $TER) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -1117,6 +1124,7 @@ foreach ($PaymentTerms as $TER) {
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">HSN/SAC</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -1157,6 +1165,7 @@ foreach ($PaymentTerms as $TER) {
<td><?php echo $record->MaterialCode ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td><?php echo $record->HSNCODE; ?></td>
<td style="text-align:left !important;">
<a href="#"
class="editable-field"
@ -1374,7 +1383,7 @@ foreach ($PaymentTerms as $TER) {
<textarea name="ScopeofWork" id="ScopeofWork" class="form-control" rows="8" cols="40">
<?php
$ServiceDescription = html_entity_decode($ServiceDescription);
$ServiceDescription = strip_tags($ServiceDescription);
// $ServiceDescription = strip_tags($ServiceDescription);
echo set_value('ScopeofWork', $ServiceDescription); ?>
</textarea>
@ -1400,7 +1409,7 @@ foreach ($PaymentTerms as $TER) {
<span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
<button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
</div>
<?php }} ?>
@ -1447,9 +1456,9 @@ foreach ($PaymentTerms as $TER) {
</div>
<div class="col-md-7 text-right">
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
</div>
</div>
@ -1779,7 +1788,7 @@ foreach ($PaymentTerms as $TER) {
<div class="modal-footer" align="right">
<div class="form-group col-md-12">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:10px;">Cancel</a>
<a class="btn btn-success font EditService" ID="Edit">&nbsp;&nbsp;<span class="bold">Update Service</span></a>
<a class="btn btn-success font EditService auditor-restricted-btn" ID="Edit">&nbsp;&nbsp;<span class="bold">Update Service</span></a>
</div>
</div>
</div>
@ -1880,7 +1889,7 @@ foreach ($PaymentTerms as $TER) {
$('#EditotherDescription').hide();
$(document).ready(function() {
var openOrder = <?php echo $IsOpenOrder; ?>;
var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0 ; ?>;
if(openOrder){
$('#EditQuantity').removeAttr('required');
$('#EditQuantity').attr('readonly', true);
@ -1910,7 +1919,7 @@ foreach ($PaymentTerms as $TER) {
RateValue = $('#itemRate' + userid).val();
RateValue = parseFloat(RateValue).toFixed(2);
$('#EditRate').val(RateValue);
$('#txtEditBasicValue').val(cellval[8].innerHTML);
$('#txtEditBasicValue').val(cellval[9].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val());
$('#EditIgst').val($('#Igst' + userid).val());
@ -1937,7 +1946,7 @@ foreach ($PaymentTerms as $TER) {
$("#EditFrequencyNo").val($('#FrequencyValue' + userid).val());
}
$('#EditTotalOrderValue').val(cellval[9].innerHTML);
$('#EditTotalOrderValue').val(cellval[11].innerHTML);
RequistQuantity = $('#quantity' + userid).val();
@ -1947,7 +1956,16 @@ foreach ($PaymentTerms as $TER) {
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
@ -1974,7 +1992,9 @@ foreach ($PaymentTerms as $TER) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
// $("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -2026,19 +2046,24 @@ foreach ($PaymentTerms as $TER) {
var TotalTaxValue = calculateEditTaxValue();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[11].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode);

View File

@ -498,7 +498,7 @@ if (!empty($supplier)) {
<button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span>
</button>
<button type="button" id="updateSupplierBtnId" class="btn btn-info pull-right">Submit</button>
<button type="button" id="updateSupplierBtnId" class="btn btn-info pull-right auditor-restricted-btn">Submit</button>
</div>
</div>
</div>

View File

@ -24,6 +24,8 @@ if (!empty($master)) {
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
@ -33,7 +35,7 @@ if (!empty($master)) {
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Config <?= ' - ' . $ConfigName; ?> Details</h4>
<a class="btn btn-secondary" href="<?php echo base_url(); ?>configlisting"><span
<a class="btn btn-secondary" href="<?php echo base_url(); ?>configlisting?page=<?=$page?>"><span
class="bold">Back</span></a>
</div>
</div>
@ -66,7 +68,7 @@ if (!empty($master)) {
<div class="card-body">
<?php
$attributes = array('class' => 'form-horizontal', 'id' => 'editConfig');
echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes); ?>
echo form_open(base_url() . "configurationctrl/updateconfig?page=$page", $attributes); ?>
<div class="form-row" style="margin-top:10px">
<div class="col-md-2">
@ -97,7 +99,7 @@ if (!empty($master)) {
</div>
<div class="col-md-3 mt-3">
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;"
class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;
class="btn btn-success auditor-restricted-btn"><i class="fa fa-plus"></i>&nbsp;&nbsp;
Configuration Value</a>
</div>
<?php echo form_close(); ?>
@ -119,6 +121,8 @@ if (!empty($master)) {
<div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12">
@ -129,6 +133,8 @@ if (!empty($master)) {
<tr>
<th>S.NO</th>
<th>Configuration Value</th>
<th>Created By</th>
<th>Last Updated By</th>
<th>Action</th>
</tr>
</thead>
@ -148,21 +154,31 @@ if (!empty($master)) {
<tr>
<td>
<?php echo $index; ?></td>
<?php if($con->Config_ID === 'C023'){ ?>
<td>
<a
class="config-category"
data-value="<?php echo $con->ConfigValue;?>"
data-key="<?php echo $con->Key; ?>"
style="cursor: pointer;">
<?php echo $index; ?>
</td>
<?php if($con->Config_ID === 'C023'){ ?>
<td>
<a
class="config-category"
data-value="<?php echo $con->ConfigValue;?>"
data-key="<?php echo $con->Key; ?>"
style="cursor: pointer;">
<?php echo $con->ConfigValue ?>
</a>
</td>
<?php }else{ ?>
<td><?php echo $con->ConfigValue; ?></td>
<?php } ?>
<td>
<?php echo $con->created_by ?>
</td>
<td>
<?php echo $con->updated_by ?>
</td>
<?php echo $con->ConfigValue ?>
</a>
</td>
<?php }else{ ?>
<td><?php echo $con->ConfigValue; ?></td>
<?php } ?>
<td>
<?php if ($con->isActive == 0) { ?>
@ -195,6 +211,7 @@ if (!empty($master)) {
&nbsp;&nbsp; &nbsp;&nbsp;
<!-- delete section -->
<a onclick="confirmDeleteConfig(event)"
class="auditor-restricted-btn"
data-key="<?php echo $con->Key; ?>"
data-code="<?php echo $con->Config_ID; ?>"
href="<?php echo base_url() . 'activeInactiveConfigValue
@ -225,8 +242,10 @@ if (!empty($master)) {
<div class="form-row text-right" style="margin-top:10px; text-align:right">
<div class="col-md-12 text-right">
<a href="<?php echo base_url() ?>configlisting" class="btn btn-secondary">Cancel</a>
<input type="button" id="updateConfigBtnId" class="btn btn-success" value="Update" />
<a href="<?php echo base_url() ?>configlisting?page=<?=$page?>" class="btn btn-secondary" >
Cancel
</a>
<input type="button" id="updateConfigBtnId" class="btn btn-success auditor-restricted-btn" value="Update" />
</div>
</div>
</div>
@ -343,7 +362,7 @@ if (!empty($master)) {
data-dismiss="modal">Cancel</a>
<button
type="button"
class=" btn btn-success font " id="tempClickUpdate"><i
class=" btn btn-success font auditor-restricted-btn" id="tempClickUpdate"><i
class="fas fa-edit"></i>&nbsp;&nbsp;Update
</button>
</div>
@ -354,16 +373,16 @@ if (!empty($master)) {
<!-- Material listing Modal -->
<div class="modal fade" id="scrollable-modal" tabindex="-1" role="dialog" aria-labelledby="scrollableModalTitle" aria-hidden="true" style="max-width: 100%;">
<div class="modal-dialog modal-dialog-scrollable" role="document" style="max-width: 50%;">
<div class="modal-content">
<!-- <div class="modal-dialog modal-dialog-scrollable" role="document" style="max-width: 50%;"> -->
<div class="modal-dialog" role="document" style="max-width: 50%;">
<div class="modal-content" style="width:1060px;">
<div class="modal-header">
<h5 class="modal-title" id="scrollableModalTitle"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<!-- Table will be dynamically inserted here -->
<div class="modal-body" style="max-height: 500px; overflow-y: auto;">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
@ -453,7 +472,9 @@ if (!empty($master)) {
url: "<?php echo base_url('configurationctrl/saveConfigValue'); ?>",
data: {
ConfigID: $('#ConfigId').val(),
ConfigValue: $("#AddConfigValue").val()
ConfigValue: $("#AddConfigValue").val(),
userId : "<?= $_SESSION['userId']?>",
},
method: 'POST',
success: function(response) {
@ -513,7 +534,8 @@ if (!empty($master)) {
data: {
key : $('#key').val(),
ConfigID: $('#Config_ID').val(),
ConfigValue: $("#configValue").val()
ConfigValue: $("#configValue").val(),
userId : "<?= $_SESSION['userId']?>"
},
method: 'POST',
success: function(response) {
@ -566,14 +588,14 @@ if (!empty($master)) {
if (response.length > 0) {
let tableHtml = `
<table class="table table-bordered">
<table class="table table-bordered" style="table-layout: auto; width: 100%;">
<thead style="background-color: #539754; color: white; font-size: 12px;">
<tr>
<th style="text-align: center;" >Material Code</th>
<th style="text-align: center;" >Material Name</th>
<th style="text-align: center;" >Material Type</th>
<th style="text-align: center;" >Material Status</th>
<th style="text-align: center;">Material Code</th>
<th style="text-align: center;">Material Name</th>
<th style="text-align: center;">Material Type</th>
<th style="text-align: center;">Material Status</th>
</tr>
</thead>
<tbody>
@ -588,16 +610,21 @@ if (!empty($master)) {
data-materialCode="${item.MaterialCode}"
data-materialType="${item.MaterialType}"
data-uom="${item.UOM}"
style="cursor: pointer; color: #4d3a6d;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">
style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:10%;
text-align:center;">
<u>${item.MaterialCode}</u>
</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis; word-wrap: break-word !important;
white-space: normal !important; width: 100px !important; ">${item.MaterialName}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.MaterialType}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">${item.IsActive?"Active":"InActive"}</td>
white-space: normal !important; width: 100px !important; width:70%;
text-align:left;">${item.MaterialName}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:10%;
text-align:center;">${item.MaterialType}</td>
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:10%;
text-align:center;">${item.IsActive == 1 ?"Active":"InActive"}</td>
</tr>
`;
// <td>${item.HSNCODE}</td>
});
tableHtml += `

View File

@ -379,11 +379,18 @@ if (!empty($getlogpodtl)) {
$("#PaymentTerms").select2();
tinymce.init({
selector: "textarea#txtSpcialInstruction",
menubar: false,
statusbar: false,
toolbar: false
toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
});
@ -836,7 +843,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="col-md-4">
<?php if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == PO_APPROVED) { ?>
<a data-toggle="modal" data-target="#importpomodel" class="btn btn-success" data-dismiss="modal" onclick="myFunction();">Add Line Item </a>
<a data-toggle="modal" data-target="#importpomodel" class="btn btn-success auditor-restricted-btn" data-dismiss="modal" onclick="myFunction();">Add Line Item </a>
<?php } ?>
</div>
@ -853,6 +860,7 @@ if (!empty($getlogpodtl)) {
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Code</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important; text-align:left !important">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</th>
@ -882,6 +890,7 @@ if (!empty($getlogpodtl)) {
<td align="left"><?php echo $record->MaterialCode ?></td>
<td align="left"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td>
<td align="center"><?php echo $record->HSNCODE ?></td>
<td align="left">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#"
@ -1035,7 +1044,7 @@ if (!empty($getlogpodtl)) {
if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED || $PONOStatus == PO_APPROVED) { ?>
<td> <a data-target='#editimportpomodel' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#editimportpomodel"><i class="ri-pencil-fill" data-toggle="tooltip"></i>&nbsp;&nbsp;&nbsp;</a>
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" class="link" data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" class="link auditor-restricted-btn" data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
</td>
<?php
} else { ?>
@ -1311,10 +1320,14 @@ if (!empty($getlogpodtl)) {
<div class="form-row ">
<div class="form-group col-md-12">
<label>Special Instructions </label>
<?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data);
?>
<!-- <?php
// $data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
// echo form_textarea($data);
?> -->
<textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="10" cols="40">
<?php echo html_entity_decode($ServiceDescription); ?>
</textarea>
</div>
</div>
@ -1334,7 +1347,7 @@ if (!empty($getlogpodtl)) {
<span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp;
<button class="btn btn-danger btn-sm " id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
<button class="btn btn-danger btn-sm auditor-restricted-btn" id="deletePreviousPurchaseOrderFile"><i class="mdi mdi-close"></i></button>
</div>
<?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br>
@ -1387,17 +1400,17 @@ if (!empty($getlogpodtl)) {
<div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Save" ID="Save" onclick="Save(0)">&nbsp;&nbsp;<span class="bold">Save as Draft</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == PO_CREATED) { ?>
<a class="btn btn-danger Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<a class="btn btn-danger auditor-restricted-btn Save" ID="Reset" onclick="Reset();">&nbsp;&nbsp;<span class="bold">Reset</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</span></a>
<?php } else if ($PONOStatus == SPECIAL_PO) { ?>
<a class="btn btn-success" ID="OK" onclick="PageRedirect()">OK</a>
<a class="btn btn-success Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<a class="btn btn-success auditor-restricted-btn Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Submit</span></a>
<?php } else { ?>
<a class="btn btn-success" ID="OK" onclick="PageRedirect()">OK</a>
<?php } ?>
@ -2566,7 +2579,7 @@ if (!empty($getlogpodtl)) {
</div>
<div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:10px;">Cancel</a>
<a class="btn btn-success font EditImport" ID="EditImport"> &nbsp;&nbsp;<span class="bold">Edit Import</span></a>
<a class="btn btn-success font EditImport auditor-restricted-btn" ID="EditImport"> &nbsp;&nbsp;<span class="bold">Edit Import</span></a>
</div>
</form>
</div>
@ -3365,8 +3378,9 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
@ -4241,6 +4255,12 @@ if (!empty($getlogpodtl)) {
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
var quantity = $("#Quantity").val();
@ -4325,8 +4345,9 @@ if (!empty($getlogpodtl)) {
<td align="left">${temp}</td>
<td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`;
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") {
<td align="left">${shorten}</td>
<td align="center">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}"
data-notes="-">-</a>
@ -4451,7 +4472,7 @@ if (!empty($getlogpodtl)) {
var tr = document.getElementById(userid);
//alert(tr);
var cellval = tr.cells;
//alert(cellval);
var id = $('#Reqnumber' + userid).val();
//alert(id);
//var a=$('#Reqnumber'+userid).val();
@ -4537,7 +4558,7 @@ if (!empty($getlogpodtl)) {
$('#ViewPer').val($("#Per" + userid).val());
$('#ViewTotalOrderValue').val(cellval[7].innerHTML);
$('#ViewTotalOrderValue').val(cellval[8].innerHTML);
$("#ViewMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#ViewMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
@ -4562,8 +4583,8 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -4808,7 +4829,7 @@ if (!empty($getlogpodtl)) {
var tr = document.getElementById(userid);
//alert(tr);
var cellval = tr.cells;
//alert(cellval);
var id = $('#Reqnumber' + userid).val();
//alert(id);
$('#EditReqNo').val($('#Reqnumber' + userid).val());
@ -4907,10 +4928,19 @@ if (!empty($getlogpodtl)) {
$('#EditTotalOrderValue').val(cellval[7].innerHTML);
$('#EditTotalOrderValue').val(cellval[8].innerHTML);
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
@ -4932,8 +4962,8 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -4944,7 +4974,7 @@ if (!empty($getlogpodtl)) {
});
});
$('.EditImport').click(function() {
// alert('inside edit');
@ -4952,6 +4982,12 @@ if (!empty($getlogpodtl)) {
var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").val();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var edititemname = $("#EditItemName").val();
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
@ -5015,12 +5051,12 @@ if (!empty($getlogpodtl)) {
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = BasicValue;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname);

View File

@ -76,18 +76,18 @@ td {
.th-materialCode{
text-align:center !important;
width:15%;
width:12%;
}
.th-requestedQuantity{
text-align:right !important;
width:15%;
width:11%;
}
.th-PoQuantity{
text-align:right !important;
width:15%;
width:11%;
}
.th-Sno{
@ -106,6 +106,10 @@ td {
}
.hidden-column { display: none; }
.th-HSNCode{
text-align:center !important;
width:10%;
}
</style>
<script type="text/javascript">
window.onload = function() {
@ -204,7 +208,7 @@ td {
<div class="form-row">
<div class="form-group col-md-12">
<?php if (count($MaterialCode) != 0) { ?>
<a data-toggle="modal" data-target="#add-req-modal" class="btn btn-primary waves-effect float-right">Add Line Item</a>
<a data-toggle="modal" data-target="#add-req-modal" class="btn btn-primary waves-effect float-right auditor-restricted-btn">Add Line Item</a>
<?php } ?>
</div>
</div>
@ -216,6 +220,7 @@ td {
<th class="th th-Sno" >SNo</th>
<th class="th th-materialCode">Material Code</th>
<th class="th th-materialName">Material Name</th>
<th class="th th-HSNCode">HSN/SAC</th>
<th class="th th-uom">Uom</th>
<th class="th th-requestedQuantity">RequestedQuantity</th>
<th class="th th-PoQuantity">PoQuantity</th>
@ -239,13 +244,14 @@ td {
<input type="hidden" name="<?php echo 'te' . $index ?>" id="<?php echo 'tes' . $index ?>" value="<?php echo $record->Quantity; ?>" />
<td align="center"><?php echo $record->MaterialCode; ?></td>
<td align="left"><?php echo $record->MaterialName; ?></td>
<td align="center"><?php echo $record->HSNCODE; ?></td>
<td align="left"><?php echo $record->UOM; ?></td>
<td align="right"><?php echo $record->Quantity; ?></td>
<td align="right"><?php echo $record->POQTY; ?></td>
<td align="center"><?php echo $record->StatusName; ?></td>
<input type="hidden" name="<?php echo 'materialdesc' . $index ?>" id="<?php echo 'materialdesc' . $index ?>" value="<?php echo isset($record->MaterialDescription) ? $record->MaterialDescription : ''; ?>" />
<td>
<a data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-target='#edit-req-modal' data-toggle="modal" href="#edit-req-modal"><i class="ri-pencil-fill" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->MaterialCode; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick="DeleteRow(<?php echo $index; ?>)" class="link" data-id="<?php echo $record->MaterialCode; ?>" data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
<a data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-target='#edit-req-modal' data-toggle="modal" href="#edit-req-modal"><i class="ri-pencil-fill" data-toggle="tooltip" title="Click here to view/Edit the <?php echo $record->MaterialCode; ?> Material details"></i>&nbsp;&nbsp;&nbsp;</a> <a onclick="DeleteRow(<?php echo $index; ?>)" class="link auditor-restricted-btn" data-id="<?php echo $record->MaterialCode; ?>" data-userid="<?php echo $index; ?>" id="Del"><span class="ri-delete-bin-7-fill"></span></a>
</td>
<td class="hidden-column"><?php echo $record->CategoryName; ?></td>
</tr>
@ -290,14 +296,14 @@ td {
</div>
<div class="form-row float-right">
<?php if ($Status == REQ_DRAFT) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect Save" " id="Save">Save As Draft</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" id="submit1">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" id="submit2">Approve</button>&nbsp;&nbsp;
<input type="reset" value="Reset" class="btn btn-secondary waves-effect auditor-restricted-btn" onclick="window.location.reload();">&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect auditor-restricted-btn Save" " id="Save">Save As Draft</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect auditor-restricted-btn submit" id="submit1">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light auditor-restricted-btn submit" id="submit2">Approve</button>&nbsp;&nbsp;
<?php } else if ($Status == REQ_PENDING_APPROVAL) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" id="submit1">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" id="submit2">Approve</button>&nbsp;&nbsp;
<input type="reset" value="Reset" class="btn btn-secondary auditor-restricted-btn waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect auditor-restricted-btn submit" id="submit1">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect auditor-restricted-btn waves-light submit" id="submit2">Approve</button>&nbsp;&nbsp;
<?php } ?>
</div>
<?php echo form_close(); ?>
@ -324,7 +330,9 @@ td {
$options = array("0" => 'Material Code');
if (!empty($MaterialCode)) {
foreach ($MaterialCode as $MID) :
$options[$MID->MaterialCode] = $MID->MaterialCode . ' ' . ' - ' . ' ' . $MID->MaterialName;
// $options[$MID->MaterialCode] = $MID->MaterialCode . ' ' . ' - ' . ' ' . $MID->MaterialName;
$HSN = $MID->HSNCODE ? $MID->HSNCODE.' - ' : '';
$options[$MID->MaterialCode] = $HSN . $MID->MaterialName.' ( '.$MID->MaterialCode.' )';
endforeach;
}
echo form_dropdown('drpMaterial', $options, set_value('drpMaterial'), 'id="drpMaterial" class="form-control searchabledropdown"');
@ -337,7 +345,7 @@ td {
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="AddCategory" class="control-label">Category</label>
<label for="AddCategory" class="control-label">Material Category</label>
<input type ="text" id="AddCategory" readonly class="form-control">
</div>
</div>
@ -409,8 +417,9 @@ td {
<div class="col-md-12">
<div class="form-group">
<label for="EditMaterialCode" class="control-label">Material Code</label>
<input type="hidden" name="EditMaterialCode" id="EditMaterialCode" />
<?php
$data = array('name' => 'EditMaterialCode', 'value' => set_value('EditMaterialCode'), 'id' => 'EditMaterialCode', 'class' => 'form-control searchabledropdown', 'readonly' => 'true');
$data = array('name' => 'EditMaterialType', 'value' => set_value('EditMaterialType'), 'id' => 'EditMaterialType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
@ -478,7 +487,7 @@ td {
<button type="button" class="btn btn-secondary waves-effect"
data-dismiss="modal" value="Cancel">Cancel</button>
<button type="button"
class="btn btn-info waves-effect waves-light EditClick">Edit</button>
class="btn btn-info waves-effect waves-light auditor-restricted-btn EditClick">Edit</button>
</div>
</div>
</div>
@ -488,6 +497,35 @@ td {
<script>
$(document).ready(function() {
$(".searchabledropdown").select2();
// $('#AddCategory').change(function() {
// var id = $('#RequestType').val();
// var cid = $('#AddCategory').val();
// if(id){
// $.ajax({
// data: {
// id: id,
// cid : cid
// },
// dataType: 'json',
// type: "POST",
// url: "<?php echo base_url(); ?>getMaterialCode",
// success: function(json) {
// console.log(json);
// // $('#content').loader('hide');
// $("#drpMaterial").empty();
// $("#drpMaterial").append(json.Material);
// // $("#Description").val(json.MaterialName);
// // $("#UOM").val(json.UOM);
// }
// });
// }else{
// alert('Please select the Material Category');
// return false;
// }
// });
});
function isNumberKey(evt) {
@ -818,6 +856,12 @@ td {
var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val();
var categoryName = $('#AddCategory').val();
var selectedText = $('#drpMaterial option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
$('#drpMaterial option[value=' + materialCode + ']').remove();
$('#Description').val('');
@ -832,6 +876,7 @@ td {
<td align="center">${temp}</td>
<td align="center">${materialCode}</td>
<td align="left">${materialName}</td>
<td align="center">${HSN}</td>
<td align="left">${uom}</td>
<td align="right">${quantity}</td>
<td align="right">0.00</td>
@ -939,13 +984,15 @@ td {
}
$('#EditMaterialCode').val($cells.eq(1).text());
$('#EditDescription').val($cells.eq(2).text());
$('#EditUOM').val($cells.eq(3).text());
$('#EditQuantity').val($cells.eq(4).text());
$('#EditCategory').val($cells.eq(8).text());
$('#EditUOM').val($cells.eq(4).text());
$('#EditQuantity').val($cells.eq(5).text());
$('#EditCategory').val($cells.eq(9).text());
$('#Edituserid').val(userid);
var HSN = $cells.eq(3).text()?$cells.eq(3).text()+'-':'';
var MaterialType = HSN+$cells.eq(2).text()+' ( '+$cells.eq(1).text()+ ' ) ';
$('#EditMaterialType').val(MaterialType);
});
});
@ -967,13 +1014,19 @@ td {
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
var edituserid = $("#Edituserid").val();
var editMaterialType = $('#EditMaterialType').val();
var editparts = editMaterialType.split('-');
var editHSN = editMaterialType.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = $('#' + edituserid);
var cells = tr.find('td');
cells.eq(1).text(editMaterialCode);
cells.eq(2).text(editDescription);
cells.eq(3).text(editUOM);
cells.eq(4).text(editQuantity);
cells.eq(3).text(editHSN);
cells.eq(4).text(editUOM);
cells.eq(5).text(editQuantity);
$('#MaterialCode' + edituserid).val(editMaterialCode);
$('#Description' + edituserid).val(editDescription);

View File

@ -82,14 +82,14 @@
<th>From Date</th>
<th>To Date</th>
<th>Number Of Days</th>
<th>Status</th>
<th class="security-restricted labstaff-restricted stock-restricted">Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($leave_info)) :
foreach ($leave_info as $d) {
foreach ($leave_info as $i => $d) {
$createdat = new DateTime($d['created_on']);
$crdate = $createdat->format('d-m-Y');
$crtime = $createdat->format('h:i A');
@ -105,7 +105,25 @@
<td><?= esc($stdate) ?></td>
<td><?= esc($eddate) ?></td>
<td><?= esc($d['no_of_days']) ?></td>
<td><?= esc($d['status']) ?></td>
<td class="security-restricted labstaff-restricted stock-restricted"><?php if($d['status'] !== "Approved"){ ?>
<select
class="form-control"
name="drpStatus"
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="Draft" <?php echo ($d['status'] == 'Draft') ? 'selected' : ''; ?> >Draft</option>
<option value="Approved" <?php echo ($d['status'] == 'Approved') ? 'selected' : ''; ?> >Approve</option>
<option value="Cancel" <?php echo ($d['status'] == 'Cancel') ? 'selected' : ''; ?> >Cancel</option>
</select>
<?php }else{
echo esc($d['status']);
} ?>
</td>
<td><?php if($d['leave_application_id']){ ?>
<a data-toggle="modal" href="#applicationModal" data-arr='<?php echo json_encode($d); ?>' data-id='<?= esc($d['leave_application_id']) ?>' title="<?php echo $d['emp_id']; ?> - Click here to View/Edit Employee Leave Details">
<i class="fas fa-edit"></i>&nbsp;&nbsp;&nbsp;
@ -211,7 +229,7 @@
<input type="text" class="form-control" id="no_of_days" name="no_of_days" readonly>
</div>
</div><!--/. r o w 5 -->
<div class="row mt-2">
<div class="row mt-2 security-restricted labstaff-restricted stock-restricted">
<div class="col-md-2" style="text-align: end; align-content: center;">
<label class="form" for="status_val">Status</label>
</div>
@ -224,6 +242,7 @@
</select>
</div>
</div><!--/. r o w 6 -->
<div class="row mt-2">
<div class="col-md-2" style="text-align: end; align-content: center;">
<label class="form" for="reason">Reason</label>
@ -239,8 +258,10 @@
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</button>
<span class="auditor-restricted labstaff-restricted security-restricted">
<button type="button" class="btn btn-info waves-effect waves-light tempClick"
id="tempClick">Submit</button>
</span>
</div>
</div><!-- /. m o d a l-c o n t e n t -->
</div><!-- /.m o d a l-d i a l o g -->
@ -258,8 +279,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
@ -332,10 +353,10 @@
alert('Please Enter the Reason');
return;
}
if ($('#status_val').val() === '') {
alert('Please Select Status');
return;
}
// if ($('#status_val').val() === '') {
// alert('Please Select Status');
// return;
// }
// validateDateRange(function(isValid) {
// if (!isValid) {
// alert("The selected date range overlaps with an existing approved leave.");
@ -349,7 +370,7 @@
end_date:$('#end_date').val(),
no_of_days:$('#no_of_days').val(),
reason:$('#reason').val(),
status:$('#status_val').val(),
status:$('#status_val').val() ? $('#status_val').val() : 'Draft',
};
$('#loader').show();
@ -555,3 +576,57 @@ function validateDateRange() {
}
</script>
<script>
function callLeaveStatus(leaveid, Status, selectElem) {
// $("#drpStatus").val(Status); // not working
// $('#drpStatus_'+leaveid).val(Status);
// selectElem.value = Status;
// $(selectElem).val(Status).trigger('change');
// if (drpStatusElem) {
// drpStatusElem.;
// } else {
// console.error("Element with ID 'drpStatus' not found");
// return;
// }
if (Status == '') {
alert('Please select a valid status!');
selectElem.value = ''; // reset to default
return;
}else{
$('#drpStatus_'+leaveid).val(Status).select2();
}
var strMsg = '';
if (Status === 'Approved') {
strMsg = 'Do you want to Approve?';
} else if (Status === 'Draft') {
strMsg = 'Do you want to change to Draft?';
}
if (confirm(strMsg)) {
$.ajax({
type: "GET",
url: `<?= base_url('leaveStatus') ?>/${leaveid}/${Status}`,
success: function(response) {
alert(response.message);
location.reload();
},
error: function() {
alert('Error occurred while updating leave status.');
}
});
} else {
// reset dropdown to default if cancelled
selectElem.value = '';
}
}
</script>

View File

@ -90,7 +90,7 @@
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">HR</a></li>
<li class="breadcrumb-item active">
@ -99,7 +99,10 @@
</ol>
</div>
<a class="btn btn-success" href="<?php echo base_url(); ?>addemployee">Add New Employee</a>
<div>
<a class="btn btn-success" href="<?php echo base_url(); ?>exportemployee">Export Excel</a>
<a class="btn btn-success auditor-restricted-btn" href="<?php echo base_url(); ?>addemployee">Add New Employee</a>
</div>
</div>
</div>
</div>
@ -222,9 +225,7 @@
var table = $('#datatable').DataTable({
dom: 'Blfrtip',
buttons: [
'excel', 'pdf'
],
buttons: [ 'pdf' ],
pageLength: 10,
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: false,

View File

@ -3,17 +3,15 @@
<!-- Flatpickr JS -->
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<style>
.num {
text-align: right;
}
#Inwardgateregistertable1 thead tr th{
#Inwardgateregistertable1 thead tr th {
width: 150px;
width: 150px;
word-wrap: break-word;
white-space: normal;
white-space: normal;
}
th {
@ -75,27 +73,26 @@
.footer-textarea {
width: 100%;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
width: 100%;
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
}
.send-btn {
padding: 10px 20px;
background-color: #2ecc71; /* Green color */
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
padding: 10px 20px;
background-color: #2ecc71;
/* Green color */
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.send-btn:hover {
background-color: #27ae60; /* Darker green on hover */
background-color: #27ae60;
/* Darker green on hover */
}
</style>
<script>
$(function() {
@ -117,22 +114,25 @@
/* background-color: darkgrey; */
outline: 1px solid slategrey;
}
.igr-remarks{
.igr-remarks {
position: relative;
}
.igr-remarks i{
.igr-remarks i {
font-size: 14px;
}
.igr-remarks span{
.igr-remarks span {
position: absolute;
top: -5px;
right: -6px;
background-color: transparent;
border-radius: 50px!important;
border-radius: 50px !important;
font-weight: 600;
width: 14px;
box-shadow: 0 0 20px 0 rgba(0,0,0,0.2);
color:#35462c;
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.2);
color: #35462c;
}
</style>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script>
@ -148,14 +148,14 @@
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Inward</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Gas Cylinder Returned </h4>
</li>
</ol>
</div>
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Inward</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Gas Cylinder Completed </h4>
</li>
</ol>
</div>
</div>
</div>
@ -171,30 +171,30 @@
<div class="card">
<div class="row">
<div class="col-md-8">
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('ViewIGR'); ?>">
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search"
value=""
id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<form class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;" method="post" action="<?= base_url('ViewIGR'); ?>">
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search"
value=""
id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<label for="fromDate">From:</label>
<input class="form-control date_range form-date-search"
value=""
id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<button type="submit" class="range_search_button" >
<i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i>
</button>
<i class="fe-rotate-cw range_reset_button"
style="cursor:pointer;"
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<label for="toDate">To:</label>
<input class="form-control date_range to-date-search"
value=""
id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button">
<i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i>
</button>
<i class="fe-rotate-cw range_reset_button"
style="cursor:pointer;"
aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
</div>
<!-- <div class="col-md-4">
<button id="downloadExcel" class="btn btn-primary" style="margin-top: 14px;margin-bottom: -11px;margin-right: 25px;float: right;">Download Excel</button>
</div> -->
@ -203,76 +203,92 @@
<table id="view_inward_gate_register" class="table table-bordered table-hover">
<thead>
<tr>
<!-- basic details -->
<th>Full Cylinder Date</th>
<!-- basic details -->
<th>Full Cylinder Date</th>
<th>IGR No</th>
<th>Supplier</th>
<th>Supplier</th>
<th>Bill/Invoice No</th>
<th>Cylinder Name</th>
<!-- cylinderdetails -->
<!-- cylinderdetails -->
<th>Gross Weight</th>
<th>Empty Cylinder Date</th>
<th>Tare Weight</th>
<th>Net Weight</th>
<th>Tare Weight</th>
<th>Net Weight</th>
<th>Actual Weight</th>
<th>Shortage</th>
<th>Cylinder Count</th>
<th>Cylinder Pending</th>
<!-- least details -->
<!-- least details -->
<th>Bill Date</th>
<th>Driver Name</th>
<th>Vehicle No</th>
<th>Download</th>
</tr>
</thead>
<tbody>
<?php if(empty($gasCylinderReturnedList)){?>
<p align="center" > No Gas Cylinder Returned in the Given Dates..!!</p>
<?php }else{ ?>
<?php if (empty($gasCylinderReturnedList)) { ?>
<p align="center"> No Gas Cylinder Returned in the Given Dates..!!</p>
<?php } else { ?>
<?php foreach($gasCylinderReturnedList as $index => $gasCylinder):
$gasCylinder['MaterialRcvdDate'] = date('d-m-Y',strtotime($gasCylinder['MaterialRcvdDate']));
$gasCylinder['DeliveryChellanDate'] = date('d-m-Y',strtotime($gasCylinder['DeliveryChellanDate']));
$gasCylinder['emptyCylinderDate'] = date('d-m-Y',strtotime($gasCylinder['emptyCylinderDate']));
?>
<?php foreach ($gasCylinderReturnedList as $index => $gasCylinder):
$gasCylinder['MaterialRcvdDate'] = date('d-m-Y', strtotime($gasCylinder['MaterialRcvdDate']));
$gasCylinder['DeliveryChellanDate'] = date('d-m-Y', strtotime($gasCylinder['DeliveryChellanDate']));
$gasCylinder['emptyCylinderDate'] = date('d-m-Y', strtotime($gasCylinder['emptyCylinderDate']));
?>
<tr>
<!-- basic details -->
<td><?=$gasCylinder['MaterialRcvdDate']?></td>
<td><?=$gasCylinder['IGRNO-']?></td>
<td><?=$gasCylinder['SupplierName']?></td>
<td><?=$gasCylinder['DeliveryChellanOrInvoiceNo']?></td>
<td><?=$gasCylinder['MaterialName']?></td>
<!-- cylinderdetails -->
<td><?=$gasCylinder['grossWeight']?></td>
<td><?=$gasCylinder['emptyCylinderDate']?></td>
<td><?=$gasCylinder['tareWeight']?></td>
<td><?=$gasCylinder['netWeight']?></td>
<td><?=$gasCylinder['actualWeight']?></td>
<td><?=$gasCylinder['shortage']?></td>
<td><?=$gasCylinder['gasCylinderPendingCount']?></td>
<tr>
<!-- basic details -->
<td><?= $gasCylinder['MaterialRcvdDate'] ?></td>
<td><?= $gasCylinder['IGRNO-'] ?></td>
<td><?= $gasCylinder['SupplierName'] ?></td>
<td><?= $gasCylinder['DeliveryChellanOrInvoiceNo'] ?></td>
<td><?= $gasCylinder['MaterialName'] ?></td>
<!-- least details -->
<td><?=$gasCylinder['DeliveryChellanDate']?></td>
<td><?=$gasCylinder['DriverName']?></td>
<td><?=$gasCylinder['VehicleNo']?></td>
<!-- cylinderdetails -->
<td><?= $gasCylinder['grossWeight'] ?></td>
<td><?= $gasCylinder['emptyCylinderDate'] ?></td>
<td><?= $gasCylinder['tareWeight'] ?></td>
<td><?= $gasCylinder['netWeight'] ?></td>
<td><?= $gasCylinder['actualWeight'] ?></td>
<td><?= $gasCylinder['shortage'] ?></td>
<td><?= $gasCylinder['gasCylinderCount'] ?></td>
<td><?= $gasCylinder['gasCylinderPendingCount'] ?></td>
</tr>
<?php endforeach ?>
<?php } ?>
<!-- least details -->
<td><?= $gasCylinder['DeliveryChellanDate'] ?></td>
<td><?= $gasCylinder['DriverName'] ?></td>
<td><?= $gasCylinder['VehicleNo'] ?></td>
<td style="text-align: center;">
<i class="fa fa-download"
onclick="downloadExcel(this)"
title="Download" aria-hidden="true"
style="font-size:large;
cursor:pointer;
color:rgb(23, 162, 162);">
</i>
</td>
</tr>
<?php endforeach ?>
<?php } ?>
</tbody>
</table>
<div>
<div style="display: none;" id="excelTableDiv"></div>
</div>
</div> <!-- end card body-->
</div> <!-- end card -->
@ -304,31 +320,41 @@
console.log("Received date string:", dateString);
// Split the date string into date and time components
var dateTimeParts = dateString.split(' ');
var dateParts = dateTimeParts[0].split('-');
var timeParts = dateTimeParts[1].split(':');
var dateTimeParts = dateString?.split(' ');
var dateParts = dateTimeParts[0]?.split('-');
var timeParts = dateTimeParts[1]?.split(':');
// Extract individual components
var year = parseInt(dateParts[0], 10);
var month = parseInt(dateParts[1], 10) - 1; // Months are zero-based in JavaScript
var day = parseInt(dateParts[2], 10);
var hours = parseInt(timeParts[0], 10);
var minutes = parseInt(timeParts[1], 10);
var seconds = parseInt(timeParts[2], 10);
var hours = 0;
var minutes = 0;
var seconds = 0;
if(timeParts){
// Extract time components
hours = parseInt(timeParts[0], 10);
minutes = parseInt(timeParts[1], 10);
seconds = parseInt(timeParts[2], 10);
}
// Create a new Date object
var date = new Date(year, month, day, hours, minutes, seconds);
// Extract date components
var day = date.getDate().toString().padStart(2, '0');
var month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based
var year = date.getFullYear();
day = date.getDate().toString().padStart(2, '0');
month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based
year = date.getFullYear();
// Extract time components
var hours = date.getHours().toString().padStart(2, '0');
var minutes = date.getMinutes().toString().padStart(2, '0');
var seconds = date.getSeconds().toString().padStart(2, '0');
hours = date.getHours().toString().padStart(2, '0');
minutes = date.getMinutes().toString().padStart(2, '0');
seconds = date.getSeconds().toString().padStart(2, '0');
var formattedDate = '';
// Format the date and time in DD-MM-YYYY HH:MM:SS format
if (flag == 1) {
@ -355,9 +381,8 @@
<!-- data table related initialization -->
<script>
$(document).ready(function() {
// this code for table date filed ordering
// this code for table date filed ordering
$.fn.dataTable.ext.type.order['date-dd-mm-yyyy-pre'] = function(date) {
if (!date) return 0;
@ -367,27 +392,29 @@
var orderColumnIndex = <?php echo (session()->get('roleText') == 'Auditor') ? 6 : 0; ?>;
table = $('#view_inward_gate_register').DataTable({
dom: 'Blfrtip',
buttons: [
{
extend: 'excel',
text: 'Excel',
exportOptions: {
columns: ':not(:last-child)' // Exclude the last column
}
dom: 'Blfrtip',
buttons: [{
extend: 'excel',
text: 'Excel',
exportOptions: {
columns: ':not(:last-child)' // Exclude the last column
}
],
}],
pageLength: 10,
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
],
responsive: false,
ordering: true,
columnDefs: [
{ targets: parseInt(orderColumnIndex), type: 'date-dd-mm-yyyy' } // Apply custom sorting
],
order: [[parseInt(orderColumnIndex), 'desc']],
responsive: false,
ordering: true,
columnDefs: [{
targets: parseInt(orderColumnIndex),
type: 'date-dd-mm-yyyy'
} // Apply custom sorting
],
order: [
[parseInt(orderColumnIndex), 'desc']
],
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -400,7 +427,7 @@
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
window.location="gasCylinderReturned"
window.location = "gasCylinderReturned"
});
// Automatically focus and open the To Date picker when From Date is selected
@ -422,198 +449,192 @@
<!-- data table related date filter -->
<script>
$(document).ready(function() {
$('#fromDate , #toDate').change(function() {
let fromDate = $('#fromDate').val();
let toDate = $('#toDate').val();
$(document).ready(function() {
$('#fromDate , #toDate').change(function() {
let fromDateObj = new Date(fromDate.split('-').reverse().join('-'));
let toDateObj = new Date(toDate.split('-').reverse().join('-'));
if (fromDateObj > toDateObj) {
alert('Incorrect Date Applied For Filter..!!');
$('#toDate').attr('min', fromDate);
$('#toDate').val('');
}
});
});
let fromDate = $('#fromDate').val();
let toDate = $('#toDate').val();
</script>
let fromDateObj = new Date(fromDate.split('-').reverse().join('-'));
let toDateObj = new Date(toDate.split('-').reverse().join('-'));
if (fromDateObj > toDateObj) {
alert('Incorrect Date Applied For Filter..!!');
$('#toDate').attr('min', fromDate);
$('#toDate').val('');
<!-- while Opening gasEnteredDetails modal -->
<script>
$(document).on('click', '.gas-entered-details', function() {
let row = $(this).closest("tr");
let fullCylinderDate = row.find("td:eq(0)").text().trim();
let igrNo = row.find("td:eq(1)").text().trim();
let supplierName = row.find("td:eq(2)").text().trim();
let invoiceNo = row.find("td:eq(3)").text().trim();
let billDate = row.find("td:eq(4)").text().trim();
let driverName = row.find("td:eq(5)").text().trim();
let vehicleNo = row.find("td:eq(6)").text().trim();
let cylinderName = row.find("td:eq(7)").text().trim();
let cylinderCount = parseInt(row.find("td:eq(8)").text().trim(), 10);
// Convert fullCylinderDate to YYYY-MM-DD
if (fullCylinderDate) {
let dateParts = fullCylinderDate.split("-");
fullCylinderDate = `${dateParts[2]}-${dateParts[1]}-${dateParts[0]}`;
}
// Convert billDate to YYYY-MM-DD
if (billDate) {
let dateParts = billDate.split("-");
billDate = `${dateParts[2]}-${dateParts[1]}-${dateParts[0]}`;
}
// Assign values to modal inputs
$('#fullCylinderDate').val(fullCylinderDate);
$('#IGRNO').val(igrNo);
$('#supplierName').val(supplierName);
$('#invoiceNo').val(invoiceNo);
$('#billDate').val(billDate);
$('#driverName').val(driverName);
$('#vehicleNo').val(vehicleNo);
$('#cylinderName').val(cylinderName);
$('#cylinderCount').val(cylinderCount);
// Clear previous cylinder inputs
$('#cylinderDiv').html("");
// Generate cylinder input fields dynamically
if (cylinderCount > 0) {
let inputFields = `
<div class="form-group row">
<div class="col-md-4"><label>Cylinder Number</label> <span class="text-danger">*</span> </div>
<div class="col-md-4"><label>Gross Weight</label> <span class="text-danger">*</span> </div>
<div class="col-md-4"><label>Actual Weight</label> <span class="text-danger">*</span> </div>
</div>`;
for (let i = 1; i <= cylinderCount; i++) {
inputFields += `
<div class="form-group row dynamicField">
<div class="col-md-4">
<input type="text" class="form-control" name="cylinderNumber[]" placeholder="Cylinder ${i}" required>
</div>
<div class="col-md-4">
<input type="number" class="form-control" name="grossWeight[]" placeholder="Gross Weight ${i}" required>
</div>
<div class="col-md-4">
<input type="number" class="form-control" name="actualWeight[]" placeholder="Actual Weight ${i}" required>
</div>
</div>`;
}
$('#cylinderDiv').html(inputFields);
}
// Show the modal
$('#gasEnteredDetails').modal('show');
});
</script>
<!-- while closing gasEnteredDetails modal -->
<script>
$(document).ready(function(){
$('#gasEnteredDetails').on("hide.bs.modal", function(e){
$('#fullCylinderDate').val(" ");
$('#IGRNO').val(" ");
$('#supplierName').val(" ");
$('#invoiceNo').val(" ");
$('#billDate').val(" ");
$('#driverName').val(" ");
$('#vehicleNo').val(" ");
$('#cylinderName').val(" ");
$('#cylinderCount').val(" ");
$('#cylinderDiv').html("");
}
});
});
</script>
<!-- end of add gas shortage calculator -->
<!-- ajax call for gas Shortage -->
<script>
function downloadExcel(clickedElement) {
$(document).ready(function () {
$("#gasEnteredDetails form").submit(function (event) {
event.preventDefault(); // Prevent form reload
var row = $(clickedElement).closest("tr");
var igrNo = row.find("td:eq(1)").text().trim();
var cylinderPendingCount = row.find("td:eq(12)").text().trim();
let method = $("#gasEnteredDetails").data("form"); // Get form type
cylinderPendingCount = parseInt(cylinderPendingCount, 10);
// Collecting form data
let formData = {
fullCylinderDate: $("#fullCylinderDate").val(),
IGRNO: $("#IGRNO").val(),
supplierName: $("#supplierName").val(),
invoiceNo: $("#invoiceNo").val(),
billDate: $("#billDate").val(),
driverName: $("#driverName").val(),
vehicleNo: $("#vehicleNo").val(),
cylinderName: $('#cylinderName').val(),
cylinderCount: $("#cylinderCount").val(),
cylinders: [] // Array to store cylinder details
};
// Loop through dynamically generated cylinder inputs
$("#cylinderDiv .form-group.row.dynamicField").each(function () {
let cylinderData = {
cylinderNo : $(this).find("input[name='cylinderNumber[]']").val(),
grossWeight : $(this).find("input[name='grossWeight[]']").val(),
actualWeight: $(this).find("input[name='actualWeight[]']").val(),
};
formData.cylinders.push(cylinderData);
});
console.log(formData); // Debugging - Check if data is correct
$('#loader').show(); // Show loader
$.ajax({
type: "POST",
url: "<?php echo base_url()?>/updateGasShortage", // Adjust endpoint as needed
data: JSON.stringify(formData), // Send data as JSON
contentType: "application/json",
dataType: "json",
success: function (response) {
if (response.status === "success") {
alert("Gas Shortage Data Saved Successfully!");
$('#gasEnteredDetails').modal('hide'); // Close modal
} else {
alert("Error: " + response.message);
}
},
error: function (xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete: function () {
console.log("AJAX request completed.");
$('#loader').hide();
}
});
});
});
</script>
if (cylinderPendingCount > 0) {
alert("Please clear the " + cylinderPendingCount + " pending cylinders before downloading the Excel file.");
return false;
}
$("#loader").show();
$.ajax({
type: "POST",
url: "<?php echo base_url() ?>gasCylindersByIgr",
data: {
IGRNO: igrNo
},
success: function(response) {
$("#loader").hide();
if (response.status === "success") {
console.log(response.data); // Debugging - Check if data is correct
let tableHTML = `
<table border="1" id="excelTable" >
<thead>
<tr>
<th>IGRNO</th>
<th>Full Cylinder Date</th>
<th>Cylinder No</th>
<th>Gross Weight</th>
<th>Empty Cylinder Return Date</th>
<th>Tare Weight</th>
<th>Net Weight</th>
<th>Actual Weight</th>
<th>Shortage</th>
<th>Bill No</th>
<th>Bill Date</th>
<th>Driver Name</th>
<th>Vehicle No</th>
</tr>
</thead>
<tbody>
`;
let totalShortage = 0;
let totalNetWeight = 0;
let totalActualWeight = 0;
response.data.forEach(item => {
totalShortage += Number(item.shortage);
totalNetWeight += Number(item.netWeight);
totalActualWeight += Number(item.actualWeight);
item.fullCylinderDate = formatDateTime(item.fullCylinderDate, 1);
item.emptyCylinderDate = formatDateTime(item.emptyCylinderDate, 1);
item.DeliveryChellanDate = formatDateTime(item.DeliveryChellanDate, 1);
tableHTML += `
<tr>
<td>${item.IGRNO}</td>
<td>${item.fullCylinderDate}</td>
<td>${item.cylinderNo}</td>
<td align="right">${item.grossWeight}</td>
<td>${item.emptyCylinderDate}</td>
<td align="right">${item.tareWeight}</td>
<td align="right">${item.netWeight}</td>
<td align="right">${item.actualWeight}</td>
<td align="right">${item.shortage}</td>
<td>${item.invoiceNo}</td>
<td>${item.DeliveryChellanDate}</td>
<td>${item.DriverName}</td>
<td>${item.VehicleNo}</td>
</tr>
`;
});
tableHTML += `
</tbody>
<tfoot>
<tr class="empty-row">
<td colspan="13">&nbsp;</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td align="right"> Weight</td>
<td align="right">${totalNetWeight}</td>
<td align="right">${totalActualWeight}</td>
<td align="right">${totalShortage}</td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>
`;
$("#excelTableDiv").html(tableHTML);
let table = document.getElementById('excelTable');
let filename = "GasCylinderReturned_" + igrNo + ".xlsx";
let rows = [];
// Extract table data row-by-row
$(table).find('tr').each(function(rowIndex) {
let rowData = [];
$(this).find('th, td').each(function(colIndex) {
// Skip hidden columns
if ($(this).css('display') === 'none') return;
let cellText = $(this).text().trim();
rowData.push(cellText);
});
// Add the cleaned row only if it has data
if (rowData.length > 0) {
rows.push(rowData);
}
});
// Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows);
// Define column widths (in character units)
const columnWidth = 15; // Set your desired width here
const wscols = [];
for (let i = 0; i < Object.keys(response.data[0]).length; i++) {
wscols.push({
wch: columnWidth
});
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
},
error: function(xhr, status, error) {
console.log(xhr.responseText);
alert("Something went wrong! Please try again.");
},
complete: function() {
console.log("AJAX request completed.");
$("#loader").hide(); // Hide loader
}
});
}
</script>

View File

@ -322,10 +322,19 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
$('#editTripsValue').hide();
}
$('#EditPer').val($('#Per' + userid).val());
$('#EditTotalOrderValue').val(cellval[9].innerHTML);
$('#EditTotalOrderValue').val(cellval[10].innerHTML);
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
@ -341,7 +350,9 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
}
});
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
});
@ -842,6 +853,7 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -2355,8 +2367,9 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -3439,6 +3452,14 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
var quantity = $("#Quantity").val();
@ -3533,6 +3554,7 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
<td style="text-align:center !important">${Reqnumber}</td>
<td style="text-align:left !important">${materialCode}</td>
<td style="text-align:left !important">${shorten}</td>
<td style="text-align:center !important">${HSN}</td>
<td style="text-align:left !important">
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
@ -3873,13 +3895,20 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
if (FreightTypename != "PER TRIP") {
Nooftrip = '';
}
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = BasicValue;
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname);

View File

@ -155,6 +155,39 @@
</script>
<script>
$(function () {
<?php if(session()->get('roleText') == 'Auditor'){ ?>
$(".auditor-restricted").hide();
$(".auditor-restricted-btn").hide();
$(".auditor-restricted-field").attr("readonly", true);
$(".auditor-restricted-dropdown").prop("disabled", true);
<?php } ?>
<?php if(session()->get('roleText') == 'Lab Staff'){ ?>
$(".labstaff-restricted").hide();
$(".labstaff-restricted-btn").hide();
$(".labstaff-restricted-field").attr("readonly", true);
$(".labstaff-restricted-dropdown").prop("disabled", true);
<?php } ?>
<?php if(session()->get('roleText') == 'Security'){ ?>
$(".security-restricted").hide();
$(".security-restricted-btn").hide();
$(".security-restricted-field").attr("readonly", true);
$(".security-restricted-dropdown").prop("disabled", true);
<?php } ?>
<?php if(session()->get('roleText') == 'Stock Handler'){ ?>
$(".stock-restricted").hide();
$(".stock-restricted-btn").hide();
$(".stock-restricted-field").attr("readonly", true);
$(".stock-restricted-dropdown").prop("disabled", true);
<?php } ?>
});
</script>
<script>
$('document').ready(function(){
$('#deletePreviousPurchaseOrderFile').click(function(){

View File

@ -524,7 +524,7 @@
<li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<?php if(session()->get('ProfilePic') != null){ ?>
<img src="<?php echo base_url(); ?>public/uploads/images/<?php echo session()->get('ProfilePic'); ?>" alt="user-image" class="rounded-circle">
<img src="<?php echo base_url(); ?>public/uploads/images/<?php echo session()->get('ProfilePic'); ?>" alt="user-image" class="rounded-circle">
<?php }else{ ?>
<img src="<?php echo base_url(); ?>public/new_assets/images/avatar.png" alt="user-image" class="rounded-circle">
<?php } ?>
@ -619,24 +619,41 @@
<ul class="navbar-nav">
<!-- Dashboard module -->
<?php if(session()->get('roleText') == 'Auditor'){?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-hr" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ri-dashboard-line mr-1 mr-1"></i> Dashboard <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-hr">
<a href="<?php echo base_url(); ?>accountsDashboard" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Accounts Dashboard</a>
<a href="<?php echo base_url(); ?>sales_dashboard" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i>Sales Dashboard</a>
</div>
</li>
<?php }else{?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>sales_dashboard" role="button"
aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i>Dashboard</a>
</li>
<?php }?>
<!-- <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>sales_dashboard" role="button"
aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i>Dashboard</a>
</li> -->
<?php if(session()->get('roleText') == 'Auditor'){?>
<!-- Accounts Dashboard -->
<li class="nav-item dropdown">
<!-- <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none"
href="<?php echo base_url(); ?>accountsDashboard"
role="button" aria-expanded="false">
<i class="fas fa-cubes mr-1"></i> Accounts Dashboard
</a>
</li>
<?php } ?>
</li> -->
<?php } ?>
@ -679,7 +696,7 @@
</a>
<div class="dropdown-menu" aria-labelledby="topnav-purchase">
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-requisition"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -687,10 +704,12 @@
</a>
<div class="dropdown-menu" aria-labelledby="topnav-requisition">
<a href="<?php echo base_url(); ?>Requisition" class="dropdown-item">Raise Requisition </a>
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<a href="<?php echo base_url(); ?>CreatePO" class="dropdown-item">Purchase Order From Requisition</a>
<?php } ?>
</div>
</div>
<?php } ?>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-po"
@ -702,6 +721,8 @@
<a href="<?php echo base_url(); ?>PORelease" class="dropdown-item">Approve Purchase Order</a>
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<a href="<?php echo base_url(); ?>EmergencyPO" class="dropdown-item">Emergency Purchase Order </a>
<?php } ?>
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor'){ ?>
<a href="<?php echo base_url(); ?>Report_pending_purchase" class="dropdown-item">Pending Purchase Order </a>
<a href="<?php echo base_url(); ?>amendmentpurchaseorder" class="dropdown-item">Amendment Purchase Order</a>
<?php } ?>
@ -759,7 +780,7 @@
<div class="dropdown-menu" aria-labelledby="topnav-po" >
<a href="<?php echo base_url(); ?>gasCylinderEntered" class="dropdown-item"><i class="fa fa-truck mr-1"></i>Gas Cylinder Entered</a>
<a href="<?php echo base_url(); ?>gasCylinderPending" class="dropdown-item"><i class="fa fa fa-hourglass-half mr-1"></i>Gas Cylinder Pending </a>
<a href="<?php echo base_url(); ?>gasCylinderReturned" class="dropdown-item"><i class="fa fa-check mr-1"></i>Gas Cylinder Returned</a>
<a href="<?php echo base_url(); ?>gasCylinderReturned" class="dropdown-item"><i class="fa fa-check mr-1"></i>Gas Cylinder Completed</a>
</div>
</div>
@ -775,7 +796,7 @@
<!-- HR module -->
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor' || session()->get('roleText') == 'Stock Handler' || session()->get('roleText') == 'Security' || session()->get('roleText') == 'Lab Staff'){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-hr" role="button"
@ -783,6 +804,7 @@
<i class="ri-contacts-book-line mr-1"></i> HR <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-hr">
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor'){ ?>
<a href="<?php echo base_url(); ?>employeeListing" class="dropdown-item"><i class="ri-shield-user-line align-middle mr-1"></i> Employee Details</a>
<a href="<?php echo base_url(); ?>DriverListing" class="dropdown-item"><i class="ri-file-settings-line align-middle mr-1"></i> Driver Load Details</a>
<a href="<?php echo base_url(); ?>attendance" class="dropdown-item"><i class=" ri-time-line align-middle mr-1"></i> Attendance</a>
@ -800,7 +822,6 @@
<a href="<?php echo base_url(); ?>overTimeDetails" class="dropdown-item">OverTime Details</a>
</div>
</div>
<div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -808,10 +829,11 @@
</a>
<div class="dropdown-menu" aria-labelledby="topnav-leave">
<a href="<?php echo base_url(); ?>publicholidays" class="dropdown-item">Public Holidays</a>
<a href="<?php echo base_url(); ?>leaveApplicationForm" class="dropdown-item">Leave Application Form</a>
<a href="<?php echo base_url(); ?>leavereports" class="dropdown-item"> Reports</a>
</div>
</div>
<?php } ?>
<a href="<?php echo base_url(); ?>leaveApplicationForm" class="dropdown-item"><i class="ri-user-shared-2-fill align-middle mr-1"></i> Leave Application Form</a>
</div>
@ -839,7 +861,7 @@
<!-- material module -->
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor'){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>rawmaterialListing" role="button" aria-expanded="false">
@ -852,7 +874,7 @@
<!-- master detail module -->
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor'){ ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-others" role="button"
@ -883,7 +905,7 @@
<!-- Stock module -->
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Stock Handler' || session()->get('roleText') == 'Lab Staff'){?>
<?php if(session()->get('roleText') == 'System Administrator' || session()->get('roleText') == 'Auditor' || session()->get('roleText') == 'Stock Handler' || session()->get('roleText') == 'Lab Staff'){?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-stock" role="button"
@ -891,7 +913,6 @@
<i class="ri-shopping-bag-line"></i> Stock <div class="arrow-down"></div>
</a>
<div class="dropdown-menu" aria-labelledby="topnav-stock">
<div class="dropdown" >
<a href="<?php echo base_url(); ?>incomingSilicaSandDetails?remark=noRemark" class="dropdown-item"><i class="ri-file-info-line align-middle mr-1"></i>Incoming Silica Sand Details</a>
<div class="dropdown-menu" aria-labelledby="topnav-stock">

View File

@ -160,13 +160,14 @@
<th>#</th>
<th>Item Code</th>
<th>Item Description</th>
<th>HSN/SAC</th>
<th>Rate</th>
<th>UOM</th>
<th>Ordered Quantity</th>
<th>Received Quantity</th>
<th>Balance Quantity</th>
<th>Invoice Quantity<span class="text-danger">*</span></th>
<th>Remarks</th>
<th>Remarks<span class="text-danger">*</span></th>
<th> </th>
</tr>
</thead>
@ -297,13 +298,35 @@
$(".searchabledropdown").select2();
$('#IGRLink').on('click', function() {
filecheck(1);
function debounce(func, timeout = 300) {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => { func.apply(this, args); }, timeout);
};
}
$('#IGRLink, #IGRDraftLink').on('click', function(e) {
e.preventDefault();
const $btn = $(this);
const strMsg = $btn.is('#IGRLink')
? 'generate the IGR?'
: 'Save as draft IGR?';
if (confirm('Are you sure you want to ' + strMsg)) {
$btn.prop("disabled", true)
.html('<i class="fa fa-spinner fa-spin"></i> Processing...');
filecheck($btn.is('#IGRLink') ? 1 : 0);
}
});
$('#IGRDraftLink').on('click', function() {
filecheck(0);
});
// $('#IGRLink').on('click', function() {
// filecheck(1);
// });
// $('#IGRDraftLink').on('click', function() {
// filecheck(0);
// });
function filecheck(status) {
$('#hideIGRStatus').val(status);
@ -320,9 +343,19 @@
// }
// }
function Save() {
$("#IGRLink, #IGRDraftLink").prop("disabled", true);
$("#IGRLink, #IGRDraftLink")
.prop("disabled", true)
.html('<i class="fa fa-spinner fa-spin"></i> Processing...');
if (validate()) { $("#IGRForm").submit(); }
else { $("#IGRLink, #IGRDraftLink").prop("disabled", false); }
else {
// Re-enable buttons and restore original text
$("#IGRLink, #IGRDraftLink")
.prop("disabled", false)
.text(function() {
return $(this).attr('id') === 'IGRLink' ? 'Generate IGR' : 'Save as Draft IGR';
});
}
}
});
</script>
@ -380,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;
@ -466,6 +499,7 @@
'<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' +
'<td>' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td>' + Number(item.Rate).toFixed(2) + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</td>' +
@ -611,6 +645,11 @@
var RecQty = parseFloat($('#txtReceivedQuantity' + Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity' + Rowid).val());
var OrderedQty = parseFloat($("#Quantity_1" + Rowid).text());
var r = $("#Remark" + Rowid).val();
if (r == '') {
alert("Please Enter the Remark")
$("#Remark" + Rowid).focus();
return false;
}
var isOpenOrder = parseInt($("#hiddenIsOpenOrder").val(), 2);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? 0 : 1;
if (formatted_IsOpenOrder == 0) {
@ -863,7 +902,7 @@
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder);
var button_text_for_IGRDraftLink = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Open IGR";
var button_text_for_IGRDraftLink = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Draft IGR";
$('#IGRDraftLink').text(button_text_for_IGRDraftLink);
//$("#Add").val(obj.Address);
$("#del").val(obj.DeliveryDate);
@ -898,6 +937,7 @@
'<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' +
'<td>' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td>' + Number(item.Rate).toFixed(2) + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</td>' +

View File

@ -198,15 +198,23 @@
</div>
<div class="col-9 text-right d-flex" style="justify-content: end;" id="savebutton">
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
<input type="text" id="searchInput" placeholder="Search..." style="padding: 8px;margin-bottom: 10px;width: 250px;
cursor:pointer;
border: 1px solid #ccc;border-radius: 5px;margin-right:15px;">
<!-- <input type="button" id="submit" value="Save" class="btn btn-success" onclick="getAllData();" style="margin-top:0px;"> -->
<a href="<?php echo base_url("exportMonthlyPayInputs/".$dropdownvalue); ?>"
title="<?php echo 'Resico Salary '.$ot[$currentselection].'.xls'; ?>">
<i class="fas fa-file-excel"
style="margin-right: 15px; margin-top: 8px; font-size: 25px; color: green;">
</i>
</a>
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;" title="Export Excel"></i>
<i id="exportButton" class="fas fa-download download-icon" style="margin-right: 15px;margin-top: 8px;font-size:25px;cursor:pointer;" title="Export Excel"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;" title="Full screen view"></i>
<i class="fe-maximize noti-icon" onclick="toggleDivFullscreen()" style="margin-right: 15px;margin-top: 5px;font-size: 28px;cursor:pointer;" title="Full screen view"></i>
<i class="fas fa-save" onclick="getAllData();" style="margin-right: 15px;margin-top: 5px;font-size:28px;" title="Save"></i>
<i class="fas fa-save auditor-restricted-btn" onclick="getAllData();" style="margin-right: 15px;margin-top: 5px;font-size:28px;cursor:pointer;" title="Save"></i>
</div>
</div>
@ -496,7 +504,7 @@
<input type="hidden" id="duedate<?php echo $index ?>"
value="<?php echo $record->DueDate ?>">
<input type="hidden" id="is_driver<?php echo $index ?>"
value="<?php echo $record->is_driver ?>">
value="<?php echo $record->is_driver ?>">
@ -559,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>
@ -581,7 +589,6 @@
</td>
<td style="max-width:80px;text-align:right;">
<!-- $record->driver_salary_amount -->
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalworkedSalary[] = $sum_of_amount; ?>
</td>
@ -612,7 +619,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;"
@ -632,7 +639,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);"
@ -770,7 +777,7 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script type="text/javascript">
@ -808,25 +815,27 @@ $(document).ready(function () {
function exportTableToExcel(tableId, filename = 'monthlypay.xlsx') {
var table = document.getElementById(tableId);
var rows = table.rows;
var data = [];
let ws = XLSX.utils.table_to_sheet(table); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
var range = XLSX.utils.decode_range(ws['!ref']);
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
var cols = row.querySelectorAll('td, th');
var rowData = [];
for (var j = 0; j < cols.length; j++) {
rowData.push(cols[j].innerText);
// Auto-size columns
let colWidths = [];
for (let R = range.s.r; R <= range.e.r; ++R) {
for (let C = range.s.c; C <= range.e.c; ++C) {
let cell_ref = XLSX.utils.encode_cell({ c: C, r: R });
let cell = ws[cell_ref];
if (cell) {
let val = cell.v ? cell.v.toString() : '';
colWidths[C] = Math.max(colWidths[C] || 10, val.length);
}
}
data.push(rowData);
}
var wb = XLSX.utils.book_new();
var ws = XLSX.utils.aoa_to_sheet(data);
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename);
ws['!cols'] = colWidths.map(w => ({ wch: w + 2 }));
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
// Add click event listener to the export button
@ -949,6 +958,32 @@ $(document).ready(function () {
});
}
function DataForExportExcel(){
var my = $('#monthyear').val();
$('#loader').show();
$.ajax({
data:{MY:my},
type: "POST",
url: "<?php echo base_url() ?>exportMonthlyPayInputs",
success: function(data) {
if(data){
alert("step1");
}else{
alert("false");
}
},
error:function(error){
alert("error");
console.log("error occured..!!" ,error);
},
complete:function(){
$('#loader').hide();
console.log('ajax call completed..!!');
}
});
}
$("#monthyear").change(function() {
@ -1245,7 +1280,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);
@ -1253,35 +1288,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();
@ -1289,7 +1330,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();
@ -1297,7 +1338,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();
@ -1305,7 +1346,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();
@ -1318,11 +1359,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];

View File

@ -39,7 +39,7 @@
<input type="text" name="hdate" id="hdate" class="form-control">
</div>
<div class="col-md-3">
<input type="button" id="Add" value="Add" class="btn btn-success" class="form-control" style="margin-top: 25px;margin-bottom: 0px;">
<input type="button" id="Add" value="Add" class="btn btn-success auditor-restricted-btn" class="form-control" style="margin-top: 25px;margin-bottom: 0px;">
</div>
</div>
<div class="card-body">
@ -70,7 +70,7 @@
echo "NO DATA";
} ?></td>
<td contenteditable='false' style="text-align:left;"><?php echo $date; ?></td>
<td style="text-align:center;"><a href='#' onclick="DeleteRow(<?php echo $index; ?>)" id="Del"><span class="fas fa-trash"></span></a></td>
<td style="text-align:center;"><a href='#' onclick="DeleteRow(<?php echo $index; ?>)" id="Del" class="auditor-restricted-btn"><span class="fas fa-trash"></span></a></td>
</tr>
<?php
}
@ -80,7 +80,7 @@
</table>
<p>&nbsp;</p>
<div class="row">
<div class="col-md-12 text-right" id="savebutton">
<div class="col-md-12 text-right auditor-restricted-btn" id="savebutton">
<input type="button" id="submit" value="Save" class="btn btn-success">
</div>
</div>
@ -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
}
});

View File

@ -406,8 +406,9 @@ if (!empty($INRSYMBOL)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
@ -2191,6 +2192,7 @@ if (!empty($INRSYMBOL)) {
<th style="white-space: nowrap !important; text-align:left !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -3311,7 +3313,7 @@ if (!empty($INRSYMBOL)) {
} else {
$('#EditPer').val($('#uom' + userid).val());
}
$('#txtEditBasicValue').val(cellval[8].innerHTML);
$('#txtEditBasicValue').val(cellval[9].innerHTML);
RequistQuantity = $('#quantity' + userid).val();
$('#txtEditDiscount').val($('#DisVal' + userid).val());
$('#txtEditAfterDiscount').val($('#AfterDisVal' + userid).val());
@ -3346,7 +3348,17 @@ if (!empty($INRSYMBOL)) {
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
// $("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val())
.html(P3)
.prop('selected', true)
);
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
@ -3373,7 +3385,9 @@ if (!empty($INRSYMBOL)) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
// $("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
}
}
@ -3443,6 +3457,12 @@ if (!empty($INRSYMBOL)) {
// $('#ReqNo').val(Reqnumber).remove();
// $('#ReqNo option[value='+Reqnumber+']').remove();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
$('#MaterialCode option[value=' + materialCode + ']').remove();
@ -3485,6 +3505,7 @@ if (!empty($INRSYMBOL)) {
<td style="text-align:left !important">${Reqnumber}</td>
<td style="text-align:left !important">${materialCode}</td>
<td style="text-align:left !important">${shorten}</td>
<td style="text-align:left !important">${HSN}</td>
<td style="text-align:left !important">
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>
@ -3602,17 +3623,23 @@ if (!empty($INRSYMBOL)) {
var Service_Description = $("#Edit_Service_Description").val();
var TotalTaxValue = calculateEditTaxValue();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var tr = document.getElementById(userid);
var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = itemRate;
cellval[8].innerHTML = basicval;
cellval[9].innerHTML = TotalTaxValue;
cellval[10].innerHTML = TotalOrderValue;
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = basicval;
cellval[10].innerHTML = TotalTaxValue;
cellval[11].innerHTML = TotalOrderValue;
$('#materialCode' + userid).val(editMaterialCode);

View File

@ -56,7 +56,7 @@
</div>
<div class="col-2 text-right pr-3">
<a class="btn btn-success"
<a class="btn btn-success auditor-restricted-btn"
href="<?php echo base_url(); ?>addRawmaterial">
Add New Material
</a>
@ -76,6 +76,9 @@
$type = "success";
echo show_alert($type, $success);
}
$materialListPage = session()->getFlashdata('materialListPage') ?? $_GET['materialListPage'] ?? 1;
?>
<div class="row">
@ -207,13 +210,14 @@
<?php } else { ?>
<a class="a_tag_link"
onclick="editMaterial(event)"
href="<?php echo base_url() . 'viewRawmaterial?RID=' . $record->MaterialCode . '&MType=' . $record->MaterialType . '&UOM=' . $record->UOM . '&date1=' . $date ?>"
data-toggle="tooltip"
title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><i
class="fa fa-edit" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;
</a>
<a style="cursor:pointer;" data-toggle="tooltip"
<a class="auditor-restricted-btn" style="cursor:pointer;" data-toggle="tooltip"
title="<?= $record->MaterialCode ?> - Click here to delete material details"
onclick="deleteMaterial('<?php echo $record->MaterialCode; ?>')"><i class="fa fa-trash"
style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;
@ -228,7 +232,7 @@
</tbody>
</table>
<p>( Note :The entries count includes archived data... )</p>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
@ -311,13 +315,13 @@ $(document).ready(function () {
let result = JSON.parse(response);
if (result.length > 0) {
let tableHtml = `
<table class="table table-bordered">
<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>
@ -332,13 +336,13 @@ $(document).ready(function () {
href = `${baseUrl}purchaseorder/CreatePOPrint?PONO=${item.PONO}&ReqType=${item.ReqType}`;
tableHtml += `
<tr>
<td>${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: #4d3a6d;">
<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}
</td>
<td style="text-align: right;">${item.POType}</td>
<td style="text-align: left; padding-left: 1.5%;">${item.POType}</td>
<td style="text-align: right;">${TotalOrderValue}</td>
<td style="text-align: center;">
<a data-toggle="tooltip" href=${href} target="_blank">
@ -414,6 +418,30 @@ $(document).ready(function () {
}
});
// Ensure the saved page is a valid number
let savedPage =<?= $materialListPage ?? 0 ?>; // Default to 1 if not set
savedPage = savedPage -1 ;
if (!isNaN(savedPage)) {
// Check if the DataTable is initialized
if ($.fn.DataTable.isDataTable('#raw_material_list_table')) {
var dataTable = $('#raw_material_list_table').DataTable();
// Get the total number of pages in DataTable
var totalPages = dataTable.page.info().pages;
// Ensure the page number is within range
if (savedPage >= totalPages) {
savedPage = totalPages > 0 ? totalPages - 1 : 0;
}
// Set DataTable to the saved page
dataTable.page(savedPage).draw(false);
}
}
// Date range filter function
// $.fn.dataTable.ext.search.push(
// function (settings, data, dataIndex) {
@ -542,10 +570,31 @@ $(document).ready(function () {
});
});
</script>
<script>
function editMaterial(event) {
event.preventDefault();
const targetElement = event.currentTarget;
let href = $(targetElement).attr('href');
let paginationNumber = $('#raw_material_list_table').DataTable().page.info().page + 1; // Get the current page number from dataTable
href += '&page=' + paginationNumber;
// Update the 'href' attribute of the target element
$(targetElement).attr('href', href);
window.location.href = href;
}
function deleteMaterial(mid) {
var answer = confirm(" Do you want to delete the Material from the List?")

View File

@ -155,6 +155,7 @@ if (!empty($Emp)) {
<th class="th">Material Code</th>
<th class="th" style="text-align:left !important;">Material Name</th>
<th class="th" style="text-align:left !important;">Material Category</th>
<th class="th">HSN/SAC</th>
<th class="th" style="text-align:left !important;">Uom</th>
<th class="th" style="text-align:right !important;">Quantity</th>
<th class="th">Action</th>
@ -205,6 +206,7 @@ if (!empty($Emp)) {
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<div class="row">
<div class="col-md-12">
@ -215,7 +217,7 @@ if (!empty($Emp)) {
//print_r( $options);
if (!empty($MaterialList)) {
foreach ($MaterialList as $MID) :
$options[$MID->MaterialCode] = $MID->MaterialCode . ' ' . ' - ' . ' ' . $MID->MaterialName;
$options[$MID->MaterialCode] = $MID->HSNCODE . ' ' . ' - ' . ' ' . $MID->MaterialName.' ( '.$MID->MaterialCode.' )';
endforeach;
}
echo form_dropdown('MaterialCode', $options, set_value('MaterialCode'), 'id="MaterialCode" class="form-control searchabledropdown" ');
@ -228,7 +230,7 @@ if (!empty($Emp)) {
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="AddCategory" class="control-label">Category</label>
<label for="AddCategory" class="control-label">Material Category</label>
<input type ="text" id="AddCategory" readonly class="form-control">
</div>
</div>
@ -299,9 +301,10 @@ if (!empty($Emp)) {
<div class="row">
<div class="col-md-12">
<div class="form-group">
<input type="hidden" name="EditMaterialCode" id="EditMaterialCode" />
<label for="EditMaterialCode" class="control-label">Material Code</label>
<?php
$data = array('value' => set_value('EditMaterialCode'), 'id' => 'EditMaterialCode', 'class' => 'form-control', 'readonly' => 'true');
$data = array('value' => set_value('EditMaterialType'), 'id' => 'EditMaterialType', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
@ -677,6 +680,11 @@ if (!empty($Emp)) {
var uom = $("#UOM").val();
var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
$('#MaterialCode option[value=' + materialCode + ']').remove();
@ -695,6 +703,7 @@ if (!empty($Emp)) {
<td align="center">${materialCode}</td>
<td align="left">${materialName}</td>
<td align="left">${categoryName}</td>
<td align="center">${HSN}</td>
<td align="left">${uom}</td>
<td align="right">${quantity}</td>
<td align="center">
@ -760,11 +769,14 @@ if (!empty($Emp)) {
var userid = $triggerElement.data('userid');
var $tr = $('#' + userid);
var $cells = $tr.find('td');
var HSN = $cells.eq(4).text()?$cells.eq(4).text()+'-':'';
var MaterialType = HSN+$cells.eq(2).text()+' ( '+$cells.eq(1).text()+ ' ) ';
$('#EditMaterialCode').val($cells.eq(1).text());
$('#EditMaterialType').val(MaterialType);
$('#EditDescription').val($cells.eq(2).text());
$('#EditCategory').val($cells.eq(3).text());
$('#EditUOM').val($cells.eq(4).text());
$('#EditQuantity').val($cells.eq(5).text());
$('#EditUOM').val($cells.eq(5).text());
$('#EditQuantity').val($cells.eq(6).text());
$('#Edituserid').val(userid);
});
});
@ -783,6 +795,13 @@ if (!empty($Emp)) {
var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditDescription").val();
var editCategory = $("#EditCategory").val();
var editMaterialType = $('#EditMaterialType').val();
var editparts = editMaterialType.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val();
@ -791,8 +810,9 @@ if (!empty($Emp)) {
cells.eq(1).text(editMaterialCode);
cells.eq(2).text(editDescription);
cells.eq(3).text(editCategory);
cells.eq(4).text(editUOM);
cells.eq(5).text(editQuantity);
cells.eq(4).text(editHSN);
cells.eq(5).text(editUOM);
cells.eq(6).text(editQuantity);
$('#MaterialCode' + edituserid).val(editMaterialCode);
$('#Description' + edituserid).val(editDescription);
@ -902,4 +922,34 @@ if (!empty($Emp)) {
}
});
// $('#AddCategory').change(function() {
// var id = $('#RequestType').val();
// var cid = $('#AddCategory').val();
// if(id){
// $.ajax({
// data: {
// id: id,
// cid : cid
// },
// dataType: 'json',
// type: "POST",
// url: "<?php echo base_url(); ?>getMaterialCode",
// success: function(json) {
// console.log(json);
// // $('#content').loader('hide');
// $("#MaterialCode").empty();
// $("#MaterialCode").append(json.Material);
// // $("#Description").val(json.MaterialName);
// // $("#UOM").val(json.UOM);
// }
// });
// }else{
// alert('Please select the Material Category');
// return false;
// }
// });
</script>

View File

@ -111,10 +111,10 @@ if (!empty($Status)) {
</div>
<?php if ($DraftCount == 0) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<a class="btn btn-success auditor-restricted-btn" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?>
<?php if ($DraftCount > 0) { ?>
<p><span class="highlight">The Requisition No <b><?php echo $ReqNo; ?></b> is in Draft
<p><span class="highlight auditor-restricted-btn">The Requisition No <b><?php echo $ReqNo; ?></b> is in Draft
status.</span> Please act on the requisition.<span class="highlight">Then only you can raise
New Requisition. </span></p>
<?php } ?>
@ -170,13 +170,13 @@ if (!empty($Status)) {
<td align="center"> <?php echo $record->newLineItem ?></td>
<td align="center"><?php echo strtoupper($record->StatusName); ?></td>
<td align="left" style="padding-left: 3%;"><?php echo strtoupper($record->StatusName); ?></td>
<td> <a data-toggle="tooltip"
href="<?php echo base_url() . 'EditRequisitionForm?ReqNo=' . $record->ReqNo . '&ReqType=' . $record->ReqType; ?>"><i
class="fas fa-pencil-alt" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to view Requisition details"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-toggle="tooltip" href="#" onclick="DeleteRow('<?php echo $record->ReqNo; ?>' )"><i
<a data-toggle="tooltip" href="#" class="auditor-restricted-btn" onclick="DeleteRow('<?php echo $record->ReqNo; ?>' )"><i
class="fas fa-trash" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to Delete Requisition details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>

View File

@ -252,7 +252,7 @@
}
},
min: 0, // Minimum value for y-axis
max: 30000000 // Maximum value for y-axis
max: 50000000 // Maximum value for y-axis
}
},
plugins: {

View File

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

View File

@ -336,8 +336,8 @@ if (!empty($INRSYMBOL)) {
if (isAdded == "0") {
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -686,6 +686,13 @@ if (!empty($INRSYMBOL)) {
var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").val();
var selectedText = $('#EditMaterialCode option:selected').text();
var editselectedText = $('#EditMaterialCode option:selected').text();
var editparts = editselectedText.split('-');
var editHSN = editselectedText.includes('-') && /^\d+$/.test(editparts[0].trim())
? editparts[0].trim()
: '';
var editDescription = $("#EditItemName").val();
var editUOM = $('#EditUOM').val();
var editPer = '';
@ -725,12 +732,13 @@ if (!empty($INRSYMBOL)) {
cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity;
cellval[6].innerHTML = editUOM;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[11].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode);
@ -1069,6 +1077,7 @@ if (!empty($INRSYMBOL)) {
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;">HSN/SAC</th>
<th style="white-space: nowrap !important;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th>
@ -1824,7 +1833,7 @@ if (!empty($INRSYMBOL)) {
$('#EditQuantity').val($('#quantity' + userid).val());
RequistQuantity = $('#quantity' + userid).val();
$('#EditRate').val($('#itemRate' + userid).val());
$('#txtEditBasicValue').val(cellval[7].innerHTML);
$('#txtEditBasicValue').val(cellval[9].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val());
$('#EditAfterCgst').val($('#AfterCgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val());
@ -1842,7 +1851,7 @@ if (!empty($INRSYMBOL)) {
$("#EditFrequencyNo").val($('#FrequencyValue' + userid).val());
}
$('#EditTotalOrderValue').val(cellval[9].innerHTML);
$('#EditTotalOrderValue').val(cellval[11].innerHTML);
$('#EditOtherAllowances').val($('#OtherAmt' + userid).val());
$('#EditOtheritemDescription').val($('#OtherServiceDescription' + userid).val());
@ -1863,7 +1872,12 @@ if (!empty($INRSYMBOL)) {
$("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()));
var P0 = cellval[4].innerHTML;
var P1 = (P0) ? P0 + " - " : "";
var P2 = P1 + $('#materialName' + userid).val() ;
var P3 = P2 + " ( " + $('#materialCode' + userid).val() + ' ) ';
$("#EditMaterialCode").append($('<option></option>').val($('#materialCode' + userid).val()).html(P3));
var isAdded = "0";
for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) {
@ -1891,8 +1905,8 @@ if (!empty($INRSYMBOL)) {
if (isAdded == "0") {
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
}
}
@ -1919,6 +1933,11 @@ if (!empty($INRSYMBOL)) {
var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').val();
var selectedText = $('#MaterialCode option:selected').text();
var parts = selectedText.split('-');
var HSN = selectedText.includes('-') && /^\d+$/.test(parts[0].trim())
? parts[0].trim()
: '';
var materialName = $("#ItemName").val();
var uom = $("#UOM").val();
@ -1991,6 +2010,7 @@ if (!empty($INRSYMBOL)) {
<td style="text-align:center !important">${Reqnumber}</td>
<td>${materialCode}</td>
<td>${shorten}</td>
<td>${HSN}</td>
<td>
<a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a>

View File

@ -335,7 +335,11 @@
</div>
</div>
<?php if (session()->getFlashdata('error')): ?>
<?php
use PhpOffice\PhpSpreadsheet\Reader\Xml\Style\NumberFormat;
if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger">
<?= session()->getFlashdata('error'); ?>
</div>
@ -361,9 +365,7 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
readonly>
</div>
@ -393,12 +395,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-plus-circle btn-lg mt-2"
<i class="fa fa-plus-circle btn-lg mt-2 auditor-restricted-btn"
title="Add Entry"
data-target="#coatingMachineDetailModal"
data-toggle="modal"
@ -636,7 +638,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary submit-btn">Save </button>
<button type="submit" class="btn btn-primary submit-btn auditor-restricted-btn">Save </button>
</div>
</form>
</div>
@ -840,7 +842,7 @@
<div class="form-row" id="editBatchCardRowId">
<!-- batch card file upload -->
<div class="form-group col-md-4">
<div class="form-group auditor-restricted col-md-4">
<label for="editBatchCardId">Upload Batch Card</label>
<br>
@ -857,7 +859,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="cancelBtn">Cancel</button>
<button type="submit" class="btn btn-primary submit-btn">Save </button>
<button type="submit" class="btn btn-primary submit-btn auditor-restricted-btn">Save </button>
</div>
</form>
</div>
@ -999,15 +1001,15 @@
<!-- td:eq(6) -->
<td class="celda_normal"><?php echo $record['grade'] ?? ' ' ?></td>
<!-- td:eq(7) -->
<td class="celda_normal"><?php echo $record['totalCoating'] ?></td>
<td class="celda_normal"><?php echo number_format((float)$record['totalCoating'],2) ?></td>
<!-- td:eq(8) -->
<td class="celda_normal"><?php echo $record['totalCoatingSandInKg'] ?></td>
<td class="celda_normal"><?php echo number_format((float)$record['totalCoatingSandInKg'],2) ?></td>
<!-- td:eq(9) -->
<td class="celda_normal"><?php echo $record['totalGasConsumption'] ?></td>
<td class="celda_normal"><?php echo number_format((float)$record['totalGasConsumption'],2) ?></td>
<!-- td:eq(10) -->
<td class="celda_normal"><?php echo round($record['perHourGasConsumption']) ?? '' ?></td>
<td class="celda_normal"><?php echo number_format($record['perHourGasConsumption'], 2) ?? '' ?></td>
<!-- td:eq(11) -->
<td class="celda_normal"><?php echo round($record['perHourCoatingSandQTY']) ?? '' ?></td>
<td class="celda_normal"><?php echo number_format($record['perHourCoatingSandQTY'] , 2) ?? '' ?></td>
<!-- td:eq(12) -->
<!-- edit and download option..!! -->
<td class="celda_normal">
@ -1077,11 +1079,11 @@
<td class="celda_normal "> <?= $summary['totalMachineRunningHrs'] ?></td>
<td class="celda_normal "> - </td>
<td class="celda_normal "> - </td>
<td class="celda_normal "><?= $summary['totalCoating'] ?></td>
<td class="celda_normal "><?= $summary['totalCoatingSandInKg'] ?></td>
<td class="celda_normal "><?= $summary['totalGasConsumption'] ?></td>
<td class="celda_normal "><?= round($summary['totalGasConsumption'] / $summary['totalMachineRunningHrs']) ?> (A)</td>
<td class="celda_normal "><?= round($summary['totalCoatingSandInKg'] / $summary['totalMachineRunningHrs']) ?> (A)</td>
<td class="celda_normal "><?= number_format($summary['totalCoating'],2) ?></td>
<td class="celda_normal "><?= number_format($summary['totalCoatingSandInKg'],2) ?></td>
<td class="celda_normal "><?= number_format($summary['totalGasConsumption'],2) ?></td>
<td class="celda_normal "><?= number_format($summary['totalGasConsumption'] / $summary['totalMachineRunningHrs'] , 2) ?> (A)</td>
<td class="celda_normal "><?= number_format($summary['totalCoatingSandInKg'] / $summary['totalMachineRunningHrs'], 2) ?> (A)</td>
</tr>
</tfoot>
@ -1296,7 +1298,7 @@
<script>
function confirmDelete(event) {
let result = confirm(` Do you Confirm to Delete the Coating Machine Detail?`);
let result = confirm(`Do you Confirm to Delete the Coating Machine Detail?`);
if (result) {
return result;
} else {
@ -1314,8 +1316,7 @@
$('#editMachineOffTimeHrId ').select2();
$('#fromDateFilter ').select2();
$('#toDateFilter ').select2();
});
});
</script>
@ -1364,10 +1365,10 @@
<label for="">Change Batch Card</label>
<input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" >
<p>( Previously Uploaded File ${element.client_given_name} )</p>
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch" data-id="${element.batchCardId}">Remove</button>
<button type="button" class="btn btn-danger btn-sm mt-2 removeBatch auditor-restricted-btn" data-id="${element.batchCardId}" style="display: none;">Remove</button>
</div>`;
$('#editBatchCardRowId').append(string)
$('#editBatchCardRowId').append(string);
});
@ -1459,7 +1460,6 @@
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
if (!machineRunningInHrs) {
$('#machineOffTimeHrId').val('');
return
}
@ -1467,12 +1467,31 @@
$('#totalCoatingSandId').trigger('change');
$('#totalGasConsumptionId').trigger('change');
})
$('#totalCoatingId , #shiftId , #gradeId').change(function(){
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
})
$('#totalCoatingSandId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalCoatingSandValue = $(this).val();
let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
@ -1486,6 +1505,15 @@
$('#totalGasConsumptionId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalGasConsumptionValue = $(this).val();
let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
if (totalGasConsumptionValue && machineRunningInHrsValue) {
@ -1496,14 +1524,6 @@
})
})
</script>
<!-- calculations for some fields needed in onChange while editing coating machine details -->
<script>
$(document).ready(function() {
$('#editMachineOnTimeHrId , #editDateId').change(function() {
@ -1562,11 +1582,34 @@
})
$('#editTotalCoatingId , #editShiftId , #editGradeId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
})
$('#editTotalCoatingSandId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalCoatingSandValue = $(this).val();
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
if (totalCoatingSandValue && machineRunningInHrsValue) {
let perHourCoatingSandQTYValue = (totalCoatingSandValue / machineRunningInHrsValue).toFixed(2);
$('#editPerHourCoatingSandQTYId').val(perHourCoatingSandQTYValue);
@ -1577,6 +1620,13 @@
$('#editTotalGasConsumptionId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalGasConsumptionValue = $(this).val();
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
if (totalGasConsumptionValue && machineRunningInHrsValue) {
@ -1587,6 +1637,16 @@
})
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
})
</script>
@ -1651,15 +1711,15 @@
$('#changeMonthForm').submit();
});
$(document).ready(function(){
$('#month').datepicker({
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
@ -1712,48 +1772,59 @@
<script>
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let rows = [];
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let rows = [];
// Extract table data row-by-row
$(table).find('tr').each(function(rowIndex) {
let rowData = [];
// Extract table data row-by-row
$(table).find('tr').each(function(rowIndex) {
let rowData = [];
$(this).find('th, td').each(function(colIndex) {
// Skip hidden columns
if ($(this).css('display') === 'none') return;
$(this).find('th, td').each(function(colIndex) {
// Skip hidden columns
if ($(this).css('display') === 'none') return;
let cellText = $(this).text().trim();
rowData.push(cellText);
});
// Add the cleaned row only if it has data
if (rowData.length > 0) {
rows.push(rowData);
}
let cellText = $(this).text().trim();
rowData.push(cellText);
});
// Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows);
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'coatingMachineDetailTableId';
document.getElementById('coatingMachineDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'coatingMachineDetails_<?= $month ?>.xlsx');
// Add the cleaned row only if it has data
if (rowData.length > 0) {
rows.push(rowData);
}
});
// Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows);
// Set column widths: wch: 10 for each column
if (rows.length > 0) {
const colCount = rows[0].length;
const wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 });
}
ws['!cols'] = wscols;
}
// Create a new workbook and add the sheet
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
// Write the workbook to a file
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'coatingMachineDetailTableId';
document.getElementById('coatingMachineDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'coatingMachineDetails_<?= $month ?>.xlsx');
});
});
</script>
<script>
$(document).ready(function() {
$('#batchCardAddBtnId').click(function() {
@ -1883,7 +1954,7 @@
});
// Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function () {
$('#filterModalId').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});

View File

@ -272,6 +272,11 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -328,9 +333,20 @@ foreach ($period as $day) {
<div class="row">
<div class="col-12">
<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>
<form id="changeMonthForm" action="<?= base_url('bagStockDetails'); ?>" method="post">
@ -384,12 +400,12 @@ foreach ($period as $day) {
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fas fa-save btn-lg mt-2"
<i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
@ -598,14 +614,14 @@ foreach ($period as $day) {
foreach ($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails) {
$currentDate = date('Y-m-d');
?>
<tr
<tr class="<?=$bagStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $bagStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
if ($bagStockDetails[0]['date'] === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
@ -676,6 +692,7 @@ foreach ($period as $day) {
'receipt' => 0,
'used' => 0,
'balanceStock' => 0,
'materialCode' => $materialCode,
];
}
@ -701,10 +718,14 @@ foreach ($period as $day) {
?>
<td class="celda_normal "><?= $each['opening'] ?></td>
<td class="celda_normal "><?= $each['receipt'] ?></td>
<td class="celda_normal "><?= $each['used'] ?></td>
<td class="celda_normal "><?= $each['balanceStock'] ?></td>
<td class="celda_normal openingStock"
data-id="footer <?=$each['materialCode']?>"></td>
<td class="celda_normal receiptStock"
data-id="footer <?=$each['materialCode']?>"> <?= $each['receipt'] == 0 ? " " : $each['receipt'] ?> </td>
<td class="celda_normal usedStock"
data-id="footer <?=$each['materialCode']?>"> <?= $each['used'] == 0 ? " " : $each['used'] ?></td>
<td class="celda_normal balanceStock"
data-id="footer <?=$each['materialCode']?>"></td>
<?php } ?>
@ -714,95 +735,125 @@ foreach ($period as $day) {
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else {
// dd($bagMaterials);
// dd($previousMonthBagStockDetails);
?>
<?php } else {
?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
<?php
?>
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<?php
foreach ($bagMaterials as $bagMaterialIndex => $bagMaterial) { ?>
<!-- this will loop till materials present -->
<?php if ($bagMaterialIndex == 0): ?>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<td class="celda_normal">
<?= $startDate ?>
</td>
<?php endif; ?>
<td class="celda_normal" style="display:none">
<?= $dateInMonth ?>
</td>
<td class="celda_normal" style="display:none"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['MaterialCode'] ?>
</td>
<td class="celda_normal customer" style="display:none"
data-materialCode="<?= $bagMaterial['MaterialCode'] ?>"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['customers'] ?>
</td>
<td class="celda_normal openingStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingStockChange(this)"
contenteditable="true"
<?php } ?>>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"';
}
}
?>
</td>
<td class="celda_normal receiptStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="receiptStockChange(this)"
contenteditable="true"> <?= " " ?> </td>
<td class="celda_normal usedStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="usedStockChange(this)" contenteditable="true"> <?= " " ?> </td>
<td class="celda_normal balanceStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
?>>
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
}
}
?>
</td>
foreach ($bagMaterials as $bagMaterialIndex => $bagMaterial) { ?>
<!-- this will loop till materials present -->
<?php if ($bagMaterialIndex == 0): ?>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<td class="celda_normal">
<?= $startDate ?>
</td>
<?php endif; ?>
<td class="celda_normal" style="display:none">
<?= $dateInMonth ?>
</td>
<td class="celda_normal" style="display:none"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['MaterialCode'] ?>
</td>
<td class="celda_normal customer" style="display:none"
data-materialCode="<?= $bagMaterial['MaterialCode'] ?>"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['customers'] ?>
</td>
<td class="celda_normal openingStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingStockChange(this)"
contenteditable="true"
<?php } ?>>
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
}
}
?>
</td>
<td class="celda_normal receiptStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="receiptStockChange(this)"
contenteditable="true"> <?= " " ?> </td>
<td class="celda_normal usedStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="usedStockChange(this)" contenteditable="true"> <?= " " ?> </td>
<td class="celda_normal balanceStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
}
}
?>
</td>
<?php } ?>
</tr>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<?php foreach ($bagMaterials as $each) {
?>
<td class="celda_normal openingStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<td class="celda_normal receiptStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<td class="celda_normal usedStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<td class="celda_normal balanceStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<?php } ?>
</tr>
</tfoot>
<?php } ?>
</tbody>
@ -914,9 +965,8 @@ foreach ($period as $day) {
var updateBagStockDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateBagStockDetails
@ -928,8 +978,7 @@ foreach ($period as $day) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
showMessage(data);
}
},
@ -988,6 +1037,13 @@ foreach ($period as $day) {
<script>
function openingStockChange(tdElement) {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
try {
let dataId = tdElement.getAttribute('data-id');
@ -1005,6 +1061,14 @@ foreach ($period as $day) {
updateStockValue(date, materialCode, currentBalanceStock)
let table = document.getElementById('bagStockDetailsTableId');
let column1 = 'usedStock';
let column2 = 'receiptStock';
calculateTotal(table, dataId, column1);
calculateTotal(table, dataId, column2);
} catch (error) {
@ -1016,6 +1080,13 @@ foreach ($period as $day) {
function receiptStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
@ -1030,7 +1101,15 @@ foreach ($period as $day) {
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
updateStockValue(date, materialCode, currentBalanceStock)
updateStockValue(date, materialCode, currentBalanceStock);
let table = document.getElementById('bagStockDetailsTableId');
let column1 = 'usedStock';
let column2 = 'receiptStock';
calculateTotal(table, dataId, column1);
calculateTotal(table, dataId, column2);
} catch (error) {
@ -1046,6 +1125,13 @@ foreach ($period as $day) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
@ -1060,7 +1146,16 @@ foreach ($period as $day) {
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock;
updateStockValue(date, materialCode, currentBalanceStock)
updateStockValue(date, materialCode, currentBalanceStock);
let table = document.getElementById('bagStockDetailsTableId');
let column1 = 'usedStock';
let column2 = 'receiptStock';
calculateTotal(table, dataId, column1);
calculateTotal(table, dataId, column2);
} catch (error) {
@ -1128,12 +1223,21 @@ foreach ($period as $day) {
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
return input;
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
@ -1141,60 +1245,70 @@ foreach ($period as $day) {
<script>
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
$(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden rows
$(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden columns
$(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') {
$(this).remove();
}
});
$(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date)
// Remove hidden columns
$(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') {
$(this).remove();
}
});
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
// Convert Date Format and align date column
$(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0);
let originalDate = firstTd.text().trim();
let parts = originalDate.split('-');
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate);
}
firstTd.css("text-align", "left");
});
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY
firstTd.text(formattedDate); // Update the cell value
}
// Create a new workbook
let wb = XLSX.utils.book_new();
// Apply left alignment to the date column
firstTd.css("text-align", "left");
// Convert the modified table to a sheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
// Set custom column widths based on number of columns in the table header
const columnWidth = 10;
const wscols = [];
});
// Count the number of visible columns in the table after hidden ones are removed
let visibleColumnCount = $(cloneTable).find('thead tr th').length;
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
for (let i = 0; i < visibleColumnCount; i++) {
wscols.push({ wch: columnWidth });
}
ws['!cols'] = wscols;
// Append the sheet to the workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
let tableId = 'bagStockDetailsTableId';
// Write the workbook to a file
XLSX.writeFile(wb, filename || 'export.xlsx');
}
document.getElementById('bagStockExport').addEventListener('click', function() {
let tableId = 'bagStockDetailsTableId';
exportTableToExcel(tableId, 'Bag_Stock_Details<?= $month ?>.xlsx');
document.getElementById('bagStockExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'Bag_Stock_Details<?= $month ?>.xlsx');
});
})
})
});
</script>
<script>
document.addEventListener("keydown", function(event) {
@ -1327,11 +1441,14 @@ foreach ($period as $day) {
})
$('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025"
minViewMode: 1, // Month-Year Picker
autoclose: true,
todayHighlight: true
}).on('focus', function() {
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
});
@ -1431,4 +1548,77 @@ foreach ($period as $day) {
}, 200);
});
});
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
let materialCode = dataId.split(' ')[1];
rows.forEach(row => {
let date = row.querySelector('td:first-child').innerText.trim().split('-');
date = date[2] + "-" + date[1] + "-" + date[0]; // Convert to YYYY-MM-DD format
let cell = row.querySelector(`td.${column}[data-id="${date} ${materialCode}"]`);
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value;
}
});
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${materialCode}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2); // Set the total value in the footer cell
}
// let footerColumnOpeningStock = table.querySelector(`tfoot tr td.openingStock[data-id="footer ${materialCode}`)??0;
// let footerColumnReceiptStock = table.querySelector(`tfoot tr td.receiptStock[data-id="footer ${materialCode}`)??0;
// let footerColumnUsedStock = table.querySelector(`tfoot tr td.usedStock[data-id="footer ${materialCode}`)??0;
// let footerColumnBalanceStock = table.querySelector(`tfoot tr td.balanceStock[data-id="footer ${materialCode}`);
// footerColumnOpeningStock.innerText = "-";
// footerColumnBalanceStock.innerText = ( parseFloat(footerColumnOpeningStock.innerText.trim())
// +
// parseFloat(footerColumnReceiptStock.innerText.trim())
// )
// -
// parseFloat(footerColumnUsedStock.innerText.trim()) ;
// footerColumnBalanceStock.innerText = "-";
}
</script>

View File

@ -260,6 +260,13 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -319,6 +326,19 @@ foreach ($period as $day) {
<div class="col-12">
<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>
<form id="changeMonthForm" action="<?= base_url('dieselMachineDetails'); ?>" method="post">
@ -368,17 +388,17 @@ foreach ($period as $day) {
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="bagStockExport">
id="dieselMachineStockDetailsExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fas fa-save btn-lg mt-2"
<i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
@ -581,17 +601,17 @@ foreach ($period as $day) {
foreach ($groupedDieselMachineStockDetails as $rowIndex => $dieselStockDetails) {
$currentDate = date('Y-m-d');
?>
<tr
<tr class="<?=$dieselStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dieselStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if ($dieselStockDetails[0]['date'] === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<?php
@ -744,6 +764,7 @@ foreach ($period as $day) {
'consumption' => 0,
'running_hours' => 0,
'mileage' => 0,
'machineId' => $machineId,
];
}
@ -782,21 +803,39 @@ foreach ($period as $day) {
</td>
<td class="celda_normal "><?= $summary['openingStock'] ?></td>
<td class="celda_normal "><?= $summary['totalPurchaseDiesel'] ?></td>
<td class="celda_normal "><?= $summary['totalFillingDiesel'] ?></td>
<td class="celda_normal "><?= $summary['balanceStock'] ?></td>
<td class="celda_normal openingTD"
data-id="footer openingTD"></td>
<td class="celda_normal purchaseTD"
data-id="footer purchaseTD"><?= $summary['totalPurchaseDiesel'] ?></td>
<td class="celda_normal fillingTD"
data-id="footer fillingTD"><?= $summary['totalFillingDiesel'] ?></td>
<td class="celda_normal balanceTD"
data-id="footer balanceTD"></td>
<?php foreach ($summary as $each) {
if (is_array($each)) {
?>
<td class="celda_normal "><?= $each['opening_reading'] ?> </td>
<td class="celda_normal "><?= $each['closing_reading'] ?></td>
<td class="celda_normal "><?= $each['filling_diesel'] ?></td>
<td class="celda_normal "><?= $each['consumption'] ?></td>
<td class="celda_normal "><?= $each['running_hours'] ?></td>
<td class="celda_normal "><?= $each['mileage'] ?></td>
<td class="celda_normal openingReading"
data-id="footer <?=$each['machineId']?>" > </td>
<td class="celda_normal closingReading"
data-id="footer <?=$each['machineId']?>" ></td>
<td class="celda_normal fillingDiesel"
data-id="footer <?=$each['machineId']?>" ><?= $each['filling_diesel'] ?></td>
<td class="celda_normal consumption"
data-id="footer <?=$each['machineId']?>" ><?= $each['consumption'] ?></td>
<td class="celda_normal runningHours"
data-id="footer <?=$each['machineId']?>" ><?= $each['running_hours'] ?></td>
<td class="celda_normal mileage"
data-id="footer <?=$each['machineId']?>" ><?= $each['mileage'] ?></td>
<?php
}
@ -811,18 +850,20 @@ foreach ($period as $day) {
<!-- this else condition work if groupeddieselStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else { ?>
<?php } else {?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
@ -1017,6 +1058,59 @@ foreach ($period as $day) {
<?php } ?>
</tr>
<?php } ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal openingTD" style="color:rgb(235, 236, 203);"
data-id="footer openingTD"></td>
<td class="celda_normal purchaseTD"
data-id="footer purchaseTD"></td>
<td class="celda_normal fillingTD"
data-id="footer fillingTD"></td>
<td class="celda_normal balanceTD" style="color:rgb(235, 236, 203);"
data-id="footer balanceTD"></td>
<?php foreach ($dieselMachines as $each) {
if (is_array($each)) {
?>
<td class="celda_normal openingReading" style="color:rgb(235, 236, 203);"
data-id="footer <?=$each['id']?>" > </td>
<td class="celda_normal closingReading" style="color:rgb(235, 236, 203);"
data-id="footer <?=$each['id']?>" > </td>
<td class="celda_normal fillingDiesel"
data-id="footer <?=$each['id']?>" > </td>
<td class="celda_normal consumption"
data-id="footer <?=$each['id']?>" > </td>
<td class="celda_normal runningHours"
data-id="footer <?=$each['id']?>" > </td>
<td class="celda_normal mileage"
data-id="footer <?=$each['id']?>" > </td>
<?php
}
}
?>
</tr>
</tfoot>
<?php } ?>
@ -1123,10 +1217,9 @@ foreach ($period as $day) {
var updateDieselMachineDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
$.ajax({
data: {
updateDieselMachineDetails
},
@ -1135,16 +1228,13 @@ foreach ($period as $day) {
success: function(data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
showMessage(data);
}
},
error: function(xhr, status, error) {
alert("An error occurred while processing the request. Please try again.");
showMessage("An error occurred while processing the request. Please try again.");
console.error("Error Code:", xhr.status);
console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText);
@ -1223,6 +1313,15 @@ foreach ($period as $day) {
function openingReadingChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let openingReading = validateInput(tdElement.innerText);
@ -1235,7 +1334,16 @@ foreach ($period as $day) {
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2);
updateStockValue(date, machine_id, closingReading)
updateStockValue(date, machine_id, closingReading);
let table = document.getElementById('dieselStockDetailsTableId');
let column1 = 'runningHours';
let column2 = 'mileage';
calculateTotal(table,dataId,column1)
calculateTotal(table,dataId,column2)
} catch (error) {
@ -1248,6 +1356,15 @@ foreach ($period as $day) {
function closingReadingChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let closingReading = validateInput(tdElement.innerText);
@ -1259,8 +1376,16 @@ foreach ($period as $day) {
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2);
updateStockValue(date, machine_id, closingReading)
updateStockValue(date, machine_id, closingReading);
let table = document.getElementById('dieselStockDetailsTableId');
let column1 = 'runningHours';
let column2 = 'mileage';
calculateTotal(table,dataId,column1)
calculateTotal(table,dataId,column2)
} catch (error) {
@ -1273,6 +1398,15 @@ foreach ($period as $day) {
function consumptionChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let closingReading = validateInput(document.querySelector(`td.closingReading[data-id="${dataId}"]`).innerText);
@ -1284,7 +1418,16 @@ foreach ($period as $day) {
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2);
updateStockValue(date, machine_id, closingReading)
updateStockValue(date, machine_id, closingReading);
let table = document.getElementById('dieselStockDetailsTableId');
let column1 = 'consumption';
let column2 = 'mileage';
calculateTotal(table,dataId,column1)
calculateTotal(table,dataId,column2)
} catch (error) {
@ -1298,6 +1441,15 @@ foreach ($period as $day) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(" ");
@ -1327,6 +1479,17 @@ foreach ($period as $day) {
updateTotalStockValue(date, balanceTD);
let table = document.getElementById('dieselStockDetailsTableId');
let column1 = 'fillingDiesel';
let column2 = 'fillingTD';
let column3 = 'purchaseTD';
calculateTotal(table,dataId,column1);
calculateTotal(table,date,column2);
calculateTotal(table,date,column3);
} catch (error) {
@ -1344,6 +1507,14 @@ foreach ($period as $day) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let openingTD = validateInput(tdElement.innerText);
@ -1355,7 +1526,17 @@ foreach ($period as $day) {
document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2);
updateTotalStockValue(dataId, balanceTD)
updateTotalStockValue(dataId, balanceTD);
let table = document.getElementById('dieselStockDetailsTableId');
let column1 = 'fillingTD';
let column2 = 'purchaseTD';
calculateTotal(table,dataId,column1);
calculateTotal(table,dataId,column2);
} catch (error) {
@ -1369,6 +1550,16 @@ foreach ($period as $day) {
function purchaseTDStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let purchaseTD = validateInput(tdElement.innerText);
let openingTD = validateInput(document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText);
@ -1381,6 +1572,18 @@ foreach ($period as $day) {
updateTotalStockValue(dataId, balanceTD);
let table = document.getElementById('dieselStockDetailsTableId');
let column1 = 'fillingTD';
let column2 = 'purchaseTD';
calculateTotal(table,dataId,column1);
calculateTotal(table,dataId,column2);
} catch (error) {
@ -1405,12 +1608,23 @@ foreach ($period as $day) {
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
return input;
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<script>
@ -1546,7 +1760,17 @@ foreach ($period as $day) {
});
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
// Convert modified table to sheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
// Set custom column widths (wch: 10 for each)
const colCount = $(cloneTable).find('tr').first().find('th, td').length;
const wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 });
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
@ -1656,7 +1880,7 @@ foreach ($period as $day) {
window.removeSelectedMaterial = function(checkbox) {
let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value;
let machineId = checkbox.value;
let materialName = container.querySelector("label").innerText;
container.remove();
@ -1667,17 +1891,17 @@ foreach ($period as $day) {
let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") {
let materialCode = selectedOption.value;
let machineId = selectedOption.value;
let materialName = selectedOption.text;
let container = document.createElement("div");
container.classList.add("sortable-item");
container.id = materialCode + "_container";
container.id = machineId + "_container";
container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId"
name="customisedMachineCodes[]" value="${materialCode}"
<input type="checkbox" id="${machineId}_checkboxId"
name="customisedMachineCodes[]" value="${machineId}"
onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label>
<label class="grab" for="${machineId}_checkboxId"> ${materialName} </label>
<br>
`;
@ -1706,8 +1930,12 @@ foreach ($period as $day) {
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>
@ -1778,25 +2006,160 @@ foreach ($period as $day) {
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
$('#fullscreenBtn').click(function() {
// Show fullscreen container
$('#fullscreenDiv').show();
// Request fullscreen
if (document.fullscreenElement == null) {
document.getElementById('fullscreenDiv').requestFullscreen();
}
// Move the modal backdrop when a modal opens
$('#bs-example-modal-lg, #customizeModalId').on('show.bs.modal', function() {
moveModalBackdropToFullscreen();
// Add custom backdrop
$('#fullscreenDiv').prepend('<div class="custom-backdrop"></div>');
// Move modal into fullscreen div and show it manually
$('#fullscreenDiv').append($('#customizeModalId'));
$('#customizeModalId').modal('show');
});
// On modal close, clean up
$('#customizeModalId').on('hidden.bs.modal', function () {
$('.custom-backdrop').remove();
$('#fullscreenDiv').hide();
if (document.fullscreenElement) {
document.exitFullscreen();
}
});
});
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
let machineId = dataId.split(' ')[1]??'';
console.log("here")
rows.forEach(row => {
let date = row.querySelector('td:first-child').innerText.trim().split('-');
date = date[2] + "-" + date[1] + "-" + date[0]; // Convert to YYYY-MM-DD format
let cell = null;
if(machineId) {
cell = row.querySelector(`td.${column}[data-id="${date} ${machineId}"]`);
}else{
cell = row.querySelector(`td.${column}[data-id="${date}"]`);
console.log('inside machine id not present');
}
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value;
}
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
if(machineId) {
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${machineId}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2);
}
// let footerColumnOpeningReading = table.querySelector(`tfoot tr td.openingReading[data-id="footer ${machineId}`)??0;
// let footerColumnClosingReading = table.querySelector(`tfoot tr td.closingReading[data-id="footer ${machineId}`)??0;
// let footerColumnFillingReading = table.querySelector(`tfoot tr td.fillingDiesel[data-id="footer ${machineId}`)??0;
// let footerColumnConsumption = table.querySelector(`tfoot tr td.consumption[data-id="footer ${machineId}`);
// let footerColumnMachineRunningHours = table.querySelector(`tfoot tr td.runningHours[data-id="footer ${machineId}`)??0;
// let footerColumnMileage = table.querySelector(`tfoot tr td.mileage[data-id="footer ${machineId}`);
// footerColumnMachineRunningHours.innerText = isNaN(
// (parseFloat(footerColumnClosingReading.innerText.trim())
// -
// parseFloat(footerColumnOpeningReading.innerText.trim()))
// ) ? " " :
// (parseFloat(footerColumnClosingReading.innerText.trim())
// -
// parseFloat(footerColumnOpeningReading.innerText.trim())).toFixed(2);
// footerColumnMileage.innerText = (
// isNaN(parseFloat(footerColumnConsumption.innerText.trim()))
// ||
// isNaN(parseFloat(footerColumnMachineRunningHours.innerText.trim()))
// ||
// parseFloat(footerColumnMachineRunningHours.innerText.trim()) === 0
// ) ? " " :
// (parseFloat(footerColumnConsumption.innerText.trim()) / parseFloat(footerColumnMachineRunningHours.innerText.trim())).toFixed(2);
}else{
// Update the total cell in the footer for TD
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${column}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal;
}
// let footerColumnOpeningTD = table.querySelector(`tfoot tr td.openingTD[data-id="footer openingTD`)??0;
// let footerColumnPurchaseTD = table.querySelector(`tfoot tr td.purchaseTD[data-id="footer purchaseTD`)??0;
// let footerColumnFillingTD = table.querySelector(`tfoot tr td.fillingTD[data-id="footer fillingTD`)??0;
// let footerColumnBalanceTD = table.querySelector(`tfoot tr td.balanceTD[data-id="footer balanceTD`);
// footerColumnOpeningTD.innerText = " ";
// footerColumnBalanceTD.innerText = " ";
// footerColumnBalanceTD.innerText = ( parseFloat(footerColumnOpeningTD.innerText.trim())
// +
// parseFloat(footerColumnPurchaseTD.innerText.trim())
// )
// -
// parseFloat(footerColumnFillingTD.innerText.trim());
}
}
</script>

View File

@ -327,9 +327,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<input type="text" name="month" id="month" value="<?php echo "$datefordropdown" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
readonly>
</div>
@ -359,12 +357,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-plus-circle btn-lg mt-2"
<i class="fa fa-plus-circle btn-lg mt-2 auditor-restricted-btn"
title="Add Entry"
data-target="#additionalEntriesModalId"
data-toggle="modal"
@ -471,12 +469,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="row">
<div class="col-md-3">
<label class="form" for="additionalEntryDateId">Date</label>
<span class="text-danger">*</span>
<input type="date" class="form-control" id="additionalEntryDateId" name="date" value="<?= $calendarCurrentDate ?>"
min="<?= $calendarStartDate ?>" max="<?= $calendarEndDate ?>" required>
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label>
<span class="text-danger">*</span>
<select onchange="calculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="additionalEntryDrierOnTimeId" name="drier_on_time">
@ -488,7 +487,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryDrierOffTimeId">Drier Off Time</label>
<span class="text-danger">*</span>
<select onchange="calculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="additionalEntryDrierOffTimeId" name="drier_off_time">
@ -512,6 +511,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- supplier name -->
<div class="col-md-3">
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
<span class="text-danger">*</span>
<select class="timeDropdown supplier_name select2" style="width: 300px;" required
id="additionalEntrySupplierNameId" name="supplier_name">
<option value="">Select</option>
@ -523,7 +523,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- input sand qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity (Metric Ton)</label>
<label class="form" for="additionalEntryInputSandQtyId">Input Sand Quantity (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="" required>
</div>
@ -531,7 +532,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- input sand moisture -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value="" required>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value=""
onchange="additionalEntryInputSandMoisture();"
required>
</div>
@ -539,6 +543,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- sand dried qty -->
<div class="col-md-3">
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="" required>
</div>
@ -552,13 +557,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- total gas consumption -->
<div class="col-md-3">
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
</div>
<!-- gas per ton -->
<div class="col-md-3">
<label class="form" for="additionalEntryGasPerTonId">Gas per Ton</label>
<label class="form" for="additionalEntryGasPerTonId">Gas / Ton</label>
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="gas_per_ton" value="" required
readonly>
</div>
@ -566,7 +572,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- qty per hours -->
<div class="col-md-3">
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
<label class="form" for="additionalEntryQtyPerHoursId">Qty / Hours</label>
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value="" required
readonly>
</div>
@ -586,14 +592,18 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- dust qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryDustQtyId">Dust Qty (Metric Ton)</label>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value="" required>
<label class="form" for="additionalEntryDustQtyId">Dust Qty (Kgs)</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value=""
onchange="additionalEntryDustQty();"
required>
</div>
<!-- customer name -->
<div class="col-md-3">
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="customer_name" value="" required>
</div>
@ -627,13 +637,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="row">
<div class="col-md-3">
<label class="form" for="editEntryDateId">Date</label>
<span class="text-danger">*</span>
<input type="date" class="form-control" id="editEntryDateId" name="date" value=""
required readonly>
</div>
<div class="col-md-3">
<label class="form" for="editEntryDrierOnTimeId">Drier On Time</label>
<select onchange="editEntryCalculateMachineRunningHrs()"
<span class="text-danger">*</span>
<select onchange="editEntryCalculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="editEntryDrierOnTimeId" name="drier_on_time">
<option value="">Select</option>
@ -644,8 +655,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div>
<div class="col-md-3">
<label class="form" for="editEntryDrierOffTimeId">Drier Off Time</label>
<select onchange="editEntryCalculateMachineRunningHrs()"
<span class="text-danger">*</span>
<select onchange="editEntryCalculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;"
id="editEntryDrierOffTimeId" name="drier_off_time">
<option value="">Select</option>
@ -668,7 +679,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- supplier name -->
<div class="col-md-3">
<label class="form" for="editEntrySupplierNameId">Supplier Name</label>
<select class="timeDropdown supplier_name select2" style="width: 300px;"
<span class="text-danger">*</span>
<select class="timeDropdown supplier_name select2" style="width: 300px;" required
id="editEntrySupplierNameId" name="supplier_name" value="">
<option value="">Select</option>
<?php foreach ($supplierData as $key => $value) { ?>
@ -679,15 +691,19 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- input sand qty -->
<div class="col-md-3">
<label class="form" for="editEntryInputSandQtyId">Input sand Quantity (Metric Ton)</label>
<label class="form" for="editEntryInputSandQtyId">Input Sand Quantity (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); "
type="text" class="form-control" id="editEntryInputSandQtyId" name="input_sand_qty" value="">
type="text" class="form-control" id="editEntryInputSandQtyId" name="input_sand_qty" value="" required>
</div>
<!-- input sand moisture -->
<div class="col-md-3">
<label class="form" for="editEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<input type="text" class="form-control" id="editEntryInputSandMoistureId" name="input_sand_moisture" value="">
<span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryInputSandMoistureId" name="input_sand_moisture" value=""
onchange="editEntryInputSandMoisture();"
required>
</div>
@ -695,8 +711,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- sand dried qty -->
<div class="col-md-3">
<label class="form" for="editEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); "
type="text" class="form-control" id="editEntrySandDriedQtyId" name="sand_dried_qty" value="">
type="text" class="form-control" id="editEntrySandDriedQtyId" name="sand_dried_qty" value="" required>
</div>
@ -708,21 +725,22 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- total gas consumption -->
<div class="col-md-3">
<label class="form" for="editEntryTotalGasConsumptionId">Total Gas Consumption</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); "
type="text" class="form-control" id="editEntryTotalGasConsumptionId" name="total_gas_consumption" value="">
type="text" class="form-control" id="editEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
</div>
<!-- gas per ton -->
<div class="col-md-3">
<label class="form" for="editEntryGasPerTonId">Gas per Ton</label>
<input type="text" class="form-control" id="editEntryGasPerTonId" name="gas_per_ton" value=""
<label class="form" for="editEntryGasPerTonId">Gas / Ton</label>
<input type="text" class="form-control" id="editEntryGasPerTonId" name="gas_per_ton" value=""
readonly>
</div>
<!-- qty per hours -->
<div class="col-md-3">
<label class="form" for="editEntryQtyPerHoursId">Qty per Hours</label>
<label class="form" for="editEntryQtyPerHoursId">Qty / Hours</label>
<input type="text" class="form-control" id="editEntryQtyPerHoursId" name="qty_per_hours" value=""
readonly>
</div>
@ -731,7 +749,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- moisture loss qty -->
<div class="col-md-3">
<label class="form" for="editEntryMoistureLossQtyId">Moisture Loss Qty (Metric Ton)</label>
<input type="text" class="form-control" id="editEntryMoistureLossQtyId" name="moisture_loss_qty" value=""
<input type="text" class="form-control" id="editEntryMoistureLossQtyId" name="moisture_loss_qty" value=""
readonly>
</div>
</div>
@ -742,19 +760,23 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- dust qty -->
<div class="col-md-3">
<label class="form" for="editEntryDustQtyId">Dust Qty (Metric Ton)</label>
<input type="text" class="form-control" id="editEntryDustQtyId" name="dust_qty" value="">
<label class="form" for="editEntryDustQtyId">Dust Qty (Kgs)</label>
<span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryDustQtyId" name="dust_qty" value=""
onchange="editEntryDustQty();"
required>
</div>
<!-- customer name -->
<div class="col-md-3">
<label class="form" for="editEntryCustomerNameId">Customer Name</label>
<input type="text" class="form-control" id="editEntryCustomerNameId" name="customer_name" value="">
<span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryCustomerNameId" name="customer_name" value="" required>
</div>
</div>
<button type="submit" class="btn btn-primary float-right submit-btn">Update</button>
<button type="submit" class="btn btn-primary float-right submit-btn auditor-restricted-btn">Update</button>
<!-- hidden fields -->
@ -791,7 +813,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th class="celda_encabezado_general">Gas Per Ton</th>
<th class="celda_encabezado_general">Qty Per Hrs (Metric Ton)</th>
<th class="celda_encabezado_general">Moisture Loss Qty (Metric Ton)</th>
<th class="celda_encabezado_general">Dust Qty (Metric Ton)</th>
<th class="celda_encabezado_general">Dust Qty (Kgs)</th>
<th class="celda_encabezado_general" align="left">Customer Name</th>
<th class="celda_encabezado_general" style="display:none;">id</th>
@ -879,12 +901,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- td:eq(9) gas_per_ton -->
<td class="celda_normal">
<?php echo round($a['gas_per_ton']); ?>
<?php echo $a['gas_per_ton']; ?>
</td>
<!-- td:eq(10) qty_per_hours -->
<td class="celda_normal">
<?php echo round($a['qty_per_hours']); ?>
<?php echo $a['qty_per_hours']; ?>
</td>
@ -944,8 +966,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$summary['input_sand_qty'] += $a['input_sand_qty'] == "-" ? 0 : (float) $a['input_sand_qty'];
$summary['moisture_loss_qty'] += $a['moisture_loss_qty'] == "-" ? 0 : (float) $a['moisture_loss_qty'];
$summary['sand_dried_qty'] += $a['sand_dried_qty'] == "-" ? 0 : (float) $a['sand_dried_qty'];
$summary['gas_per_ton'] = round(($summary['total_gas_consumption'] / $summary['sand_dried_qty']));
$summary['qty_per_hrs'] = round( ($summary['sand_dried_qty'] / $summary['drier_running_hours']) );
$summary['gas_per_ton'] = number_format(($summary['total_gas_consumption'] / $summary['sand_dried_qty']), 2);
$summary['qty_per_hrs'] = number_format(($summary['sand_dried_qty'] / $summary['drier_running_hours']), 2);
$summary['dust_qty'] += $a['dust_qty'] == "-" ? 0 : (float) $a['dust_qty'];
} ?>
@ -1106,9 +1129,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
hours = parseInt(hours, 10);
// Adjust hours based on AM/PM
if (modifier === "pm" && hours < 12) {
if (modifier === "PM" && hours < 12) {
hours += 12;
} else if (modifier === "am" && hours === 12) {
} else if (modifier === "AM" && hours === 12) {
hours = 0;
}
@ -1172,6 +1195,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let totalGasConsumption = $('#additionalEntryTotalGasConsumptionId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(totalGasConsumption);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (totalGasConsumption != '' && sandDriedQty != '') {
let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2);
@ -1187,6 +1221,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let inputSandQty = $('#additionalEntryInputSandQtyId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(inputSandQty);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (inputSandQty != '' && sandDriedQty != '') {
let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
@ -1203,6 +1248,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let drierRunninhHrs = $('#additionalEntryRunningHrsId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(drierRunninhHrs);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (drierRunninhHrs != '' && sandDriedQty != '') {
let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
@ -1217,13 +1273,38 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
}
function additionalEntryInputSandMoisture(value) {
let sandMoisture = $('#additionalEntryInputSandMoistureId').val();
let basicCheck = checkIsNumber(sandMoisture);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
function additionalEntryDustQty(value) {
let dustQty = $('#additionalEntryDustQtyId').val();
let basicCheck = checkIsNumber(dustQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
// this for edit entry in ten ton f=drier
function editEntryCalculateMachineRunningHrs() {
let dreierMachineOnTime = $('#editEntryDrierOnTimeId').val();
let dreierMachineOnTime = $('#editEntryDrierOnTimeId').val();
let dreierMachineOffTime = $('#editEntryDrierOffTimeId').val();
if (dreierMachineOnTime == dreierMachineOffTime) {
@ -1275,6 +1356,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let totalGasConsumption = $('#editEntryTotalGasConsumptionId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(totalGasConsumption);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (totalGasConsumption != '' && sandDriedQty != '') {
let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2);
@ -1290,6 +1382,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let inputSandQty = $('#editEntryInputSandQtyId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(inputSandQty);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (inputSandQty != '' && sandDriedQty != '') {
let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
@ -1306,6 +1409,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let drierRunninhHrs = $('#editEntryRunningHrsId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').val();
let basicCheck = checkIsNumber(drierRunninhHrs);
let basicCheck2 = checkIsNumber(sandDriedQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (basicCheck2 == 0) {
alert("Kindly Enter Numbers only..!!");
}
if (drierRunninhHrs != '' && sandDriedQty != '') {
let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
@ -1316,6 +1430,41 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
}
}
function editEntryInputSandMoisture(value) {
let sandMoisture = $('#editEntryInputSandMoistureId').val();
let basicCheck = checkIsNumber(sandMoisture);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
function editEntryDustQty(value) {
let dustQty = $('#editEntryDustQtyId').val();
let basicCheck = checkIsNumber(dustQty);
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
}
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<!-- date filter optiond -->
@ -1379,17 +1528,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let rows = [];
// Extract table data row-by-row
$(table).find('tr').each(function(rowIndex) {
$(table).find('tr').each(function() {
let rowData = [];
$(this).find('th, td').each(function(colIndex) {
$(this).find('th, td').each(function() {
// Skip hidden columns
if ($(this).css('display') === 'none') return;
let cellText = $(this).text().trim();
rowData.push(cellText);
});
@ -1401,35 +1547,59 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
// Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows);
// Calculate max column count from the collected rows
let colCount = 0;
rows.forEach(row => {
if (row.length > colCount) colCount = row.length;
});
// Set custom column widths (10 for each column)
const wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 });
}
ws['!cols'] = wscols;
// Create workbook and export
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'drierTable';
document.getElementById('drierMachineDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'drierMachineDetails_<?= $datefordropdown ?>.xlsx');
});
})
})
});
</script>
<!-- script section ends -->
<!-- onchange of month submit will happen -->
<script>
$(document).ready(function() {
$('#month').change(function() {
$('#changeMonthForm').submit();
})
})
$(document).on('change', '#month', function() {
$('#changeMonthForm').submit();
});
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>

View File

@ -297,6 +297,12 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -332,73 +338,84 @@
<div class="card" id="fullscreenDiv">
<div class="card-body">
<form align="center" id="changeMonthForm" action="<?= base_url('dustAndRoughStockDetails'); ?>" method="post">
<div class="row">
<?php $today = date('M-Y'); ?>
<div class="col-3">
</div>
<div class="col-2 mt-2 ml-4">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly
style="max-width: 175px;">
</div>
<div class="col-3 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..."
class="mt-2"
style="padding: 8px;margin-bottom: 10px;width: 150px;border: 2px solid rgb(123, 11, 214);
border-radius: 5px;margin-right:15px;">
<i class="fa fa-table btn-lg mt-2"
title="Date Range Filter"
style="font-size: x-large; cursor:pointer; color:rgb(95, 102, 105)"
data-toggle="modal"
data-target="#filterModalId">
</i>
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="dustAndRoughStockExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-save btn-lg mt-2"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
</i>
</div>
<div class="col-4">
</div>
<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>
</form>
<div align="center">
<form style="width: 700px;" id="changeMonthForm" action="<?= base_url('dustAndRoughStockDetails'); ?>" method="post">
<div class="row">
<?php $today = date('M-Y'); ?>
<div class="col-3 mt-2">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
readonly
style="max-width: 175px;">
</div>
<div class="col-9 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..."
class="mt-2"
style="padding: 8px;margin-bottom: 10px;width: 150px;border: 2px solid rgb(123, 11, 214);
border-radius: 5px;margin-right:15px;">
<i class="fa fa-table btn-lg mt-2"
title="Date Range Filter"
style="font-size: x-large; cursor:pointer; color:rgb(95, 102, 105)"
data-toggle="modal"
data-target="#filterModalId">
</i>
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="dustAndRoughStockExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
</i>
</div>
<div class="col-4">
</div>
</div>
</form>
</div>
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
@ -510,12 +527,12 @@
$summary = [];
foreach ($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail) {
?>
<tr
$currentDate = date('Y-m-d');
?>
<tr class="<?=$dustAndRoughStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dustAndRoughStockDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
if ($dustAndRoughStockDetail['date'] === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
@ -560,9 +577,9 @@
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;"> Total </td>
<td class="celda_normal "> <b> <?= $summary['finalRough'] ?> </b> </td>
<td class="celda_normal "> <b> <?= $summary['dust'] ?> </b> </td>
<td class="celda_normal "> <b> <?= $summary['total'] ?> </b> </td>
<td class="celda_normal finalRough"> <b> <?= $summary['finalRough'] ?> </b> </td>
<td class="celda_normal dust"> <b> <?= $summary['dust'] ?> </b> </td>
<td class="celda_normal total"> <b> <?= $summary['total'] ?> </b> </td>
</tr>
</tfoot>
@ -589,15 +606,15 @@
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?>
<tr
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) {
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
?>
>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
@ -618,8 +635,20 @@
data-id="<?= $dateInMonth ?>"><?= ' ' ?></td>
</tr>
<?php
}
}
}
?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;"> Total </td>
<td class="celda_normal finalRough">0</td>
<td class="celda_normal dust">0</td>
<td class="celda_normal total">0</td>
</tr>
</tfoot>
<?php
}
?>
@ -667,8 +696,6 @@
}
function checkDateRange(fromDate, toDate, tableDate) {
// Convert the dates to a comparable format (YYYY-MM-DD)
let from = convertToDate(fromDate);
@ -703,9 +730,8 @@
var updateDustAndRoughStockDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateDustAndRoughStockDetails
@ -715,10 +741,8 @@
success: function(data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
showMessage(data);
}
},
@ -730,7 +754,7 @@
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
console.log("Ajax Request Completed for dust and Rough Stock Details");
}
});
@ -774,12 +798,26 @@
function finalRoughStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id')
let finalRoughStock = validateInput(tdElement.innerText);
let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText);
let total = (Number(finalRoughStock) + Number(dustStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
let table = document.getElementById('dustAndRoughStockDetailsTableId');
let column = 'finalRough' ;
calculateTotal(table,dataId,column);
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
}
@ -787,12 +825,25 @@
function dustStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id')
let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText);
let dustStock = validateInput(tdElement.innerText);
let total = (Number(finalRoughStock) + Number(dustStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
let table = document.getElementById('dustAndRoughStockDetailsTableId');
let column = 'dust';
calculateTotal(table,dataId,column);
} catch (error) {
@ -801,8 +852,6 @@
}
}
function validateInput(input) {
@ -818,12 +867,21 @@
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
return input;
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
@ -847,45 +905,52 @@
}
});
// Format date in first column and left-align
$(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date)
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
let firstTd = $(this).find('td').eq(0);
let originalDate = firstTd.text().trim();
let parts = originalDate.split('-');
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY
firstTd.text(formattedDate); // Update the cell value
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate);
}
// Apply left alignment to the date column
firstTd.css("text-align", "left");
});
// Convert modified table to worksheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
// Dynamically get maximum column count
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
// Set column widths to 10 units for each
const wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 });
}
ws['!cols'] = wscols;
// Create workbook and save
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'dustAndRoughStockDetailsTableId';
document.getElementById('dustAndRoughStockExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'dustAndRoughStockDetails.xlsx');
});
})
})
});
</script>
<script>
document.addEventListener("keydown", function(event) {
@ -925,21 +990,26 @@
<script>
$(document).ready(function() {
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$(document).ready(function() {
$('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025"
minViewMode: 1, // Month-Year Picker
autoclose: true,
todayHighlight: true,
orientation: "auto" // Adjusts automatically, or use "top" / "bottom"
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
});
</script>
@ -1024,4 +1094,54 @@
}, 200);
});
});
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
rows.forEach(row => {
let cell = row.querySelector(`td.${column}`);
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value;
}
});
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2); // Format to 2 decimal places
}
let footerColumnTotal = table.querySelector(`tfoot tr td.total`);
let footerColumnFinalRough = table.querySelector(`tfoot tr td.finalRough`);
let footerColumnDust = table.querySelector(`tfoot tr td.dust`);
footerColumnTotal.innerText = parseFloat(footerColumnFinalRough.innerText.trim())
+
parseFloat(footerColumnDust.innerText.trim()) ;
}
</script>

View File

@ -280,6 +280,12 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
<div class="content-page">
<div class="content">
@ -312,6 +318,20 @@
<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>
<form id="changeMonthForm" action="<?= base_url('gasStockDetails'); ?>" method="post">
@ -323,9 +343,7 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
readonly>
</div>
@ -355,12 +373,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-save btn-lg mt-2"
<i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
@ -472,9 +490,9 @@
<!-- gas stock details stored -->
<th class="celda_encabezado_general">Consumption </th>
<th class="celda_encabezado_general">Sand Dried Qty </th>
<th class="celda_encabezado_general">Sand Dried Qty(MT) </th>
<th class="celda_encabezado_general">Consumption</th>
<th class="celda_encabezado_general">Sand Coated Qty </th>
<th class="celda_encabezado_general">Sand Coated Qty(Kg) </th>
<th class="celda_encabezado_general">Panel Consumption</th>
<th class="celda_encabezado_general">Physical Consumption</th>
<th class="celda_encabezado_general">Ton </th>
@ -486,21 +504,22 @@
</thead>
<tbody style="background-color: #fff;">
<?php if (!empty($gasStockDetails)) {
foreach ($gasStockDetails as $index => $gasStockDetail) {
$date = Datetime::createFromFormat('Y-m-d', $gasStockDetail['date'])->format('d-m-Y')
$currentDate = date('Y-m-d');
$date = Datetime::createFromFormat('Y-m-d', $gasStockDetail['date'])->format('d-m-Y');
?>
<!-- implementing date highlighter -->
<tr
<tr class="<?=$gasStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
if ($date === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if ($gasStockDetail['date'] === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<!-- td:eq(0) -->
<td class="celda_normal"><?= $date ?? '-' ?></td>
@ -656,20 +675,34 @@
</td>
<td class="celda_normal"><?= $summary['opening'] ?></td>
<td class="celda_normal"><?= $summary['purchaseBharath'] ?></td>
<td class="celda_normal"><?= $summary['purchaseIndian'] ?></td>
<td class="celda_normal"><?= $summary['total'] ?></td>
<td class="celda_normal"><?= $summary['consumption'] ?></td>
<td class="celda_normal"><?= $summary['total'] - $summary['consumption'] ?></td>
<td class="celda_normal"><?= $summary['drierMachineGasConsumption'] ?></td>
<td class="celda_normal"><?= $summary['sandDried'] ?></td>
<td class="celda_normal"><?= $summary['coatingMachineGasconsumption'] ?></td>
<td class="celda_normal"><?= $summary['coatedSand'] ?></td>
<td class="celda_normal"><?= $summary['trp_panel_gas_consumption'] ?></td>
<td class="celda_normal"><?= $summary['trp_physical_gas_consumption'] ?></td>
<td class="celda_normal"><?= $summary['trp_sand_production'] ?></td>
<td class="celda_normal"><?= $summary['rotary_drier_consumption'] ?></td>
<td class="celda_normal openingStock"
data-id="footer openingStock"> </td>
<td class="celda_normal purchaseBharath"
data-id="footer purchaseBharath" ><?= $summary['purchaseBharath'] == 0 ? "" : $summary['purchaseBharath'] ?></td>
<td class="celda_normal purchaseIndian"
data-id="footer purchaseIndian"><?= $summary['purchaseIndian'] == 0 ? "" : $summary['purchaseIndian'] ?></td>
<td class="celda_normal total"
data-id="footer total"><?= $summary['total'] == 0 ? "" : $summary['total'] ?></td>
<td class="celda_normal consumption"
data-id="footer consumption"><?= $summary['consumption'] == 0 ? "" : $summary['consumption'] ?></td>
<td class="celda_normal balanceStock"
data-id="footer balanceStock" ><?= $summary['total'] - $summary['consumption'] == 0 ? "" : $summary['total'] - $summary['consumption'] ?></td>
<td class="celda_normal tenTonGasConsumption"
data-id="footer tenTonGasConsumption"><?= $summary['drierMachineGasConsumption'] == 0 ? "" : $summary['drierMachineGasConsumption'] ?></td>
<td class="celda_normal sandDried"
data-id="footer sandDried"><?= $summary['sandDried'] == 0 ? "" : $summary['sandDried'] ?></td>
<td class="celda_normal coatingGasConsumption"
data-id="footer coatingGasConsumption"><?= $summary['coatingMachineGasconsumption'] == 0 ? "" : $summary['coatingMachineGasconsumption'] ?></td>
<td class="celda_normal coatedSand"
data-id="footer coatedSand"><?= $summary['coatedSand'] == 0 ? "" : $summary['coatedSand'] ?></td>
<td class="celda_normal trpPanelGasConsumption"
data-id="footer trpPanelGasConsumption"><?= $summary['trp_panel_gas_consumption'] == 0 ? "" : $summary['trp_panel_gas_consumption'] ?></td>
<td class="celda_normal trpPhysicalGasConsumption"
data-id="footer trpPhysicalGasConsumption"><?= $summary['trp_physical_gas_consumption'] == 0 ? "" : $summary['trp_physical_gas_consumption'] ?></td>
<td class="celda_normal trpSandProduction"
data-id="footer trpSandProduction"><?= $summary['trp_sand_production'] == 0 ? "" : $summary['trp_sand_production'] ?></td>
<td class="celda_normal rotaryGasConsumption"
data-id="footer rotaryGasConsumption"><?= $summary['rotary_drier_consumption'] == 0 ? "" : $summary['rotary_drier_consumption'] ?></td>
@ -698,18 +731,18 @@
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = Datetime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<!-- implementing date highlighter -->
<tr
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
@ -768,8 +801,51 @@
oninput="gasConsumptionChange(this)"
contenteditable="true"> </td>
</tr>
<?php }
} ?>
<?php } ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal openingStock"
data-id="footer openingStock"> </td>
<td class="celda_normal purchaseBharath"
data-id="footer purchaseBharath" > </td>
<td class="celda_normal purchaseIndian"
data-id="footer purchaseIndian"></td>
<td class="celda_normal total"
data-id="footer total"></td>
<td class="celda_normal consumption"
data-id="footer consumption"> </td>
<td class="celda_normal balanceStock"
data-id="footer balanceStock" > </td>
<td class="celda_normal tenTonGasConsumption"
data-id="footer tenTonGasConsumption"> </td>
<td class="celda_normal sandDried"
data-id="footer sandDried"> </td>
<td class="celda_normal coatingGasConsumption"
data-id="footer coatingGasConsumption"> </td>
<td class="celda_normal coatedSand"
data-id="footer coatedSand"> </td>
<td class="celda_normal trpPanelGasConsumption"
data-id="footer trpPanelGasConsumption"> </td>
<td class="celda_normal trpPhysicalGasConsumption"
data-id="footer trpPhysicalGasConsumption"> </td>
<td class="celda_normal trpSandProduction"
data-id="footer trpSandProduction"> </td>
<td class="celda_normal rotaryGasConsumption"
data-id="footer rotaryGasConsumption"> </td>
</tr>
</tfoot>
<?php } ?>
</tbody>
</table>
</div>
@ -826,9 +902,8 @@
var updateGasStockDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateGasStockDetails
@ -838,22 +913,19 @@
success: function(data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
showMessage(data);
}
},
error: function(xhr, status, error) {
alert("An error occurred while processing the request. Please try again.");
showMessage("An error occurred while processing the request. Please try again.");
console.error("Error Code:", xhr.status);
console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
console.log("Request completed.");
}
});
@ -900,6 +972,14 @@
function openingStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let date = dataId;
let openingStock = validateInput(tdElement.innerText);
@ -912,7 +992,16 @@
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = totalGas;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, currentBalanceStock)
updateStockValue(date, currentBalanceStock);
let table = document.getElementById('gasStockDetailsTableId');
let column2 = "openingStock";
let column3 = "total";
let column4 = "balanceStock";
calculateTotal(table,dataId,column2);
calculateTotal(table,dataId,column3);
calculateTotal(table,dataId,column4);
} catch (error) {
@ -924,6 +1013,14 @@
function purchaseBharathStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let date = dataId;
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
@ -936,7 +1033,18 @@
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = totalGas;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, currentBalanceStock)
updateStockValue(date, currentBalanceStock);
let table = document.getElementById('gasStockDetailsTableId');
let column1 = 'purchaseBharath';
let column2 = "openingStock";
let column3 = "total";
let column4 = "balanceStock";
calculateTotal(table,dataId,column1);
calculateTotal(table,dataId,column2);
calculateTotal(table,dataId,column3);
calculateTotal(table,dataId,column4);
} catch (error) {
@ -949,6 +1057,14 @@
function purchaseIndianStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let date = dataId;
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
@ -961,7 +1077,19 @@
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = totalGas;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, currentBalanceStock)
updateStockValue(date, currentBalanceStock);
let table = document.getElementById('gasStockDetailsTableId') ;
let column1 = 'purchaseIndian' ;
let column2 = "openingStock" ;
let column3 = "total" ;
let column4 = "balanceStock" ;
calculateTotal(table,dataId,column1);
calculateTotal(table,dataId,column2);
calculateTotal(table,dataId,column3);
calculateTotal(table,dataId,column4);
} catch (error) {
@ -974,18 +1102,29 @@
function gasConsumptionChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let date = dataId;
//total gas consumption
let tenTonGasConsumption = validateInput(document.querySelector(`td.tenTonGasConsumption[data-id="${dataId}"]`).innerText);
let coatingGasConsumption = validateInput(document.querySelector(`td.coatingGasConsumption[data-id="${dataId}"]`).innerText);
let trpPanelGasConsumption = validateInput(document.querySelector(`td.trpPanelGasConsumption[data-id="${dataId}"]`).innerText);
let trpPhysicalGasConsumption = validateInput(document.querySelector(`td.trpPhysicalGasConsumption[data-id="${dataId}"]`).innerText);
let rotaryGasConsumption = validateInput(document.querySelector(`td.rotaryGasConsumption[data-id="${dataId}"]`).innerText);
let toatalGasConsumption = Number(tenTonGasConsumption) + Number(coatingGasConsumption) + Number(trpPhysicalGasConsumption) +
Number(trpPanelGasConsumption) + Number(rotaryGasConsumption);
let tenTonGasConsumption = validateInput(document.querySelector(`td.tenTonGasConsumption[data-id="${dataId}"]`).innerText);
let coatingGasConsumption = validateInput(document.querySelector(`td.coatingGasConsumption[data-id="${dataId}"]`).innerText);
let trpPanelGasConsumption = validateInput(document.querySelector(`td.trpPanelGasConsumption[data-id="${dataId}"]`).innerText);
let trpPhysicalGasConsumption = validateInput(document.querySelector(`td.trpPhysicalGasConsumption[data-id="${dataId}"]`).innerText);
let rotaryGasConsumption = validateInput(document.querySelector(`td.rotaryGasConsumption[data-id="${dataId}"]`).innerText);
let toatalGasConsumption = Number(tenTonGasConsumption) + Number(coatingGasConsumption)
+ Number(trpPhysicalGasConsumption)
// + Number(trpPanelGasConsumption)
//panel gas is not used in consumption calculation but needed its value in sheet..!!
+ Number(rotaryGasConsumption);
//total gas purchase and opening addition
@ -1001,13 +1140,38 @@
document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText = toatalGasConsumption;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, currentBalanceStock)
updateStockValue(date, currentBalanceStock);
let table = document.getElementById('gasStockDetailsTableId');
let column1 = tdElement.className.split(' ')[1];
let column2 = "openingStock";
let column3 = "total";
let column4 = "balanceStock";
let column5 = "consumption";
calculateTotal(table,dataId,column5);
calculateTotal(table,dataId,column1);
calculateTotal(table,dataId,column2);
calculateTotal(table,dataId,column3);
calculateTotal(table,dataId,column4);
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
}
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<script>
@ -1138,7 +1302,6 @@
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
@ -1167,43 +1330,52 @@
}
});
// Format date in first column and left-align
$(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date)
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
let firstTd = $(this).find('td').eq(0);
let originalDate = firstTd.text().trim();
let parts = originalDate.split('-');
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY
firstTd.text(formattedDate); // Update the cell value
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate);
}
// Apply left alignment to the date column
firstTd.css("text-align", "left");
});
// Convert modified table to worksheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
// Dynamically get maximum column count
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
// Set each column width to 10
const wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 });
}
ws['!cols'] = wscols;
// Create workbook and save
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'gasStockDetailsTableId';
document.getElementById('gasStockDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'gasStockDetails<?= $month ?>.xlsx');
});
})
})
});
</script>
<script>
document.addEventListener("keydown", function(event) {
@ -1246,6 +1418,15 @@
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
})
</script>
@ -1337,4 +1518,99 @@
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
rows.forEach(row => {
let date = row.querySelector('td:first-child').innerText.trim().split('-');
date = date[2] + "-" + date[1] + "-" + date[0]; // Convert to YYYY-MM-DD format
let cell = null;
cell = row.querySelector(`td.${column}[data-id="${date}"]`);
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value ;
}
});
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${column}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2);
}
let footerColumnOpeningStock = table.querySelector(`tfoot tr td.openingStock[data-id="footer openingStock`);
let footerColumnPurchaseBharath = table.querySelector(`tfoot tr td.purchaseBharath[data-id="footer purchaseBharath`);
let footerColumnPurchaseIndian = table.querySelector(`tfoot tr td.purchaseIndian[data-id="footer purchaseIndian`);
let footerColumnTotal = table.querySelector(`tfoot tr td.total[data-id="footer total`);
let footerColumnConsumption = table.querySelector(`tfoot tr td.consumption[data-id="footer consumption`);
let footerColumnBalanceStock = table.querySelector(`tfoot tr td.balanceStock[data-id="footer balanceStock`);
footerColumnTotal.innerText = isNaN(
parseFloat(footerColumnOpeningStock.innerText.trim() )
+
parseFloat(footerColumnPurchaseBharath.innerText.trim())
+
parseFloat(footerColumnPurchaseIndian.innerText.trim())
) == true
?
" " : (
parseFloat(footerColumnOpeningStock.innerText.trim() )
+
parseFloat(footerColumnPurchaseBharath.innerText.trim())
+
parseFloat(footerColumnPurchaseIndian.innerText.trim())
) ;
footerColumnBalanceStock.innerText = isNaN(
parseFloat(footerColumnTotal.innerText.trim())
-
parseFloat(footerColumnConsumption.innerText.trim())
) == true
?
" " : (
parseFloat(footerColumnTotal.innerText.trim())
-
parseFloat(footerColumnConsumption.innerText.trim())
) ;
}
</script>

View File

@ -325,9 +325,6 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1"
readonly>
<input type="hidden" name="remark" id="remark" value="<?php echo $remark ?>">
@ -353,12 +350,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fas fa-save btn-lg mt-2"
<i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
@ -720,7 +717,7 @@
<span style="min-width: 150px; max-width: 150px;">
<select class="form-control select2" name="remark" id="remarkInFormId" required>
<option value="">select</option>
<option value="">Select</option>
<option value="noRemark">No Remark</option>
<option value="accepted">Accepted</option>
<option value="conditionallyAccepted">Conditionally Accepted</option>
@ -1448,7 +1445,7 @@
<!-- Save All Data in Incoming Silica Sand Details from table -->
<script type="text/javascript">
$(document).ready(function() {
$('#save').click(function() {
$('#saveId').click(function() {
var incomingSilicaSandDetailsData = incomingSilicaSandTableToJson();
@ -1550,12 +1547,20 @@
<!-- Calculate Row on oninput inside sand report modal -->
<script>
function calculateRow(value) {
function calculateRow(tdElement) {
var table = $('#meshTableId');
if (value != "moistureValue") {
var tr = $(value).closest('tr');
if (tdElement != "moistureValue") {
let basicCheck = checkIsNumber(tdElement.innerText.trim()) ;
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return;
}
var tr = $(tdElement).closest('tr');
var weighOfSand = validateInput(tr.find('td:eq(3)').text());
var factor = validateInput(tr.find('td:eq(4)').text());
tr.find('td:eq(5)').text(parseFloat((weighOfSand * factor).toFixed(2)));
@ -1645,6 +1650,35 @@
return;
}
$('#dwnldMoistureActualId , #dwnldMoistureSpecId , dwnldLossOfIgnitionId , #dwnldClayId , #dwnldGradeId , .celda_normal').on('input', function() {
let input = $(this).text().trim();
let isValid = checkIsNumber(input);
if (isValid == 0) {
alert("Kindly Enter Numbers only..!!");
return;
} else {
$(this).text(input);
}
calculateRow(value='moistureValue');
});
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}else{
return 1;
}
}
</script>
@ -1761,7 +1795,6 @@
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
@ -1777,7 +1810,6 @@
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
@ -1792,55 +1824,64 @@
}
});
// Format Invoice Date and Material Received Date columns
$(cloneTable).find('tbody tr').each(function() {
let invoiceTd = $(this).find('td').eq(2); // Get the first column (Date)
let materialReceivedTd = $(this).find('td').eq(3); // Get the second column (Material Received)
let invoiceTd = $(this).find('td').eq(2);
let materialReceivedTd = $(this).find('td').eq(3);
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
let originalInvoiceDate = invoiceTd.text().trim(); // Get the text value
let originalMaterialReceivedDate = materialReceivedTd.text().trim(); // Get the text value
let originalInvoiceDate = invoiceTd.text().trim();
let originalMaterialReceivedDate = materialReceivedTd.text().trim();
let originalInvoiceParts = originalInvoiceDate.split('-'); // Split into [YYYY, MM, DD]
let originalMaterialReceivedParts = originalMaterialReceivedDate.split('-'); // Split into [YYYY, MM, DD]
let invoiceParts = originalInvoiceDate.split('-');
let materialReceivedParts = originalMaterialReceivedDate.split('-');
if (originalInvoiceParts.length === 3) {
let formattedDate = `${originalInvoiceParts[2]}-${originalInvoiceParts[1]}-${originalInvoiceParts[0]}`; // Rearrange to DD-MM-YYYY
invoiceTd.text(formattedDate); // Update the cell value
if (invoiceParts.length === 3) {
let formattedInvoiceDate = `${invoiceParts[2]}-${invoiceParts[1]}-${invoiceParts[0]}`;
invoiceTd.text(formattedInvoiceDate);
}
if (originalMaterialReceivedParts.length === 3) {
let formattedDate = `${originalMaterialReceivedParts[2]}-${originalMaterialReceivedParts[1]}-${originalMaterialReceivedParts[0]}`; // Rearrange to DD-MM-YYYY
materialReceivedTd.text(formattedDate); // Update the cell value
if (materialReceivedParts.length === 3) {
let formattedMaterialDate = `${materialReceivedParts[2]}-${materialReceivedParts[1]}-${materialReceivedParts[0]}`;
materialReceivedTd.text(formattedMaterialDate);
}
// Apply left alignment to the date column
invoiceTd.css("text-align", "left");
materialReceivedTd.css("text-align", "left");
});
// Convert modified table to sheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
// Dynamically calculate visible column count for setting column widths
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
// Set each column width to 10 characters
let wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 15 });
}
ws['!cols'] = wscols;
// Create workbook and save
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'incomingSilicaSandDetailsTable';
document.getElementById('incomingSilicaSandDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'incomingSilicaSandDetails_<?= $month ?>.xlsx');
});
})
})
});
</script>
<!-- on enter key press allowing user to go next line instead of submitting any form here -->
<script>
document.addEventListener("keydown", function(event) {
@ -1935,6 +1976,15 @@
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
})
</script>

View File

@ -266,6 +266,11 @@
/* Replace with your table's actual ID or selector */
border-collapse: collapse;
}
.hidden-row {
display: none;
}
</style>
@ -326,6 +331,20 @@ foreach ($period as $day) {
<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>
<form id="changeMonthForm" action="<?= base_url('powerConsumptionDetails'); ?>" method="post">
@ -334,6 +353,7 @@ foreach ($period as $day) {
<div class="col-2">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2"
style="z-index:30;" readonly>
</div>
@ -374,17 +394,17 @@ foreach ($period as $day) {
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="bagStockExport">
id="powerConsumptionExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fas fa-save btn-lg mt-2"
<i class="fas fa-save auditor-restricted-btn btn-lg mt-2"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
@ -590,19 +610,17 @@ foreach ($period as $day) {
foreach ($groupedPowerConsumptionStockDetails as $groupedIndex => $powerStockDetails) {
$currentDate = date('Y-m-d');
?>
<tr
?>
<tr class="<?=$powerStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $powerStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if ($powerStockDetails[0]['date'] === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<?php
@ -774,6 +792,7 @@ foreach ($period as $day) {
'opening_units' => "-",
'closing_units' => 0,
'total_units' => 0,
'machine_id' => $machineId,
];
}
@ -797,22 +816,48 @@ foreach ($period as $day) {
<b> Total </b>
</td>
<td class="celda_normal "><?= $summary['openingReading'] ?></td>
<td class="celda_normal "><?= $summary['finalReading'] ?></td>
<td class="celda_normal "><?= $summary['totalReading'] ?></td>
<td class="celda_normal "><?= $summary['totalUnits'] ?></td>
<td class="celda_normal "><?= $summary['averagePf'] ?></td>
<td class="celda_normal "><?= $summary['presentPf'] ?></td>
<td class="celda_normal "><?= $summary['md'] ?></td>
<td class="celda_normal "><?= $summary['mf'] ?></td>
<td class="celda_normal openingTP"
data-id="footer openingTP">
</td>
<td class="celda_normal finalTP"
data-id="footer finalTP">
</td>
<td class="celda_normal totalReadingTP"
data-id="footer totalReadingTP">
<?= $summary['totalReading'] ?></td>
<td class="celda_normal totalUnitsTP"
data-id="footer totalUnitsTP">
<?= $summary['totalUnits'] ?></td>
<td class="celda_normal averagePf"
data-id="footer averagePf">
</td>
<td class="celda_normal presentPf"
data-id="footer presentPf">
</td>
<td class="celda_normal mdTP"
data-id="footer mdTP">
</td>
<td class="celda_normal mfTP"
data-id="footer mfTP">
</td>
<?php foreach ($summary as $each) {
if (is_array($each)) {
?>
<td class="celda_normal "><?= $each['opening_units'] ?> </td>
<td class="celda_normal "><?= $each['closing_units'] ?></td>
<td class="celda_normal "><?= $each['total_units'] ?></td>
<td class="celda_normal openingUnits"
data-id="footer <?=$each['machine_id']?>"> </td>
<td class="celda_normal closingUnits"
data-id="footer <?=$each['machine_id']?>"></td>
<td class="celda_normal totalUnits"
data-id="footer <?=$each['machine_id']?>"><?= $each['total_units'] ?></td>
<?php
}
@ -824,152 +869,217 @@ foreach ($period as $day) {
<!-- this else condition work if groupedpowerStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else { ?>
<?php } else { ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?>
<td class="celda_normal">
<?= $startDate ?>
</td>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<td class="celda_normal">
<?= $startDate ?>
</td>
<td class="celda_normal openingTP"
data-id="<?= $dateInMonth ?>"
<td class="celda_normal openingTP"
data-id="<?= $dateInMonth ?>"
<?php if ($datesInMonthIndex == 0) { ?>
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingTPStockChange(this)"
contenteditable="true"
oninput="openingTPStockChange(this)"
contenteditable="true"
<?php } ?>>
<?php
if (empty($previousMonthTotalPowerMachineStockDetails)) {
echo " ";
} else {
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
}
<?php } ?>>
<?php
if (empty($previousMonthTotalPowerMachineStockDetails)) {
echo " ";
} else {
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
}
?>
?>
</td>
</td>
<td class="celda_normal finalTP"
data-id="<?= $dateInMonth ?>"
<td class="celda_normal finalTP"
data-id="<?= $dateInMonth ?>"
oninput="finalTPStockChange(this)"
contenteditable="true">
oninput="finalTPStockChange(this)"
contenteditable="true">
<?php
if (empty($previousMonthTotalPowerMachineStockDetails)) {
echo " ";
} else {
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
}
<?php
if (empty($previousMonthTotalPowerMachineStockDetails)) {
echo " ";
} else {
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
}
?>
?>
</td>
</td>
<td class="celda_normal totalReadingTP"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal totalReadingTP"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal totalUnitsTP"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal totalUnitsTP"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal averagePfTP" contenteditable="true"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal presentPfTP" contenteditable="true"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal averagePfTP" contenteditable="true"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal presentPfTP" contenteditable="true"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal mdTP" contenteditable="true"
oninput="mdTPStockChange(this)"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal mdTP" contenteditable="true"
oninput="mdTPStockChange(this)"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal mfTP"
data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal mfTP"
data-id="<?= $dateInMonth ?>"> </td>
<?php
foreach ($electricMachines as $powerMachineIndex => $powerMachine) {
?>
<!-- this will loop till machines present -->
<?php
foreach ($electricMachines as $powerMachineIndex => $powerMachine) {
?>
<!-- this will loop till machines present -->
<td class="celda_normal" style="display:none">
<?= $dateInMonth ?>
</td>
<td class="celda_normal" style="display:none">
<?= $dateInMonth ?>
</td>
<td class="celda_normal" style="display:none"
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
<?= $powerMachine['id'] ?>
</td>
<td class="celda_normal" style="display:none"
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
<?= $powerMachine['id'] ?>
</td>
<td class="celda_normal openingUnits"
<td class="celda_normal openingUnits"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingUnitsChange(this)"
contenteditable="true"
<?php } ?>
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
<?php
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
break;
}
}
?>
</td>
<td class="celda_normal closingUnits"
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
oninput="closingUnitsChange(this)"
contenteditable="true">
<?php
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
break;
}
}
?>
</td>
<td class="celda_normal totalUnits"
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
contenteditable="true"> </td>
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingUnitsChange(this)"
contenteditable="true"
<?php } ?>
</tr>
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
<?php
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
break;
}
}
?>
</td>
<td class="celda_normal closingUnits"
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
oninput="closingUnitsChange(this)"
contenteditable="true">
<?php
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
break;
}
}
?>
</td>
<td class="celda_normal totalUnits"
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
contenteditable="true"> </td>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal openingTP"
data-id="footer openingTP">
</td>
<td class="celda_normal finalTP"
data-id="footer finalTP">
</td>
<td class="celda_normal totalReadingTP"
data-id="footer totalReadingTP">
</td>
<td class="celda_normal totalUnitsTP"
data-id="footer totalUnitsTP">
</td>
<td class="celda_normal averagePf"
data-id="footer averagePf">
</td>
<td class="celda_normal presentPf"
data-id="footer presentPf">
</td>
<td class="celda_normal mdTP"
data-id="footer mdTP">
</td>
<td class="celda_normal mfTP"
data-id="footer mfTP">
</td>
<?php foreach ($electricMachines as $each) {
if (is_array($each)) {
?>
<td class="celda_normal openingUnits"
data-id="footer <?=$each['id']?>"></td>
<td class="celda_normal closingUnits"
data-id="footer <?=$each['id']?>"></td>
<td class="celda_normal totalUnits"
data-id="footer <?=$each['id']?>"></td>
<?php
}
}
?>
</tr>
</tfoot>
<?php } ?>
</tbody>
@ -1077,9 +1187,8 @@ foreach ($period as $day) {
var updatePowerConsumptionDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updatePowerConsumptionDetails
@ -1089,21 +1198,19 @@ foreach ($period as $day) {
success: function(data) {
if (data) {
$('#loader').hide();
alert(data);
window.location.reload();
showMessage(data);
}
},
error: function(xhr, status, error) {
alert("An error occurred while processing the request. Please try again.");
showMessage("An error occurred while processing the request. Please try again.");
console.error("Error Code:", xhr.status);
console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
console.log("Request completed.");
}
});
@ -1176,6 +1283,14 @@ foreach ($period as $day) {
function openingUnitsChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let openingUnits = validateInput(tdElement.innerText);
@ -1186,7 +1301,13 @@ foreach ($period as $day) {
document.querySelector(`td.totalUnits[data-id="${dataId}"]`).innerText = parseFloat(totalUnits).toFixed(2);
updateStockValue(date, machine_id, closingUnits)
updateStockValue(date, machine_id, closingUnits);
let table = document.getElementById('powerStockDetailsTableId');
let column1 = 'totalUnits';
calculateTotal(table,dataId,column1);
} catch (error) {
@ -1199,6 +1320,14 @@ foreach ($period as $day) {
function closingUnitsChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let openingUnits = validateInput(document.querySelector(`td.openingUnits[data-id="${dataId}"]`).innerText);
@ -1209,7 +1338,13 @@ foreach ($period as $day) {
document.querySelector(`td.totalUnits[data-id="${dataId}"]`).innerText = parseFloat(totalUnits).toFixed(2);
updateStockValue(date, machine_id, closingUnits)
updateStockValue(date, machine_id, closingUnits);
let table = document.getElementById('powerStockDetailsTableId');
let column1 = 'totalUnits';
calculateTotal(table,dataId,column1);
} catch (error) {
@ -1224,6 +1359,13 @@ foreach ($period as $day) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let openingTP = validateInput(tdElement.innerText);
@ -1239,6 +1381,15 @@ foreach ($period as $day) {
updateTotalStockValue(dataId, finalTP);
let table = document.getElementById('powerStockDetailsTableId');
let column2 = 'totalReadingTP';
let column3 = 'totalUnitsTP';
calculateTotal(table,dataId,column2);
calculateTotal(table,dataId,column3);
} catch (error) {
@ -1252,6 +1403,13 @@ foreach ($period as $day) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let openingTP = validateInput(document.querySelector(`td.openingTP[data-id="${dataId}"]`).innerText);
@ -1265,8 +1423,19 @@ foreach ($period as $day) {
document.querySelector(`td.totalUnitsTP[data-id="${dataId}"]`).innerText = parseFloat(totalUnitsTP).toFixed(2);
updateTotalStockValue(dataId, finalTP)
updateTotalStockValue(dataId, finalTP);
let table = document.getElementById('powerStockDetailsTableId');
let column2 = 'totalReadingTP';
let column3 = 'totalUnitsTP';
calculateTotal(table,dataId,column2);
calculateTotal(table,dataId,column3);
} catch (error) {
@ -1280,12 +1449,30 @@ foreach ($period as $day) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let mdTP = validateInput(tdElement.innerText);
document.querySelector(`td.mfTP[data-id="${dataId}"]`).innerText = parseFloat(mdTP * 60).toFixed(2);
// let table = document.getElementById('powerStockDetailsTableId');
// let column1 = 'mdTP';
// let cloumn2 = 'mfTP';
// calculateTotal(table,dataId,column1);
// calculateTotal(table,dataId,column2);
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
@ -1315,6 +1502,16 @@ foreach ($period as $day) {
return input;
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<script>
@ -1408,9 +1605,8 @@ foreach ($period as $day) {
<script>
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
function exportTableToExcel(tableID, filename = '', dateColumns = []) {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
@ -1425,43 +1621,52 @@ foreach ($period as $day) {
}
});
// Format specified date columns
$(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date)
dateColumns.forEach(function(colIndex) {
let td = $(this).find('td').eq(colIndex);
let originalDate = td.text().trim();
let parts = originalDate.split('-');
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY
firstTd.text(formattedDate); // Update the cell value
}
// Apply left alignment to the date column
firstTd.css("text-align", "left");
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
td.text(formattedDate);
}
td.css("text-align", "left");
}.bind(this));
});
let ws = XLSX.utils.table_to_sheet(cloneTable);
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
// Set column width to 10 for all columns
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
let wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 }); // Set width of 10 for all columns
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'powerStockDetailsTableId';
// Power Stock Table Export
document.getElementById('powerConsumptionExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'power_Consumption_details<?= $month ?>.xlsx');
})
exportTableToExcel('powerStockDetailsTableId', 'power_Consumption_details<?= $month ?>.xlsx', [0]);
});
})
});
</script>
<script>
document.addEventListener("keydown", function(event) {
@ -1599,8 +1804,10 @@ foreach ($period as $day) {
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
@ -1692,4 +1899,117 @@ foreach ($period as $day) {
}, 200);
});
});
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
let machineId = dataId.split(' ')[1]??'';
rows.forEach(row => {
let date = row.querySelector('td:first-child').innerText.trim().split('-');
date = date[2] + "-" + date[1] + "-" + date[0]; // Convert to YYYY-MM-DD format
let cell = null;
if(machineId) {
cell = row.querySelector(`td.${column}[data-id="${date} ${machineId}"]`);
}else{
cell = row.querySelector(`td.${column}[data-id="${date}"]`);
console.log('inside machine id not present');
}
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value ;
}
});
if(machineId) {
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${machineId}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2);
}
// let footerColumnOpeningUnits = table.querySelector(`tfoot tr td.openingUnits[data-id="footer ${machineId}`)??0;
// let footerColumnClosingUnits = table.querySelector(`tfoot tr td.closingUnits[data-id="footer ${machineId}`)??0;
// let footerColumnTotalUnits = table.querySelector(`tfoot tr td.totalUnits[data-id="footer ${machineId}`)??0;
// footerColumnTotalUnits.innerText = (
// parseFloat(footerColumnClosingUnits.innerText.trim())
// -
// parseFloat(footerColumnOpeningUnits.innerText.trim())
// ) ?? '';
}else{
// Update the total cell in the footer for TD
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${column}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2);
}
// let footerColumnOpeningTP = table.querySelector(`tfoot tr td.openingTP[data-id="footer openingTP`);
// let footerColumnFinalTP = table.querySelector(`tfoot tr td.finalTP[data-id="footer finalTP`);
// let footerColumnTotalReadingTP = table.querySelector(`tfoot tr td.totalReadingTP[data-id="footer totalReadingTP`)??0;
// let footerColumnTotalUnitsTP = table.querySelector(`tfoot tr td.totalUnitsTP[data-id="footer totalUnitsTP`);
// let footerColumnMdTP = table.querySelector(`tfoot tr td.mdTP[data-id="footer mdTP`);
// let footerColumnMfTP = table.querySelector(`tfoot tr td.mfTP[data-id="footer mfTP`);
// footerColumnTotalReadingTP.innerText = ( parseFloat(footerColumnFinalTP.innerText.trim())
// -
// parseFloat(footerColumnOpeningTP.innerText.trim())
// ) ?? '';
// footerColumnTotalUnitsTP.innerText = ( parseFloat(footerColumnTotalReadingTP.innerText.trim())
// * 60
// ) ?? '';
// footerColumnMfTP.innerText = ( parseFloat(footerColumnMdTP.innerText.trim())
// * 60
// ) ?? '';
}
}
</script>

View File

@ -265,6 +265,13 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -325,6 +332,20 @@ foreach ($period as $day) {
<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>
<form id="changeMonthForm" action="<?= base_url('resinStockDetails'); ?>" method="post">
@ -374,17 +395,17 @@ foreach ($period as $day) {
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="bagStockExport">
id="resinStockExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fas fa-save btn-lg mt-2"
<i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
@ -576,21 +597,27 @@ foreach ($period as $day) {
<?php if (!empty($groupedResinStockDetails)) {
$summary = [];
foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) {
?>
<tr
$currentDate = date('Y-m-d');
$backgroundColor = " ";
?>
<tr class="<?=$resinStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($resinStockDetails[0]['date'] === $currentDate) {
$backgroundColor ="background: #cef0ad;";
}
?>
style="<?= $backgroundColor;?> ">
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $resinStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<!-- td -->
<?php foreach ($resinStockDetails as $resinStockIndex => $resinStock) {
?>
@ -660,6 +687,7 @@ foreach ($period as $day) {
'receipt' => 0,
'used' => 0,
'balanceStock' => 0,
'materialCode' => $resinStock['materialCode'],
];
}
@ -686,10 +714,14 @@ foreach ($period as $day) {
<?php foreach ($summary as $each) { ?>
<td class="celda_normal "><?= $each['opening'] ?></td>
<td class="celda_normal "><?= $each['receipt'] ?></td>
<td class="celda_normal "><?= $each['used'] ?></td>
<td class="celda_normal "><?= $each['balanceStock'] ?></td>
<td class="celda_normal openingStock"
data-id="footer <?=$each['materialCode']?>"></td>
<td class="celda_normal receiptStock"
data-id="footer <?=$each['materialCode']?>"><?= $each['receipt'] == 0 ? " " : $each['receipt'] ?></td>
<td class="celda_normal usedStock"
data-id="footer <?=$each['materialCode']?>"><?= $each['used'] == 0 ? " " : $each['used'] ?></td>
<td class="celda_normal balanceStock"
data-id="footer <?=$each['materialCode']?>"></td>
<?php } ?>
@ -699,96 +731,127 @@ foreach ($period as $day) {
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else { ?>
<?php } else { ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?>
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad ;"';
}
?>>
<?php
// dd($resinMaterials);
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
<!-- this will loop till materials present -->
<?php if ($resinMaterialIndex == 0): ?>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<td class="celda_normal">
<?= $startDate ?>
</td>
<?php endif; ?>
<td class="celda_normal" style="display:none">
<?= $dateInMonth ?>
</td>
<td class="celda_normal" style="display:none"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
<?= $resinMaterial['MaterialCode'] ?>
</td>
<td class="celda_normal customer" style="display:none"
data-materialCode="<?= $resinMaterial['MaterialCode'] ?>"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
<?= $resinMaterial['customers'] ?>
</td>
<td class="celda_normal openingStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingStockChange(this)"
contenteditable="true"
<?php } ?>>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
echo $previousMonthResinStockDetail['balanceStock'];
break;
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad ;"';
}
}
?>
</td>
<td class="celda_normal receiptStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
oninput="receiptStockChange(this)"
contenteditable="true"> <?= ' ' ?> </td>
<td class="celda_normal usedStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
oninput="usedStockChange(this)"
contenteditable="true"> <?= ' ' ?> </td>
<td class="celda_normal balanceStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
>
<?php
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
echo $previousMonthResinStockDetail['balanceStock'];
break;
}
}
?>
// dd($resinMaterials);
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
<!-- this will loop till materials present -->
</td>
<?php if ($resinMaterialIndex == 0): ?>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<td class="celda_normal">
<?= $startDate ?>
</td>
<?php endif; ?>
<td class="celda_normal" style="display:none">
<?= $dateInMonth ?>
</td>
<td class="celda_normal" style="display:none"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
<?= $resinMaterial['MaterialCode'] ?>
</td>
<td class="celda_normal customer" style="display:none"
data-materialCode="<?= $resinMaterial['MaterialCode'] ?>"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
<?= $resinMaterial['customers'] ?>
</td>
<td class="celda_normal openingStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingStockChange(this)"
contenteditable="true"
<?php } ?>>
<?php
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
echo $previousMonthResinStockDetail['balanceStock'];
break;
}
}
?>
</td>
<td class="celda_normal receiptStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
oninput="receiptStockChange(this)"
contenteditable="true"> <?= ' ' ?> </td>
<td class="celda_normal usedStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
oninput="usedStockChange(this)"
contenteditable="true"> <?= ' ' ?> </td>
<td class="celda_normal balanceStock"
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
<?php
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
echo $previousMonthResinStockDetail['balanceStock'];
break;
}
}
?>
</td>
<?php } ?>
</tr>
<?php } ?>
</tr>
<?php } ?>
<?php } ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<?php foreach ($resinMaterials as $each) { ?>
<td class="celda_normal openingStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<td class="celda_normal receiptStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<td class="celda_normal usedStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<td class="celda_normal balanceStock"
data-id="footer <?=$each['MaterialCode']?>"></td>
<?php } ?>
</tr>
</tfoot>
<?php } ?>
</tbody>
@ -901,9 +964,8 @@ foreach ($period as $day) {
var updateResinStockDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateResinStockDetails
@ -913,10 +975,9 @@ foreach ($period as $day) {
success: function(data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
showMessage(data);
}
},
@ -928,7 +989,7 @@ foreach ($period as $day) {
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
console.log("Ajax request is completed..!!")
}
});
@ -976,6 +1037,14 @@ foreach ($period as $day) {
function openingStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(tdElement.innerText);
@ -984,7 +1053,16 @@ foreach ($period as $day) {
let currentBalanceStock = validateInput((Number(openingStock) + Number(receiptStock)) - Number(usedStock));
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, materialCode, currentBalanceStock)
updateStockValue(date, materialCode, currentBalanceStock);
let table = document.getElementById('resinStockDetailsTableId');
let column1 = 'receiptStock';
let column2 = 'usedStock';
calculateTotal(table, dataId, column1);
calculateTotal(table, dataId, column2);
} catch (error) {
@ -996,6 +1074,12 @@ foreach ($period as $day) {
function receiptStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
@ -1004,7 +1088,17 @@ foreach ($period as $day) {
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, materialCode, currentBalanceStock)
updateStockValue(date, materialCode, currentBalanceStock);
let table = document.getElementById('resinStockDetailsTableId');
let column1 = 'receiptStock';
let column2 = 'usedStock';
calculateTotal(table, dataId, column1);
calculateTotal(table, dataId, column2);
} catch (error) {
@ -1019,6 +1113,14 @@ foreach ($period as $day) {
function usedStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText);
@ -1027,7 +1129,16 @@ foreach ($period as $day) {
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock;
updateStockValue(date, materialCode, currentBalanceStock)
updateStockValue(date, materialCode, currentBalanceStock);
let table = document.getElementById('resinStockDetailsTableId');
let column1 = 'receiptStock';
let column2 = 'usedStock';
calculateTotal(table, dataId, column1);
calculateTotal(table, dataId, column2);
} catch (error) {
@ -1053,12 +1164,22 @@ foreach ($period as $day) {
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
return input;
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<script>
@ -1134,7 +1255,21 @@ foreach ($period as $day) {
});
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
// Set column width to 10 for all columns
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
let wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 }); // Set width of 10 for all columns
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
@ -1164,6 +1299,7 @@ foreach ($period as $day) {
let table = activeElement.closest("table");
if (table && cell) {
event.preventDefault(); // Prevent form submission
let columnIndex = cell.cellIndex; // Get the current column index
@ -1292,8 +1428,10 @@ foreach ($period as $day) {
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>
@ -1384,4 +1522,70 @@ foreach ($period as $day) {
}, 200);
});
});
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
let materialCode = dataId.split(' ')[1];
rows.forEach(row => {
let date = row.querySelector('td:first-child').innerText.trim().split('-');
date = date[2] + "-" + date[1] + "-" + date[0]; // Convert to YYYY-MM-DD format
let cell = row.querySelector(`td.${column}[data-id="${date} ${materialCode}"]`);
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value;
}
});
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${materialCode}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2); // Set the total value in the footer cell
}
// let footerColumnOpeningStock = table.querySelector(`tfoot tr td.openingStock[data-id="footer ${materialCode}`)??0;
// let footerColumnReceiptStock = table.querySelector(`tfoot tr td.receiptStock[data-id="footer ${materialCode}`)??0;
// let footerColumnUsedStock = table.querySelector(`tfoot tr td.usedStock[data-id="footer ${materialCode}`)??0;
// let footerColumnBalanceStock = table.querySelector(`tfoot tr td.balanceStock[data-id="footer ${materialCode}`);
// footerColumnBalanceStock.innerText = ( parseFloat(footerColumnOpeningStock.innerText.trim())
// +
// parseFloat(footerColumnReceiptStock.innerText.trim())
// )
// -
// parseFloat(footerColumnUsedStock.innerText.trim()) ;
}
</script>

File diff suppressed because it is too large Load Diff

View File

@ -283,6 +283,11 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -319,76 +324,90 @@
<div class="card" id="fullscreenDiv">
<div class="card-body">
<form align="center" id="changeMonthForm" action="<?= base_url('trpSandUseStockDetails'); ?>" method="post">
<div class="row">
<?php $today = date('M-Y'); ?>
<div class="col-3">
<div class="header">
<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="col-2 mt-2 ml-4">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly
style="max-width: 175px;">
<div>
</div>
<div align="center">
<form style="width: 750px;" id="changeMonthForm" action="<?= base_url('trpSandUseStockDetails'); ?>" method="post">
<div class="row">
<?php $today = date('M-Y'); ?>
<div class="col-3 text-right d-flex" style="justify-content: end;">
<div class="col-3 mt-2">
<input type="text" id="searchInput" placeholder="Search..."
class="mt-2"
style="padding: 8px;margin-bottom: 10px;width: 150px;border: 2px solid rgb(123, 11, 214);
border-radius: 5px;margin-right:15px;">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
readonly
style="max-width: 175px;">
<i class="fa fa-table btn-lg mt-2"
title="Date Range Filter"
style="font-size: x-large; cursor:pointer; color:rgb(95, 102, 105)"
data-toggle="modal"
data-target="#filterModalId">
</i>
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="trpSandUseStockExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(230, 184, 35)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-save btn-lg mt-2"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
</i>
</div>
<div class="col-9 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..."
class="mt-2"
style="padding: 8px;margin-bottom: 10px;width: 150px;border: 2px solid rgb(123, 11, 214);
border-radius: 5px;margin-right:15px;">
<i class="fa fa-table btn-lg mt-2"
title="Date Range Filter"
style="font-size: x-large; cursor:pointer; color:rgb(95, 102, 105)"
data-toggle="modal"
data-target="#filterModalId">
</i>
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="trpSandUseStockExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
</i>
</div>
</div>
</form>
</div>
<div class="col-4">
</div>
</div>
</div>
</form>
<!-- filter modal -->
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
@ -462,17 +481,14 @@
</div>
<!-- end modal section -->
<!-- end modal section -->
<div class="table-responsive" id="table-responsive" align="center">
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table ">
<thead class="celda_encabezado_general">
<tr>
<th class="celda_encabezado_general" colspan="5">Trp Sand To Use Coating Sand </th>
<th class="celda_encabezado_general" colspan="5">TRP SAND TO USE COATING SAND </th>
</tr>
<tr>
@ -495,17 +511,16 @@
$summary = [];
foreach ($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail) {
$currentDate = date('d-m-Y');
?>
<tr
<tr class="<?=$trpSandUseStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpSandUseStockDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if($trpSandUseStockDetail['date'] === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<td class="celda_normal">
<?php
@ -559,9 +574,9 @@
<b> Total </b>
</td>
<td class="celda_normal "><b><?= $summary['rough_kgs'] ?></b></td>
<td class="celda_normal "><b><?= $summary['fine_kgs'] ?></b></td>
<td class="celda_normal "><b><?= $summary['total_kgs'] ?></b></td>
<td class="celda_normal rough"><b><?= $summary['rough_kgs'] ?></b></td>
<td class="celda_normal fine"><b><?= $summary['fine_kgs'] ?></b></td>
<td class="celda_normal total"><b><?= $summary['total_kgs'] ?></b></td>
<td class="celda_normal "> </td>
</tr>
@ -575,75 +590,96 @@
<?php } else {
<?php } else {
$date = DateTime::createFromFormat('M-Y', $month);
$date = DateTime::createFromFormat('M-Y', $month);
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$datesInMonth = [];
$datesInMonth = [];
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<!-- td:eq(0) -->
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?>
</td>
<!-- td:eq(1) -->
<td class="celda_normal rough"
data-id="<?= $dateInMonth ?>"
oninput="roughStockChange(this)"
contenteditable="true"><?= " " ?></td>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<!-- td:eq(2) -->
<td class="celda_normal fine"
data-id="<?= $dateInMonth ?>"
oninput="fineStockChange(this)"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(0) -->
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
?>
</td>
<!-- td:eq(3) -->
<td class="celda_normal total"
data-id="<?= $dateInMonth ?>"><?= " " ?></td>
<!-- td:eq(1) -->
<td class="celda_normal rough"
data-id="<?= $dateInMonth ?>"
oninput="roughStockChange(this)"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(4) -->
<td class="celda_normal customer"
data-id="<?= $dateInMonth ?>"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(2) -->
<td class="celda_normal fine"
data-id="<?= $dateInMonth ?>"
oninput="fineStockChange(this)"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(5) -->
<td style="display:none"
data-id="<?= $dateInMonth ?>"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(3) -->
<td class="celda_normal total"
data-id="<?= $dateInMonth ?>"><?= " " ?></td>
</tr>
<?php
}
}
?>
<!-- td:eq(4) -->
<td class="celda_normal customer"
data-id="<?= $dateInMonth ?>"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(5) -->
<td style="display:none"
data-id="<?= $dateInMonth ?>"
contenteditable="true"><?= " " ?></td>
</tr>
<?php
}?>
<tfoot>
<tr class="total_row">
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal rough">0</td>
<td class="celda_normal fine">0</td>
<td class="celda_normal total">0</b></td>
<td class="celda_normal ">0</td>
</tr>
</tfoot>
<?php
}
?>
</tbody>
</table>
@ -728,9 +764,8 @@
var updateTrpSandUseStockDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
showMessage('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateTrpSandUseStockDetails
@ -740,22 +775,19 @@
success: function(data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
window.location.reload();
showMessage(data);
}
},
error: function(xhr, status, error) {
alert("An error occurred while processing the request. Please try again.");
showMessage("An error occurred while processing the request. Please try again.");
console.error("Error Code:", xhr.status);
console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
console.log("Request completed.");
}
});
@ -795,6 +827,14 @@
function roughStockChange(tdElement) {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
console.log("just an alert from RoughStockChange..!!")
console.log(tdElement.innerText)
let dataId = tdElement.getAttribute('data-id')
@ -803,6 +843,10 @@
let total = (Number(roughStock) + Number(fineStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total;
let table = document.getElementById('trpSandUseStockDetailsTableId');
let column = 'rough';
calculateTotal(table,dataId,column);
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
@ -812,14 +856,24 @@
function fineStockChange(tdElement) {
try {
console.log("just an alert from fineStockChange..!!")
console.log(tdElement.innerText)
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id')
let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText);
let fineStock = validateInput(tdElement.innerText);
let total = (Number(roughStock) + Number(fineStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total;
let table = document.getElementById('trpSandUseStockDetailsTableId');
let column = 'fine';
calculateTotal(table,dataId,column);
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
@ -851,6 +905,17 @@
return input;
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
@ -896,7 +961,21 @@
});
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let ws = XLSX.utils.table_to_sheet(cloneTable);
// Set column width to 10 for all columns
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
let wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 }); // Set width of 10 for all columns
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
@ -954,22 +1033,29 @@
</script>
<script>
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$(document).ready(function() {
$('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025"
minViewMode: 1, // Month-Year Picker
autoclose: true,
todayHighlight: true,
orientation: "auto" // Adjusts automatically, or use "top" / "bottom"
}).on('focus', function() {
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
$('#month').change(function() {
$('#changeMonthForm').submit();
})
});
</script>
@ -1058,3 +1144,49 @@
});
</script>
<script>
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";
}, 5000);
}
</script>
<script>
function calculateTotal(table,dataId,column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
rows.forEach(row => {
let cell = row.querySelector(`td.${column}`);
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value;
}
});
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2); // Format to 2 decimal places
}
let footerColumnTotal = table.querySelector(`tfoot tr td.total`);
let footerColumnRough = table.querySelector(`tfoot tr td.rough`);
let footerColumnFine = table.querySelector(`tfoot tr td.fine`);
footerColumnTotal.innerText = parseFloat(footerColumnRough.innerText.trim())
+
parseFloat(footerColumnFine.innerText.trim()) ;
}
</script>

View File

@ -164,6 +164,7 @@
<a style="cursor:pointer;" data-toggle="tooltip"
title="<?= $record->SupplierID ?> - Click here to delete Supplier details"
class="auditor-restricted-btn"
onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i
class="fa fa-trash"
style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;

View File

@ -54,7 +54,7 @@
</li>
</ol>
</div>
<a class="btn btn-success " href="<?php echo base_url(); ?>addNew">Add New User</a>
<a class="btn btn-success auditor-restricted-btn" href="<?php echo base_url(); ?>addNew">Add New User</a>
</div>
@ -152,6 +152,7 @@
<?php if ($record->isDeleted == 1) { ?>
<a onclick="confirmReActivateUser(event)"
class="auditor-restricted-btn"
href="<?php echo base_url() . 'user/reActivateUser?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
<i class="fas fa-key"></i>
</a>
@ -159,14 +160,14 @@
<?php } else { ?>
<a
href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
<a href="<?php echo base_url() . 'user/editOld?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
<i class="fas fa-edit"></i>
</a>
&nbsp;&nbsp;
<a onclick="confirmDeleteUser(event)"
<a class="auditor-restricted-btn"
onclick="confirmDeleteUser(event)"
href="<?php echo base_url() . 'user/deleteUser?UID=' . $record->userId . '&EMPID=' . $record->EmpID; ?>">
<i class="fas fa-trash"></i>
</a>

View File

@ -248,7 +248,7 @@
$time = $createddate->format('h:i A');
?>
<tr id="<?php echo $index ?>" >
<td align="center"><?php echo $date; ?></td>
<td align="left" style="padding-left: 0.4%"><?php echo $date; ?></td>
<td align="center"><?php echo $time; ?></td>
<td style="cursor:pointer; color:#0bb2b5" >
@ -267,7 +267,7 @@
</td>
<td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
<td align="left" style="padding-left: 0.4%"><?php
$invdate = $record->DeliveryChellanDate;
if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){
echo "";
@ -282,9 +282,13 @@
<td align="right"><?php echo (int)$record->NetWeight ?></td>
<td align="right"><?php echo (int)$record->taxable_value ?></td>
<td align="right"><?php echo (int)$record->gst_amount ?></td>
<td align="right"><?php echo ((int)$record->taxable_value + (int)$record->gst_amount) ?></td>
<td align="right"><?php echo number_format((float)$record->gst_amount, 2, '.', ''); ?></td>
<td align="right">
<?php
$total_amt = (float)$record->taxable_value + (float)$record->gst_amount;
echo number_format($total_amt, 2, '.', '');
?>
</td>
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>
@ -301,7 +305,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>
&nbsp;
@ -497,6 +501,7 @@
<th style="width: 50px;">SNo</th>
<th style="width: 100px;">Item Code</th>
<th style="width: 150px;">Item Description</th>
<th style="width: 50px;">HSN/SAC</th>
<th style="width: 50px;">UOM</th>
<th style="width: 100px;">Ordered Qty</th>
<th style="width: 100px;">Received Qty</th>
@ -505,7 +510,7 @@
<th style="width: 50px;">Tax (%)</th>
<th style="width: 50px;">Taxable Amt</th>
<th style="width: 50px;">Total Amt</th>
<th style="width: 150px;">Remarks</th>
<th style="width: 150px;">Remarks <span class="text-danger">*</span></th>
<th style="width: 25px;">Net Weight</th>
<th style="width: 25px; display:none" id="gasShortageHeader">Add Gas Shortage</th>
<th style="width: 25px; display:none" id="gasShortageListHeader">Gas Shortage list</th>
@ -561,7 +566,7 @@
<div class="modal-footer">
<div class="buttonContainer">
<a class="btn btn-secondary" data-dismiss="modal" value="Close">Close</a>
<a class="btn btn-primary" id="generateIGR" value="generateIGR">Generate IGR</a>
<a class="btn btn-primary auditor-restricted" id="generateIGR" value="generateIGR">Generate IGR</a>
<a class="btn btn-primary" id="draftIGR" value="draftIGR">Save as Draft IGR</a>
</div>
</div>
@ -629,7 +634,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>
@ -1253,15 +1258,16 @@
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="HSNCODE">' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="'+item.Remarks+'"> </td>' +
'<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form auditor-restricted-fieldgr" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="' + item.Remarks + '"></td>'+
'<td style="width: 25px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
@ -1307,6 +1313,7 @@
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="HSNCODE">' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>';
if (userRole == 5) { // 5 - lab staff
@ -1317,16 +1324,16 @@
trIGRHTML += '<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>';
if (userRole == 5) {
trIGRHTML += '<td style="width: 100px;"> ' + item.Remarks + ' </td>';
} else {
trIGRHTML += '<td style="width: 100px;">' +
'<input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" ' +
'onchange="SetRemarks(' + i + ')" style="width: 75px;" value="' + item.Remarks + '">' +
'</td>';
}
'<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>' ;
if (userRole == 5) {
trIGRHTML += '<td style="width: 100px;">' + item.Remarks + '</td>';
} else {
trIGRHTML += '<td style="width: 100px;">' +
'<input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form auditor-restricted-field" ' +
'onchange="SetRemarks(' + i + ')" style="width: 75px;" value="' + item.Remarks + '">' +
'</td>';
}
trIGRHTML += '<td style="width: 25px;">' + '<a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" ' + 'data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus="' + igrstatus + '">' + '<i class="fa fa-solid fa-truck" style="text-align: center;"></i></a>' + '</td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
@ -1367,6 +1374,7 @@
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="HSNCODE">' + ((item.HSNCODE) ?item.HSNCODE : '') + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" name="Quantity">' + item.Quantity + '</td>' ;
if (userRole == 5) { // 5 - lab staff
@ -1376,13 +1384,13 @@
}
trIGRHTML += '<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>';
'<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>';
if (userRole == 5) {
trIGRHTML += '<td style="width: 100px;"> ' + item.Remarks + ' </td>';
} else {
trIGRHTML += '<td style="width: 100px;">' +
'<input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" ' +
'<input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form auditor-restricted-field" ' +
'onchange="SetRemarks(' + i + ')" style="width: 75px;" value="' + item.Remarks + '">' +
'</td>';
}
@ -1716,15 +1724,16 @@
// let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2');
let sentence = " ";
if (parseInt(record.is_add) === 1) {
// sentence += record.IGR_No + " was Created by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time;
sentence += record.IGR_No + " was Created by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time+" </br></br>";
if (record.field === "IGRStatus") {
str1 = record.new_data;
str2 = str1.replace(/\bIGR\b/i, '').trim();
str2 = str2 == "CREATED" ? "GENERATED" : str2;
sentence += record.IGR_No + " was <b> ` " + str2 + " ` </b> by " + record.FullName +
" on " + record.indian_date + " at " + record.indian_time;
} else {
sentence += record.IGR_No + " was <b> ` CREATED ` </b> by " + record.FullName +
sentence += record.IGR_No + " was <b> ` GENERATED ` </b> by " + record.FullName +
" on " + record.indian_date + " at " + record.indian_time;
}
} else if (parseInt(record.is_edit) === 1) {
@ -1735,7 +1744,9 @@
let displayNewData = record.new_data === null || record.new_data === "" ? " " : record.new_data;
if (record.field === "IGRStatus") {
displayOldData = displayOldData.replace(/\bIGR\b/i, '').trim();
displayOldData = displayOldData == "CREATED" ? "GENERATED" : displayOldData;
displayNewData = displayNewData.replace(/\bIGR\b/i, '').trim();
displayNewData = displayNewData == "CREATED" ? "GENERATED" : displayNewData;
}
if(displayNewData || displayOldData ){
sentence += ((record.IGRItem_No) ? record.MaterialName+" ( "+ record.MaterialCode + " ) - " : "")+fieldName+" <b> ` "+ displayOldData + " ` </b> was Updated into <b> ` " + displayNewData + " ` </b> by "+record.FullName+ " on "+record.indian_date+" at "+record.indian_time;
@ -1809,8 +1820,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);
@ -1843,7 +1854,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
@ -1854,7 +1864,6 @@
$("#NetWeight").val(v5);
$("#CurrentInx").val(inx);
fileName
if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#WeightFile")[0];
var file = fileInput.files[0];
@ -1880,20 +1889,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);
@ -1902,54 +1902,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) {
@ -2900,4 +2878,3 @@ $("#gasShortageCalculator, #editGasShortageCalculator").submit(function (event)
</script>