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

View File

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

View File

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

View File

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

View File

@ -150,7 +150,27 @@ class Emppaydate extends BaseController
function downloadEmpLoanData($paydataid = "") 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); $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'); $PO = $this->request->getPost('id');
$CreatedBy = $this->session->get('userId'); $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); $data = $this->inwardgateregister_model->viewpurchaseorder($PO);
// echo "<pre>"; print_r($data);die;
echo json_encode($data); echo json_encode($data);
} }
@ -1080,24 +1081,29 @@ function updateIGRWeight(){
$this->saveIGRLineitemHistory($igr_lineitem, $IGRNO,$IGRItemNo); $this->saveIGRLineitemHistory($igr_lineitem, $IGRNO,$IGRItemNo);
$requestWeightFileName =null ; $requestWeightFileName =null ;
if($WeightFile){ $msg = null;
if (!empty($requestWeightFileName)) {
if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) { if ($WeightFile && $WeightFile->isValid() && !$WeightFile->hasMoved()) {
$requestWeightFileName = $WeightFile->getName(); // Generate a unique name
// Optional: Check for duplicates in DB if needed
if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) { if (!empty($this->inwardgateregister_model->isFileExistsInIGRdetails($requestWeightFileName))) {
log_message('error', 'File already exists in the database'.$requestWeightFileName); log_message('error', 'File already exists in the database: ' . $requestWeightFileName);
} $msg = "'File already exists in the database: ' . $requestWeightFileName";
else{ } else {
$WeightFile->move($path, $requestWeightFileName); $WeightFile->move($path, $requestWeightFileName);
$igr_lineitem['WeightFile'] = $requestWeightFileName; $igr_lineitem['WeightFile'] = $requestWeightFileName;
$msg = "";
} }
} }else{
} log_message('error', 'File invlisd: ' . $requestWeightFileName);
$msg = "";
} }
$update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo); $update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo);
if ($update) { if ($update) {
echo "Details update successfully!"; echo "Details updated successfully!\n".$msg;
} }
} }
function AddOgr() function AddOgr()
@ -1327,34 +1333,46 @@ function updateIGRWeight(){
} }
} }
public function downloadFilesAsZip($igrno)
public function downloadFilesAsZip()
{ {
// Get all file details for the given IGR number // Get the IGR number from query string
$igrno = $this->request->getGet('IGRNO');
// Get file details based on IGR number
$fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrno); $fileDetails = $this->inwardgateregister_model->getAllIgrFileDetails($igrno);
// Define the root path for files // Define root path for original files
$rootPath = ROOTPATH . 'public/uploads/Igrfiles/'; $fileRootPath = ROOTPATH . 'public/uploads/Igrfiles/';
// Check if the directory exists, create if it doesn't // Define separate directory for ZIP output
if (!is_dir($rootPath)) { $zipDir = ROOTPATH . 'writable/zips/';
if (!mkdir($rootPath, 0755, true)) { if (!is_dir($zipDir)) {
echo '<script>alert("Failed to create the directory.");</script>'; if (!mkdir($zipDir, 0777, true)) {
echo '<script>alert("Failed to create zip directory.");</script>';
return; return;
} }
} }
// Ensure the directory is writable // Make sure ZIP directory is writable
if (!is_writable($rootPath)) { if (!is_writable($zipDir)) {
echo '<script>alert("Directory is not writable.");</script>'; echo '<script>alert("ZIP directory is not writable.");</script>';
return; return;
} }
// Create a new ZIP archive // OPTIONAL: Set PHP's temp directory if the system one is failing
$customTemp = ROOTPATH . 'writable/tempzip/';
if (!is_dir($customTemp)) {
mkdir($customTemp, 0777, true);
}
ini_set('sys_temp_dir', $customTemp);
// Create ZIP archive
$zip = new ZipArchive(); $zip = new ZipArchive();
$zipFileName = $igrno . '.zip'; $zipFileName = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $igrno) . '.zip'; // sanitize filename
$zipFilePath = $rootPath . $zipFileName; $zipFilePath = $zipDir . $zipFileName;
// Attempt to open the ZIP file
if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== TRUE) { if ($zip->open($zipFilePath, ZipArchive::CREATE | ZipArchive::OVERWRITE) !== TRUE) {
echo '<script>alert("Failed to create ZIP file.");</script>'; echo '<script>alert("Failed to create ZIP file.");</script>';
return redirect()->to('/ViewIGR'); return redirect()->to('/ViewIGR');
@ -1362,32 +1380,27 @@ function updateIGRWeight(){
$filesAdded = false; $filesAdded = false;
// Add each file to the ZIP archive // Add each file to ZIP
foreach ($fileDetails as $file) { foreach ($fileDetails as $file) {
$filePath = $rootPath . $file->file; $filePath = $fileRootPath . $file->file;
// Ensure file exists and is not a directory
if (file_exists($filePath) && is_file($filePath)) { if (file_exists($filePath) && is_file($filePath)) {
// Sanitize filename for ZIP
$sanitizedFilename = preg_replace('/[^a-zA-Z0-9_\-\.]/', '_', $file->file); $sanitizedFilename = preg_replace('/[^a-zA-Z0-9_\-\.]/', '_', $file->file);
if (!$zip->addFile($filePath, $sanitizedFilename)) { if (!$zip->addFile($filePath, $sanitizedFilename)) {
echo '<script>alert("Failed to add file: ' . $file->filename . '");</script>'; echo '<script>alert("Failed to add file: ' . $file->file . '");</script>';
$zip->close(); $zip->close();
return redirect()->to('/ViewIGR'); return redirect()->to('/ViewIGR');
} }
$filesAdded = true; $filesAdded = true;
} else { } else {
echo '<script> alert("File not found or is a directory: ' . $filePath . '");</script>'; echo '<script>alert("File not found: ' . $filePath . '");</script>';
continue;
} }
} }
// Close ZIP archive if files were added
if ($filesAdded) { if ($filesAdded) {
$zip->close(); // Close ZIP only if files were added $zip->close();
return $this->response->download($zipFilePath, null)->setFileName($zipFileName); return $this->response->download($zipFilePath, null)->setFileName($zipFileName);
} else { } else {
// Close and remove any empty ZIP file created
$zip->close(); $zip->close();
if (file_exists($zipFilePath)) { if (file_exists($zipFilePath)) {
unlink($zipFilePath); unlink($zipFilePath);
@ -1697,6 +1710,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 ************************************************************** ********************************************************* sec_gas_shortage_ends **************************************************************
*/ */

View File

@ -970,7 +970,7 @@ class Monthlypay extends BaseController
$this->global['pageTitle'] = 'Employee Leave Application Form'; $this->global['pageTitle'] = 'Employee Leave Application Form';
$data['leave_info'] = $this->monthlypay_model->getheringleaveApplicationForm(); $data['leave_info'] = $this->monthlypay_model->getheringleaveApplicationForm();
$data['employee_info'] = $this->monthlypay_model->getheringemployeeinformation(); $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); $this->loadviews('employeeLeaveApplicationForm', $this->global, $data, NULL);
} }
@ -991,18 +991,19 @@ class Monthlypay extends BaseController
$leave_details['created_by'] = $userId; $leave_details['created_by'] = $userId;
$affectedRows = $this->monthlypay_model->saveleaveApplicationForm($leave_details,$id); $affectedRows = $this->monthlypay_model->saveleaveApplicationForm($leave_details,$id);
if ($affectedRows > 0) { // if ($affectedRows > 0) {
$data = ['status' => true, 'message' => 'Leave Applicationform details created successfully.']; $data = ['status' => true, 'message' => 'Leave Applicationform details created successfully.'];
} // }
} else { } else {
$leave_details['leave_application_id'] = $id; $leave_details['leave_application_id'] = $id;
$leave_details['updated_by'] = $userId; $leave_details['updated_by'] = $userId;
$affectedRows = $this->monthlypay_model->saveleaveApplicationForm($leave_details,$id); $affectedRows = $this->monthlypay_model->saveleaveApplicationForm($leave_details,$id);
if ($affectedRows > 0) { // if ($affectedRows > 0) {
// $data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
// }else{
// $data = ['status' => true, 'message' => 'There is no changes in Leave Applicationform details.'];
// }
$data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.']; $data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
}else{
$data = ['status' => true, 'message' => 'There is no changes in Leave Applicationform details.'];
}
} }
@ -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){ public function leaveApplicationPDF($leave_application_id){

View File

@ -287,13 +287,6 @@ class Payslip extends BaseController
$empSalarySub = $esiAmount + $pfAmount + $loan; $empSalarySub = $esiAmount + $pfAmount + $loan;
$salaryInCurrentday = $empSalaryAdd - $empSalarySub; $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); $employeeSalary[] = round($salaryInCurrentday);
$esi[] = number_format($esiAmount,2, '.', ''); $esi[] = number_format($esiAmount,2, '.', '');
@ -309,6 +302,331 @@ class Payslip extends BaseController
$this->loadViews("monthlypayinputs", $this->global, $data, NULL); $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) public function driverMonthlyPayInputs($current)
{ {
@ -576,7 +894,7 @@ class Payslip extends BaseController
$Estimate_first = explode(".", $Estimate); $Estimate_first = explode(".", $Estimate);
if (!is_numeric($Estimate) || (strlen((string)$Estimate)) > 8 || (strlen((string)$Estimate_first[0])) > 6) { if (!is_numeric($Estimate) || (strlen((string)$Estimate)) > 10 || (strlen((string)$Estimate_first[0])) > 8) {
// echo $Estimate_first[0]; // echo $Estimate_first[0];
// echo $EmpID . "-Estimate Invalid Data!"; // echo $EmpID . "-Estimate Invalid Data!";
$ErrorFlag++; $ErrorFlag++;
@ -602,7 +920,7 @@ class Payslip extends BaseController
$EmpID = $j['Emp ID']; $EmpID = $j['Emp ID'];
$is_driver = $this->driver_model->getDriverName($EmpID,1); $is_driver = $this->driver_model->getDriverName($EmpID,1);
$DaysWorked = $j['Days Worked']; $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 ; $TotalCalDays = isset($j['Total Days']) ? $j['Total Days'] : 0.00 ;
$ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ; $ActualSalary = isset($j['Basic Salary']) ? $j['Basic Salary'] : 0.00 ;
$WorkedSalary = isset($j['Worked Salary']) ? $j['Worked Salary'] : 0.00 ; $WorkedSalary = isset($j['Worked Salary']) ? $j['Worked Salary'] : 0.00 ;
@ -664,7 +982,6 @@ class Payslip extends BaseController
'month_year'=>$month, 'month_year'=>$month,
'driver_id'=>$EmpID, 'driver_id'=>$EmpID,
'TotalCalDays' => $TotalCalDays, 'TotalCalDays' => $TotalCalDays,
'no_of_loads'=>(strpos($NoTrips, "(trip)") !== false) ? explode(" ", $NoTrips)[0] : 0,
'monthly_food_amount'=>$Food, 'monthly_food_amount'=>$Food,
'total_diesel_amount'=>$Diesel, 'total_diesel_amount'=>$Diesel,
'total_shed_amount'=>$Shed, 'total_shed_amount'=>$Shed,
@ -681,7 +998,6 @@ class Payslip extends BaseController
); );
// print_r($drivermonthlypaydata);die;
$result = $this->driver_model->saveMonthlyData($drivermonthlypaydata); $result = $this->driver_model->saveMonthlyData($drivermonthlypaydata);
} }
@ -845,7 +1161,6 @@ class Payslip extends BaseController
// print_r($is_driver);die; // print_r($is_driver);die;
if($is_driver == "1"){ if($is_driver == "1"){
$Data['PayDetails'] = $this->driver_model->GetPayslipdata($Payon, $EmpID); $Data['PayDetails'] = $this->driver_model->GetPayslipdata($Payon, $EmpID);
// print_r($Data['PayDetails']);die;
$name = $Data['PayDetails'][0]->driver_name; $name = $Data['PayDetails'][0]->driver_name;
$filename = 'PayslipFor-' . $EmpID . ' ' . $name . ' ' . $m . ' ' . $y; $filename = 'PayslipFor-' . $EmpID . ' ' . $name . ' ' . $m . ' ' . $y;
@ -878,7 +1193,7 @@ class Payslip extends BaseController
} }
} }
// echo $html;die;
$mpdf = new Mpdf([ $mpdf = new Mpdf([
'mode' => 'utf-8', 'mode' => 'utf-8',
@ -899,7 +1214,7 @@ class Payslip extends BaseController
$mpdf->WriteHTML($html); $mpdf->WriteHTML($html);
$mpdf->SetTitle('Resico:Payslip'); $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['assetcode'] = $this->rawmaterialdetails_model->getAssetcode();
$data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID); $data['avg_price'] = $this->rawmaterialdetails_model->getMaterialAvg($RawMaterialID);
$data['materialRateHistory'] = $this->rawmaterialdetails_model->getMaterialRateHistory($RawMaterialID); $data['materialRateHistory'] = $this->rawmaterialdetails_model->getMaterialRateHistory($RawMaterialID);
$data['materialListPage'] = $_GET['page']??1;
//print_r($data['avg_price']);die(); //print_r($data['avg_price']);die();
$this->global['pageTitle'] = 'Edit Material Master'; $this->global['pageTitle'] = 'Edit Material Master';
@ -317,6 +318,7 @@ class Rawmaterialdetails extends BaseController
$stock = $this->request->getPost('openstock'); $stock = $this->request->getPost('openstock');
$reorder = $this->request->getPost('reorder'); $reorder = $this->request->getPost('reorder');
$stockdate = $this->request->getPost('Date'); $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"); $stockdate = (empty($stockdate)) ? NULL : get_date_time_dynamical_format('d-m-Y','Y-m-d',"$stockdate");
$chked = $this->request->getPost('isactive'); $chked = $this->request->getPost('isactive');
@ -331,9 +333,13 @@ class Rawmaterialdetails extends BaseController
if ($result == true) { if ($result == true) {
$this->session->setFlashdata('success', 'RawMaterial Updated successfully!'); $this->session->setFlashdata('success', 'RawMaterial Updated successfully!');
$this->session->setFlashdata('materialListPage', "$materialListPage");
} else { } else {
echo "<script>alert('RawMaterial Record Not updated!');</script>"; echo "<script>alert('RawMaterial Record Not updated!');</script>";
$this->session->setFlashdata('error', 'RawMaterial Record Not updated!'); $this->session->setFlashdata('error', 'RawMaterial Record Not updated!');
$this->session->setFlashdata('materialListPage', "$materialListPage");
} }
return redirect()->route('rawmaterialListing'); return redirect()->route('rawmaterialListing');

View File

@ -130,18 +130,7 @@ class Requisitionform extends BaseController
// echo 'ReqType'.$ReqPOType; // echo 'ReqType'.$ReqPOType;
$data['ReqPOType'] = $ReqPOType == '' ? $ReqType : $ReqPOType; $data['ReqPOType'] = $ReqPOType == '' ? $ReqType : $ReqPOType;
$data['LineItem'] = $this->requistion_model->getEditRequistItemList($ReqNo); $data['LineItem'] = $this->requistion_model->getEditRequistItemList($ReqNo);
$data['description'] = ''; $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['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, $ReqType); // Old Based on Type..
$data['MaterialCode'] = $this->requistion_model->EditMaterialCode($ReqNo); $data['MaterialCode'] = $this->requistion_model->EditMaterialCode($ReqNo);
@ -215,49 +204,6 @@ class Requisitionform extends BaseController
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL); $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() function getAvailableBudAmount()
{ {
@ -288,6 +234,7 @@ class Requisitionform extends BaseController
{ {
$ReqType = $this->request->getPost('id'); $ReqType = $this->request->getPost('id');
$CatType = $this->request->getPost('cid');
$MaterialCode = $this->requistion_model->GetMaterialCode($ReqType); $MaterialCode = $this->requistion_model->GetMaterialCode($ReqType);
$MaterialName = ""; $MaterialName = "";
@ -298,7 +245,9 @@ class Requisitionform extends BaseController
for ($j = 0; $j < count($MaterialCode); $j++) { for ($j = 0; $j < count($MaterialCode); $j++) {
$Code = $MaterialCode[$j]['MaterialCode']; $Code = $MaterialCode[$j]['MaterialCode'];
$Name = $MaterialCode[$j]['MaterialName']; $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']; $MaterialName = $MaterialCode[0]['MaterialName'];
$UOM = $MaterialCode[0]['UOM']; $UOM = $MaterialCode[0]['UOM'];
@ -319,6 +268,28 @@ class Requisitionform extends BaseController
return $this->response->setJSON(['MatDetail' => $MaterialDetails]); 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 * To Insert the Requistion Details to Database
*/ */
@ -399,9 +370,13 @@ class Requisitionform extends BaseController
} }
if ($Status == REQ_DRAFT) { if ($Status == REQ_DRAFT) {
$display_message = 'Successfully Saved 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{ }else{
$display_message = 'Successfully Created the Requistion details.Requistion No is ' . $ReqNumber; $display_message = "Successfully Created the Requistion details!\nRequistion Number Is: ". $ReqNumber;
} }
return $this->response->setJSON([$display_message]); 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]); return $this->response->setJSON([$display_message]);
} }
@ -601,7 +577,8 @@ class Requisitionform extends BaseController
$Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy); $Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy);
$this->requistion_model->UpdateRequistion($Request, $ReqNo); $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 // Validation passed
$EmpID = $this->request->getPost('EmpList'); $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'); $password = (string)$this->request->getPost('password');
$Createddt = date('Y-m-d H:i:s'); $Createddt = date('Y-m-d H:i:s');
$email = $this->request->getPost('MailID'); $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 = [ $userInfo = [
'email' => $email, 'email' => $email,
'EmpID' => $EmpID, 'EmpID' => $EmpID,
@ -1040,15 +1036,6 @@ class User extends BaseController
$result = $this->user_model->addNewUser($userInfo); $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) { if ($result > 0) {
// return redirect()->to('userListing')->with('success', 'New user created successfully!'); // return redirect()->to('userListing')->with('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() function Deleteuserdepartment()
{ {

View File

@ -3,47 +3,412 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\Exception as SpreadsheetReaderException; 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')) { if (!function_exists('generate_excel')) {
/* function generate_excel($headlines, $xldata)
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)
{ {
$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 // Create new Spreadsheet object
$spreadsheet = new Spreadsheet(); $spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
// Set worksheet title // Set worksheet title
$spreadsheet->getActiveSheet()->setTitle('Sheet 1'); $sheet->setTitle('Sheet 1');
// Set headers into the spreadsheet
$spreadsheet->getActiveSheet()->fromArray([$headers], null, 'A1');
// Set data into the spreadsheet
$spreadsheet->getActiveSheet()->fromArray($data, null, 'A2');
// A1 Start here... should be compnay name ....
$sheet->setCellValue('A1', $company);
// 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);
$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 // Create Excel writer
$writer = new Xlsx($spreadsheet); $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 { try {
// Save Excel file to the specified path // Save Excel file to the specified path
$writer->save($filename); ob_clean();
return true; // Return true if file was successfully saved 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) { } catch (\Exception $e) {
// Log or handle the exception // Log or handle the exception
return false; // Return false if there was an error saving the file 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 $afterFind = [];
protected $beforeDelete = []; protected $beforeDelete = [];
protected $afterDelete = []; 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(); //echo $ConfigID ;die();
$builder = $this->db->table('t_configmaster COM') $builder = $this->db->table('t_configmaster COM')
->select('*') ->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('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('COM.Config_ID', $ConfigID)
->where('con.isActive', $isActiveFilter); ->where('con.isActive', $isActiveFilter)
->orderBy('con.Key', 'desc');
$query = $builder->get(); $query = $builder->get();
return $query->getResult(); 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('Config_ID', $configId)
->where('key',$key) ->where('key',$key)
->update([ ->update([
'ConfigValue'=> $configValue 'ConfigValue'=> $configValue,
'updated_by' => $userId
]); ]);
$res = $this->db->affectedRows(); $res = $this->db->affectedRows();
return $res; return $res;
@ -308,6 +324,7 @@ return $result;
[ [
'ConfigValue'=>$configValue, 'ConfigValue'=>$configValue,
'Config_ID'=>$configId, 'Config_ID'=>$configId,
'created_by'=> $userId,
'isActive'=> 1]); 'isActive'=> 1]);
$res = $this->db->affectedRows(); $res = $this->db->affectedRows();
return $res; return $res;
@ -320,6 +337,7 @@ return $result;
$result = $this->db->table('t_configdetails') $result = $this->db->table('t_configdetails')
->where('Config_ID','C023') ->where('Config_ID','C023')
->where('isActive',1)
->get() ->get()
->getResultArray(); ->getResultArray();

View File

@ -131,12 +131,14 @@ class Driver_model extends Model
} }
function driverAttendanceForMonthlyPayInputs($from,$to){ function driverAttendanceForMonthlyPayInputs($from,$to){
// list($year,$month,$date) = explode('-', get_current_date()); list($year,$month,$date) = explode('-', $from);
$t_driver_monthly_pay_inputs_month_year = "$month-$year";
// $new_date_format = "$year-$month-01"; // $new_date_format = "$year-$month-01";
$builder = $this->db->table('t_driver_attendance') $builder = $this->db->table('t_driver_attendance')
->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, ->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, ->select('SUM(t_driver_attendance.salary_amount) as monthly_salary_amount,
SUM(t_driver_attendance.food_amount) as monthly_food_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') 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_emp_pay_data','t_emp_pay_data.EmpID=driver_details.EmpID','Left')
->join('t_loan_master','t_loan_master.EmpID = driver_details.EmpID and t_loan_master.Remaining_Due != 0','Left') ->join('t_loan_master','t_loan_master.EmpID = driver_details.EmpID and t_loan_master.Remaining_Due != 0','Left')
->join('t_loan_history','t_loan_history.Loan_ID = t_loan_master.Loan_ID','Left') ->join('t_loan_history','t_loan_history.Loan_ID = t_loan_master.Loan_ID','Left')
->join('t_driver_monthly_pay_inputs','t_driver_monthly_pay_inputs.driver_id = driver_details.EmpID','Left') ->join('t_driver_monthly_pay_inputs',
't_driver_monthly_pay_inputs.driver_id = driver_details.EmpID AND
t_driver_monthly_pay_inputs.month_year = "'.$t_driver_monthly_pay_inputs_month_year.'"',
'left'
)
->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"') ->where('t_driver_attendance.date BETWEEN "'.$from.'" AND "'.$to.'"')
// ->where("t_loan_master.Due_Start_Date", $new_date_format) // ->where("t_loan_master.Due_Start_Date", $new_date_format)
->groupBy('DATE_FORMAT(t_driver_attendance.date, "%M-%Y"),t_driver_attendance.driver_id'); ->groupBy('DATE_FORMAT(t_driver_attendance.date, "%M-%Y"),t_driver_attendance.driver_id');
$query = $builder->get(); $query = $builder->get();
// $last_query = $this->db->getLastQuery(); // $last_query = $this->db->getLastQuery();
// echo $last_query;die; // echo $last_query;
return $query->getResult(); return $query->getResult();
} }
function driverMonthlyPayInputs($monthYear){ function driverMonthlyPayInputs($monthYear){
$builder = $this->db->table('t_driver_monthly_pay_inputs'); $builder = $this->db->table('t_driver_monthly_pay_inputs');
@ -222,6 +227,7 @@ class Driver_model extends Model
->where('t_driver_attendance.driver_id',$input_driver_id); ->where('t_driver_attendance.driver_id',$input_driver_id);
$query = $builder->get()->getRow(); $query = $builder->get()->getRow();
// $last_query = $this->db->getLastQuery(); // $last_query = $this->db->getLastQuery();
// echo $last_query;die;
return $query; return $query;
} }
function getPayOn() function getPayOn()
@ -317,13 +323,14 @@ class Driver_model extends Model
$builder = $this->db->table('t_driver_payroll Pay')->select('Pay.*') $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('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.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') // ->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_employee_details Emp', 'Pay.driver_id = Emp.EmpID')
->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode') ->join('t_departmentdetails Dep', 'Emp.Departmentcode = Dep.DEPCode')
->join('t_emp_pay_data','t_emp_pay_data.EmpID=Emp.EmpID','Left') ->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 != '') { if ($PayOn != '') {
$builder->where('Pay.PayOn', $PayOn); $builder->where('Pay.PayOn', $PayOn);
} }

View File

@ -256,13 +256,18 @@ class Employeedetails_model extends Model
function export_excel() function export_excel()
{ {
$builder = $this->db->table('t_employee_details as det') $builder = $this->db->table('t_employee_details as ed')
->select(' det.*,Dep.DepartmentName as DepartmentName,det.firstname,emp1.firstname as UpdatedByName,emp1.firstname as CreatedByName') ->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')
->join('t_departmentdetails Dep', 'det.Departmentcode = Dep.DEPCode', 'left') ->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('tbl_users as tbl', ' det.createdby = tbl.userid', 'left') ->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('t_employee_details as emp', 'emp.empid=tbl.empid', 'left')
->join('tbl_users as tbl1', ' det.UpdatedBy = tbl1.userid', 'left') ->join('tbl_users as tbl1', ' ed.UpdatedBy = tbl1.userid', 'left')
->join('t_employee_details as emp1', 'emp1.empid=tbl1.empid', '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(); return $builder->get()->getResultArray();
} }
} }

View File

@ -68,7 +68,7 @@ class Emppaydate_model extends Model
} }
function getUserInfo($paydataid) 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 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 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 = ?;'; where t_emp_pay_data.Pay_Data_ID = ?;';
@ -76,6 +76,23 @@ class Emppaydate_model extends Model
return $query->getResult(); 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) function getUserLoanHistoryInfo($loan_id)
{ {
$sql = 'select * from t_loan_history where Loan_ID = ?;'; $sql = 'select * from t_loan_history where Loan_ID = ?;';

View File

@ -45,4 +45,57 @@ class GasStockModel extends Model
protected $afterFind = []; protected $afterFind = [];
protected $beforeDelete = []; protected $beforeDelete = [];
protected $afterDelete = []; 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) 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 FROM t_purchaseorder_master POM
LEFT JOIN t_purchaseorder_lineitem POL ON POL.PONO = POM.PONO LEFT JOIN t_purchaseorder_lineitem POL ON POL.PONO = POM.PONO
LEFT JOIN t_igr_master IGM ON IGM.PONO = POL.PONO LEFT JOIN t_igr_master IGM ON IGM.PONO = POL.PONO
@ -568,7 +568,7 @@ class Inwardgateregister_model extends Model
->distinct() ->distinct()
->select(" ->select("
igr.IGRNO,igr.*,igrd.*, igr.IGRNO,igr.*,igrd.*,
MM.MaterialName,MM.UOM, MM.MaterialName,MM.UOM,MM.HSNCODE,
sup.Address,sup.SupplierName, sup.Address,sup.SupplierName,
POL.Rate, POL.Rate,
POM.ServiceDescription,POL.Quantity,POM.POType,POM.IsOpenOrder, POM.ServiceDescription,POL.Quantity,POM.POType,POM.IsOpenOrder,
@ -1515,4 +1515,41 @@ class Inwardgateregister_model extends Model
return $result; 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; //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(?) //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 from t_emp_pay_data
left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID 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 = ? 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)); $query = $this->db->query($sql, array($month, $month, $lastdate, $current, $current));
// Get the last executed query // Get the last executed query
// $last_query = $this->db->getLastQuery(); // $last_query = $this->db->getLastQuery();
// echo $last_query; // echo $last_query;die;
return $query->getResult(); 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 $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 FROM t_purchaseorder_lineitem LineItem
left join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode left join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join t_service_tax Tax on Tax.LineItemNo = LineItem.LineItemNo 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 + $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 FROM t_purchaseorder_lineitem LineItem
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join t_revenue_tax Tax on Tax.LineItemNo = LineItem.LineItemNo 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, ExciseDutySHCess, AfterCustomEdCess, ROUND((Quantity * Rate), 2) AS TotalOrderValue,
ROUND((POMast.ExchangeRate * BasicPriceInMTon), 2) AS BasicINRValue, TotalValue, CurrencyType, ROUND((POMast.ExchangeRate * BasicPriceInMTon), 2) AS BasicINRValue, TotalValue, CurrencyType,
ReceivedQuantity, Tax.*, LineItem.ServiceMaterialDescription, Req.CostCenterCode, ReceivedQuantity, Tax.*, LineItem.ServiceMaterialDescription, Req.CostCenterCode,
Dept.DepartmentName Dept.DepartmentName,Mat.HSNCODE
FROM t_purchaseorder_lineitem LineItem FROM t_purchaseorder_lineitem LineItem
LEFT JOIN t_purchaseorder_master POMast ON POMast.PONO = LineItem.PONO 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, $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.*, 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, 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 Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode 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 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, ,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, 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 Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode 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 //This function used to get the material category using configdetails table
function getmaterialCategory($MaterialCategory = '') function getmaterialCategory()
{ {
$Config_ID = 'C023'; $Config_ID = 'C023';
$builder = $this->db->table('t_configdetails') $builder = $this->db->table('t_configdetails')
->select('Key,Config_ID,ConfigValue') ->select('Key,Config_ID,ConfigValue')
->where('isActive', 1) ->where('isActive', 1)
->where('Config_id', $Config_ID); ->where('Config_id', $Config_ID);
if ($MaterialCategory != '') { // if ($MaterialCategory != '') {
$builder->where('ConfigValue !=', $MaterialCategory); // $builder->where('ConfigValue !=', $MaterialCategory);
} // }
$query = $builder->get(); $query = $builder->get();
return $query->getResult(); return $query->getResult();
@ -143,6 +143,7 @@ class Rawmaterialdetails_model extends Model
return $query->getResult(); return $query->getResult();
} }
function getAllSilicaRawMaterialCode(){ function getAllSilicaRawMaterialCode(){
$builder = $this->db->table('t_materialmaster') $builder = $this->db->table('t_materialmaster')
@ -444,7 +445,7 @@ where (CurrentStock+OpeningStock)<reorder";
$builder = $this->db->table('t_materialmaster MM') $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); ->where('MM.Category' , $configKey);
$query = $builder->get(); $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..... // This function also called in store req. also $reqType not removed.....
function EditMaterialCode($ReqNo, $ReqType = NULL){ 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 ( WHERE Mat.MaterialCode NOT IN (
SELECT Req.MaterialCode FROM t_requestion_details Req SELECT Req.MaterialCode FROM t_requestion_details Req
JOIN t_requestion_master mast ON Req.ReqNo = mast.ReqNo JOIN t_requestion_master mast ON Req.ReqNo = mast.ReqNo
@ -175,7 +175,7 @@ class Requistion_model extends Model
function GetMaterialCode($ReqType,$NotArray='') function GetMaterialCode($ReqType,$NotArray='')
{ {
$builder = $this->db->table('t_materialmaster') $builder = $this->db->table('t_materialmaster')
->select('MaterialCode, MaterialName,UOM,material_rate') ->select('MaterialCode, MaterialName,UOM,material_rate,HSNCODE')
->where('IsActive',1); ->where('IsActive',1);
//->where('MaterialType',$ReqType ); //->where('MaterialType',$ReqType );
@ -190,6 +190,7 @@ class Requistion_model extends Model
return $query->getResult(); return $query->getResult();
} }
} }
/** /**
* This function is used to get the Raw Material information * This function is used to get the Raw Material information
* @return array $result : This is result of the query * @return array $result : This is result of the query
@ -197,7 +198,7 @@ class Requistion_model extends Model
function getRawMaterialList($MaterialCode) function getRawMaterialList($MaterialCode)
{ {
$builder = $this->db->table('t_materialmaster MM') $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') ->join('t_configdetails CD', 'CD.Key = MM.Category', 'left')
->where('MM.MaterialCode',$MaterialCode ); ->where('MM.MaterialCode',$MaterialCode );
$query = $builder->get(); $query = $builder->get();
@ -594,6 +595,17 @@ class Requistion_model extends Model
return $categoryName; 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 $returnType = 'array';
protected $useSoftDeletes = false; protected $useSoftDeletes = false;
protected $protectFields = true; 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', 'trpPhysicalGasPerTon', 'panelGasConsumption','panelGasPerTon','edRunningHours','edProduction','edUsage',
'trpProduction', 'trpProductionPerHour', 'waterReceipt', 'waterConsumption' ,'ebReading', 'trpProduction', 'trpProductionPerHour', 'waterReceipt', 'waterConsumption' ,'ebReading',
'ebReadingPerUnitTon']; 'ebReadingPerUnitTon'];
@ -88,8 +89,8 @@ class TrpProductionModel extends Model
tpd.physicalGasConsumption, tpd.physicalGasConsumption,
IFNULL(tdmd.totalGasConsumption, 0) AS drierGasConsumption,
IFNULL(tcmd.totalGasConsumption, 0) AS coatingGasConsumption, IFNULL(tcmd.totalGasConsumption, 0) AS coatingGasConsumption,
tpd.drierGasConsumption As drierGasConsumption,
tpd.trpPlusDrierGasConsumption, tpd.trpPlusDrierGasConsumption,
tpd.trpPhysicalGasPerTon, tpd.trpPhysicalGasPerTon,
tpd.panelGasConsumption, tpd.panelGasConsumption,
@ -143,13 +144,15 @@ class TrpProductionModel extends Model
$builder->join("({$subquery1}) tcmd", 'tcmd.date = tpmd.date', 'left'); $builder->join("({$subquery1}) tcmd", 'tcmd.date = tpmd.date', 'left');
// Subquery: Drier Machine Gas Consumption //client requirement change from auto entry to manual entry from drier 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'); // 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(); 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, menubar: false,
statusbar: false, statusbar: false,
toolbar: false toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
}); });
tinymce.init({ tinymce.init({
selector: "textarea#txtSpcialInstruction", // Add model SpcialInstruction selector: "textarea#txtSpcialInstruction", // Add model SpcialInstruction
@ -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 <input type="checkbox" id="IsOpenOrder" name="IsOpenOrder" value="1" <?php echo $isChecked ? 'checked' : ''; ?>> IS THIS OPEN ORDER FORMAT
<?php } ?> <?php } ?>
<?php if(!$isChecked){ ?> <?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 } ?>
<?php } ?> <?php } ?>
</div> </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:center !important; white-space: nowrap !important;">Requisition No</th>
<th style="text-align:left !important; white-space: nowrap !important;">Item Code</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="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="white-space: nowrap !important;">Line Item Specs</th>
<th style="text-align: left; white-space: nowrap !important;">Quantity</th> <th style="text-align: left; white-space: nowrap !important;">Quantity</th>
<th style="white-space: nowrap !important;">UOM</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 echo $record->MaterialCode ?></td>
<td style="text-align:left !important;"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "..."); <td style="text-align:left !important;"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td> echo $shortName; ?></td>
<td style="text-align:center !important;"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;"> <td style="text-align:left !important;">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?> <?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#" <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) { ?> 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> <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 <?php
} else { ?> } 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> <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> <label>Scope Of Work</label>
<?php <?php
$ServiceDescription = html_entity_decode($ServiceDescription); $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'); $data = array('name' => 'ScopeofWork', 'value' => set_value('ScopeofWork', $ServiceDescription), 'id' => 'ScopeofWork', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data); echo form_textarea($data);
?> ?>
@ -1657,7 +1664,7 @@ if (!empty($getlogpodtl)) {
<label for="deletePreviousPurchaseOrderFile"><a title="Previous Upload PO File" <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> href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>Previous Upload - </span><small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp; &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> </div>
<?php } ?> <?php } ?>
@ -1699,21 +1706,21 @@ if (!empty($getlogpodtl)) {
<div class="col-md-7 text-right"> <div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?> <?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-danger auditor-restricted-btn 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 auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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) { ?> <?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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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) { ?> <?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 auditor-restricted-btn" 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 if($PONOStatus == REQITEM_Emergency_PO_CREATED) { ?> <?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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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 { ?> <?php } else { ?>
<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="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<?php } ?> <?php } ?>
@ -1966,7 +1973,7 @@ if (!empty($getlogpodtl)) {
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:10px;">Cancel</a> <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> </div>
</form> </form>
@ -2260,7 +2267,7 @@ if (!empty($getlogpodtl)) {
<div class="modal-footer"> <div class="modal-footer">
<div class="form-row"> <div class="form-row">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin:10px;">Cancel</a> <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>
</div> </div>
@ -2547,7 +2554,7 @@ if (!empty($getlogpodtl)) {
$('input[type="file"], input[type="radio"], input[type="checkbox"]').attr('disabled', true); $('input[type="file"], input[type="radio"], input[type="checkbox"]').attr('disabled', true);
$("#PaymentTerms,#drpSupplier,#insuranceStatus,#PoTypeOptions,#workstatus").prop("disabled", true); $("#PaymentTerms,#drpSupplier,#insuranceStatus,#PoTypeOptions,#workstatus").prop("disabled", true);
} }
var openOrder = <?php echo $IsOpenOrder; ?>; var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0 ; ?>;
if(openOrder){ if(openOrder){
$('#Quantity').val(0); $('#Quantity').val(0);
$('#Quantity').removeAttr('required'); $('#Quantity').removeAttr('required');
@ -2583,7 +2590,7 @@ if (!empty($getlogpodtl)) {
$('#EditotherDescription').hide(); $('#EditotherDescription').hide();
$('#otherdescription').hide() $('#otherdescription').hide();
@ -2597,6 +2604,14 @@ if (!empty($getlogpodtl)) {
var AvilBudget = $('#AvlBudAmt').val(); var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val(); var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').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 materialName = $("#ItemName").val();
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var addPer = ''; var addPer = '';
@ -2666,8 +2681,9 @@ if (!empty($getlogpodtl)) {
<td align="left">${temp}</td> <td align="left">${temp}</td>
<td align="center">${Reqnumber}</td> <td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td> <td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`; <td align="left">${shorten}</td>
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { <td align="center">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td><a href="#" class="editable-field" rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}" data-id="${temp}"
data-notes="-">-</a> data-notes="-">-</a>
@ -2783,6 +2799,11 @@ if (!empty($getlogpodtl)) {
var OtherAmt = $('#EditOtherAllowances').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(); var basicval = $("#txtEditBasicValue").val();
@ -2795,12 +2816,13 @@ if (!empty($getlogpodtl)) {
cellval[2].innerHTML = editMaterialCode; cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription; cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity; cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editUOM; cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2); cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = parseFloat(basicval).toFixed(2); cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2); cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2); cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[11].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode); $('#materialCode' + userid).val(editMaterialCode);
@ -3118,7 +3140,7 @@ if (!empty($getlogpodtl)) {
$('#txtSpcialInstruction').focus(); $('#txtSpcialInstruction').focus();
return false; return false;
} else { } else {
var openOrder = <?php echo $IsOpenOrder; ?>; var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0; ?>;
if(!openOrder){ if(!openOrder){
if ($('#Quantity').val() == '') { if ($('#Quantity').val() == '') {
alert('Please Enter the Quantity value'); alert('Please Enter the Quantity value');
@ -3356,6 +3378,7 @@ if (!empty($getlogpodtl)) {
//If others is the payment terms to display mandatory field //If others is the payment terms to display mandatory field
$(document).ready(function() { $(document).ready(function() {
$('#otherdescription').hide();
$("#PaymentTerms").change(function() { $("#PaymentTerms").change(function() {
var otherPayment = '<?php echo $otherPayment; ?>'; var otherPayment = '<?php echo $otherPayment; ?>';
if ($('#PaymentTerms').val().trim() == 'PT08') { if ($('#PaymentTerms').val().trim() == 'PT08') {
@ -3417,8 +3440,8 @@ if (!empty($getlogpodtl)) {
if (obj.materialCode == materialCode) { if (obj.materialCode == materialCode) {
$("#MaterialCode").val(''); $("#MaterialCode").val('');
} else { } 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") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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 = $('#itemRate' + userid).val();
RateValue = parseFloat(RateValue).toFixed(2) RateValue = parseFloat(RateValue).toFixed(2)
$('#EditRate').val(RateValue); $('#EditRate').val(RateValue);
$('#txtEditBasicValue').val(cellval[8].innerHTML); $('#txtEditBasicValue').val(cellval[9].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val()); $('#EditCgst').val($('#Cgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val()); $('#EditSgst').val($('#Sgst' + userid).val());
$('#EditIgst').val($('#Igst' + userid).val()); $('#EditIgst').val($('#Igst' + userid).val());
@ -3544,7 +3568,7 @@ if (!empty($getlogpodtl)) {
$("#EditFrequencyNo").val($('#FrequencyValue' + userid).val()); $("#EditFrequencyNo").val($('#FrequencyValue' + userid).val());
} }
$('#EditTotalOrderValue').val(cellval[10].innerHTML); $('#EditTotalOrderValue').val(cellval[11].innerHTML);
$('#EditOtherAllowances').val($('#OtherAmt' + userid).val()); $('#EditOtherAllowances').val($('#OtherAmt' + userid).val());
tinyMCE.get('EdittxtSpcialInstruction').setContent($('#ItemDescription' + userid).val()); tinyMCE.get('EdittxtSpcialInstruction').setContent($('#ItemDescription' + userid).val());
RequistQuantity = $('#quantity' + userid).val(); RequistQuantity = $('#quantity' + userid).val();
@ -3552,9 +3576,14 @@ if (!empty($getlogpodtl)) {
$("#EditMaterialCode").empty(); $("#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>') $("#EditMaterialCode").append($('<option></option>')
.val($('#materialCode' + userid).val()) .val($('#materialCode' + userid).val())
.html($('#materialCode' + userid).val() + "-" + $('#materialName' + userid).val()) .html(P3)
.prop('selected', true) .prop('selected', true)
); );
// Make the select element read-only (disable it) // Make the select element read-only (disable it)
@ -3589,8 +3618,9 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") { 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 = $('#itemRate' + userid).val();
RateValue = parseFloat(RateValue).toFixed(2) RateValue = parseFloat(RateValue).toFixed(2)
$('#ViewRate').val(RateValue); $('#ViewRate').val(RateValue);
$('#txtViewBasicValue').val(cellval[8].innerHTML); $('#txtViewBasicValue').val(cellval[9].innerHTML);
$('#ViewCgst').val($('#Cgst' + userid).val()); $('#ViewCgst').val($('#Cgst' + userid).val());
$('#ViewSgst').val($('#Sgst' + userid).val()); $('#ViewSgst').val($('#Sgst' + userid).val());
$('#ViewIgst').val($('#Igst' + userid).val()); $('#ViewIgst').val($('#Igst' + userid).val());
@ -3654,7 +3684,7 @@ if (!empty($getlogpodtl)) {
$("#ViewFrequencyNo").val($('#FrequencyValue' + userid).val()); $("#ViewFrequencyNo").val($('#FrequencyValue' + userid).val());
} }
$('#ViewTotalOrderValue').val(cellval[10].innerHTML); $('#ViewTotalOrderValue').val(cellval[11].innerHTML);
$('#ViewOtherAllowances').val($('#OtherAmt' + userid).val()); $('#ViewOtherAllowances').val($('#OtherAmt' + userid).val());
tinyMCE.get('ViewtxtSpcialInstruction').setContent($('#ItemDescription' + userid).val()); tinyMCE.get('ViewtxtSpcialInstruction').setContent($('#ItemDescription' + userid).val());

View File

@ -193,13 +193,13 @@
?> ?>
<td> <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; ?>"> 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> <i class="fa fa-pencil-alt" data-toggle="tooltip"> </i>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
</a> </a>
<?php } ?>
</td> </td>
<?php <?php
} else if ($statusCode == PO_AMENDED ) { ?> } else if ($statusCode == PO_AMENDED ) { ?>

View File

@ -209,7 +209,7 @@
if(!empty($draft)){ if(!empty($draft)){
?> ?>
<tr id="<?php echo $index ?>" > <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 ?>"> <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> <?php echo $record->IGRNO ?></a>
</td> </td>
@ -218,7 +218,7 @@
</td> </td>
<td><?php echo $record->SupplierName ?></td> <td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td> <td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php <td align="left" style="padding-left:0.4%;"><?php
$invdate = $record->DeliveryChellanDate; $invdate = $record->DeliveryChellanDate;
if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){ if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){
echo ""; 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> --> <!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
<?php if(($record->isIgrFilePresent)){ ?> <?php if(($record->isIgrFilePresent)){ ?>
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>"> <a target="_blank" href="<?php echo base_url().'download-files?IGRNO='.$record->IGRNO; ?>">
<i class="fa fa-download" style="text-align: center;"></i> <i class="fa fa-download" style="text-align: center;"></i>
</a> </a>
&nbsp; &nbsp;
@ -427,6 +427,7 @@
<th style="width: 50px;">SNo</th> <th style="width: 50px;">SNo</th>
<th style="width: 100px;">Item Code</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: 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: 50px;">UOM</th>
<th style="width: 100px;">Ordered Qty</th> <th style="width: 100px;">Ordered Qty</th>
<th style="width: 100px;">Received Qty</th> <th style="width: 100px;">Received Qty</th>
@ -435,7 +436,7 @@
<th style="width: 50px;">Tax (%)</th> <th style="width: 50px;">Tax (%)</th>
<th style="width: 50px;">Taxable Amt</th> <th style="width: 50px;">Taxable Amt</th>
<th style="width: 50px;">Total 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> <th style="width: 50px;"></th>
</tr> </tr>
</thead> </thead>
@ -804,14 +805,15 @@
'<td style="width: 50px;" align="right">' + i + '</td>' + '<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</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: 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: 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" 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;" 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: 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="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</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="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</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: 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>' + '<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 + '">' + '<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: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</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: 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: 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" 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;" 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: 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="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</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="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</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: 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>' + '<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 + '">' + '<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: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</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: 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: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" name="Quantity">' + item.Quantity + '</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: 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="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</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="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</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: 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>' + '<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 + '">' + '<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +

View File

@ -18,8 +18,8 @@
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-12"> <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"> <div class="box-body">
<!-- Supplier Information --> <!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;"> <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"> <input type="text" class="form-control required digits" readonly id="ContactNo" name="ContactNo" minlength="10" maxlength="10">
</div> </div>
<div class="col-md-3"> <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> <select class="form-control required" id="role" name="role" required>
<option value="0">Select Role</option> <option value="0">Select Role</option>
<?php <?php
@ -181,58 +181,67 @@
$("#ContactNo").val(''); $("#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>
<script> <script>
function Validate() { function Validate() {
var isValid = true; var isValid;
var fname = document.getElementById('FirstName').value; 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) { if (!fname) {
alert('First Name is required'); alert('First Name is required');
isValid = false; isValid = false;
} }else if (!emailPattern.test(email)) {
var email = document.getElementById('MailID').value;
var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(email)) {
alert('Invalid email address'); alert('Invalid email address');
isValid = false; isValid = false;
} }else if (role === "0") {
alert('Role is required');
var password = document.getElementById('password').value; isValid = false;
var cpassword = document.getElementById('cpassword').value; }else if(!password){
if (password !== cpassword) { alert('Missing Passwords');
isValid = false;
}else if (password !== cpassword) {
alert('Passwords do not match'); alert('Passwords do not match');
isValid = false; isValid = false;
}else{
isValid = true;
$('#loader').show();
} }
return isValid; return isValid;

View File

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

View File

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

View File

@ -256,16 +256,19 @@ $currentday = date('d');
<div class="col-9 text-right d-flex" style="justify-content: end;" id="savebutton"> <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> </div>
@ -633,7 +636,6 @@ $currentday = date('d');
}); });
</script> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
@ -670,25 +672,12 @@ $(document).ready(function () {
function exportTableToExcel(tableId, filename = 'attendance.xlsx') { function exportTableToExcel(tableId, filename = 'attendance.xlsx') {
var table = document.getElementById(tableId); var table = document.getElementById(tableId);
var rows = table.rows; 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++) { let ws = XLSX.utils.table_to_sheet(table); // Convert modified table to sheet
rowData.push(cols[j].innerText); 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
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);
} }
// Add click event listener to the export button // 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;" align="center">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</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;">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;">Line Item Specs</th>
<th style="white-space: nowrap !important;" align="right">Quantity</th> <th style="white-space: nowrap !important;" align="right">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th> <th style="white-space: nowrap !important;">UOM</th>
@ -2643,8 +2644,9 @@ if (!empty($INRSYMBOL)) {
if (isAdded == "0") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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(); $('#MaterialCode option[value=' + materialCode + ']').remove();
@ -3484,6 +3491,7 @@ if (!empty($INRSYMBOL)) {
<td align="center">${Reqnumber}</td> <td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td> <td align="left">${materialCode}</td>
<td align="left">${shorten}</td> <td align="left">${shorten}</td>
<td align="center">${HSN}</td>
<td align="left"> <td align="left">
<a href="#" class="editable-field" <a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a> data-notes = "-" data-id ="${temp}">-</a>
@ -3992,8 +4000,8 @@ if (!empty($INRSYMBOL)) {
if (value.MaterialCode == materialCode) { if (value.MaterialCode == materialCode) {
var HSNCODE = value.HSNCODE ? value.HSNCODE+"-" : "";
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName)); $("#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()); console.log($('#Igst' + userid).val());
$('#EdittxtTotalOrderValue').val(cellval[10].innerHTML); $('#EdittxtTotalOrderValue').val(cellval[11].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val()); $('#EditCgst').val($('#Cgst' + userid).val());
$('#EditAfterCgst').val($('#AfterCgst' + userid).val()); $('#EditAfterCgst').val($('#AfterCgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val()); $('#EditSgst').val($('#Sgst' + userid).val());
@ -4375,13 +4383,23 @@ if (!empty($INRSYMBOL)) {
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>; var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").empty(); $("#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 + ')'); $('#EditRateIn').html('Rate(in' + " " + DisplayCurrencySymbol + '/' + EditUOM + ')');
for (i = 0; i < Material.length; i++) { for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) { $.each(Material[i], function(idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) { 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); $('#ClearingCharges' + userid).val(Clearing);
$('#Subtotal' + userid).val(Subtotal); $('#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') { if (capitalType == 'International') {
TotalTaxValue = 0.00; TotalTaxValue = 0.00;
Total = basicval; Total = basicval;
@ -4930,13 +4954,14 @@ if (!empty($INRSYMBOL)) {
cellval[2].innerHTML = materialCode; cellval[2].innerHTML = materialCode;
cellval[3].innerHTML = materialName; cellval[3].innerHTML = materialName;
cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = quantity; cellval[6].innerHTML = quantity;
cellval[6].innerHTML = uom; cellval[7].innerHTML = uom;
cellval[7].innerHTML = itemRate; cellval[8].innerHTML = itemRate;
cellval[8].innerHTML = basicval; cellval[9].innerHTML = basicval;
cellval[9].innerHTML = TotalTaxValue; cellval[10].innerHTML = TotalTaxValue;
cellval[10].innerHTML = Total; cellval[11].innerHTML = Total;
$('#EDITCAPITAL').modal('hide'); $('#EDITCAPITAL').modal('hide');

View File

@ -57,6 +57,10 @@
</style> </style>
<?php
$page = session()->getFlashdata('page') ?? $_GET['page'] ?? 1;
?>
<div class="content-page"> <div class="content-page">
<div class="content"> <div class="content">
@ -168,7 +172,9 @@
<td><?= $record->isActive == 1 ? 'Active' : 'InActive'; ?></td> <td><?= $record->isActive == 1 ? 'Active' : 'InActive'; ?></td>
<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" data-toggle="tooltip"
title="<?php echo $record->Config_ID ?> - Click here to Edit Config Details"> title="<?php echo $record->Config_ID ?> - Click here to Edit Config Details">
<i class="fas fa-edit"></i> <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 // Date range filter function
$.fn.dataTable.ext.search.push( $.fn.dataTable.ext.search.push(
function (settings, data, dataIndex) { function (settings, data, dataIndex) {
@ -287,6 +317,30 @@
} }
}); });
}); });
</script> </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> </li>
</ol> </ol>
</div> </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> Details </a>
</div> </div>
</div> </div>
@ -137,7 +137,7 @@
<a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>" <a data-toggle="modal" href="#ccwizard" data-id="<?php echo $record->id; ?>"
data-name="<?php echo $record->CostCenterName; ?>"><i data-name="<?php echo $record->CostCenterName; ?>"><i
class="fas fa-edit"></i>&nbsp;&nbsp;</a> 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 href="<?php echo base_url() . 'deleteCostCenter?CostCenterCode=' . $record->code; ?>"><i
class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
<?php } ?> <?php } ?>
@ -187,7 +187,7 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal" <button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</button> 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> id="tempClick">Submit</button>
</div> </div>
</div> </div>

View File

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

View File

@ -76,7 +76,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<?php if($payslip_id == 0){ ?> <?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 Add Trip details
</button> </button>
<?php }else { ?> <?php }else { ?>
@ -130,7 +130,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<i class="fas fa-edit"></i>&nbsp;&nbsp;&nbsp; <i class="fas fa-edit"></i>&nbsp;&nbsp;&nbsp;
</a> </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; <i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;
</a> </a>
@ -165,7 +165,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th></th> <th></th>
<th></th> <th></th>
<th>Diesel</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>
<th></th> <th></th>
</tr> </tr>
@ -179,7 +179,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th></th> <th></th>
<th></th> <th></th>
<th>Shed Amount</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>
<th></th> <th></th>
</tr> </tr>
@ -234,32 +234,19 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!--first row --> <!--first row -->
<input type="hidden" class="form-control" id="driver_attendance_id" name="driver_attendance_id"> <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_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 $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 $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');?> <?php $calendarCurrDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('today')->format('Y-m-d');?>
<div class="row"> <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"> <div class="col-md-4">
<label class="form" for="category_type">Category</label> <label class="form" for="category_type">Category</label>
<select class="form-control" id="category_type" name="category_type" onchange="resetthefields();"> <select class="form-control" id="category_type" name="category_type" onchange="resetthefields();">
<option value="">Select</option> <option value="">Select</option>
<option value="IGR">IGR</option>
<option value="INVOICE">INVOICE</option> <option value="INVOICE">INVOICE</option>
<option value="IGR">IGR</option>
</select> </select>
</div> </div>
</div>
<!-- second row -->
<div class="row mt-2">
<div class="col-md-4"> <div class="col-md-4">
<label class="form" for="invoice_number">Invoice Number</label> <label class="form" for="invoice_number">Invoice Number</label>
<input type="text" class="form-control" id="invoice_number" name="invoice_number" onchange="customerandquantity();"> <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> --> </select> -->
</div> </div>
<div class="col-md-4"> <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> <label class="form" for="customer">Customer</label>
<input type="text" class="form-control" id="customer" name="customer" readonly> <input type="text" class="form-control" id="customer" name="customer" readonly>
</div> </div>
<div class="col-md-4"> <div class="col-md-6">
<label class="form" for="quantity">Quantity</label> <label class="form" for="quantity">Quantity</label>
<input type="text" class="form-control" id="quantity" name="quantity" readonly> <input type="text" class="form-control" id="quantity" name="quantity" readonly>
</div> </div>
@ -323,7 +319,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal" <button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</button> 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> id="tempClick">Submit</button>
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
@ -385,16 +381,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$("#attendanceModal").on("shown.bs.modal", function (e) { $("#attendanceModal").on("shown.bs.modal", function (e) {
var dname = "<?php echo $page_driver_name;?>";
var id = $(e.relatedTarget).data('id'); 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) { fields.forEach(function(field) {
$("#" + field).val(""); $("#" + field).val("");
}); });
if (id == 0) { if (id == 0) {
$('#attendanceTitle').html("Add Driver Trip"); $('#attendanceTitle').html("Add "+dname+" Trip Details");
$("#driver_attendance_id").val(0); $("#driver_attendance_id").val(0);
} else { } else {
$("#driver_attendance_id").val(id); $("#driver_attendance_id").val(id);
@ -408,6 +405,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
if(field == 'driver_id'){ if(field == 'driver_id'){
$("#driver_id").val(arr && arr['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 salary = arr['salary_amount'] ? parseFloat(arr['salary_amount']) : 0;
var food = arr['food_amount'] ? parseFloat(arr['food_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)); $('#total_amount').val(ttl.toFixed(2));
}); });
$('#attendanceTitle').html("Edit Driver Trip"); $('#attendanceTitle').html("Edit "+dname+" Trip Details");
} }
}); });
$('#tempClick').click(function () { $('#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 diesel = parseFloat($('input[data-column="diesel_amount"]').val()) || 0;
var shed = parseFloat($('input[data-column="shed_amount"]').val()) || 0; var shed = parseFloat($('input[data-column="shed_amount"]').val()) || 0;
var row = parseInt($('#rowTotalAmount').text()) || 0; var row = parseInt($('#rowTotalAmount').text()) || 0;
console.log(row);
var total = row + diesel + shed; var total = row + diesel + shed;
$('#totalAmount').text(total); // Display the total with 2 decimal places $('#totalAmount').text(total); // Display the total with 2 decimal places
@ -571,14 +570,15 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let param_month_year = urlParams.get("month_year"); let param_month_year = urlParams.get("month_year");
let param_date = urlParams.get("date"); let param_date = urlParams.get("date");
if(param_date == ""){ if (!param_date || param_date.trim() === "") {
let new_my = param_month_year ? param_month_year : "<?php echo date('M-Y'); ?>";
let monthMap = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04", "May": "05", "Jun": "06", "Jul": "07", "Aug": "08", "Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12"}; let monthMap = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04", "May": "05", "Jun": "06", "Jul": "07", "Aug": "08", "Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12"};
let [month, year] = param_month_year.split('-'); let [month, year] = new_my.split('-');
input_date = `01-${monthMap[month]}-${year}`; input_date = `01-${monthMap[month]}-${year}`;
}else{ } else { input_date = param_date; }
input_date = param_date;
}
// Send data to the server using AJAX // Send data to the server using AJAX
$.ajax({ $.ajax({

View File

@ -19,63 +19,86 @@
</tr> </tr>
<tr> <tr>
<td colspan="11"> <td colspan="11">
<table> <table style="width: 100%; border-collapse: collapse;">
<tbody> <tbody>
<tr> <tr>
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Name </td> <td style="width: 14%; border: none; 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 style="width: 1%; border: none; white-space: nowrap;">:</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="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->driver_name; ?></td>
<td width="160px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Employee ID </td> <td style="width: 2%; border: none;"></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> <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>
<tr> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Designation </td> <td style="width: 14%; border: none; 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 style="width: 1%; border: none; white-space: nowrap;">:</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="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->Designation ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Department </td> <td style="width: 2%; border: none;"></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> <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>
<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="width: 14%; border: none; 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 style="width: 1%; border: none; white-space: nowrap;">:</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="width: 34%; border: none; white-space: nowrap;"><?php echo date('d-m-Y', strtotime($PayDetails[0]->DOJ)) ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">No Of Loads </td> <td style="width: 2%; border: none;"></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> <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>
<tr> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank Name </td> <td style="width: 14%; border: none; 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 style="width: 1%; border: none; white-space: nowrap;">:</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="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->BankName ?></td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">PAN Number </td> <td style="width: 2%; border: none;"></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> <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>
<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 style="width: 14%; border: none; 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 style="width: 1%; border: none; white-space: nowrap;">:</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="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->BankAccountNumber ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> Aadhar Number</td> <td style="width: 2%; border: none;"></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> <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>
<tr> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank IFSC </td> <td style="width: 14%; border: none; 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 style="width: 1%; border: none; white-space: nowrap;">:</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="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->IFSCCode ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Loan Balance </td> <td style="width: 2%; border: none;"></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> <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>
<tr> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> </td> <td style="width: 14%; border: none;"></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo '&nbsp;' ?></td> <td style="width: 1%; border: none;"></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="width: 34%; border: none;"></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Diesel </td> <td style="width: 2%; border: none;"></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> <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>
<tr> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> </td> <td style="width: 14%; border: none;"></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo '&nbsp;'; ?></td> <td style="width: 1%; border: none;"></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="width: 34%; border: none;"></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Shed Duty Amount </td> <td style="width: 2%;border: none;"></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> <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> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -337,7 +337,12 @@ if (!empty($POItem) && $CapitalRange == '1') {
selector: "textarea#txtSpcialInstruction", selector: "textarea#txtSpcialInstruction",
menubar: false, menubar: false,
statusbar: false, statusbar: false,
toolbar: false toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $scopeofwork; ?>`);
});
}
// plugins: "link image" // plugins: "link image"
}); });
tinymce.init({ 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: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: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: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: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:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</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:center !important"><?php echo $record->ReqNo ?></td>
<td style="text-align:left !important"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "..."); <td style="text-align:left !important"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td> echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;"> <td style="text-align:left !important;">
<a href="#" <a href="#"
class="editable-field" class="editable-field"
@ -1681,10 +1688,11 @@ if (!empty($POItem) && $CapitalRange == '1') {
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>Special Instructions </label> <?php <label>Special Instructions </label>
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($scopeofwork)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40'); <textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="10" cols="40">
echo form_textarea($data); <?php echo $scopeofwork ? html_entity_decode($scopeofwork) : "" ; ?>
?> <!-- strip_tags($scopeofwork) -->
</textarea>
</div> </div>
</div><!-- /.Special Instructions section --> </div><!-- /.Special Instructions section -->
@ -1757,9 +1765,9 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="col-md-7 text-right"> <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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</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>
</div> </div>
@ -2444,8 +2452,8 @@ if (!empty($POItem) && $CapitalRange == '1') {
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-success" data-dismiss="modal" value="Cancel" style="margin-right:10px">Cancel</a> <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 <a class="btn btn-success font auditor-restricted-btn EditCapital" ID="UpdateCapital"> &nbsp;&nbsp;<span
class="bold">Update Capital</span></a> class="bold">Update Capital</span></a>
</div> </div>
</form> </form>
@ -2681,8 +2689,9 @@ if (!empty($POItem) && $CapitalRange == '1') {
if (isAdded == "0") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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()); $('#EditOtherAllowances').val($('#otherallowance' + userid).val());
//$('#Editservicetotalordervaue').val($('#totalservicevalue'+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").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++) { for (i = 0; i < Material.length; i++) {
$.each(Material[i], function (idx, obj) { $.each(Material[i], function (idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) { 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); $('#DisVal' + userid).val(DisVal);
$('#AfterDisVal' + userid).val(AfterDisVal); $('#AfterDisVal' + userid).val(AfterDisVal);
var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName; 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; cellval[2].innerHTML = shorten;
//alert(materialName); //alert(materialName);
cellval[4].innerHTML = parseFloat(quantity).toFixed(2); cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = parseFloat(quantity).toFixed(2);
//alert(quantity); //alert(quantity);
cellval[5].innerHTML = uom; cellval[6].innerHTML = uom;
//alert(uom); //alert(uom);
cellval[6].innerHTML = parseFloat(itemRate).toFixed(2); cellval[7].innerHTML = parseFloat(itemRate).toFixed(2);
//alert(itemRate); //alert(itemRate);
cellval[7].innerHTML = parseFloat(basicval).toFixed(2); cellval[8].innerHTML = parseFloat(basicval).toFixed(2);
//alert(basicval); //alert(basicval);
cellval[8].innerHTML = parseFloat(TotalTaxValue).toFixed(2); cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
//alert(TotalTaxValue); //alert(TotalTaxValue);
cellval[9].innerHTML = parseFloat(totalservicevalue).toFixed(2); cellval[10].innerHTML = parseFloat(totalservicevalue).toFixed(2);
//alert(basicval); //alert(basicval);

View File

@ -343,7 +343,12 @@ if (!empty($getlogpodtl)) {
selector: "textarea#txtSpcialInstruction", selector: "textarea#txtSpcialInstruction",
menubar: false, menubar: false,
statusbar: false, statusbar: false,
toolbar: false toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
}); });
tinymce.init({ tinymce.init({
selector: "textarea#ItemDescription", selector: "textarea#ItemDescription",
@ -926,7 +931,7 @@ $(document).ready(function () {
<!-- </div> --> <!-- </div> -->
<div class="form-group col-md-12" align=" right"> <div class="form-group col-md-12" align=" right">
<?php if ($POStatus == PO_DRAFT || $POStatus == PO_CREATED) { ?> <?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> id="abcd">Select Line Item</button> </a>
<?php } ?> <?php } ?>
</div> </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; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</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;">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;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th> <th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th> <th style="white-space: nowrap !important;">UOM</th>
@ -976,6 +982,7 @@ $(document).ready(function () {
<td><?php echo $record->MaterialCode ?></td> <td><?php echo $record->MaterialCode ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "..."); <td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td> echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td> <td>
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?> <?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#" <a href="#"
@ -1269,7 +1276,7 @@ $(document).ready(function () {
data-userid="<?php echo $index; ?>" data-toggle="modal" href="#EDITCAPITAL"><i 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='#' 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; ?>" 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 <?php
} else { ?> } else { ?>
<td> <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 --> <!-- 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-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>Special Instructions </label> <?php <label>Special Instructions </label>
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40'); <textarea id="txtSpcialInstruction" name="txtSpcialInstruction" class="form-control" rows="10" cols="40">
echo form_textarea($data); <?php echo $ServiceDescription ? html_entity_decode($ServiceDescription) : "" ; ?>
?> <!-- strip_tags($ServiceDescription) -->
</textarea>
</div> </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--> </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" <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> href="<?php echo base_url() . 'public/uploads/POfiles/' . $PrePOFile ?>"><span>Previous Upload - </span><small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp; &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> </div>
@ -1658,17 +1666,17 @@ $(document).ready(function () {
<div class="col-md-7 text-right"> <div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?> <?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-danger auditor-restricted-btn 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 auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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) { ?> <?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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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) { ?> <?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="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 { ?> <?php } else { ?>
<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="OK" href="<?php echo base_url() . 'purchaseorderListing'; ?>">&nbsp;&nbsp;<span class="bold">OK</span></a>
<?php } ?> <?php } ?>
@ -2448,7 +2456,7 @@ $(document).ready(function () {
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:20px;">Cancel</a> <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> Capital</span></a>
</div> </div>
</form> </form>
@ -3096,7 +3104,7 @@ $(document).ready(function () {
</div><!-- /.body --> </div><!-- /.body -->
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right: 10px;">Cancel</a> <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> Capital</span></a>
</div><!-- /.footer --> </div><!-- /.footer -->
</form> </form>
@ -4061,8 +4069,8 @@ $(document).ready(function () {
if (isAdded == "0") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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 costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').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 materialName = $("#CapitalItemName").val();
var uom = $("#CPUOM").val(); var uom = $("#CPUOM").val();
var addPer = ''; var addPer = '';
@ -4942,8 +4958,9 @@ $(document).ready(function () {
<td align="left">${temp}</td> <td align="left">${temp}</td>
<td align="center">${Reqnumber}</td> <td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td> <td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`; <td align="left">${shorten}</td>
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { <td align="center">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td><a href="#" class="editable-field" rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}" data-id="${temp}"
data-notes="-">-</a> data-notes="-">-</a>
@ -5466,9 +5483,8 @@ $(document).ready(function () {
if (value.MaterialCode == materialCode) { if (value.MaterialCode == materialCode) {
var HSNCODE = value.HSNCODE ? value.HSNCODE+"-" : "";
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html( HSNCODE + value.MaterialName+ " ( "+value.MaterialCode+" ) "));
$("#MaterialCode").append($('<option></option>').val(value.MaterialCode).html(value.MaterialCode + "-" + value.MaterialName));
} }
@ -5835,7 +5851,7 @@ $(document).ready(function () {
$('#EditCustomDutyExpenses').val($('#CustomDutyExpenses' + userid).val()); $('#EditCustomDutyExpenses').val($('#CustomDutyExpenses' + userid).val());
//$('#txtEditInsurance').val($('#RMCIncludingCustomers'+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) ?>; var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
$("#EditMaterialCode").empty(); $("#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++) { for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) { $.each(Material[i], function(idx, obj) {
if (obj.MaterialCode != $('#materialCode' + userid).val()) { 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()); $('#ViewAfterSgst').val($('#AfterSgst' + userid).val());
$('#ViewAfterIgst').val($('#AfterIgst' + userid).val()); $('#ViewAfterIgst').val($('#AfterIgst' + userid).val());
$('#ViewOtherAllowances').val($('#OtherAmt' + userid).val()); $('#ViewOtherAllowances').val($('#OtherAmt' + userid).val());
$('#ViewTotalAmountlocal').val(cellval[10].innerHTML); $('#ViewTotalAmountlocal').val(cellval[11].innerHTML);
$('#drpFreightviewloc').val($("#Ftype" + userid).val()); $('#drpFreightviewloc').val($("#Ftype" + userid).val());
@ -6555,12 +6583,12 @@ $(document).ready(function () {
var itemRate = parseFloat(convertRate).toFixed(2); var itemRate = parseFloat(convertRate).toFixed(2);
var basicval = $("#EditCPTotalAmount").val(); var basicval = $("#EditCPTotalAmount").val();
var Cgst = $("#EditCgst").val(); var Cgst = $("#EditCgst").val();
var AfterCgst = $("#EditAfterCgst").val(); var AfterCgst = $("#EditAfterCgst").val() == '' ? 0 : $("#EditAfterCgst").val();
var Sgst = $("#EditSgst").val(); var Sgst = $("#EditSgst").val();
var AfterSgst = $("#EditAfterSgst").val(); var AfterSgst = $("#EditAfterSgst").val() == '' ? 0 : $("#EditAfterSgst").val();
var Igst = $("#EditIgst").val(); //Dom Caps var Igst = $("#EditIgst").val(); //Dom Caps
var AfterIgst = $("#EditAfterIgst").val(); //Dom Caps var AfterIgst = $("#EditAfterIgst").val() == '' ? 0 :$("#EditAfterIgst").val(); //Dom Caps
var OtherAmt = parseFloat($("#EditOtherAllowances").val() == '' ? "0.00" : $('#EditOtherAllowances').val()).toFixed(2); var OtherAmt = parseFloat($("#EditOtherAllowances").val() == '' ? 0 : $('#EditOtherAllowances').val()).toFixed(2);
var TotalTaxValue = EditcalculateTaxValue(); var TotalTaxValue = EditcalculateTaxValue();
@ -6601,7 +6629,7 @@ $(document).ready(function () {
var NoOfTrip = $("#EditNOOfTrips").val(); var NoOfTrip = $("#EditNOOfTrips").val();
var DisType = $("#EditDiscountType").val(); var DisType = $("#EditDiscountType").val();
var DisVal = $("#txtEditDiscount").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 FreightTypeloc = $('#drpFreighteditloc').val();
var FreightRateloc = $('#txtFreightlocedit').val(); var FreightRateloc = $('#txtFreightlocedit').val();
var FreightRateAmountloc = $('#txtAfterFreightlocedit').val(); var FreightRateAmountloc = $('#txtAfterFreightlocedit').val() == '' ? 0 : $('#txtAfterFreightlocedit').val();
var Nooftriploc = $('#NOOfTripslocedit').val(); var Nooftriploc = $('#NOOfTripslocedit').val();
var Total = (parseFloat(basicval) + parseFloat(AfterCgst) + parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(OtherAmt) - parseFloat(AfterDisVal) + parseFloat(FreightRateAmountloc)).toFixed(2); var Total = (parseFloat(basicval) + parseFloat(AfterCgst) + parseFloat(AfterSgst) + parseFloat(AfterIgst) + parseFloat(OtherAmt) - parseFloat(AfterDisVal) + parseFloat(FreightRateAmountloc)).toFixed(2);
if (capital == 0) { if (capital == 0) {
@ -6715,19 +6740,24 @@ $(document).ready(function () {
$('#DutyImpact' + userid).val(DutyImpact); $('#DutyImpact' + userid).val(DutyImpact);
$('#NetValue' + userid).val(Nett); $('#NetValue' + userid).val(Nett);
$('#ClearingCharge' + userid).val(ClearingCharges); $('#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; var shorten = materialName.length > 13 ? materialName.slice(0, 13) + "..." : materialName;
cellval[2].innerHTML = materialCode; cellval[2].innerHTML = materialCode;
cellval[3].innerHTML = shorten; cellval[3].innerHTML = shorten;
cellval[4].innerHTML = editHSN;
cellval[5].innerHTML = quantity; cellval[6].innerHTML = quantity;
cellval[6].innerHTML = uom; cellval[7].innerHTML = uom;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2); cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[8].innerHTML = parseFloat(basicval).toFixed(2); cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2); // what should i display here ?? if international means cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2); // what should i display here ?? if international means
cellval[10].innerHTML = parseFloat(Total).toFixed(2); cellval[11].innerHTML = parseFloat(Total).toFixed(2);

View File

@ -1307,7 +1307,7 @@ if (!empty($EmpDetails)) {
</li> </li>
<li class="next list-inline-item float-right"> <li class="next list-inline-item float-right">
<button type="submit" <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> </li>
</ul> </ul>
</div> </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/tinymce/js/tinymce/tinymce.min.js"></script>
<script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script> <script src="<?php echo base_url(); ?>public/assets/js/CreatePOValidation.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
// tinymce.init({
// selector: "textarea#txtSpcialInstruction",
// menubar: false,
// statusbar: false,
// toolbar: false
// });
tinymce.init({ tinymce.init({
selector: "textarea#txtSpcialInstruction", selector: "textarea#txtSpcialInstruction",
menubar: false, menubar: false,
statusbar: 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>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:15px">Cancel</a> <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>--> <!--<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> </div>
</form> </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: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: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: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: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:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</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 style="text-align:center !important"><?php echo $record->ReqNo ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "..."); <td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td> echo $shortName; ?></td>
<td style="text-align:center !important"><?php echo $record->HSNCODE ?></td>
<td style="text-align:left !important;"> <td style="text-align:left !important;">
<a href="#" <a href="#"
class="editable-field" class="editable-field"
@ -1587,10 +1601,13 @@ if (!empty($RequistionDetails)) {
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>Special Instructions </label> <label>Special Instructions </label>
<?php <!-- <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40'); // $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); // 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>
</div> </div>
@ -1608,7 +1625,7 @@ if (!empty($RequistionDetails)) {
<span>Previous Upload - </span> <span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label> <small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp; &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> </div>
<?php } ?> <?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br> <input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br>
@ -1663,9 +1680,9 @@ if (!empty($RequistionDetails)) {
</div> </div>
<div class="col-md-7 text-right"> <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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</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 /> <br />
</div> </div>
</div> </div>
@ -1998,8 +2015,8 @@ if (!empty($RequistionDetails)) {
if (isAdded == "0") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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(); $("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>; 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"; var isAdded = "0";
for (i = 0; i < Material.length; i++) { for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) { $.each(Material[i], function(idx, obj) {
@ -2724,6 +2750,13 @@ if (!empty($RequistionDetails)) {
var CostCode = $("#EditCostCenter").val(); var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val(); var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").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 edititemname = $("#EditItemName").val();
var editUOM = $('#EditUOM').val(); var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val(); var editQuantity = $('#EditQuantity').val();
@ -2799,11 +2832,11 @@ if (!empty($RequistionDetails)) {
var tr = document.getElementById(userid); var tr = document.getElementById(userid);
var cellval = tr.cells; var cellval = tr.cells;
cellval[4].innerHTML = editHSN;
cellval[4].innerHTML = editQuantity; cellval[5].innerHTML = editQuantity;
cellval[5].innerHTML = editUOM; cellval[6].innerHTML = editUOM;
cellval[6].innerHTML = itemRate; cellval[7].innerHTML = itemRate;
cellval[7].innerHTML = BasicValue; cellval[8].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode); $('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname); $('#materialName' + userid).val(edititemname);

View File

@ -92,8 +92,8 @@ if (!empty($EmpList)) {
</div> </div>
<div class="form-group text-right mt-3"> <div class="form-group text-right mt-3">
<input type="hidden" name="txtEmpid" id="txtEmpid" value="<?php echo $EmpId ?>"> <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="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" value="Submit"> <input type="submit" class="btn btn-success auditor-restricted-btn" value="Submit">
</div> </div>
</form> </form>
@ -133,7 +133,7 @@ if (!empty($EmpList)) {
</div> </div>
<!-- Change Password Form --> <!-- Change Password Form -->
<div class="row"> <div class="row auditor-restricted-btn">
<div class="col-12"> <div class="col-12">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
@ -285,4 +285,32 @@ if (!empty($EmpList)) {
alert("Before remove please select any position."); 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>> </script>>

View File

@ -272,7 +272,7 @@ if (!empty($assetList)) {
<div class="form-row mt-4 text-right"> <div class="form-row mt-4 text-right">
<div class="col-md-12"> <div class="col-md-12">
<a href="<?php echo base_url() ?>assetListing" class="btn btn-secondary">Cancel</a> <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>
</div> </div>
</form> </form>

View File

@ -113,7 +113,7 @@ if ($total <= $reorder) {
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Material - <?php echo $MaterialCode; ?> Details</h4> <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> <span class="bold">Cancel</span>
</button> </button>
</div> </div>
@ -361,10 +361,12 @@ if ($total <= $reorder) {
</div> </div>
</div> </div>
<div class="box-footer text-right"> <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> <span class="bold">Cancel</span>
</button> </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> </div>
</form> </form>
</div><!-- /.card-body --> </div><!-- /.card-body -->

View File

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

View File

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

View File

@ -217,6 +217,11 @@ foreach ($PaymentTerms as $TER) {
menubar: false, menubar: false,
statusbar: false, statusbar: false,
toolbar: false, toolbar: false,
setup: function(ed) {
ed.on('init', function(evt) {
ed.setContent(`<?php echo $ServiceDescription; ?>`);
});
}
// plugins: "link image" // plugins: "link image"
}); });
tinymce.init({ tinymce.init({
@ -390,7 +395,9 @@ foreach ($PaymentTerms as $TER) {
if (obj.materialCode == materialCode) { if (obj.materialCode == materialCode) {
$("#MaterialCode").val(''); $("#MaterialCode").val('');
} else { } 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") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</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;">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: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:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</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 echo $record->MaterialCode ?></td>
<td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "..."); <td><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td> echo $shortName; ?></td>
<td><?php echo $record->HSNCODE; ?></td>
<td style="text-align:left !important;"> <td style="text-align:left !important;">
<a href="#" <a href="#"
class="editable-field" class="editable-field"
@ -1374,7 +1383,7 @@ foreach ($PaymentTerms as $TER) {
<textarea name="ScopeofWork" id="ScopeofWork" class="form-control" rows="8" cols="40"> <textarea name="ScopeofWork" id="ScopeofWork" class="form-control" rows="8" cols="40">
<?php <?php
$ServiceDescription = html_entity_decode($ServiceDescription); $ServiceDescription = html_entity_decode($ServiceDescription);
$ServiceDescription = strip_tags($ServiceDescription); // $ServiceDescription = strip_tags($ServiceDescription);
echo set_value('ScopeofWork', $ServiceDescription); ?> echo set_value('ScopeofWork', $ServiceDescription); ?>
</textarea> </textarea>
@ -1400,7 +1409,7 @@ foreach ($PaymentTerms as $TER) {
<span>Previous Upload - </span> <span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label> <small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp; &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> </div>
<?php }} ?> <?php }} ?>
@ -1447,9 +1456,9 @@ foreach ($PaymentTerms as $TER) {
</div> </div>
<div class="col-md-7 text-right"> <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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(1)">&nbsp;&nbsp;<span class="bold">Approve</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>
</div> </div>
@ -1779,7 +1788,7 @@ foreach ($PaymentTerms as $TER) {
<div class="modal-footer" align="right"> <div class="modal-footer" align="right">
<div class="form-group col-md-12"> <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-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> </div>
</div> </div>
@ -1880,7 +1889,7 @@ foreach ($PaymentTerms as $TER) {
$('#EditotherDescription').hide(); $('#EditotherDescription').hide();
$(document).ready(function() { $(document).ready(function() {
var openOrder = <?php echo $IsOpenOrder; ?>; var openOrder = <?php echo $IsOpenOrder ? $IsOpenOrder : 0 ; ?>;
if(openOrder){ if(openOrder){
$('#EditQuantity').removeAttr('required'); $('#EditQuantity').removeAttr('required');
$('#EditQuantity').attr('readonly', true); $('#EditQuantity').attr('readonly', true);
@ -1910,7 +1919,7 @@ foreach ($PaymentTerms as $TER) {
RateValue = $('#itemRate' + userid).val(); RateValue = $('#itemRate' + userid).val();
RateValue = parseFloat(RateValue).toFixed(2); RateValue = parseFloat(RateValue).toFixed(2);
$('#EditRate').val(RateValue); $('#EditRate').val(RateValue);
$('#txtEditBasicValue').val(cellval[8].innerHTML); $('#txtEditBasicValue').val(cellval[9].innerHTML);
$('#EditCgst').val($('#Cgst' + userid).val()); $('#EditCgst').val($('#Cgst' + userid).val());
$('#EditSgst').val($('#Sgst' + userid).val()); $('#EditSgst').val($('#Sgst' + userid).val());
$('#EditIgst').val($('#Igst' + userid).val()); $('#EditIgst').val($('#Igst' + userid).val());
@ -1937,7 +1946,7 @@ foreach ($PaymentTerms as $TER) {
$("#EditFrequencyNo").val($('#FrequencyValue' + userid).val()); $("#EditFrequencyNo").val($('#FrequencyValue' + userid).val());
} }
$('#EditTotalOrderValue').val(cellval[9].innerHTML); $('#EditTotalOrderValue').val(cellval[11].innerHTML);
RequistQuantity = $('#quantity' + userid).val(); RequistQuantity = $('#quantity' + userid).val();
@ -1947,7 +1956,16 @@ foreach ($PaymentTerms as $TER) {
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>; var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
// For Binding Material list center for the selected Requistion Number // 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"; var isAdded = "0";
for (i = 0; i < Material.length; i++) { for (i = 0; i < Material.length; i++) {
@ -1974,7 +1992,9 @@ foreach ($PaymentTerms as $TER) {
if (isAdded == "0") { 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 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 tr = document.getElementById(userid);
var cellval = tr.cells; var cellval = tr.cells;
cellval[2].innerHTML = editMaterialCode; cellval[2].innerHTML = editMaterialCode;
cellval[3].innerHTML = editDescription; cellval[3].innerHTML = editDescription;
cellval[5].innerHTML = editQuantity; cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editUOM; cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = parseFloat(itemRate).toFixed(2); cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = parseFloat(basicval).toFixed(2); cellval[8].innerHTML = parseFloat(itemRate).toFixed(2);
cellval[9].innerHTML = parseFloat(TotalTaxValue).toFixed(2); cellval[9].innerHTML = parseFloat(basicval).toFixed(2);
cellval[10].innerHTML = parseFloat(TotalOrderValue).toFixed(2); cellval[10].innerHTML = parseFloat(TotalTaxValue).toFixed(2);
cellval[11].innerHTML = parseFloat(TotalOrderValue).toFixed(2);
$('#materialCode' + userid).val(editMaterialCode); $('#materialCode' + userid).val(editMaterialCode);

View File

@ -498,7 +498,7 @@ if (!empty($supplier)) {
<button type="button" class="btn btn-secondary" onclick="history.back()"> <button type="button" class="btn btn-secondary" onclick="history.back()">
<span class="bold">Cancel</span> <span class="bold">Cancel</span>
</button> </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> </div>
</div> </div>

View File

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

View File

@ -379,11 +379,18 @@ if (!empty($getlogpodtl)) {
$("#PaymentTerms").select2(); $("#PaymentTerms").select2();
tinymce.init({ tinymce.init({
selector: "textarea#txtSpcialInstruction", selector: "textarea#txtSpcialInstruction",
menubar: false, menubar: false,
statusbar: 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>
<div class="col-md-4"> <div class="col-md-4">
<?php if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == PO_APPROVED) { ?> <?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 } ?> <?php } ?>
</div> </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: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 Code</th>
<th style="white-space: nowrap !important; text-align:left !important">Item Description</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: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:right !important">Quantity</th>
<th style="white-space: nowrap !important; text-align:left !important">UOM</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 echo $record->MaterialCode ?></td>
<td align="left"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "..."); <td align="left"><?php $shortName = mb_strimwidth($record->MaterialName, 0, 13, "...");
echo $shortName; ?></td> echo $shortName; ?></td>
<td align="center"><?php echo $record->HSNCODE ?></td>
<td align="left"> <td align="left">
<?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?> <?php if ($PONOStatus === PO_DRAFT || $PONOStatus === PO_CREATED) { ?>
<a href="#" <a href="#"
@ -1035,7 +1044,7 @@ if (!empty($getlogpodtl)) {
if ($PONOStatus == PO_DRAFT || $PONOStatus == PO_CREATED || $PONOStatus == REQITEM_Emergency_PO_CREATED || $PONOStatus == PO_APPROVED) { ?> 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> <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> </td>
<?php <?php
} else { ?> } else { ?>
@ -1311,10 +1320,14 @@ if (!empty($getlogpodtl)) {
<div class="form-row "> <div class="form-row ">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<label>Special Instructions </label> <label>Special Instructions </label>
<?php <!-- <?php
$data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40'); // $data = array('name' => 'txtSpcialInstruction', 'value' => set_value('txtSpcialInstruction', strip_tags($ServiceDescription)), 'id' => 'txtSpcialInstruction', 'class' => 'form-control', 'rows' => '10', 'cols' => '40');
echo form_textarea($data); // 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>
</div> </div>
@ -1334,7 +1347,7 @@ if (!empty($getlogpodtl)) {
<span>Previous Upload - </span> <span>Previous Upload - </span>
<small><?= $PrePOFile; ?></small></a></label> <small><?= $PrePOFile; ?></small></a></label>
&nbsp;&nbsp;&nbsp;&nbsp; &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> </div>
<?php } ?> <?php } ?>
<input type="hidden" id="PrePOFile" name="PrePOFile" value="<?php echo $PrePOFile; ?>" /><br> <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"> <div class="col-md-7 text-right">
<?php if ($PONOStatus == PO_DRAFT) { ?> <?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-danger auditor-restricted-btn 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 auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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) { ?> <?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-danger auditor-restricted-btn 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-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 Submit" ID="Submit" onclick="Save(4)">&nbsp;&nbsp;<span class="bold">Approve</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) { ?> <?php } else if ($PONOStatus == SPECIAL_PO) { ?>
<a class="btn btn-success" ID="OK" onclick="PageRedirect()">OK</a> <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 { ?> <?php } else { ?>
<a class="btn btn-success" ID="OK" onclick="PageRedirect()">OK</a> <a class="btn btn-success" ID="OK" onclick="PageRedirect()">OK</a>
<?php } ?> <?php } ?>
@ -2566,7 +2579,7 @@ if (!empty($getlogpodtl)) {
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a class="btn btn-secondary" data-dismiss="modal" value="Cancel" style="margin-right:10px;">Cancel</a> <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> </div>
</form> </form>
</div> </div>
@ -3365,8 +3378,9 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#MaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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 AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val(); var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').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 materialName = $("#ItemName").val();
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var quantity = $("#Quantity").val(); var quantity = $("#Quantity").val();
@ -4325,8 +4345,9 @@ if (!empty($getlogpodtl)) {
<td align="left">${temp}</td> <td align="left">${temp}</td>
<td align="center">${Reqnumber}</td> <td align="center">${Reqnumber}</td>
<td align="left">${materialCode}</td> <td align="left">${materialCode}</td>
<td align="left">${shorten}</td>`; <td align="left">${shorten}</td>
if (PONOStatus === "PO_DRAFT" || PONOStatus === "PO_CREATED") { <td align="center">${HSN}</td>`;
if (PONOStatus === "<?php echo PO_DRAFT; ?>" || PONOStatus === "<?php echo PO_CREATED; ?>") {
rowHtml += `<td><a href="#" class="editable-field" rowHtml += `<td><a href="#" class="editable-field"
data-id="${temp}" data-id="${temp}"
data-notes="-">-</a> data-notes="-">-</a>
@ -4451,7 +4472,7 @@ if (!empty($getlogpodtl)) {
var tr = document.getElementById(userid); var tr = document.getElementById(userid);
//alert(tr); //alert(tr);
var cellval = tr.cells; var cellval = tr.cells;
//alert(cellval);
var id = $('#Reqnumber' + userid).val(); var id = $('#Reqnumber' + userid).val();
//alert(id); //alert(id);
//var a=$('#Reqnumber'+userid).val(); //var a=$('#Reqnumber'+userid).val();
@ -4537,7 +4558,7 @@ if (!empty($getlogpodtl)) {
$('#ViewPer').val($("#Per" + userid).val()); $('#ViewPer').val($("#Per" + userid).val());
$('#ViewTotalOrderValue').val(cellval[7].innerHTML); $('#ViewTotalOrderValue').val(cellval[8].innerHTML);
$("#ViewMaterialCode").empty(); $("#ViewMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>; 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())); $("#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") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#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); var tr = document.getElementById(userid);
//alert(tr); //alert(tr);
var cellval = tr.cells; var cellval = tr.cells;
//alert(cellval);
var id = $('#Reqnumber' + userid).val(); var id = $('#Reqnumber' + userid).val();
//alert(id); //alert(id);
$('#EditReqNo').val($('#Reqnumber' + userid).val()); $('#EditReqNo').val($('#Reqnumber' + userid).val());
@ -4907,10 +4928,19 @@ if (!empty($getlogpodtl)) {
$('#EditTotalOrderValue').val(cellval[7].innerHTML); $('#EditTotalOrderValue').val(cellval[8].innerHTML);
$("#EditMaterialCode").empty(); $("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>; 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"; var isAdded = "0";
for (i = 0; i < Material.length; i++) { for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) { $.each(Material[i], function(idx, obj) {
@ -4932,8 +4962,8 @@ if (!empty($getlogpodtl)) {
if (isAdded == "0") { if (isAdded == "0") {
var HSNCODE = obj.HSNCODE ? obj.HSNCODE+" - " : "";
$("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName)); $("#EditMaterialCode").append($('<option></option>').val(obj.MaterialCode).html( HSNCODE + obj.MaterialName+ " ( "+obj.MaterialCode+" ) "));
} }
} }
@ -4952,6 +4982,12 @@ if (!empty($getlogpodtl)) {
var CostCode = $("#EditCostCenter").val(); var CostCode = $("#EditCostCenter").val();
var AvilBudget = $('#EditAvlBudAmt').val(); var AvilBudget = $('#EditAvlBudAmt').val();
var editMaterialCode = $("#EditMaterialCode").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 edititemname = $("#EditItemName").val();
var editUOM = $('#EditUOM').val(); var editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val(); var editQuantity = $('#EditQuantity').val();
@ -5015,12 +5051,12 @@ if (!empty($getlogpodtl)) {
var tr = document.getElementById(userid); var tr = document.getElementById(userid);
var cellval = tr.cells; var cellval = tr.cells;
cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editQuantity;
cellval[5].innerHTML = editQuantity; cellval[7].innerHTML = editUOM;
cellval[6].innerHTML = editUOM; cellval[8].innerHTML = itemRate;
cellval[7].innerHTML = itemRate; cellval[9].innerHTML = BasicValue;
cellval[8].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode); $('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname); $('#materialName' + userid).val(edititemname);

View File

@ -76,18 +76,18 @@ td {
.th-materialCode{ .th-materialCode{
text-align:center !important; text-align:center !important;
width:15%; width:12%;
} }
.th-requestedQuantity{ .th-requestedQuantity{
text-align:right !important; text-align:right !important;
width:15%; width:11%;
} }
.th-PoQuantity{ .th-PoQuantity{
text-align:right !important; text-align:right !important;
width:15%; width:11%;
} }
.th-Sno{ .th-Sno{
@ -106,6 +106,10 @@ td {
} }
.hidden-column { display: none; } .hidden-column { display: none; }
.th-HSNCode{
text-align:center !important;
width:10%;
}
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
window.onload = function() { window.onload = function() {
@ -204,7 +208,7 @@ td {
<div class="form-row"> <div class="form-row">
<div class="form-group col-md-12"> <div class="form-group col-md-12">
<?php if (count($MaterialCode) != 0) { ?> <?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 } ?> <?php } ?>
</div> </div>
</div> </div>
@ -216,6 +220,7 @@ td {
<th class="th th-Sno" >SNo</th> <th class="th th-Sno" >SNo</th>
<th class="th th-materialCode">Material Code</th> <th class="th th-materialCode">Material Code</th>
<th class="th th-materialName">Material Name</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-uom">Uom</th>
<th class="th th-requestedQuantity">RequestedQuantity</th> <th class="th th-requestedQuantity">RequestedQuantity</th>
<th class="th th-PoQuantity">PoQuantity</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; ?>" /> <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="center"><?php echo $record->MaterialCode; ?></td>
<td align="left"><?php echo $record->MaterialName; ?></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="left"><?php echo $record->UOM; ?></td>
<td align="right"><?php echo $record->Quantity; ?></td> <td align="right"><?php echo $record->Quantity; ?></td>
<td align="right"><?php echo $record->POQTY; ?></td> <td align="right"><?php echo $record->POQTY; ?></td>
<td align="center"><?php echo $record->StatusName; ?></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 : ''; ?>" /> <input type="hidden" name="<?php echo 'materialdesc' . $index ?>" id="<?php echo 'materialdesc' . $index ?>" value="<?php echo isset($record->MaterialDescription) ? $record->MaterialDescription : ''; ?>" />
<td> <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>
<td class="hidden-column"><?php echo $record->CategoryName; ?></td> <td class="hidden-column"><?php echo $record->CategoryName; ?></td>
</tr> </tr>
@ -290,14 +296,14 @@ td {
</div> </div>
<div class="form-row float-right"> <div class="form-row float-right">
<?php if ($Status == REQ_DRAFT) { ?> <?php if ($Status == REQ_DRAFT) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&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 Save" " id="Save">Save As Draft</button>&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 submit" id="submit1">Submit</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 submit" id="submit2">Approve</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) { ?> <?php } else if ($Status == REQ_PENDING_APPROVAL) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&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 submit" id="submit1">Submit</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 submit" id="submit2">Approve</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 } ?> <?php } ?>
</div> </div>
<?php echo form_close(); ?> <?php echo form_close(); ?>
@ -324,7 +330,9 @@ td {
$options = array("0" => 'Material Code'); $options = array("0" => 'Material Code');
if (!empty($MaterialCode)) { if (!empty($MaterialCode)) {
foreach ($MaterialCode as $MID) : 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; endforeach;
} }
echo form_dropdown('drpMaterial', $options, set_value('drpMaterial'), 'id="drpMaterial" class="form-control searchabledropdown"'); echo form_dropdown('drpMaterial', $options, set_value('drpMaterial'), 'id="drpMaterial" class="form-control searchabledropdown"');
@ -337,7 +345,7 @@ td {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <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"> <input type ="text" id="AddCategory" readonly class="form-control">
</div> </div>
</div> </div>
@ -409,8 +417,9 @@ td {
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<label for="EditMaterialCode" class="control-label">Material Code</label> <label for="EditMaterialCode" class="control-label">Material Code</label>
<input type="hidden" name="EditMaterialCode" id="EditMaterialCode" />
<?php <?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); echo form_input($data);
?> ?>
@ -478,7 +487,7 @@ td {
<button type="button" class="btn btn-secondary waves-effect" <button type="button" class="btn btn-secondary waves-effect"
data-dismiss="modal" value="Cancel">Cancel</button> data-dismiss="modal" value="Cancel">Cancel</button>
<button type="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> </div>
</div> </div>
@ -488,6 +497,35 @@ td {
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$(".searchabledropdown").select2(); $(".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) { function isNumberKey(evt) {
@ -818,6 +856,12 @@ td {
var quantity = $("#Quantity").val(); var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').val(); var materialdescription = $('#otherD').val();
var categoryName = $('#AddCategory').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(); $('#drpMaterial option[value=' + materialCode + ']').remove();
$('#Description').val(''); $('#Description').val('');
@ -832,6 +876,7 @@ td {
<td align="center">${temp}</td> <td align="center">${temp}</td>
<td align="center">${materialCode}</td> <td align="center">${materialCode}</td>
<td align="left">${materialName}</td> <td align="left">${materialName}</td>
<td align="center">${HSN}</td>
<td align="left">${uom}</td> <td align="left">${uom}</td>
<td align="right">${quantity}</td> <td align="right">${quantity}</td>
<td align="right">0.00</td> <td align="right">0.00</td>
@ -939,13 +984,15 @@ td {
} }
$('#EditMaterialCode').val($cells.eq(1).text()); $('#EditMaterialCode').val($cells.eq(1).text());
$('#EditDescription').val($cells.eq(2).text()); $('#EditDescription').val($cells.eq(2).text());
$('#EditUOM').val($cells.eq(3).text()); $('#EditUOM').val($cells.eq(4).text());
$('#EditQuantity').val($cells.eq(4).text()); $('#EditQuantity').val($cells.eq(5).text());
$('#EditCategory').val($cells.eq(8).text()); $('#EditCategory').val($cells.eq(9).text());
$('#Edituserid').val(userid); $('#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 editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val(); var editQuantity = $('#EditQuantity').val();
var edituserid = $("#Edituserid").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 tr = $('#' + edituserid);
var cells = tr.find('td'); var cells = tr.find('td');
cells.eq(1).text(editMaterialCode); cells.eq(1).text(editMaterialCode);
cells.eq(2).text(editDescription); cells.eq(2).text(editDescription);
cells.eq(3).text(editUOM); cells.eq(3).text(editHSN);
cells.eq(4).text(editQuantity); cells.eq(4).text(editUOM);
cells.eq(5).text(editQuantity);
$('#MaterialCode' + edituserid).val(editMaterialCode); $('#MaterialCode' + edituserid).val(editMaterialCode);
$('#Description' + edituserid).val(editDescription); $('#Description' + edituserid).val(editDescription);

View File

@ -82,14 +82,14 @@
<th>From Date</th> <th>From Date</th>
<th>To Date</th> <th>To Date</th>
<th>Number Of Days</th> <th>Number Of Days</th>
<th>Status</th> <th class="security-restricted labstaff-restricted stock-restricted">Status</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
if (!empty($leave_info)) : if (!empty($leave_info)) :
foreach ($leave_info as $d) { foreach ($leave_info as $i => $d) {
$createdat = new DateTime($d['created_on']); $createdat = new DateTime($d['created_on']);
$crdate = $createdat->format('d-m-Y'); $crdate = $createdat->format('d-m-Y');
$crtime = $createdat->format('h:i A'); $crtime = $createdat->format('h:i A');
@ -105,7 +105,25 @@
<td><?= esc($stdate) ?></td> <td><?= esc($stdate) ?></td>
<td><?= esc($eddate) ?></td> <td><?= esc($eddate) ?></td>
<td><?= esc($d['no_of_days']) ?></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']){ ?> <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"> <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; <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> <input type="text" class="form-control" id="no_of_days" name="no_of_days" readonly>
</div> </div>
</div><!--/. r o w 5 --> </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;"> <div class="col-md-2" style="text-align: end; align-content: center;">
<label class="form" for="status_val">Status</label> <label class="form" for="status_val">Status</label>
</div> </div>
@ -224,6 +242,7 @@
</select> </select>
</div> </div>
</div><!--/. r o w 6 --> </div><!--/. r o w 6 -->
<div class="row mt-2"> <div class="row mt-2">
<div class="col-md-2" style="text-align: end; align-content: center;"> <div class="col-md-2" style="text-align: end; align-content: center;">
<label class="form" for="reason">Reason</label> <label class="form" for="reason">Reason</label>
@ -239,8 +258,10 @@
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal" <button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal"
value="Cancel">Cancel</button> value="Cancel">Cancel</button>
<span class="auditor-restricted labstaff-restricted security-restricted">
<button type="button" class="btn btn-info waves-effect waves-light tempClick" <button type="button" class="btn btn-info waves-effect waves-light tempClick"
id="tempClick">Submit</button> id="tempClick">Submit</button>
</span>
</div> </div>
</div><!-- /. m o d a l-c o n t e n t --> </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 --> </div><!-- /.m o d a l-d i a l o g -->
@ -258,8 +279,8 @@
$('.tooltip-trigger').tooltip(); $('.tooltip-trigger').tooltip();
$(".searchabledropdown").select2(); $(".searchabledropdown").select2();
let today = new Date().toISOString().split("T")[0]; // Format: YYYY-MM-DD let today = new Date().toISOString().split("T")[0]; // Format: YYYY-MM-DD
$("#start_date").attr("min", today); // $("#start_date").attr("min", today);
$("#end_date").attr("min", today); // $("#end_date").attr("min", today);
$('#start_date').change(function() { $('#start_date').change(function() {
let start = new Date($('#start_date').val()); let start = new Date($('#start_date').val());
let formattedStart = start.toISOString().split('T')[0]; // Convert to YYYY-MM-DD format let formattedStart = start.toISOString().split('T')[0]; // Convert to YYYY-MM-DD format
@ -332,10 +353,10 @@
alert('Please Enter the Reason'); alert('Please Enter the Reason');
return; return;
} }
if ($('#status_val').val() === '') { // if ($('#status_val').val() === '') {
alert('Please Select Status'); // alert('Please Select Status');
return; // return;
} // }
// validateDateRange(function(isValid) { // validateDateRange(function(isValid) {
// if (!isValid) { // if (!isValid) {
// alert("The selected date range overlaps with an existing approved leave."); // alert("The selected date range overlaps with an existing approved leave.");
@ -349,7 +370,7 @@
end_date:$('#end_date').val(), end_date:$('#end_date').val(),
no_of_days:$('#no_of_days').val(), no_of_days:$('#no_of_days').val(),
reason:$('#reason').val(), reason:$('#reason').val(),
status:$('#status_val').val(), status:$('#status_val').val() ? $('#status_val').val() : 'Draft',
}; };
$('#loader').show(); $('#loader').show();
@ -555,3 +576,57 @@ function validateDateRange() {
} }
</script> </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

@ -99,7 +99,10 @@
</ol> </ol>
</div> </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> </div>
</div> </div>
@ -222,9 +225,7 @@
var table = $('#datatable').DataTable({ var table = $('#datatable').DataTable({
dom: 'Blfrtip', dom: 'Blfrtip',
buttons: [ buttons: [ 'pdf' ],
'excel', 'pdf'
],
pageLength: 10, pageLength: 10,
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: false, responsive: false,

View File

@ -3,8 +3,6 @@
<!-- Flatpickr JS --> <!-- Flatpickr JS -->
<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script> <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<style> <style>
.num { .num {
text-align: right; text-align: right;
} }
@ -83,7 +81,8 @@
.send-btn { .send-btn {
padding: 10px 20px; padding: 10px 20px;
background-color: #2ecc71; /* Green color */ background-color: #2ecc71;
/* Green color */
color: white; color: white;
border: none; border: none;
border-radius: 5px; border-radius: 5px;
@ -91,11 +90,9 @@
} }
.send-btn:hover { .send-btn:hover {
background-color: #27ae60; /* Darker green on hover */ background-color: #27ae60;
/* Darker green on hover */
} }
</style> </style>
<script> <script>
$(function() { $(function() {
@ -117,12 +114,15 @@
/* background-color: darkgrey; */ /* background-color: darkgrey; */
outline: 1px solid slategrey; outline: 1px solid slategrey;
} }
.igr-remarks { .igr-remarks {
position: relative; position: relative;
} }
.igr-remarks i { .igr-remarks i {
font-size: 14px; font-size: 14px;
} }
.igr-remarks span { .igr-remarks span {
position: absolute; position: absolute;
top: -5px; top: -5px;
@ -152,7 +152,7 @@
<ol class="breadcrumb m-0"> <ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Inward</a></li> <li class="breadcrumb-item"><a href="javascript: void(0);">Inward</a></li>
<li class="breadcrumb-item active"> <li class="breadcrumb-item active">
<h4 class="page-title">Gas Cylinder Returned </h4> <h4 class="page-title">Gas Cylinder Completed </h4>
</li> </li>
</ol> </ol>
</div> </div>
@ -218,6 +218,7 @@
<th>Net Weight</th> <th>Net Weight</th>
<th>Actual Weight</th> <th>Actual Weight</th>
<th>Shortage</th> <th>Shortage</th>
<th>Cylinder Count</th>
<th>Cylinder Pending</th> <th>Cylinder Pending</th>
@ -225,6 +226,7 @@
<th>Bill Date</th> <th>Bill Date</th>
<th>Driver Name</th> <th>Driver Name</th>
<th>Vehicle No</th> <th>Vehicle No</th>
<th>Download</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -255,6 +257,7 @@
<td><?= $gasCylinder['netWeight'] ?></td> <td><?= $gasCylinder['netWeight'] ?></td>
<td><?= $gasCylinder['actualWeight'] ?></td> <td><?= $gasCylinder['actualWeight'] ?></td>
<td><?= $gasCylinder['shortage'] ?></td> <td><?= $gasCylinder['shortage'] ?></td>
<td><?= $gasCylinder['gasCylinderCount'] ?></td>
<td><?= $gasCylinder['gasCylinderPendingCount'] ?></td> <td><?= $gasCylinder['gasCylinderPendingCount'] ?></td>
@ -263,6 +266,15 @@
<td><?= $gasCylinder['DeliveryChellanDate'] ?></td> <td><?= $gasCylinder['DeliveryChellanDate'] ?></td>
<td><?= $gasCylinder['DriverName'] ?></td> <td><?= $gasCylinder['DriverName'] ?></td>
<td><?= $gasCylinder['VehicleNo'] ?></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> </tr>
@ -273,6 +285,10 @@
</tbody> </tbody>
</table> </table>
<div>
<div style="display: none;" id="excelTableDiv"></div>
</div>
</div> <!-- end card body--> </div> <!-- end card body-->
</div> <!-- end card --> </div> <!-- end card -->
@ -304,31 +320,41 @@
console.log("Received date string:", dateString); console.log("Received date string:", dateString);
// Split the date string into date and time components // Split the date string into date and time components
var dateTimeParts = dateString.split(' '); var dateTimeParts = dateString?.split(' ');
var dateParts = dateTimeParts[0].split('-'); var dateParts = dateTimeParts[0]?.split('-');
var timeParts = dateTimeParts[1].split(':'); var timeParts = dateTimeParts[1]?.split(':');
// Extract individual components // Extract individual components
var year = parseInt(dateParts[0], 10); var year = parseInt(dateParts[0], 10);
var month = parseInt(dateParts[1], 10) - 1; // Months are zero-based in JavaScript var month = parseInt(dateParts[1], 10) - 1; // Months are zero-based in JavaScript
var day = parseInt(dateParts[2], 10); var day = parseInt(dateParts[2], 10);
var hours = parseInt(timeParts[0], 10); var hours = 0;
var minutes = parseInt(timeParts[1], 10); var minutes = 0;
var seconds = parseInt(timeParts[2], 10); 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 // Create a new Date object
var date = new Date(year, month, day, hours, minutes, seconds); var date = new Date(year, month, day, hours, minutes, seconds);
// Extract date components // Extract date components
var day = date.getDate().toString().padStart(2, '0'); day = date.getDate().toString().padStart(2, '0');
var month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based month = (date.getMonth() + 1).toString().padStart(2, '0'); // Months are zero-based
var year = date.getFullYear(); year = date.getFullYear();
// Extract time components // Extract time components
var hours = date.getHours().toString().padStart(2, '0'); hours = date.getHours().toString().padStart(2, '0');
var minutes = date.getMinutes().toString().padStart(2, '0'); minutes = date.getMinutes().toString().padStart(2, '0');
var seconds = date.getSeconds().toString().padStart(2, '0'); seconds = date.getSeconds().toString().padStart(2, '0');
var formattedDate = ''; var formattedDate = '';
// Format the date and time in DD-MM-YYYY HH:MM:SS format // Format the date and time in DD-MM-YYYY HH:MM:SS format
if (flag == 1) { if (flag == 1) {
@ -355,7 +381,6 @@
<!-- data table related initialization --> <!-- data table related initialization -->
<script> <script>
$(document).ready(function() { $(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) { $.fn.dataTable.ext.type.order['date-dd-mm-yyyy-pre'] = function(date) {
@ -368,15 +393,13 @@
var orderColumnIndex = <?php echo (session()->get('roleText') == 'Auditor') ? 6 : 0; ?>; var orderColumnIndex = <?php echo (session()->get('roleText') == 'Auditor') ? 6 : 0; ?>;
table = $('#view_inward_gate_register').DataTable({ table = $('#view_inward_gate_register').DataTable({
dom: 'Blfrtip', dom: 'Blfrtip',
buttons: [ buttons: [{
{
extend: 'excel', extend: 'excel',
text: 'Excel', text: 'Excel',
exportOptions: { exportOptions: {
columns: ':not(:last-child)' // Exclude the last column columns: ':not(:last-child)' // Exclude the last column
} }
} }],
],
pageLength: 10, pageLength: 10,
lengthMenu: [ lengthMenu: [
[10, 20, 30, 50, -1], [10, 20, 30, 50, -1],
@ -384,10 +407,14 @@
], ],
responsive: false, responsive: false,
ordering: true, ordering: true,
columnDefs: [ columnDefs: [{
{ targets: parseInt(orderColumnIndex), type: 'date-dd-mm-yyyy' } // Apply custom sorting targets: parseInt(orderColumnIndex),
type: 'date-dd-mm-yyyy'
} // Apply custom sorting
],
order: [
[parseInt(orderColumnIndex), 'desc']
], ],
order: [[parseInt(orderColumnIndex), 'desc']],
language: { language: {
paginate: { paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon next: '<i class="fas fa-angle-right"></i>', // Next button icon
@ -438,182 +465,176 @@
} }
}); });
}); });
</script> </script>
<!-- while Opening gasEnteredDetails modal -->
<script> <script>
function downloadExcel(clickedElement) {
$(document).on('click', '.gas-entered-details', function() { var row = $(clickedElement).closest("tr");
var igrNo = row.find("td:eq(1)").text().trim();
var cylinderPendingCount = row.find("td:eq(12)").text().trim();
cylinderPendingCount = parseInt(cylinderPendingCount, 10);
let row = $(this).closest("tr"); if (cylinderPendingCount > 0) {
alert("Please clear the " + cylinderPendingCount + " pending cylinders before downloading the Excel file.");
let fullCylinderDate = row.find("td:eq(0)").text().trim(); return false;
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 $("#loader").show();
$('#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>
$(document).ready(function () {
$("#gasEnteredDetails form").submit(function (event) {
event.preventDefault(); // Prevent form reload
let method = $("#gasEnteredDetails").data("form"); // Get form type
// 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({ $.ajax({
type: "POST", type: "POST",
url: "<?php echo base_url()?>/updateGasShortage", // Adjust endpoint as needed url: "<?php echo base_url() ?>gasCylindersByIgr",
data: JSON.stringify(formData), // Send data as JSON data: {
contentType: "application/json", IGRNO: igrNo
dataType: "json", },
success: function(response) { success: function(response) {
$("#loader").hide();
if (response.status === "success") { if (response.status === "success") {
alert("Gas Shortage Data Saved Successfully!"); console.log(response.data); // Debugging - Check if data is correct
$('#gasEnteredDetails').modal('hide'); // Close modal
} else { let tableHTML = `
alert("Error: " + response.message); <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) { error: function(xhr, status, error) {
console.log(xhr.responseText); console.log(xhr.responseText);
alert("Something went wrong! Please try again."); alert("Something went wrong! Please try again.");
}, },
complete: function() { complete: function() {
console.log("AJAX request completed."); console.log("AJAX request completed.");
$('#loader').hide(); $("#loader").hide(); // Hide loader
} }
}); });
}); }
});
</script> </script>

View File

@ -322,10 +322,19 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
$('#editTripsValue').hide(); $('#editTripsValue').hide();
} }
$('#EditPer').val($('#Per' + userid).val()); $('#EditPer').val($('#Per' + userid).val());
$('#EditTotalOrderValue').val(cellval[9].innerHTML); $('#EditTotalOrderValue').val(cellval[10].innerHTML);
$("#EditMaterialCode").empty(); $("#EditMaterialCode").empty();
var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>; 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"; var isAdded = "0";
for (i = 0; i < Material.length; i++) { for (i = 0; i < Material.length; i++) {
$.each(Material[i], function(idx, obj) { $.each(Material[i], function(idx, obj) {
@ -341,7 +350,9 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
} }
}); });
if (isAdded == "0") { 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; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;">Item Code</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;">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;">Line Item Specs</th>
<th style="white-space: nowrap !important; text-align:right !important">Quantity</th> <th style="white-space: nowrap !important; text-align:right !important">Quantity</th>
<th style="white-space: nowrap !important;">UOM</th> <th style="white-space: nowrap !important;">UOM</th>
@ -2355,8 +2367,9 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
if (isAdded == "0") { if (isAdded == "0") {
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));
} }
} }
@ -3439,6 +3452,14 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
var AvilBudget = $('#AvlBudAmt').val(); var AvilBudget = $('#AvlBudAmt').val();
var costCode = $('#CostCenter').val(); var costCode = $('#CostCenter').val();
var materialCode = $('#MaterialCode').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 materialName = $("#ItemName").val();
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var quantity = $("#Quantity").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:center !important">${Reqnumber}</td>
<td style="text-align:left !important">${materialCode}</td> <td style="text-align:left !important">${materialCode}</td>
<td style="text-align:left !important">${shorten}</td> <td style="text-align:left !important">${shorten}</td>
<td style="text-align:center !important">${HSN}</td>
<td style="text-align:left !important"> <td style="text-align:left !important">
<a href="#" class="editable-field" <a href="#" class="editable-field"
data-notes = "-" data-id ="${temp}">-</a> data-notes = "-" data-id ="${temp}">-</a>
@ -3874,12 +3896,19 @@ if (isset($AvlimportBudAmt) && !empty($AvlimportBudAmt)) {
Nooftrip = ''; 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 tr = document.getElementById(userid);
var cellval = tr.cells; var cellval = tr.cells;
cellval[5].innerHTML = editQuantity; cellval[4].innerHTML = editHSN;
cellval[6].innerHTML = editUOM; cellval[6].innerHTML = editQuantity;
cellval[7].innerHTML = itemRate; cellval[7].innerHTML = editUOM;
cellval[8].innerHTML = BasicValue; cellval[8].innerHTML = itemRate;
cellval[9].innerHTML = BasicValue;
$('#materialCode' + userid).val(editMaterialCode); $('#materialCode' + userid).val(editMaterialCode);
$('#materialName' + userid).val(edititemname); $('#materialName' + userid).val(edititemname);

View File

@ -155,6 +155,39 @@
</script> </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> <script>
$('document').ready(function(){ $('document').ready(function(){
$('#deletePreviousPurchaseOrderFile').click(function(){ $('#deletePreviousPurchaseOrderFile').click(function(){

View File

@ -619,23 +619,40 @@
<ul class="navbar-nav"> <ul class="navbar-nav">
<!-- Dashboard module --> <!-- 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"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>sales_dashboard" role="button" <a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>sales_dashboard" role="button"
aria-expanded="false"> aria-expanded="false">
<i class="ri-dashboard-line mr-1"></i>Dashboard</a> <i class="ri-dashboard-line mr-1"></i>Dashboard</a>
</li> </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'){?> <?php if(session()->get('roleText') == 'Auditor'){?>
<!-- Accounts Dashboard --> <!-- Accounts Dashboard -->
<li class="nav-item dropdown"> <!-- <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" <a class="nav-link dropdown-toggle arrow-none"
href="<?php echo base_url(); ?>accountsDashboard" href="<?php echo base_url(); ?>accountsDashboard"
role="button" aria-expanded="false"> role="button" aria-expanded="false">
<i class="fas fa-cubes mr-1"></i> Accounts Dashboard <i class="fas fa-cubes mr-1"></i> Accounts Dashboard
</a> </a>
</li> </li> -->
<?php } ?> <?php } ?>
@ -679,7 +696,7 @@
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-purchase"> <div class="dropdown-menu" aria-labelledby="topnav-purchase">
<?php if(session()->get('roleText') == 'System Administrator'){ ?>
<div class="dropdown"> <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-requisition" <a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-requisition"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -687,10 +704,12 @@
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-requisition"> <div class="dropdown-menu" aria-labelledby="topnav-requisition">
<a href="<?php echo base_url(); ?>Requisition" class="dropdown-item">Raise Requisition </a> <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> <a href="<?php echo base_url(); ?>CreatePO" class="dropdown-item">Purchase Order From Requisition</a>
</div>
</div>
<?php } ?> <?php } ?>
</div>
</div>
<div class="dropdown"> <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-po" <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> <a href="<?php echo base_url(); ?>PORelease" class="dropdown-item">Approve Purchase Order</a>
<?php if(session()->get('roleText') == 'System Administrator'){ ?> <?php if(session()->get('roleText') == 'System Administrator'){ ?>
<a href="<?php echo base_url(); ?>EmergencyPO" class="dropdown-item">Emergency Purchase Order </a> <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(); ?>Report_pending_purchase" class="dropdown-item">Pending Purchase Order </a>
<a href="<?php echo base_url(); ?>amendmentpurchaseorder" class="dropdown-item">Amendment Purchase Order</a> <a href="<?php echo base_url(); ?>amendmentpurchaseorder" class="dropdown-item">Amendment Purchase Order</a>
<?php } ?> <?php } ?>
@ -759,7 +780,7 @@
<div class="dropdown-menu" aria-labelledby="topnav-po" > <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(); ?>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(); ?>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>
</div> </div>
@ -775,7 +796,7 @@
<!-- HR module --> <!-- 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"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-hr" role="button" <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> <i class="ri-contacts-book-line mr-1"></i> HR <div class="arrow-down"></div>
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-hr"> <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(); ?>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(); ?>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> <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> <a href="<?php echo base_url(); ?>overTimeDetails" class="dropdown-item">OverTime Details</a>
</div> </div>
</div> </div>
<div class="dropdown"> <div class="dropdown">
<a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave" <a class="dropdown-item dropdown-toggle arrow-none" href="#" id="topnav-leave"
role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
@ -808,10 +829,11 @@
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-leave"> <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(); ?>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> <a href="<?php echo base_url(); ?>leavereports" class="dropdown-item"> Reports</a>
</div> </div>
</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> </div>
@ -839,7 +861,7 @@
<!-- material module --> <!-- 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"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="<?php echo base_url(); ?>rawmaterialListing" role="button" aria-expanded="false"> <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 --> <!-- 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"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-others" role="button" <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-others" role="button"
@ -883,7 +905,7 @@
<!-- Stock module --> <!-- 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"> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-stock" role="button" <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> <i class="ri-shopping-bag-line"></i> Stock <div class="arrow-down"></div>
</a> </a>
<div class="dropdown-menu" aria-labelledby="topnav-stock"> <div class="dropdown-menu" aria-labelledby="topnav-stock">
<div class="dropdown" > <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> <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"> <div class="dropdown-menu" aria-labelledby="topnav-stock">

View File

@ -160,13 +160,14 @@
<th>#</th> <th>#</th>
<th>Item Code</th> <th>Item Code</th>
<th>Item Description</th> <th>Item Description</th>
<th>HSN/SAC</th>
<th>Rate</th> <th>Rate</th>
<th>UOM</th> <th>UOM</th>
<th>Ordered Quantity</th> <th>Ordered Quantity</th>
<th>Received Quantity</th> <th>Received Quantity</th>
<th>Balance Quantity</th> <th>Balance Quantity</th>
<th>Invoice Quantity<span class="text-danger">*</span></th> <th>Invoice Quantity<span class="text-danger">*</span></th>
<th>Remarks</th> <th>Remarks<span class="text-danger">*</span></th>
<th> </th> <th> </th>
</tr> </tr>
</thead> </thead>
@ -297,13 +298,35 @@
$(".searchabledropdown").select2(); $(".searchabledropdown").select2();
$('#IGRLink').on('click', function() { function debounce(func, timeout = 300) {
filecheck(1); 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() { // $('#IGRLink').on('click', function() {
filecheck(0); // filecheck(1);
}); // });
// $('#IGRDraftLink').on('click', function() {
// filecheck(0);
// });
function filecheck(status) { function filecheck(status) {
$('#hideIGRStatus').val(status); $('#hideIGRStatus').val(status);
@ -320,9 +343,19 @@
// } // }
// } // }
function Save() { 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(); } 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> </script>
@ -380,7 +413,7 @@
$('#MaterialRcvdDate').focus(); $('#MaterialRcvdDate').focus();
return false; return false;
} else if (Noval == 0) { } else if (Noval == 0) {
alert('Invoice Quantity is Empty.Please Enter the value'); alert('Invoice Quantity is Missing. Kindly Enter the Value');
return false; return false;
} else if (isExceed == 1 && formatted_IsOpenOrder == 0) { } else if (isExceed == 1 && formatted_IsOpenOrder == 0) {
alert("Invoice Quantity is exceeding the Ordered Quantity. Please Contact Purchase Team for further Process ") alert("Invoice Quantity is exceeding the Ordered Quantity. Please Contact Purchase Team for further Process ")
@ -466,6 +499,7 @@
'<td align="right">' + j + '</td>' + '<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' + '<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' + '<td>' + item.MaterialName + '</td>' +
'<td>' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td>' + Number(item.Rate).toFixed(2) + '</td>' + '<td>' + Number(item.Rate).toFixed(2) + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' + '<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</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 RecQty = parseFloat($('#txtReceivedQuantity' + Rowid).val() == '' ? '0.00' : $('#txtReceivedQuantity' + Rowid).val());
var OrderedQty = parseFloat($("#Quantity_1" + Rowid).text()); var OrderedQty = parseFloat($("#Quantity_1" + Rowid).text());
var r = $("#Remark" + Rowid).val(); var r = $("#Remark" + Rowid).val();
if (r == '') {
alert("Please Enter the Remark")
$("#Remark" + Rowid).focus();
return false;
}
var isOpenOrder = parseInt($("#hiddenIsOpenOrder").val(), 2); var isOpenOrder = parseInt($("#hiddenIsOpenOrder").val(), 2);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? 0 : 1; var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? 0 : 1;
if (formatted_IsOpenOrder == 0) { if (formatted_IsOpenOrder == 0) {
@ -863,7 +902,7 @@
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2); isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open"; var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder); $('.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); $('#IGRDraftLink').text(button_text_for_IGRDraftLink);
//$("#Add").val(obj.Address); //$("#Add").val(obj.Address);
$("#del").val(obj.DeliveryDate); $("#del").val(obj.DeliveryDate);
@ -898,6 +937,7 @@
'<td align="right">' + j + '</td>' + '<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' + '<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' + '<td>' + item.MaterialName + '</td>' +
'<td>' + ((item.HSNCODE) ? item.HSNCODE : '') + '</td>' +
'<td>' + Number(item.Rate).toFixed(2) + '</td>' + '<td>' + Number(item.Rate).toFixed(2) + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' + '<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</td>' + '<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</td>' +

View File

@ -198,15 +198,23 @@
</div> </div>
<div class="col-9 text-right d-flex" style="justify-content: end;" id="savebutton"> <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;"> --> <!-- <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>
</div> </div>
@ -559,8 +567,8 @@
<?php echo number_format(0.00, 2, '.', ''); ?> <?php echo number_format(0.00, 2, '.', ''); ?>
</td> </td>
<td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;" data-empid="<?php echo $record->EmpID; ?>"> <td id="ttlsalary<?php echo $inx ?>" style="max-width:80px;text-align:right;">
<a href="#" onclick="openDriverLoad(this)"> <a href="#" onclick="openDriverLoad('<?php echo $record->EmpID; ?>')">
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalsalary[] = $sum_of_amount; ?> <?php echo number_format($sum_of_amount, 2, '.', ''); $totalsalary[] = $sum_of_amount; ?>
</a> </a>
</td> </td>
@ -581,7 +589,6 @@
</td> </td>
<td style="max-width:80px;text-align:right;"> <td style="max-width:80px;text-align:right;">
<!-- $record->driver_salary_amount -->
<?php echo number_format($sum_of_amount, 2, '.', ''); $totalworkedSalary[] = $sum_of_amount; ?> <?php echo number_format($sum_of_amount, 2, '.', ''); $totalworkedSalary[] = $sum_of_amount; ?>
</td> </td>
@ -612,7 +619,7 @@
</td> </td>
<td id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);" <td class="monthDue" id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);"
<?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?> <?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated" <?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;" style="text-align:right;color:blue;"
@ -632,7 +639,7 @@
<?php echo number_format(0.00, 2, '.', ''); ?> <?php echo number_format(0.00, 2, '.', ''); ?>
</td> </td>
<!-- <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?> --> <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?>
<td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);" <td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);"
onkeyup="driverchangeInput(event);" onkeyup="driverchangeInput(event);"
@ -770,7 +777,7 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -808,25 +815,27 @@ $(document).ready(function () {
function exportTableToExcel(tableId, filename = 'monthlypay.xlsx') { function exportTableToExcel(tableId, filename = 'monthlypay.xlsx') {
var table = document.getElementById(tableId); var table = document.getElementById(tableId);
var rows = table.rows; var rows = table.rows;
var data = [];
for (var i = 0; i < rows.length; i++) { let ws = XLSX.utils.table_to_sheet(table); // Convert modified table to sheet
var row = rows[i]; let wb = XLSX.utils.book_new(); // Create a new workbook
var cols = row.querySelectorAll('td, th'); var range = XLSX.utils.decode_range(ws['!ref']);
var rowData = [];
for (var j = 0; j < cols.length; j++) { // Auto-size columns
rowData.push(cols[j].innerText); 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); 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
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);
} }
// Add click event listener to the export button // 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() { $("#monthyear").change(function() {
@ -1245,7 +1280,7 @@ $(document).ready(function () {
var driverMonthSalary = driverSalaryAdd - driverSalarySub var driverMonthSalary = driverSalaryAdd - driverSalarySub
var driverSalary = Math.round(driverMonthSalary); var driverSalary = Math.round(driverMonthSalary);
console.log("Sal ",driverSalary); console.log("Driver Sal ",driverSalary);
var cals = (driverSalary).toFixed(0); var cals = (driverSalary).toFixed(0);
@ -1253,7 +1288,8 @@ $(document).ready(function () {
document.getElementById("empsal" + sno).innerHTML = cals; document.getElementById("empsal" + sno).innerHTML = cals;
// copied from calculategrandtotal() because we need those two only thats why // copied from calculategrandtotal() because we need those two only thats why
var AutoLoanDueIndex = 22; const td = document.querySelector('.monthDue');
var AutoLoanDueIndex = td ? td.cellIndex : -1;
var AutoLoanDue = 0; var AutoLoanDue = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(AutoLoanDueIndex).text(); var value = $(this).find('td').eq(AutoLoanDueIndex).text();
@ -1261,27 +1297,32 @@ $(document).ready(function () {
}); });
$('#monthloan').text(AutoLoanDue); $('#monthloan').text(AutoLoanDue);
var FestivalBonusIndex = 24; console.log("AutoLoanDue ",AutoLoanDue);
var FestivalBonusIndex = 23;
var FestivalBonus = 0; var FestivalBonus = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(FestivalBonusIndex).text(); var value = $(this).find('td').eq(FestivalBonusIndex).text();
FestivalBonus += parseFloat(value) || 0; FestivalBonus += parseFloat(value) || 0;
}); });
$('#fest').text(FestivalBonus); $('#fest').text(FestivalBonus);
console.log("FestivalBonus ",FestivalBonus);
var EstimateIndex = 25; var EstimateIndex = 24;
var Estimate = 0; var Estimate = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(EstimateIndex).text(); var value = $(this).find('td').eq(EstimateIndex).text();
Estimate += parseFloat(value) || 0; Estimate += parseFloat(value) || 0;
}); });
$('#estsal').text(Estimate); $('#estsal').text(Estimate);
console.log("Estimate ",Estimate);
} }
function calculategrandtotal() function calculategrandtotal()
{ {
var AutoLoanDueIndex = 22; const td = document.querySelector('.monthDue');
var AutoLoanDueIndex = td ? td.cellIndex : -1;
var AutoLoanDue = 0; var AutoLoanDue = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(AutoLoanDueIndex).text(); var value = $(this).find('td').eq(AutoLoanDueIndex).text();
@ -1289,7 +1330,7 @@ $(document).ready(function () {
}); });
$('#monthloan').text(AutoLoanDue); $('#monthloan').text(AutoLoanDue);
var TDSDeductionsIndex = 23; var TDSDeductionsIndex = 22;
var TDSDeductions = 0; var TDSDeductions = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(TDSDeductionsIndex).text(); var value = $(this).find('td').eq(TDSDeductionsIndex).text();
@ -1297,7 +1338,7 @@ $(document).ready(function () {
}); });
$('#other').text(TDSDeductions); $('#other').text(TDSDeductions);
var FestivalBonusIndex = 24; var FestivalBonusIndex = 23;
var FestivalBonus = 0; var FestivalBonus = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(FestivalBonusIndex).text(); var value = $(this).find('td').eq(FestivalBonusIndex).text();
@ -1305,7 +1346,7 @@ $(document).ready(function () {
}); });
$('#fest').text(FestivalBonus); $('#fest').text(FestivalBonus);
var EstimateIndex = 25; var EstimateIndex = 24;
var Estimate = 0; var Estimate = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(EstimateIndex).text(); var value = $(this).find('td').eq(EstimateIndex).text();
@ -1318,8 +1359,7 @@ $(document).ready(function () {
function openDriverLoad(element) { function openDriverLoad(empId) {
var empId = $(element).data("empid"); // Get the empid from clicked element
var monthYear = $('#monthyear').val(); var monthYear = $('#monthyear').val();
// Convert "03-2025" to "Mar-2025" // Convert "03-2025" to "Mar-2025"
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];

View File

@ -39,7 +39,7 @@
<input type="text" name="hdate" id="hdate" class="form-control"> <input type="text" name="hdate" id="hdate" class="form-control">
</div> </div>
<div class="col-md-3"> <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> </div>
<div class="card-body"> <div class="card-body">
@ -70,7 +70,7 @@
echo "NO DATA"; echo "NO DATA";
} ?></td> } ?></td>
<td contenteditable='false' style="text-align:left;"><?php echo $date; ?></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> </tr>
<?php <?php
} }
@ -80,7 +80,7 @@
</table> </table>
<p>&nbsp;</p> <p>&nbsp;</p>
<div class="row"> <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"> <input type="button" id="submit" value="Save" class="btn btn-success">
</div> </div>
</div> </div>
@ -94,62 +94,101 @@
</div> </div>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script> <script type="text/javascript" src="<?php echo base_url(); ?>public/assets/js/common.js" charset="utf-8"></script>
<script type="text/html" id="addList">
<tr>
<td style="text-align:left;" contenteditable="true"><%=Holiday_Name%></td>
<td style="text-align:left;" contenteditable="false"><%=Date%></td>
<td style="text-align:center;">
<a href='#' onclick="DeleteRow(<?php echo $index; ?>)" id="Del"><span class="fas fa-trash"></span></a>
</td>
</tr>
</script>
<script> <script>
function DeleteRow(rowid) { function DeleteRow(rowid) {
var d = '';
//alert(rowid);
var tr = document.getElementById(rowid); var tr = document.getElementById(rowid);
var Row = $('#phdays').find('tr').eq(rowid).find('td');
if (!tr) return; // Just in case
var isNew = tr.getAttribute('data-is-new');
if (isNew === 'true') {
// Just remove from DOM, no backend call
tr.parentNode.removeChild(tr);
return;
}
// Handle DB row delete
var d = '';
var Row = $('#' + rowid).find('td');
$.each(Row, function(index, value) { $.each(Row, function(index, value) {
if (index == 1) { if (index == 1) {
d = value.textContent d = value.textContent;
} }
}); });
// alert(d);
// $('#content').loader('show');
$.ajax({ $.ajax({
data: { data: { param1: d },
param1: d
},
type: "POST", type: "POST",
url: "<?php echo base_url() ?>monthlypay/deletePublicHoliday", url: "<?php echo base_url() ?>monthlypay/deletePublicHoliday",
success: function(data) { success: function(data) {
// $('#content').loader('hide');
alert(data); alert(data);
}
});
tr.parentNode.removeChild(tr); tr.parentNode.removeChild(tr);
} }
});
}
// function DeleteRow(rowid) {
// var d = '';
// //alert(rowid);
// var tr = document.getElementById(rowid);
// var Row = $('#phdays').find('tr').eq(rowid).find('td');
// $.each(Row, function(index, value) {
// if (index == 1) {
// d = value.textContent
// }
// });
// // alert(d);
// // $('#content').loader('show');
// $.ajax({
// data: {
// param1: d
// },
// type: "POST",
// url: "<?php echo base_url() ?>monthlypay/deletePublicHoliday",
// success: function(data) {
// // $('#content').loader('hide');
// alert(data);
// }
// });
// tr.parentNode.removeChild(tr);
// }
$('#Add').click(function() { $('#Add').click(function() {
var index = $('#phdays tr').length; var index = $('#phdays tbody tr').length + 1; // Better index logic
var H_name = $('#hname').val(); var H_name = $('#hname').val();
var H_date = $('#hdate').val(); var H_date = $('#hdate').val();
if (H_name != '' && H_date != '') { if (H_name != '' && H_date != '') {
var template = jQuery("#addList").html(); // Destroy DataTable if initialized
$('#db').append(_.template(template)({ if ($.fn.DataTable.isDataTable('#phdays')) {
index: index, $('#phdays').DataTable().destroy();
Holiday_Name: H_name, }
Date: H_date
})); var template = `
<tr id="${index}" data-is-new="true">
<td contenteditable='true' style="text-align:left;">${H_name}</td>
<td contenteditable='false' style="text-align:left;">${H_date}</td>
<td style="text-align:center;">
<a href='#' onclick="DeleteRow(${index})" id="Del"><span class="fas fa-trash"></span></a>
</td>
</tr>`;
$('#db').append(template);
// Clear inputs
$('#hname').val(''); $('#hname').val('');
$('#hdate').val(''); $('#hdate').val('');
// Re-initialize DataTable if needed
$('#phdays').DataTable();
} }
}); });
$('#submit').click(function() { $('#submit').click(function() {
var jsondata = $('#phdays').tableToJSON(); var jsondata = $('#phdays').tableToJSON();
var jsondata = JSON.stringify(jsondata); var jsondata = JSON.stringify(jsondata);
@ -165,6 +204,7 @@
success: function(data) { success: function(data) {
// $('#content').loader('hide'); // $('#content').loader('hide');
alert(data); alert(data);
location.reload(); // Refreshes the current page
} }
}); });

View File

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

View File

@ -56,7 +56,7 @@
</div> </div>
<div class="col-2 text-right pr-3"> <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"> href="<?php echo base_url(); ?>addRawmaterial">
Add New Material Add New Material
</a> </a>
@ -76,6 +76,9 @@
$type = "success"; $type = "success";
echo show_alert($type, $success); echo show_alert($type, $success);
} }
$materialListPage = session()->getFlashdata('materialListPage') ?? $_GET['materialListPage'] ?? 1;
?> ?>
<div class="row"> <div class="row">
@ -207,13 +210,14 @@
<?php } else { ?> <?php } else { ?>
<a class="a_tag_link" <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 ?>" href="<?php echo base_url() . 'viewRawmaterial?RID=' . $record->MaterialCode . '&MType=' . $record->MaterialType . '&UOM=' . $record->UOM . '&date1=' . $date ?>"
data-toggle="tooltip" data-toggle="tooltip"
title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><i title="<?php echo $record->MaterialCode; ?> - Click here to view Material details"><i
class="fa fa-edit" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp; class="fa fa-edit" style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;
</a> </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" title="<?= $record->MaterialCode ?> - Click here to delete material details"
onclick="deleteMaterial('<?php echo $record->MaterialCode; ?>')"><i class="fa fa-trash" onclick="deleteMaterial('<?php echo $record->MaterialCode; ?>')"><i class="fa fa-trash"
style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp; style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;
@ -228,7 +232,7 @@
</tbody> </tbody>
</table> </table>
<p>( Note :The entries count includes archived data... )</p>
</div> <!-- end card body--> </div> <!-- end card body-->
</div> <!-- end card --> </div> <!-- end card -->
</div><!-- end col--> </div><!-- end col-->
@ -311,13 +315,13 @@ $(document).ready(function () {
let result = JSON.parse(response); let result = JSON.parse(response);
if (result.length > 0) { if (result.length > 0) {
let tableHtml = ` 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;"> <thead style="background-color: #539754; color: white; font-size: 13px;">
<tr> <tr style="width:100%">
<th style="text-align: center;" > Date</th> <th style="text-align: center; width: 12%;" >Date</th>
<th style="text-align: center;" >Supplier</th> <th style="text-align: center;" >Supplier</th>
<th style="text-align: center;" >PONO</th> <th style="text-align: center;" >PONO</th>
<th style="text-align: center;" >PO Type</th> <th style="text-align: center; width: 12%;" >PO Type</th>
<th style="text-align: center;" >Total Value</th> <th style="text-align: center;" >Total Value</th>
<th style="text-align: center;" >Action</th> <th style="text-align: center;" >Action</th>
</tr> </tr>
@ -332,13 +336,13 @@ $(document).ready(function () {
href = `${baseUrl}purchaseorder/CreatePOPrint?PONO=${item.PONO}&ReqType=${item.ReqType}`; href = `${baseUrl}purchaseorder/CreatePOPrint?PONO=${item.PONO}&ReqType=${item.ReqType}`;
tableHtml += ` tableHtml += `
<tr> <tr style="width:100%">
<td>${CreatedDate}</td> <td style="text-align: left; padding-left: 1.5%;width:12%">${CreatedDate}</td>
<td>${item.SupplierName}</td> <td>${item.SupplierName}</td>
<td class="pono-cell" data-pono="${item.PONO}" data-potype="${item.POType}" data-capitalrange="${item.CapitalRange}" style="cursor: pointer; color: #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} ${item.PONO}
</td> </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: right;">${TotalOrderValue}</td>
<td style="text-align: center;"> <td style="text-align: center;">
<a data-toggle="tooltip" href=${href} target="_blank"> <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 // Date range filter function
// $.fn.dataTable.ext.search.push( // $.fn.dataTable.ext.search.push(
// function (settings, data, dataIndex) { // function (settings, data, dataIndex) {
@ -542,10 +570,31 @@ $(document).ready(function () {
}); });
}); });
</script> </script>
<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) { function deleteMaterial(mid) {
var answer = confirm(" Do you want to delete the Material from the List?") 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">Material Code</th>
<th class="th" style="text-align:left !important;">Material Name</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" 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:left !important;">Uom</th>
<th class="th" style="text-align:right !important;">Quantity</th> <th class="th" style="text-align:right !important;">Quantity</th>
<th class="th">Action</th> <th class="th">Action</th>
@ -205,6 +206,7 @@ if (!empty($Emp)) {
<button type="button" class="close" data-dismiss="modal" <button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button> aria-hidden="true">×</button>
</div> </div>
<div class="modal-body p-4"> <div class="modal-body p-4">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -215,7 +217,7 @@ if (!empty($Emp)) {
//print_r( $options); //print_r( $options);
if (!empty($MaterialList)) { if (!empty($MaterialList)) {
foreach ($MaterialList as $MID) : foreach ($MaterialList as $MID) :
$options[$MID->MaterialCode] = $MID->MaterialCode . ' ' . ' - ' . ' ' . $MID->MaterialName; $options[$MID->MaterialCode] = $MID->HSNCODE . ' ' . ' - ' . ' ' . $MID->MaterialName.' ( '.$MID->MaterialCode.' )';
endforeach; endforeach;
} }
echo form_dropdown('MaterialCode', $options, set_value('MaterialCode'), 'id="MaterialCode" class="form-control searchabledropdown" '); 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="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <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"> <input type ="text" id="AddCategory" readonly class="form-control">
</div> </div>
</div> </div>
@ -299,9 +301,10 @@ if (!empty($Emp)) {
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<input type="hidden" name="EditMaterialCode" id="EditMaterialCode" />
<label for="EditMaterialCode" class="control-label">Material Code</label> <label for="EditMaterialCode" class="control-label">Material Code</label>
<?php <?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); echo form_input($data);
?> ?>
@ -677,6 +680,11 @@ if (!empty($Emp)) {
var uom = $("#UOM").val(); var uom = $("#UOM").val();
var quantity = $("#Quantity").val(); var quantity = $("#Quantity").val();
var materialdescription = $('#otherD').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(); $('#MaterialCode option[value=' + materialCode + ']').remove();
@ -695,6 +703,7 @@ if (!empty($Emp)) {
<td align="center">${materialCode}</td> <td align="center">${materialCode}</td>
<td align="left">${materialName}</td> <td align="left">${materialName}</td>
<td align="left">${categoryName}</td> <td align="left">${categoryName}</td>
<td align="center">${HSN}</td>
<td align="left">${uom}</td> <td align="left">${uom}</td>
<td align="right">${quantity}</td> <td align="right">${quantity}</td>
<td align="center"> <td align="center">
@ -760,11 +769,14 @@ if (!empty($Emp)) {
var userid = $triggerElement.data('userid'); var userid = $triggerElement.data('userid');
var $tr = $('#' + userid); var $tr = $('#' + userid);
var $cells = $tr.find('td'); 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()); $('#EditMaterialCode').val($cells.eq(1).text());
$('#EditMaterialType').val(MaterialType);
$('#EditDescription').val($cells.eq(2).text()); $('#EditDescription').val($cells.eq(2).text());
$('#EditCategory').val($cells.eq(3).text()); $('#EditCategory').val($cells.eq(3).text());
$('#EditUOM').val($cells.eq(4).text()); $('#EditUOM').val($cells.eq(5).text());
$('#EditQuantity').val($cells.eq(5).text()); $('#EditQuantity').val($cells.eq(6).text());
$('#Edituserid').val(userid); $('#Edituserid').val(userid);
}); });
}); });
@ -783,6 +795,13 @@ if (!empty($Emp)) {
var editMaterialCode = $("#EditMaterialCode").val(); var editMaterialCode = $("#EditMaterialCode").val();
var editDescription = $("#EditDescription").val(); var editDescription = $("#EditDescription").val();
var editCategory = $("#EditCategory").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 editUOM = $('#EditUOM').val();
var editQuantity = $('#EditQuantity').val(); var editQuantity = $('#EditQuantity').val();
@ -791,8 +810,9 @@ if (!empty($Emp)) {
cells.eq(1).text(editMaterialCode); cells.eq(1).text(editMaterialCode);
cells.eq(2).text(editDescription); cells.eq(2).text(editDescription);
cells.eq(3).text(editCategory); cells.eq(3).text(editCategory);
cells.eq(4).text(editUOM); cells.eq(4).text(editHSN);
cells.eq(5).text(editQuantity); cells.eq(5).text(editUOM);
cells.eq(6).text(editQuantity);
$('#MaterialCode' + edituserid).val(editMaterialCode); $('#MaterialCode' + edituserid).val(editMaterialCode);
$('#Description' + edituserid).val(editDescription); $('#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> </script>

View File

@ -111,10 +111,10 @@ if (!empty($Status)) {
</div> </div>
<?php if ($DraftCount == 0) { ?> <?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 } ?>
<?php if ($DraftCount > 0) { ?> <?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 status.</span> Please act on the requisition.<span class="highlight">Then only you can raise
New Requisition. </span></p> New Requisition. </span></p>
<?php } ?> <?php } ?>
@ -170,13 +170,13 @@ if (!empty($Status)) {
<td align="center"> <?php echo $record->newLineItem ?></td> <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" <td> <a data-toggle="tooltip"
href="<?php echo base_url() . 'EditRequisitionForm?ReqNo=' . $record->ReqNo . '&ReqType=' . $record->ReqType; ?>"><i href="<?php echo base_url() . 'EditRequisitionForm?ReqNo=' . $record->ReqNo . '&ReqType=' . $record->ReqType; ?>"><i
class="fas fa-pencil-alt" data-toggle="tooltip" class="fas fa-pencil-alt" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to view Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> 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" class="fas fa-trash" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to Delete Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> title="<?php echo $record->ReqNo; ?> - Click here to Delete Requisition details"></i>&nbsp;&nbsp;&nbsp;</a>
</td> </td>

View File

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

View File

@ -177,7 +177,7 @@
<li class="breadcrumb-item"><a href="javascript: void(0);">Sales</a></li> <li class="breadcrumb-item"><a href="javascript: void(0);">Sales</a></li>
<li class="breadcrumb-item active"> <li class="breadcrumb-item active">
<h4 class="page-title">Invoices List</h4> <h4 class="page-title">Invoice List</h4>
</li> </li>
</ol> </ol>
</div> </div>
@ -341,7 +341,7 @@
</div> </div>
</div> </div>
<div class="modal-body" style="margin-top: 23px;"> <div class="modal-body">
<?php if (isset($invoice_data)) { <?php if (isset($invoice_data)) {
foreach ($invoice_data as $key => $value) { ?> foreach ($invoice_data as $key => $value) { ?>
@ -541,7 +541,7 @@ $(document).ready(function () {
console.log(element); console.log(element);
var fileName = element.file_name; var fileName = element.file_name;
var attachmentName = element.attachment_name; var attachmentName = element.attachment_name;
attachmentsHtml += ` <br> attachmentsHtml += `
<div class="row pad"> <div class="row pad">
<div class="col-md-4"> <div class="col-md-4">
<span>File Name</span> <span>File Name</span>
@ -576,11 +576,11 @@ $(document).ready(function () {
var newRowHtml = ` var newRowHtml = `
<div class="row pad"> <div class="row pad">
<div class="col-md-4"> <div class="col-md-4">
<span for="file_name">File name</span> <span for="file_name">File name<span class="text-danger">*</span></span>
<input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}"> <input type="text" id="file_name" name="file_name[]" maxlength="255" class="form-control" value="${data != null && data != '' ? data.file_name : ''}">
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<span for="emp_file">File</span> <span for="emp_file">File<span class="text-danger">*</span></span>
<input type="file" name="emp_file[]" class="form-control"> <input type="file" name="emp_file[]" class="form-control">
</div> </div>
<div class="col-md-4" style="margin-top: 23px;"> <div class="col-md-4" style="margin-top: 23px;">

View File

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

View File

@ -335,7 +335,11 @@
</div> </div>
</div> </div>
<?php if (session()->getFlashdata('error')): ?> <?php
use PhpOffice\PhpSpreadsheet\Reader\Xml\Style\NumberFormat;
if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger"> <div class="alert alert-danger">
<?= session()->getFlashdata('error'); ?> <?= session()->getFlashdata('error'); ?>
</div> </div>
@ -361,9 +365,7 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control " class="form-control "
data-provide="datepicker" readonly>
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
</div> </div>
@ -393,12 +395,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </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" title="Add Entry"
data-target="#coatingMachineDetailModal" data-target="#coatingMachineDetailModal"
data-toggle="modal" data-toggle="modal"
@ -636,7 +638,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <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> </div>
</form> </form>
</div> </div>
@ -840,7 +842,7 @@
<div class="form-row" id="editBatchCardRowId"> <div class="form-row" id="editBatchCardRowId">
<!-- batch card file upload --> <!-- 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> <label for="editBatchCardId">Upload Batch Card</label>
<br> <br>
@ -857,7 +859,7 @@
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" id="cancelBtn">Cancel</button> <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> </div>
</form> </form>
</div> </div>
@ -999,15 +1001,15 @@
<!-- td:eq(6) --> <!-- td:eq(6) -->
<td class="celda_normal"><?php echo $record['grade'] ?? ' ' ?></td> <td class="celda_normal"><?php echo $record['grade'] ?? ' ' ?></td>
<!-- td:eq(7) --> <!-- 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: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: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: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: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) --> <!-- td:eq(12) -->
<!-- edit and download option..!! --> <!-- edit and download option..!! -->
<td class="celda_normal"> <td class="celda_normal">
@ -1077,11 +1079,11 @@
<td class="celda_normal "> <?= $summary['totalMachineRunningHrs'] ?></td> <td class="celda_normal "> <?= $summary['totalMachineRunningHrs'] ?></td>
<td class="celda_normal "> - </td> <td class="celda_normal "> - </td>
<td class="celda_normal "> - </td> <td class="celda_normal "> - </td>
<td class="celda_normal "><?= $summary['totalCoating'] ?></td> <td class="celda_normal "><?= number_format($summary['totalCoating'],2) ?></td>
<td class="celda_normal "><?= $summary['totalCoatingSandInKg'] ?></td> <td class="celda_normal "><?= number_format($summary['totalCoatingSandInKg'],2) ?></td>
<td class="celda_normal "><?= $summary['totalGasConsumption'] ?></td> <td class="celda_normal "><?= number_format($summary['totalGasConsumption'],2) ?></td>
<td class="celda_normal "><?= round($summary['totalGasConsumption'] / $summary['totalMachineRunningHrs']) ?> (A)</td> <td class="celda_normal "><?= number_format($summary['totalGasConsumption'] / $summary['totalMachineRunningHrs'] , 2) ?> (A)</td>
<td class="celda_normal "><?= round($summary['totalCoatingSandInKg'] / $summary['totalMachineRunningHrs']) ?> (A)</td> <td class="celda_normal "><?= number_format($summary['totalCoatingSandInKg'] / $summary['totalMachineRunningHrs'], 2) ?> (A)</td>
</tr> </tr>
</tfoot> </tfoot>
@ -1314,7 +1316,6 @@
$('#editMachineOffTimeHrId ').select2(); $('#editMachineOffTimeHrId ').select2();
$('#fromDateFilter ').select2(); $('#fromDateFilter ').select2();
$('#toDateFilter ').select2(); $('#toDateFilter ').select2();
}); });
</script> </script>
@ -1364,10 +1365,10 @@
<label for="">Change Batch Card</label> <label for="">Change Batch Card</label>
<input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" > <input type="file" class="editBatchFile additionalBatchFile" name="batchCard[]" >
<p>( Previously Uploaded File ${element.client_given_name} )</p> <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>`; </div>`;
$('#editBatchCardRowId').append(string) $('#editBatchCardRowId').append(string);
}); });
@ -1459,7 +1460,6 @@
let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr); let machineRunningInHrs = calculateMachineRunInHrs(machineOnDate, machineOnTimeHr, machineOffTimeHr);
if (!machineRunningInHrs) { if (!machineRunningInHrs) {
$('#machineOffTimeHrId').val(''); $('#machineOffTimeHrId').val('');
return return
} }
@ -1467,12 +1467,31 @@
$('#totalCoatingSandId').trigger('change'); $('#totalCoatingSandId').trigger('change');
$('#totalGasConsumptionId').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() { $('#totalCoatingSandId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalCoatingSandValue = $(this).val(); let totalCoatingSandValue = $(this).val();
let machineRunningInHrsValue = $('#machineRunningInHrsId').val(); let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
@ -1486,6 +1505,15 @@
$('#totalGasConsumptionId').change(function() { $('#totalGasConsumptionId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalGasConsumptionValue = $(this).val(); let totalGasConsumptionValue = $(this).val();
let machineRunningInHrsValue = $('#machineRunningInHrsId').val(); let machineRunningInHrsValue = $('#machineRunningInHrsId').val();
if (totalGasConsumptionValue && machineRunningInHrsValue) { 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() { $('#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() { $('#editTotalCoatingSandId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalCoatingSandValue = $(this).val(); let totalCoatingSandValue = $(this).val();
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val(); let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
if (totalCoatingSandValue && machineRunningInHrsValue) { if (totalCoatingSandValue && machineRunningInHrsValue) {
let perHourCoatingSandQTYValue = (totalCoatingSandValue / machineRunningInHrsValue).toFixed(2); let perHourCoatingSandQTYValue = (totalCoatingSandValue / machineRunningInHrsValue).toFixed(2);
$('#editPerHourCoatingSandQTYId').val(perHourCoatingSandQTYValue); $('#editPerHourCoatingSandQTYId').val(perHourCoatingSandQTYValue);
@ -1577,6 +1620,13 @@
$('#editTotalGasConsumptionId').change(function() { $('#editTotalGasConsumptionId').change(function() {
let basicCheck =checkIsNumber($(this).val().trim());
if (basicCheck == 0) {
alert("Kindly Enter Numbers only..!!");
return;
}
let totalGasConsumptionValue = $(this).val(); let totalGasConsumptionValue = $(this).val();
let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val(); let machineRunningInHrsValue = $('#editMachineRunningInHrsId').val();
if (totalGasConsumptionValue && machineRunningInHrsValue) { if (totalGasConsumptionValue && machineRunningInHrsValue) {
@ -1587,6 +1637,16 @@
}) })
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
}) })
</script> </script>
@ -1651,15 +1711,15 @@
$('#changeMonthForm').submit(); $('#changeMonthForm').submit();
}); });
$(document).ready(function(){
$('#month').datepicker({ $('#month').datepicker({
format: 'M-yyyy', format: 'M-yyyy',
viewMode: 'months', viewMode: 'months',
minViewMode: 'months', minViewMode: 'months',
autoclose: true, autoclose: true,
orientation: 'bottom' orientation: 'bottom',
}) startDate: new Date(2025, 0), // Jan is month 0
}) endDate: new Date() // current date as max
});
@ -1726,9 +1786,6 @@
if ($(this).css('display') === 'none') return; if ($(this).css('display') === 'none') return;
let cellText = $(this).text().trim(); let cellText = $(this).text().trim();
rowData.push(cellText); rowData.push(cellText);
}); });
@ -1740,8 +1797,22 @@
// Create a worksheet from array (no DOM needed!) // Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows); 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(); let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
// Write the workbook to a file
XLSX.writeFile(wb, filename || 'export.xlsx'); XLSX.writeFile(wb, filename || 'export.xlsx');
} }
@ -1750,10 +1821,10 @@
document.getElementById('coatingMachineDetailsExport').addEventListener('click', function() { document.getElementById('coatingMachineDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'coatingMachineDetails_<?= $month ?>.xlsx'); exportTableToExcel(tableId, 'coatingMachineDetails_<?= $month ?>.xlsx');
}); });
}); });
</script> </script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#batchCardAddBtnId').click(function() { $('#batchCardAddBtnId').click(function() {
@ -1883,7 +1954,7 @@
}); });
// Initialize Select2 when the modal is shown inside full screen // Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function () { $('#filterModalId').on('shown.bs.modal', function () {
$('.select2').select2({ $('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal dropdownParent: $(this) // This ensures Select2 works in the modal
}); });

View File

@ -272,6 +272,11 @@
.card { .card {
margin-bottom: 5px; margin-bottom: 5px;
} }
.hidden-row {
display: none;
}
</style> </style>
@ -328,9 +333,20 @@ foreach ($period as $day) {
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <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"> <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" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fas fa-save btn-lg mt-2" <i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -598,14 +614,14 @@ foreach ($period as $day) {
foreach ($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails) { foreach ($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails) {
$currentDate = date('Y-m-d');
?> ?>
<tr <tr class="<?=$bagStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y'); if ($bagStockDetails[0]['date'] === $currentDate) {
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $bagStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>>
@ -676,6 +692,7 @@ foreach ($period as $day) {
'receipt' => 0, 'receipt' => 0,
'used' => 0, 'used' => 0,
'balanceStock' => 0, 'balanceStock' => 0,
'materialCode' => $materialCode,
]; ];
} }
@ -701,10 +718,14 @@ foreach ($period as $day) {
?> ?>
<td class="celda_normal "><?= $each['opening'] ?></td> <td class="celda_normal openingStock"
<td class="celda_normal "><?= $each['receipt'] ?></td> data-id="footer <?=$each['materialCode']?>"></td>
<td class="celda_normal "><?= $each['used'] ?></td> <td class="celda_normal receiptStock"
<td class="celda_normal "><?= $each['balanceStock'] ?></td> 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 } ?> <?php } ?>
@ -715,18 +736,19 @@ foreach ($period as $day) {
<!-- this else condition work if groupedBagStockDetails is empty and creating new records <!-- this else condition work if groupedBagStockDetails is empty and creating new records
with initial values 0 for entire month --> with initial values 0 for entire month -->
<?php } else { <?php } else {
// dd($bagMaterials);
// dd($previousMonthBagStockDetails);
?> ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?> <?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
<tr
$currentDate = date('Y-m-d');
?>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y'); if ($dateInMonth === $currentDate) {
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
@ -801,7 +823,36 @@ foreach ($period as $day) {
</td> </td>
<?php } ?> <?php } ?>
</tr> </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 } ?> <?php } ?>
@ -914,9 +965,8 @@ foreach ($period as $day) {
var updateBagStockDetails = tableToJson(); 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({ $.ajax({
data: { data: {
updateBagStockDetails updateBagStockDetails
@ -928,8 +978,7 @@ foreach ($period as $day) {
if (data) { if (data) {
$('#loader').hide(); $('#loader').hide();
console.log(data); console.log(data);
alert(data); showMessage(data);
window.location.reload();
} }
}, },
@ -988,6 +1037,13 @@ foreach ($period as $day) {
<script> <script>
function openingStockChange(tdElement) { function openingStockChange(tdElement) {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
try { try {
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
@ -1005,6 +1061,14 @@ foreach ($period as $day) {
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) { } catch (error) {
@ -1016,6 +1080,13 @@ foreach ($period as $day) {
function receiptStockChange(tdElement) { function receiptStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' '); 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; 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) { } catch (error) {
@ -1046,6 +1125,13 @@ foreach ($period as $day) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' '); 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; 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) { } catch (error) {
@ -1128,12 +1223,21 @@ foreach ($period as $day) {
// Validate against the regex // Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input); const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) { if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0; return 0;
} }
return input; return input;
} }
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script> </script>
@ -1157,44 +1261,54 @@ foreach ($period as $day) {
$(this).remove(); $(this).remove();
} }
}); });
// Convert Date Format and align date column
$(cloneTable).find('tbody tr').each(function() { $(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date) let firstTd = $(this).find('td').eq(0);
let originalDate = firstTd.text().trim();
// Convert Date Format (Assuming it's in YYYY-MM-DD format) let parts = originalDate.split('-');
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
if (parts.length === 3) { if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate); // Update the cell value firstTd.text(formattedDate);
} }
// Apply left alignment to the date column
firstTd.css("text-align", "left"); firstTd.css("text-align", "left");
}); });
// Create a new workbook
let wb = XLSX.utils.book_new();
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet // Convert the modified table to a sheet
let wb = XLSX.utils.book_new(); // Create a new workbook let ws = XLSX.utils.table_to_sheet(cloneTable);
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file // 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;
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');
// Write the workbook to a file
XLSX.writeFile(wb, filename || 'export.xlsx');
}
let tableId = 'bagStockDetailsTableId'; let tableId = 'bagStockDetailsTableId';
document.getElementById('bagStockExport').addEventListener('click', function() { document.getElementById('bagStockExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'Bag_Stock_Details<?= $month ?>.xlsx'); exportTableToExcel(tableId, 'Bag_Stock_Details<?= $month ?>.xlsx');
});
}) });
})
</script> </script>
<script> <script>
document.addEventListener("keydown", function(event) { document.addEventListener("keydown", function(event) {
@ -1327,10 +1441,13 @@ foreach ($period as $day) {
}) })
$('#month').datepicker({ $('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025" format: 'M-yyyy',
minViewMode: 1, // Month-Year Picker viewMode: 'months',
minViewMode: 'months',
autoclose: true, autoclose: true,
todayHighlight: true orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() { }).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus $(this).datepicker('show'); // Ensure it opens on focus
}); });
@ -1432,3 +1549,76 @@ foreach ($period as $day) {
}); });
}); });
</script> </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 { .card {
margin-bottom: 5px; margin-bottom: 5px;
} }
.hidden-row {
display: none;
}
</style> </style>
@ -319,6 +326,19 @@ foreach ($period as $day) {
<div class="col-12"> <div class="col-12">
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <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"> <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" <i class="fa fa-download btn-lg mt-2"
title="Excel Download" title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba" style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="bagStockExport"> id="dieselMachineStockDetailsExport">
</i> </i>
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fas fa-save btn-lg mt-2" <i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -581,17 +601,17 @@ foreach ($period as $day) {
foreach ($groupedDieselMachineStockDetails as $rowIndex => $dieselStockDetails) { foreach ($groupedDieselMachineStockDetails as $rowIndex => $dieselStockDetails) {
$currentDate = date('Y-m-d');
?> ?>
<tr <tr class="<?=$dieselStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
if ($dieselStockDetails[0]['date'] === $currentDate) {
$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;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>
>
<?php <?php
@ -744,6 +764,7 @@ foreach ($period as $day) {
'consumption' => 0, 'consumption' => 0,
'running_hours' => 0, 'running_hours' => 0,
'mileage' => 0, 'mileage' => 0,
'machineId' => $machineId,
]; ];
} }
@ -782,21 +803,39 @@ foreach ($period as $day) {
</td> </td>
<td class="celda_normal "><?= $summary['openingStock'] ?></td> <td class="celda_normal openingTD"
<td class="celda_normal "><?= $summary['totalPurchaseDiesel'] ?></td> data-id="footer openingTD"></td>
<td class="celda_normal "><?= $summary['totalFillingDiesel'] ?></td>
<td class="celda_normal "><?= $summary['balanceStock'] ?></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) { <?php foreach ($summary as $each) {
if (is_array($each)) { if (is_array($each)) {
?> ?>
<td class="celda_normal "><?= $each['opening_reading'] ?> </td> <td class="celda_normal openingReading"
<td class="celda_normal "><?= $each['closing_reading'] ?></td> data-id="footer <?=$each['machineId']?>" > </td>
<td class="celda_normal "><?= $each['filling_diesel'] ?></td>
<td class="celda_normal "><?= $each['consumption'] ?></td> <td class="celda_normal closingReading"
<td class="celda_normal "><?= $each['running_hours'] ?></td> data-id="footer <?=$each['machineId']?>" ></td>
<td class="celda_normal "><?= $each['mileage'] ?></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 <?php
} }
@ -815,14 +854,16 @@ foreach ($period as $day) {
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?> <?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
<tr
$currentDate = date('Y-m-d');
?>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
if ($dateInMonth === $currentDate) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>>
@ -1017,6 +1058,59 @@ foreach ($period as $day) {
<?php } ?> <?php } ?>
</tr> </tr>
<?php } ?> <?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 } ?> <?php } ?>
@ -1123,9 +1217,8 @@ foreach ($period as $day) {
var updateDieselMachineDetails = tableToJson(); 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: { data: {
updateDieselMachineDetails updateDieselMachineDetails
@ -1135,16 +1228,13 @@ foreach ($period as $day) {
success: function(data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide(); showMessage(data);
console.log(data);
alert(data);
window.location.reload();
} }
}, },
error: function(xhr, status, error) { 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 Code:", xhr.status);
console.error("Error Message:", error); console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText); console.error("Response Text:", xhr.responseText);
@ -1223,6 +1313,15 @@ foreach ($period as $day) {
function openingReadingChange(tdElement) { function openingReadingChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' '); let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let openingReading = validateInput(tdElement.innerText); 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); 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) { } catch (error) {
@ -1248,6 +1356,15 @@ foreach ($period as $day) {
function closingReadingChange(tdElement) { function closingReadingChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' '); let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let closingReading = validateInput(tdElement.innerText); 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.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).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) { } catch (error) {
@ -1273,6 +1398,15 @@ foreach ($period as $day) {
function consumptionChange(tdElement) { function consumptionChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' '); let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let closingReading = validateInput(document.querySelector(`td.closingReading[data-id="${dataId}"]`).innerText); 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.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).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) { } catch (error) {
@ -1298,6 +1441,15 @@ foreach ($period as $day) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(" "); let [date, machine_id] = tdElement.getAttribute('data-id').split(" ");
@ -1327,6 +1479,17 @@ foreach ($period as $day) {
updateTotalStockValue(date, balanceTD); 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) { } catch (error) {
@ -1344,6 +1507,14 @@ foreach ($period as $day) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let openingTD = validateInput(tdElement.innerText); 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); 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) { } catch (error) {
@ -1369,6 +1550,16 @@ foreach ($period as $day) {
function purchaseTDStockChange(tdElement) { function purchaseTDStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let purchaseTD = validateInput(tdElement.innerText); let purchaseTD = validateInput(tdElement.innerText);
let openingTD = validateInput(document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText); let openingTD = validateInput(document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText);
@ -1382,6 +1573,18 @@ foreach ($period as $day) {
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) { } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
@ -1405,12 +1608,23 @@ foreach ($period as $day) {
// Validate against the regex // Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input); const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) { if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0; return 0;
} }
return input; return input;
} }
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script> </script>
<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 let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
@ -1656,7 +1880,7 @@ foreach ($period as $day) {
window.removeSelectedMaterial = function(checkbox) { window.removeSelectedMaterial = function(checkbox) {
let container = checkbox.closest(".sortable-item"); let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value; let machineId = checkbox.value;
let materialName = container.querySelector("label").innerText; let materialName = container.querySelector("label").innerText;
container.remove(); container.remove();
@ -1667,17 +1891,17 @@ foreach ($period as $day) {
let selectedOption = dropdown.options[dropdown.selectedIndex]; let selectedOption = dropdown.options[dropdown.selectedIndex];
if (selectedOption.value !== "") { if (selectedOption.value !== "") {
let materialCode = selectedOption.value; let machineId = selectedOption.value;
let materialName = selectedOption.text; let materialName = selectedOption.text;
let container = document.createElement("div"); let container = document.createElement("div");
container.classList.add("sortable-item"); container.classList.add("sortable-item");
container.id = materialCode + "_container"; container.id = machineId + "_container";
container.innerHTML = ` container.innerHTML = `
<input type="checkbox" id="${materialCode}_checkboxId" <input type="checkbox" id="${machineId}_checkboxId"
name="customisedMachineCodes[]" value="${materialCode}" name="customisedMachineCodes[]" value="${machineId}"
onclick="removeSelectedMaterial(this)" checked> onclick="removeSelectedMaterial(this)" checked>
<label class="grab" for="${materialCode}_checkboxId"> ${materialName} </label> <label class="grab" for="${machineId}_checkboxId"> ${materialName} </label>
<br> <br>
`; `;
@ -1706,8 +1930,12 @@ foreach ($period as $day) {
viewMode: 'months', viewMode: 'months',
minViewMode: 'months', minViewMode: 'months',
autoclose: true, autoclose: true,
orientation: 'bottom' orientation: 'bottom',
}) startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script> </script>
<script> <script>
@ -1778,25 +2006,160 @@ foreach ($period as $day) {
<script> <script>
//getting modal backdrop inside full screen //getting modal backdrop inside full screen
$(document).ready(function() { $(document).ready(function() {
function moveModalBackdropToFullscreen() { $('#fullscreenBtn').click(function() {
setTimeout(() => { // Show fullscreen container
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen $('#fullscreenDiv').show();
}, 10); // Small delay ensures backdrop is created first
// Request fullscreen
if (document.fullscreenElement == null) {
document.getElementById('fullscreenDiv').requestFullscreen();
} }
// Move the modal backdrop when a modal opens // Add custom backdrop
$('#bs-example-modal-lg, #customizeModalId').on('show.bs.modal', function() { $('#fullscreenDiv').prepend('<div class="custom-backdrop"></div>');
moveModalBackdropToFullscreen();
// Move modal into fullscreen div and show it manually
$('#fullscreenDiv').append($('#customizeModalId'));
$('#customizeModalId').modal('show');
}); });
// Ensure modals work properly in fullscreen mode // On modal close, clean up
document.addEventListener("fullscreenchange", function() { $('#customizeModalId').on('hidden.bs.modal', function () {
setTimeout(() => { $('.custom-backdrop').remove();
$('.modal-backdrop').remove(); // Remove any existing backdrops $('#fullscreenDiv').hide();
moveModalBackdropToFullscreen(); if (document.fullscreenElement) {
}, 200); 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;
}
});
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> </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" ?>" <input type="text" name="month" id="month" value="<?php echo "$datefordropdown" ?>"
class="form-control " class="form-control "
data-provide="datepicker" readonly>
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
</div> </div>
@ -359,12 +357,12 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </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" title="Add Entry"
data-target="#additionalEntriesModalId" data-target="#additionalEntriesModalId"
data-toggle="modal" data-toggle="modal"
@ -471,12 +469,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryDateId">Date</label> <label class="form" for="additionalEntryDateId">Date</label>
<span class="text-danger">*</span>
<input type="date" class="form-control" id="additionalEntryDateId" name="date" value="<?= $calendarCurrentDate ?>" <input type="date" class="form-control" id="additionalEntryDateId" name="date" value="<?= $calendarCurrentDate ?>"
min="<?= $calendarStartDate ?>" max="<?= $calendarEndDate ?>" required> min="<?= $calendarStartDate ?>" max="<?= $calendarEndDate ?>" required>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label> <label class="form" for="additionalEntryDrierOnTimeId">Drier On Time</label>
<span class="text-danger">*</span>
<select onchange="calculateMachineRunningHrs()" required <select onchange="calculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;" class="timeDropdown select2" style="width: 100px;"
id="additionalEntryDrierOnTimeId" name="drier_on_time"> id="additionalEntryDrierOnTimeId" name="drier_on_time">
@ -488,7 +487,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryDrierOffTimeId">Drier Off Time</label> <label class="form" for="additionalEntryDrierOffTimeId">Drier Off Time</label>
<span class="text-danger">*</span>
<select onchange="calculateMachineRunningHrs()" required <select onchange="calculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;" class="timeDropdown select2" style="width: 100px;"
id="additionalEntryDrierOffTimeId" name="drier_off_time"> id="additionalEntryDrierOffTimeId" name="drier_off_time">
@ -512,6 +511,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- supplier name --> <!-- supplier name -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label> <label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
<span class="text-danger">*</span>
<select class="timeDropdown supplier_name select2" style="width: 300px;" required <select class="timeDropdown supplier_name select2" style="width: 300px;" required
id="additionalEntrySupplierNameId" name="supplier_name"> id="additionalEntrySupplierNameId" name="supplier_name">
<option value="">Select</option> <option value="">Select</option>
@ -523,7 +523,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- input sand qty --> <!-- input sand qty -->
<div class="col-md-3"> <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(); " <input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="" required> type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="" required>
</div> </div>
@ -531,7 +532,10 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- input sand moisture --> <!-- input sand moisture -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label> <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> </div>
@ -539,6 +543,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- sand dried qty --> <!-- sand dried qty -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label> <label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); " <input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="" required> type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="" required>
</div> </div>
@ -552,13 +557,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- total gas consumption --> <!-- total gas consumption -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label> <label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
<span class="text-danger">*</span>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); " <input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required> type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
</div> </div>
<!-- gas per ton --> <!-- gas per ton -->
<div class="col-md-3"> <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 <input type="text" class="form-control" id="additionalEntryGasPerTonId" name="gas_per_ton" value="" required
readonly> readonly>
</div> </div>
@ -566,7 +572,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- qty per hours --> <!-- qty per hours -->
<div class="col-md-3"> <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 <input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value="" required
readonly> readonly>
</div> </div>
@ -586,14 +592,18 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- dust qty --> <!-- dust qty -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryDustQtyId">Dust Qty (Metric Ton)</label> <label class="form" for="additionalEntryDustQtyId">Dust Qty (Kgs)</label>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value="" required> <span class="text-danger">*</span>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value=""
onchange="additionalEntryDustQty();"
required>
</div> </div>
<!-- customer name --> <!-- customer name -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label> <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> <input type="text" class="form-control" id="additionalEntryCustomerNameId" name="customer_name" value="" required>
</div> </div>
@ -627,13 +637,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="row"> <div class="row">
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryDateId">Date</label> <label class="form" for="editEntryDateId">Date</label>
<span class="text-danger">*</span>
<input type="date" class="form-control" id="editEntryDateId" name="date" value="" <input type="date" class="form-control" id="editEntryDateId" name="date" value=""
required readonly> required readonly>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryDrierOnTimeId">Drier On Time</label> <label class="form" for="editEntryDrierOnTimeId">Drier On Time</label>
<span class="text-danger">*</span>
<select onchange="editEntryCalculateMachineRunningHrs()" <select onchange="editEntryCalculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;" class="timeDropdown select2" style="width: 100px;"
id="editEntryDrierOnTimeId" name="drier_on_time"> id="editEntryDrierOnTimeId" name="drier_on_time">
<option value="">Select</option> <option value="">Select</option>
@ -644,8 +655,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryDrierOffTimeId">Drier Off Time</label> <label class="form" for="editEntryDrierOffTimeId">Drier Off Time</label>
<span class="text-danger">*</span>
<select onchange="editEntryCalculateMachineRunningHrs()" <select onchange="editEntryCalculateMachineRunningHrs()" required
class="timeDropdown select2" style="width: 100px;" class="timeDropdown select2" style="width: 100px;"
id="editEntryDrierOffTimeId" name="drier_off_time"> id="editEntryDrierOffTimeId" name="drier_off_time">
<option value="">Select</option> <option value="">Select</option>
@ -668,7 +679,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- supplier name --> <!-- supplier name -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntrySupplierNameId">Supplier Name</label> <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=""> id="editEntrySupplierNameId" name="supplier_name" value="">
<option value="">Select</option> <option value="">Select</option>
<?php foreach ($supplierData as $key => $value) { ?> <?php foreach ($supplierData as $key => $value) { ?>
@ -679,15 +691,19 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- input sand qty --> <!-- input sand qty -->
<div class="col-md-3"> <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(); " <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> </div>
<!-- input sand moisture --> <!-- input sand moisture -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryInputSandMoistureId">Input Sand Moisture (%)</label> <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> </div>
@ -695,8 +711,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- sand dried qty --> <!-- sand dried qty -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label> <label class="form" for="editEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); " <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> </div>
@ -708,13 +725,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- total gas consumption --> <!-- total gas consumption -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryTotalGasConsumptionId">Total Gas Consumption</label> <label class="form" for="editEntryTotalGasConsumptionId">Total Gas Consumption</label>
<span class="text-danger">*</span>
<input onchange="editEntryGasPerTon(); editEntryMoistureLossQty(); editEntryQtyPerHrs(); " <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> </div>
<!-- gas per ton --> <!-- gas per ton -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryGasPerTonId">Gas per Ton</label> <label class="form" for="editEntryGasPerTonId">Gas / Ton</label>
<input type="text" class="form-control" id="editEntryGasPerTonId" name="gas_per_ton" value="" <input type="text" class="form-control" id="editEntryGasPerTonId" name="gas_per_ton" value=""
readonly> readonly>
</div> </div>
@ -722,7 +740,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- qty per hours --> <!-- qty per hours -->
<div class="col-md-3"> <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="" <input type="text" class="form-control" id="editEntryQtyPerHoursId" name="qty_per_hours" value=""
readonly> readonly>
</div> </div>
@ -742,19 +760,23 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- dust qty --> <!-- dust qty -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryDustQtyId">Dust Qty (Metric Ton)</label> <label class="form" for="editEntryDustQtyId">Dust Qty (Kgs)</label>
<input type="text" class="form-control" id="editEntryDustQtyId" name="dust_qty" value=""> <span class="text-danger">*</span>
<input type="text" class="form-control" id="editEntryDustQtyId" name="dust_qty" value=""
onchange="editEntryDustQty();"
required>
</div> </div>
<!-- customer name --> <!-- customer name -->
<div class="col-md-3"> <div class="col-md-3">
<label class="form" for="editEntryCustomerNameId">Customer Name</label> <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>
</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 --> <!-- 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">Gas Per Ton</th>
<th class="celda_encabezado_general">Qty Per Hrs (Metric 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">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" align="left">Customer Name</th>
<th class="celda_encabezado_general" style="display:none;">id</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:eq(9) gas_per_ton -->
<td class="celda_normal"> <td class="celda_normal">
<?php echo round($a['gas_per_ton']); ?> <?php echo $a['gas_per_ton']; ?>
</td> </td>
<!-- td:eq(10) qty_per_hours --> <!-- td:eq(10) qty_per_hours -->
<td class="celda_normal"> <td class="celda_normal">
<?php echo round($a['qty_per_hours']); ?> <?php echo $a['qty_per_hours']; ?>
</td> </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['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['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['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['gas_per_ton'] = number_format(($summary['total_gas_consumption'] / $summary['sand_dried_qty']), 2);
$summary['qty_per_hrs'] = round( ($summary['sand_dried_qty'] / $summary['drier_running_hours']) ); $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']; $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); hours = parseInt(hours, 10);
// Adjust hours based on AM/PM // Adjust hours based on AM/PM
if (modifier === "pm" && hours < 12) { if (modifier === "PM" && hours < 12) {
hours += 12; hours += 12;
} else if (modifier === "am" && hours === 12) { } else if (modifier === "AM" && hours === 12) {
hours = 0; hours = 0;
} }
@ -1172,6 +1195,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let totalGasConsumption = $('#additionalEntryTotalGasConsumptionId').val(); let totalGasConsumption = $('#additionalEntryTotalGasConsumptionId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').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 != '') { if (totalGasConsumption != '' && sandDriedQty != '') {
let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2); let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2);
@ -1187,6 +1221,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let inputSandQty = $('#additionalEntryInputSandQtyId').val(); let inputSandQty = $('#additionalEntryInputSandQtyId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').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 != '') { if (inputSandQty != '' && sandDriedQty != '') {
let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty); let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
@ -1203,6 +1248,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let drierRunninhHrs = $('#additionalEntryRunningHrsId').val(); let drierRunninhHrs = $('#additionalEntryRunningHrsId').val();
let sandDriedQty = $('#additionalEntrySandDriedQtyId').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 != '') { if (drierRunninhHrs != '' && sandDriedQty != '') {
let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs); let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs);
@ -1217,6 +1273,31 @@ $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 // this for edit entry in ten ton f=drier
@ -1275,6 +1356,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let totalGasConsumption = $('#editEntryTotalGasConsumptionId').val(); let totalGasConsumption = $('#editEntryTotalGasConsumptionId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').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 != '') { if (totalGasConsumption != '' && sandDriedQty != '') {
let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2); let gasPerTon = (parseFloat(totalGasConsumption) / parseFloat(sandDriedQty)).toFixed(2);
@ -1290,6 +1382,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let inputSandQty = $('#editEntryInputSandQtyId').val(); let inputSandQty = $('#editEntryInputSandQtyId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').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 != '') { if (inputSandQty != '' && sandDriedQty != '') {
let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty); let moistureLossQty = parseFloat(inputSandQty) - parseFloat(sandDriedQty);
@ -1306,6 +1409,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let drierRunninhHrs = $('#editEntryRunningHrsId').val(); let drierRunninhHrs = $('#editEntryRunningHrsId').val();
let sandDriedQty = $('#editEntrySandDriedQtyId').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 != '') { if (drierRunninhHrs != '' && sandDriedQty != '') {
let qtyPerHrs = parseFloat(sandDriedQty) / parseFloat(drierRunninhHrs); 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> </script>
<!-- date filter optiond --> <!-- date filter optiond -->
@ -1379,17 +1528,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
let rows = []; let rows = [];
// Extract table data row-by-row // Extract table data row-by-row
$(table).find('tr').each(function(rowIndex) { $(table).find('tr').each(function() {
let rowData = []; let rowData = [];
$(this).find('th, td').each(function(colIndex) { $(this).find('th, td').each(function() {
// Skip hidden columns // Skip hidden columns
if ($(this).css('display') === 'none') return; if ($(this).css('display') === 'none') return;
let cellText = $(this).text().trim(); let cellText = $(this).text().trim();
rowData.push(cellText); rowData.push(cellText);
}); });
@ -1401,35 +1547,59 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
// Create a worksheet from array (no DOM needed!) // Create a worksheet from array (no DOM needed!)
let ws = XLSX.utils.aoa_to_sheet(rows); 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(); let wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx'); XLSX.writeFile(wb, filename || 'export.xlsx');
} }
let tableId = 'drierTable'; let tableId = 'drierTable';
document.getElementById('drierMachineDetailsExport').addEventListener('click', function() { document.getElementById('drierMachineDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'drierMachineDetails_<?= $datefordropdown ?>.xlsx'); exportTableToExcel(tableId, 'drierMachineDetails_<?= $datefordropdown ?>.xlsx');
});
}) });
})
</script> </script>
<!-- script section ends --> <!-- script section ends -->
<!-- onchange of month submit will happen --> <!-- onchange of month submit will happen -->
<script> <script>
$(document).ready(function() {
$('#month').change(function() { $(document).on('change', '#month', function() {
$('#changeMonthForm').submit(); $('#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>
<script> <script>

View File

@ -297,6 +297,12 @@
.card { .card {
margin-bottom: 5px; margin-bottom: 5px;
} }
.hidden-row {
display: none;
}
</style> </style>
@ -332,30 +338,38 @@
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <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 align="center" id="changeMonthForm" action="<?= base_url('dustAndRoughStockDetails'); ?>" method="post"> <div align="center">
<form style="width: 700px;" id="changeMonthForm" action="<?= base_url('dustAndRoughStockDetails'); ?>" method="post">
<div class="row"> <div class="row">
<?php $today = date('M-Y'); ?> <?php $today = date('M-Y'); ?>
<div class="col-3">
</div>
<div class="col-2 mt-2 ml-4"> <div class="col-3 mt-2">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control " class="form-control "
data-provide="datepicker" readonly
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly
style="max-width: 175px;"> style="max-width: 175px;">
</div> </div>
<div class="col-3 text-right d-flex" style="justify-content: end;"> <div class="col-9 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..." <input type="text" id="searchInput" placeholder="Search..."
class="mt-2" class="mt-2"
@ -379,12 +393,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fa fa-save btn-lg mt-2" <i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -399,6 +413,9 @@
</div> </div>
</form> </form>
</div>
<!-- filter modal --> <!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true"> <div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
@ -510,12 +527,12 @@
$summary = []; $summary = [];
foreach ($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail) { foreach ($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail) {
$currentDate = date('Y-m-d');
?> ?>
<tr <tr class="<?=$dustAndRoughStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dustAndRoughStockDetail['date'])->format('d-m-Y'); if ($dustAndRoughStockDetail['date'] === $currentDate) {
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>>
@ -560,9 +577,9 @@
<tfoot> <tfoot>
<tr> <tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;"> Total </td> <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 finalRough"> <b> <?= $summary['finalRough'] ?> </b> </td>
<td class="celda_normal "> <b> <?= $summary['dust'] ?> </b> </td> <td class="celda_normal dust"> <b> <?= $summary['dust'] ?> </b> </td>
<td class="celda_normal "> <b> <?= $summary['total'] ?> </b> </td> <td class="celda_normal total"> <b> <?= $summary['total'] ?> </b> </td>
</tr> </tr>
</tfoot> </tfoot>
@ -589,15 +606,15 @@
} }
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?> ?>
<tr <tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y'); if ($dateInMonth === $currentDate) {
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>
>
<td class="celda_normal"> <td class="celda_normal">
<?php <?php
echo date("d-m-Y", strtotime($dateInMonth)); echo date("d-m-Y", strtotime($dateInMonth));
@ -619,6 +636,18 @@
</tr> </tr>
<?php <?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) { function checkDateRange(fromDate, toDate, tableDate) {
// Convert the dates to a comparable format (YYYY-MM-DD) // Convert the dates to a comparable format (YYYY-MM-DD)
let from = convertToDate(fromDate); let from = convertToDate(fromDate);
@ -703,9 +730,8 @@
var updateDustAndRoughStockDetails = tableToJson(); 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({ $.ajax({
data: { data: {
updateDustAndRoughStockDetails updateDustAndRoughStockDetails
@ -715,10 +741,8 @@
success: function(data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide();
console.log(data); console.log(data);
alert(data); showMessage(data);
window.location.reload();
} }
}, },
@ -730,7 +754,7 @@
console.error("Response Text:", xhr.responseText); console.error("Response Text:", xhr.responseText);
}, },
complete: function() { complete: function() {
$('#loader').hide(); console.log("Ajax Request Completed for dust and Rough Stock Details");
} }
}); });
@ -774,12 +798,26 @@
function finalRoughStockChange(tdElement) { function finalRoughStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let finalRoughStock = validateInput(tdElement.innerText); let finalRoughStock = validateInput(tdElement.innerText);
let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText); let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText);
let total = (Number(finalRoughStock) + Number(dustStock)); let total = (Number(finalRoughStock) + Number(dustStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
let table = document.getElementById('dustAndRoughStockDetailsTableId');
let column = 'finalRough' ;
calculateTotal(table,dataId,column);
} catch (error) { } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
} }
@ -787,12 +825,25 @@
function dustStockChange(tdElement) { function dustStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText); let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText);
let dustStock = validateInput(tdElement.innerText); let dustStock = validateInput(tdElement.innerText);
let total = (Number(finalRoughStock) + Number(dustStock)); let total = (Number(finalRoughStock) + Number(dustStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
let table = document.getElementById('dustAndRoughStockDetailsTableId');
let column = 'dust';
calculateTotal(table,dataId,column);
} catch (error) { } catch (error) {
@ -801,8 +852,6 @@
} }
} }
function validateInput(input) { function validateInput(input) {
@ -818,12 +867,21 @@
// Validate against the regex // Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input); const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) { if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0; return 0;
} }
return input; return input;
} }
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script> </script>
@ -847,45 +905,52 @@
} }
}); });
// Format date in first column and left-align
$(cloneTable).find('tbody tr').each(function() { $(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date) let firstTd = $(this).find('td').eq(0);
let originalDate = firstTd.text().trim();
// Convert Date Format (Assuming it's in YYYY-MM-DD format) let parts = originalDate.split('-');
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
if (parts.length === 3) { if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate); // Update the cell value firstTd.text(formattedDate);
} }
// Apply left alignment to the date column
firstTd.css("text-align", "left"); 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 // Dynamically get maximum column count
let wb = XLSX.utils.book_new(); // Create a new workbook let colCount = 0;
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook $(cloneTable).find('tr').each(function() {
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file 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'; let tableId = 'dustAndRoughStockDetailsTableId';
document.getElementById('dustAndRoughStockExport').addEventListener('click', function() { document.getElementById('dustAndRoughStockExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'dustAndRoughStockDetails.xlsx'); exportTableToExcel(tableId, 'dustAndRoughStockDetails.xlsx');
});
}) });
})
</script> </script>
<script> <script>
document.addEventListener("keydown", function(event) { document.addEventListener("keydown", function(event) {
@ -925,21 +990,26 @@
<script> <script>
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$(document).ready(function() { $(document).ready(function() {
$('#month').datepicker({ $('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025" format: 'M-yyyy',
minViewMode: 1, // Month-Year Picker viewMode: 'months',
minViewMode: 'months',
autoclose: true, autoclose: true,
todayHighlight: true, orientation: 'bottom',
orientation: "auto" // Adjusts automatically, or use "top" / "bottom" startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() { }).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus $(this).datepicker('show'); // Ensure it opens on focus
}); });
$('#month').change(function() {
$('#changeMonthForm').submit();
})
}); });
</script> </script>
@ -1025,3 +1095,53 @@
}); });
}); });
</script> </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 { .card {
margin-bottom: 5px; margin-bottom: 5px;
} }
.hidden-row {
display: none;
}
</style> </style>
<div class="content-page"> <div class="content-page">
<div class="content"> <div class="content">
@ -312,6 +318,20 @@
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <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"> <form id="changeMonthForm" action="<?= base_url('gasStockDetails'); ?>" method="post">
@ -323,9 +343,7 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control " class="form-control "
data-provide="datepicker" readonly>
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
</div> </div>
@ -355,12 +373,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fa fa-save btn-lg mt-2" <i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -472,9 +490,9 @@
<!-- gas stock details stored --> <!-- gas stock details stored -->
<th class="celda_encabezado_general">Consumption </th> <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">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">Panel Consumption</th>
<th class="celda_encabezado_general">Physical Consumption</th> <th class="celda_encabezado_general">Physical Consumption</th>
<th class="celda_encabezado_general">Ton </th> <th class="celda_encabezado_general">Ton </th>
@ -486,21 +504,22 @@
</thead> </thead>
<tbody style="background-color: #fff;"> <tbody style="background-color: #fff;">
<?php if (!empty($gasStockDetails)) { <?php if (!empty($gasStockDetails)) {
foreach ($gasStockDetails as $index => $gasStockDetail) { foreach ($gasStockDetails as $index => $gasStockDetail) {
$currentDate = date('Y-m-d');
$date = Datetime::createFromFormat('Y-m-d', $gasStockDetail['date'])->format('d-m-Y') $date = Datetime::createFromFormat('Y-m-d', $gasStockDetail['date'])->format('d-m-Y');
?> ?>
<!-- implementing date highlighter --> <!-- implementing date highlighter -->
<tr
<tr class="<?=$gasStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
if ($gasStockDetail['date'] === $currentDate) {
$currentDate = date('d-m-Y');
if ($date === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>
>
<!-- td:eq(0) --> <!-- td:eq(0) -->
<td class="celda_normal"><?= $date ?? '-' ?></td> <td class="celda_normal"><?= $date ?? '-' ?></td>
@ -656,20 +675,34 @@
</td> </td>
<td class="celda_normal"><?= $summary['opening'] ?></td> <td class="celda_normal openingStock"
<td class="celda_normal"><?= $summary['purchaseBharath'] ?></td> data-id="footer openingStock"> </td>
<td class="celda_normal"><?= $summary['purchaseIndian'] ?></td> <td class="celda_normal purchaseBharath"
<td class="celda_normal"><?= $summary['total'] ?></td> data-id="footer purchaseBharath" ><?= $summary['purchaseBharath'] == 0 ? "" : $summary['purchaseBharath'] ?></td>
<td class="celda_normal"><?= $summary['consumption'] ?></td> <td class="celda_normal purchaseIndian"
<td class="celda_normal"><?= $summary['total'] - $summary['consumption'] ?></td> data-id="footer purchaseIndian"><?= $summary['purchaseIndian'] == 0 ? "" : $summary['purchaseIndian'] ?></td>
<td class="celda_normal"><?= $summary['drierMachineGasConsumption'] ?></td> <td class="celda_normal total"
<td class="celda_normal"><?= $summary['sandDried'] ?></td> data-id="footer total"><?= $summary['total'] == 0 ? "" : $summary['total'] ?></td>
<td class="celda_normal"><?= $summary['coatingMachineGasconsumption'] ?></td> <td class="celda_normal consumption"
<td class="celda_normal"><?= $summary['coatedSand'] ?></td> data-id="footer consumption"><?= $summary['consumption'] == 0 ? "" : $summary['consumption'] ?></td>
<td class="celda_normal"><?= $summary['trp_panel_gas_consumption'] ?></td> <td class="celda_normal balanceStock"
<td class="celda_normal"><?= $summary['trp_physical_gas_consumption'] ?></td> data-id="footer balanceStock" ><?= $summary['total'] - $summary['consumption'] == 0 ? "" : $summary['total'] - $summary['consumption'] ?></td>
<td class="celda_normal"><?= $summary['trp_sand_production'] ?></td> <td class="celda_normal tenTonGasConsumption"
<td class="celda_normal"><?= $summary['rotary_drier_consumption'] ?></td> 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) { foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = Datetime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y'); $dateInMonthDmYFormat = Datetime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?> ?>
<!-- implementing date highlighter --> <!-- implementing date highlighter -->
<tr <tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) { if ($dateInMonth === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>>
@ -768,8 +801,51 @@
oninput="gasConsumptionChange(this)" oninput="gasConsumptionChange(this)"
contenteditable="true"> </td> contenteditable="true"> </td>
</tr> </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> </tbody>
</table> </table>
</div> </div>
@ -826,9 +902,8 @@
var updateGasStockDetails = tableToJson(); 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({ $.ajax({
data: { data: {
updateGasStockDetails updateGasStockDetails
@ -838,22 +913,19 @@
success: function(data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide(); showMessage(data);
console.log(data);
alert(data);
window.location.reload();
} }
}, },
error: function(xhr, status, error) { 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 Code:", xhr.status);
console.error("Error Message:", error); console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText); console.error("Response Text:", xhr.responseText);
}, },
complete: function() { complete: function() {
$('#loader').hide(); console.log("Request completed.");
} }
}); });
@ -900,6 +972,14 @@
function openingStockChange(tdElement) { function openingStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let date = dataId; let date = dataId;
let openingStock = validateInput(tdElement.innerText); let openingStock = validateInput(tdElement.innerText);
@ -912,7 +992,16 @@
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = totalGas; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = totalGas;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
@ -924,6 +1013,14 @@
function purchaseBharathStockChange(tdElement) { function purchaseBharathStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let date = dataId; let date = dataId;
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText); 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.total[data-id="${dataId}"]`).innerText = totalGas;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
@ -949,6 +1057,14 @@
function purchaseIndianStockChange(tdElement) { function purchaseIndianStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let date = dataId; let date = dataId;
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText); 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.total[data-id="${dataId}"]`).innerText = totalGas;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
@ -974,6 +1102,14 @@
function gasConsumptionChange(tdElement) { function gasConsumptionChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let date = dataId; let date = dataId;
@ -984,8 +1120,11 @@
let trpPhysicalGasConsumption = validateInput(document.querySelector(`td.trpPhysicalGasConsumption[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 rotaryGasConsumption = validateInput(document.querySelector(`td.rotaryGasConsumption[data-id="${dataId}"]`).innerText);
let toatalGasConsumption = Number(tenTonGasConsumption) + Number(coatingGasConsumption) + Number(trpPhysicalGasConsumption) + let toatalGasConsumption = Number(tenTonGasConsumption) + Number(coatingGasConsumption)
Number(trpPanelGasConsumption) + Number(rotaryGasConsumption); + 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 //total gas purchase and opening addition
@ -1001,13 +1140,38 @@
document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText = toatalGasConsumption; document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText = toatalGasConsumption;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
console.error("There is an error updating stock ..!!" + 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>
<script> <script>
@ -1138,7 +1302,6 @@
// Validate against the regex // Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input); const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) { if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0; return 0;
} }
@ -1167,43 +1330,52 @@
} }
}); });
// Format date in first column and left-align
$(cloneTable).find('tbody tr').each(function() { $(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date) let firstTd = $(this).find('td').eq(0);
let originalDate = firstTd.text().trim();
// Convert Date Format (Assuming it's in YYYY-MM-DD format) let parts = originalDate.split('-');
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
if (parts.length === 3) { if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate); // Update the cell value firstTd.text(formattedDate);
} }
// Apply left alignment to the date column
firstTd.css("text-align", "left"); 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 // Dynamically get maximum column count
let wb = XLSX.utils.book_new(); // Create a new workbook let colCount = 0;
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook $(cloneTable).find('tr').each(function() {
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file 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'; let tableId = 'gasStockDetailsTableId';
document.getElementById('gasStockDetailsExport').addEventListener('click', function() { document.getElementById('gasStockDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'gasStockDetails<?= $month ?>.xlsx'); exportTableToExcel(tableId, 'gasStockDetails<?= $month ?>.xlsx');
});
}) });
})
</script> </script>
<script> <script>
document.addEventListener("keydown", function(event) { document.addEventListener("keydown", function(event) {
@ -1246,6 +1418,15 @@
$('#month').change(function() { $('#month').change(function() {
$('#changeMonthForm').submit(); $('#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>
@ -1338,3 +1519,98 @@
</script> </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" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control " class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1"
readonly> readonly>
<input type="hidden" name="remark" id="remark" value="<?php echo $remark ?>"> <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" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fas fa-save btn-lg mt-2" <i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -720,7 +717,7 @@
<span style="min-width: 150px; max-width: 150px;"> <span style="min-width: 150px; max-width: 150px;">
<select class="form-control select2" name="remark" id="remarkInFormId" required> <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="noRemark">No Remark</option>
<option value="accepted">Accepted</option> <option value="accepted">Accepted</option>
<option value="conditionallyAccepted">Conditionally Accepted</option> <option value="conditionallyAccepted">Conditionally Accepted</option>
@ -1448,7 +1445,7 @@
<!-- Save All Data in Incoming Silica Sand Details from table --> <!-- Save All Data in Incoming Silica Sand Details from table -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$('#save').click(function() { $('#saveId').click(function() {
var incomingSilicaSandDetailsData = incomingSilicaSandTableToJson(); var incomingSilicaSandDetailsData = incomingSilicaSandTableToJson();
@ -1550,12 +1547,20 @@
<!-- Calculate Row on oninput inside sand report modal --> <!-- Calculate Row on oninput inside sand report modal -->
<script> <script>
function calculateRow(value) { function calculateRow(tdElement) {
var table = $('#meshTableId'); var table = $('#meshTableId');
if (value != "moistureValue") { if (tdElement != "moistureValue") {
var tr = $(value).closest('tr');
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 weighOfSand = validateInput(tr.find('td:eq(3)').text());
var factor = validateInput(tr.find('td:eq(4)').text()); var factor = validateInput(tr.find('td:eq(4)').text());
tr.find('td:eq(5)').text(parseFloat((weighOfSand * factor).toFixed(2))); tr.find('td:eq(5)').text(parseFloat((weighOfSand * factor).toFixed(2)));
@ -1645,6 +1650,35 @@
return; 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> </script>
@ -1761,7 +1795,6 @@
// Validate against the regex // Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input); const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) { if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0; return 0;
} }
@ -1777,7 +1810,6 @@
function exportTableToExcel(tableID, filename = '') { function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID); 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 // Remove hidden rows
@ -1792,55 +1824,64 @@
} }
}); });
// Format Invoice Date and Material Received Date columns
$(cloneTable).find('tbody tr').each(function() { $(cloneTable).find('tbody tr').each(function() {
let invoiceTd = $(this).find('td').eq(2); // Get the first column (Date) let invoiceTd = $(this).find('td').eq(2);
let materialReceivedTd = $(this).find('td').eq(3); // Get the second column (Material Received) let materialReceivedTd = $(this).find('td').eq(3);
// Convert Date Format (Assuming it's in YYYY-MM-DD format) let originalInvoiceDate = invoiceTd.text().trim();
let originalInvoiceDate = invoiceTd.text().trim(); // Get the text value let originalMaterialReceivedDate = materialReceivedTd.text().trim();
let originalMaterialReceivedDate = materialReceivedTd.text().trim(); // Get the text value
let originalInvoiceParts = originalInvoiceDate.split('-'); // Split into [YYYY, MM, DD] let invoiceParts = originalInvoiceDate.split('-');
let originalMaterialReceivedParts = originalMaterialReceivedDate.split('-'); // Split into [YYYY, MM, DD] let materialReceivedParts = originalMaterialReceivedDate.split('-');
if (originalInvoiceParts.length === 3) { if (invoiceParts.length === 3) {
let formattedDate = `${originalInvoiceParts[2]}-${originalInvoiceParts[1]}-${originalInvoiceParts[0]}`; // Rearrange to DD-MM-YYYY let formattedInvoiceDate = `${invoiceParts[2]}-${invoiceParts[1]}-${invoiceParts[0]}`;
invoiceTd.text(formattedDate); // Update the cell value invoiceTd.text(formattedInvoiceDate);
} }
if (originalMaterialReceivedParts.length === 3) { if (materialReceivedParts.length === 3) {
let formattedDate = `${originalMaterialReceivedParts[2]}-${originalMaterialReceivedParts[1]}-${originalMaterialReceivedParts[0]}`; // Rearrange to DD-MM-YYYY let formattedMaterialDate = `${materialReceivedParts[2]}-${materialReceivedParts[1]}-${materialReceivedParts[0]}`;
materialReceivedTd.text(formattedDate); // Update the cell value materialReceivedTd.text(formattedMaterialDate);
} }
// Apply left alignment to the date column
invoiceTd.css("text-align", "left"); invoiceTd.css("text-align", "left");
materialReceivedTd.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 // Dynamically calculate visible column count for setting column widths
let wb = XLSX.utils.book_new(); // Create a new workbook let colCount = 0;
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook $(cloneTable).find('tr').each(function() {
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file 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'; let tableId = 'incomingSilicaSandDetailsTable';
document.getElementById('incomingSilicaSandDetailsExport').addEventListener('click', function() { document.getElementById('incomingSilicaSandDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'incomingSilicaSandDetails_<?= $month ?>.xlsx'); exportTableToExcel(tableId, 'incomingSilicaSandDetails_<?= $month ?>.xlsx');
});
}) });
})
</script> </script>
<!-- on enter key press allowing user to go next line instead of submitting any form here --> <!-- on enter key press allowing user to go next line instead of submitting any form here -->
<script> <script>
document.addEventListener("keydown", function(event) { document.addEventListener("keydown", function(event) {
@ -1935,6 +1976,15 @@
$('#month').change(function() { $('#month').change(function() {
$('#changeMonthForm').submit(); $('#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

@ -266,6 +266,11 @@
/* Replace with your table's actual ID or selector */ /* Replace with your table's actual ID or selector */
border-collapse: collapse; border-collapse: collapse;
} }
.hidden-row {
display: none;
}
</style> </style>
@ -326,6 +331,20 @@ foreach ($period as $day) {
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <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"> <form id="changeMonthForm" action="<?= base_url('powerConsumptionDetails'); ?>" method="post">
@ -334,6 +353,7 @@ foreach ($period as $day) {
<div class="col-2"> <div class="col-2">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" class="form-control mt-2"
style="z-index:30;" readonly> style="z-index:30;" readonly>
</div> </div>
@ -374,17 +394,17 @@ foreach ($period as $day) {
<i class="fa fa-download btn-lg mt-2" <i class="fa fa-download btn-lg mt-2"
title="Excel Download" title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba" style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="bagStockExport"> id="powerConsumptionExport">
</i> </i>
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fas fa-save btn-lg mt-2" <i class="fas fa-save auditor-restricted-btn btn-lg mt-2"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -590,19 +610,17 @@ foreach ($period as $day) {
foreach ($groupedPowerConsumptionStockDetails as $groupedIndex => $powerStockDetails) { foreach ($groupedPowerConsumptionStockDetails as $groupedIndex => $powerStockDetails) {
$currentDate = date('Y-m-d');
?> ?>
<tr <tr class="<?=$powerStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
if ($powerStockDetails[0]['date'] === $currentDate) {
$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;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>
>
<?php <?php
@ -774,6 +792,7 @@ foreach ($period as $day) {
'opening_units' => "-", 'opening_units' => "-",
'closing_units' => 0, 'closing_units' => 0,
'total_units' => 0, 'total_units' => 0,
'machine_id' => $machineId,
]; ];
} }
@ -797,22 +816,48 @@ foreach ($period as $day) {
<b> Total </b> <b> Total </b>
</td> </td>
<td class="celda_normal "><?= $summary['openingReading'] ?></td> <td class="celda_normal openingTP"
<td class="celda_normal "><?= $summary['finalReading'] ?></td> data-id="footer openingTP">
<td class="celda_normal "><?= $summary['totalReading'] ?></td> </td>
<td class="celda_normal "><?= $summary['totalUnits'] ?></td>
<td class="celda_normal "><?= $summary['averagePf'] ?></td> <td class="celda_normal finalTP"
<td class="celda_normal "><?= $summary['presentPf'] ?></td> data-id="footer finalTP">
<td class="celda_normal "><?= $summary['md'] ?></td> </td>
<td class="celda_normal "><?= $summary['mf'] ?></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) { <?php foreach ($summary as $each) {
if (is_array($each)) { if (is_array($each)) {
?> ?>
<td class="celda_normal "><?= $each['opening_units'] ?> </td> <td class="celda_normal openingUnits"
<td class="celda_normal "><?= $each['closing_units'] ?></td> data-id="footer <?=$each['machine_id']?>"> </td>
<td class="celda_normal "><?= $each['total_units'] ?></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 <?php
} }
@ -827,17 +872,19 @@ foreach ($period as $day) {
<?php } else { ?> <?php } else { ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?> <?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
<tr
$currentDate = date('Y-m-d');
?>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
if ($dateInMonth === $currentDate) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>
>
<?php <?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y'); $startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
@ -968,7 +1015,70 @@ foreach ($period as $day) {
<?php } ?> <?php } ?>
</tr> </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 } ?> <?php } ?>
@ -1077,9 +1187,8 @@ foreach ($period as $day) {
var updatePowerConsumptionDetails = tableToJson(); 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({ $.ajax({
data: { data: {
updatePowerConsumptionDetails updatePowerConsumptionDetails
@ -1089,21 +1198,19 @@ foreach ($period as $day) {
success: function(data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide(); showMessage(data);
alert(data);
window.location.reload();
} }
}, },
error: function(xhr, status, error) { 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 Code:", xhr.status);
console.error("Error Message:", error); console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText); console.error("Response Text:", xhr.responseText);
}, },
complete: function() { complete: function() {
$('#loader').hide(); console.log("Request completed.");
} }
}); });
@ -1176,6 +1283,14 @@ foreach ($period as $day) {
function openingUnitsChange(tdElement) { function openingUnitsChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' '); let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let openingUnits = validateInput(tdElement.innerText); 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); 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) { } catch (error) {
@ -1199,6 +1320,14 @@ foreach ($period as $day) {
function closingUnitsChange(tdElement) { function closingUnitsChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, machine_id] = tdElement.getAttribute('data-id').split(' '); let [date, machine_id] = tdElement.getAttribute('data-id').split(' ');
let openingUnits = validateInput(document.querySelector(`td.openingUnits[data-id="${dataId}"]`).innerText); 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); 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) { } catch (error) {
@ -1224,6 +1359,13 @@ foreach ($period as $day) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let openingTP = validateInput(tdElement.innerText); let openingTP = validateInput(tdElement.innerText);
@ -1239,6 +1381,15 @@ foreach ($period as $day) {
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) { } catch (error) {
@ -1252,6 +1403,13 @@ foreach ($period as $day) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let openingTP = validateInput(document.querySelector(`td.openingTP[data-id="${dataId}"]`).innerText); let openingTP = validateInput(document.querySelector(`td.openingTP[data-id="${dataId}"]`).innerText);
@ -1265,7 +1423,18 @@ foreach ($period as $day) {
document.querySelector(`td.totalUnitsTP[data-id="${dataId}"]`).innerText = parseFloat(totalUnitsTP).toFixed(2); 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) { } catch (error) {
@ -1280,12 +1449,30 @@ foreach ($period as $day) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let mdTP = validateInput(tdElement.innerText); let mdTP = validateInput(tdElement.innerText);
document.querySelector(`td.mfTP[data-id="${dataId}"]`).innerText = parseFloat(mdTP * 60).toFixed(2); 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) { } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
@ -1315,6 +1502,16 @@ foreach ($period as $day) {
return input; return input;
} }
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script> </script>
<script> <script>
@ -1408,9 +1605,8 @@ foreach ($period as $day) {
<script> <script>
$(document).ready(function() { $(document).ready(function() {
function exportTableToExcel(tableID, filename = '') { function exportTableToExcel(tableID, filename = '', dateColumns = []) {
let table = document.getElementById(tableID); 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 // Remove hidden rows
@ -1425,43 +1621,52 @@ foreach ($period as $day) {
} }
}); });
// Format specified date columns
$(cloneTable).find('tbody tr').each(function() { $(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);
// Convert Date Format (Assuming it's in YYYY-MM-DD format) let originalDate = td.text().trim();
let originalDate = firstTd.text().trim(); // Get the text value let parts = originalDate.split('-');
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
if (parts.length === 3) { if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`;
firstTd.text(formattedDate); // Update the cell value td.text(formattedDate);
} }
// Apply left alignment to the date column td.css("text-align", "left");
firstTd.css("text-align", "left"); }.bind(this));
});
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();
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1');
XLSX.writeFile(wb, filename || 'export.xlsx');
}
// Power Stock Table Export
document.getElementById('powerConsumptionExport').addEventListener('click', function() {
exportTableToExcel('powerStockDetailsTableId', 'power_Consumption_details<?= $month ?>.xlsx', [0]);
}); });
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
}
let tableId = 'powerStockDetailsTableId';
document.getElementById('powerConsumptionExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'power_Consumption_details<?= $month ?>.xlsx');
})
})
</script> </script>
<script> <script>
document.addEventListener("keydown", function(event) { document.addEventListener("keydown", function(event) {
@ -1599,8 +1804,10 @@ foreach ($period as $day) {
viewMode: 'months', viewMode: 'months',
minViewMode: 'months', minViewMode: 'months',
autoclose: true, autoclose: true,
orientation: 'bottom' orientation: 'bottom',
}) startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script> </script>
@ -1693,3 +1900,116 @@ foreach ($period as $day) {
}); });
}); });
</script> </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 { .card {
margin-bottom: 5px; margin-bottom: 5px;
} }
.hidden-row {
display: none;
}
</style> </style>
@ -325,6 +332,20 @@ foreach ($period as $day) {
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <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"> <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" <i class="fa fa-download btn-lg mt-2"
title="Excel Download" title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba" style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="bagStockExport"> id="resinStockExport">
</i> </i>
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fas fa-save btn-lg mt-2" <i class="fas fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -580,17 +601,23 @@ foreach ($period as $day) {
foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) { foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) {
$currentDate = date('Y-m-d');
$backgroundColor = " ";
?> ?>
<tr <tr class="<?=$resinStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
if ($resinStockDetails[0]['date'] === $currentDate) {
$currentDate = date('d-m-Y'); $backgroundColor ="background: #cef0ad;";
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $resinStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
} }
?>> ?>
style="<?= $backgroundColor;?> ">
<!-- td -->
<?php foreach ($resinStockDetails as $resinStockIndex => $resinStock) { <?php foreach ($resinStockDetails as $resinStockIndex => $resinStock) {
?> ?>
@ -660,6 +687,7 @@ foreach ($period as $day) {
'receipt' => 0, 'receipt' => 0,
'used' => 0, 'used' => 0,
'balanceStock' => 0, 'balanceStock' => 0,
'materialCode' => $resinStock['materialCode'],
]; ];
} }
@ -686,10 +714,14 @@ foreach ($period as $day) {
<?php foreach ($summary as $each) { ?> <?php foreach ($summary as $each) { ?>
<td class="celda_normal "><?= $each['opening'] ?></td> <td class="celda_normal openingStock"
<td class="celda_normal "><?= $each['receipt'] ?></td> data-id="footer <?=$each['materialCode']?>"></td>
<td class="celda_normal "><?= $each['used'] ?></td> <td class="celda_normal receiptStock"
<td class="celda_normal "><?= $each['balanceStock'] ?></td> 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 } ?> <?php } ?>
@ -702,17 +734,23 @@ foreach ($period as $day) {
<?php } else { ?> <?php } else { ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?> <?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
<tr
$currentDate = date('Y-m-d');
?>
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?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 ;"'; echo 'style="background: #cef0ad ;"';
} }
?>> ?>
>
<?php <?php
// dd($resinMaterials); // dd($resinMaterials);
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?> foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
@ -788,6 +826,31 @@ foreach ($period as $day) {
<?php } ?> <?php } ?>
</tr> </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 } ?> <?php } ?>
@ -901,9 +964,8 @@ foreach ($period as $day) {
var updateResinStockDetails = tableToJson(); 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({ $.ajax({
data: { data: {
updateResinStockDetails updateResinStockDetails
@ -913,10 +975,9 @@ foreach ($period as $day) {
success: function(data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide();
console.log(data); console.log(data);
alert(data); showMessage(data);
window.location.reload();
} }
}, },
@ -928,7 +989,7 @@ foreach ($period as $day) {
console.error("Response Text:", xhr.responseText); console.error("Response Text:", xhr.responseText);
}, },
complete: function() { complete: function() {
$('#loader').hide(); console.log("Ajax request is completed..!!")
} }
}); });
@ -976,6 +1037,14 @@ foreach ($period as $day) {
function openingStockChange(tdElement) { function openingStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' '); let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(tdElement.innerText); let openingStock = validateInput(tdElement.innerText);
@ -984,7 +1053,16 @@ foreach ($period as $day) {
let currentBalanceStock = validateInput((Number(openingStock) + Number(receiptStock)) - Number(usedStock)); let currentBalanceStock = validateInput((Number(openingStock) + Number(receiptStock)) - Number(usedStock));
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
@ -996,6 +1074,12 @@ foreach ($period as $day) {
function receiptStockChange(tdElement) { function receiptStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' '); let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText); 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); let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
@ -1019,6 +1113,14 @@ foreach ($period as $day) {
function usedStockChange(tdElement) { function usedStockChange(tdElement) {
try { try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date, materialCode] = tdElement.getAttribute('data-id').split(' '); let [date, materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = validateInput(document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText); 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); let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; 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) { } catch (error) {
@ -1053,12 +1164,22 @@ foreach ($period as $day) {
// Validate against the regex // Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input); const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) { if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0; return 0;
} }
return input; return input;
} }
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script> </script>
<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 let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
@ -1164,6 +1299,7 @@ foreach ($period as $day) {
let table = activeElement.closest("table"); let table = activeElement.closest("table");
if (table && cell) { if (table && cell) {
event.preventDefault(); // Prevent form submission event.preventDefault(); // Prevent form submission
let columnIndex = cell.cellIndex; // Get the current column index let columnIndex = cell.cellIndex; // Get the current column index
@ -1292,8 +1428,10 @@ foreach ($period as $day) {
viewMode: 'months', viewMode: 'months',
minViewMode: 'months', minViewMode: 'months',
autoclose: true, autoclose: true,
orientation: 'bottom' orientation: 'bottom',
}) startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script> </script>
<script> <script>
@ -1385,3 +1523,69 @@ foreach ($period as $day) {
}); });
}); });
</script> </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 { .card {
margin-bottom: 5px; margin-bottom: 5px;
} }
.hidden-row {
display: none;
}
</style> </style>
@ -319,29 +324,43 @@
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body"> <div class="card-body">
<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>
<form align="center" id="changeMonthForm" action="<?= base_url('trpSandUseStockDetails'); ?>" method="post"> <div>
</div>
<div align="center">
<form style="width: 750px;" id="changeMonthForm" action="<?= base_url('trpSandUseStockDetails'); ?>" method="post">
<div class="row"> <div class="row">
<?php $today = date('M-Y'); ?> <?php $today = date('M-Y'); ?>
<div class="col-3">
</div>
<div class="col-2 mt-2 ml-4"> <div class="col-3 mt-2">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>" <input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control " class="form-control "
data-provide="datepicker" readonly
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly
style="max-width: 175px;"> style="max-width: 175px;">
</div> </div>
<div class="col-3 text-right d-flex" style="justify-content: end;"> <div class="col-9 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..." <input type="text" id="searchInput" placeholder="Search..."
class="mt-2" class="mt-2"
@ -365,12 +384,12 @@
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" 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()"> onclick="toggleDivFullscreen()">
</i> </i>
<i class="fa fa-save btn-lg mt-2" <i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)" style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId"> id="saveId">
@ -380,13 +399,13 @@
</div> </div>
<div class="col-4">
</div> </div>
</div>
</form> </form>
</div>
</div>
<!-- filter modal --> <!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true"> <div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
@ -463,16 +482,13 @@
<!-- end modal section --> <!-- end modal section -->
<div class="table-responsive" id="table-responsive" align="center"> <div class="table-responsive" id="table-responsive" align="center">
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table "> <table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table ">
<thead class="celda_encabezado_general"> <thead class="celda_encabezado_general">
<tr> <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>
<tr> <tr>
@ -495,17 +511,16 @@
$summary = []; $summary = [];
foreach ($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail) { foreach ($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail) {
$currentDate = date('d-m-Y');
?> ?>
<tr <tr class="<?=$trpSandUseStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y'); if($trpSandUseStockDetail['date'] === $currentDate) {
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpSandUseStockDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>
>
<td class="celda_normal"> <td class="celda_normal">
<?php <?php
@ -559,9 +574,9 @@
<b> Total </b> <b> Total </b>
</td> </td>
<td class="celda_normal "><b><?= $summary['rough_kgs'] ?></b></td> <td class="celda_normal rough"><b><?= $summary['rough_kgs'] ?></b></td>
<td class="celda_normal "><b><?= $summary['fine_kgs'] ?></b></td> <td class="celda_normal fine"><b><?= $summary['fine_kgs'] ?></b></td>
<td class="celda_normal "><b><?= $summary['total_kgs'] ?></b></td> <td class="celda_normal total"><b><?= $summary['total_kgs'] ?></b></td>
<td class="celda_normal "> </td> <td class="celda_normal "> </td>
</tr> </tr>
@ -596,12 +611,13 @@
} }
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('Y-m-d');
?> ?>
<tr
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
<?php <?php
$currentDate = date('d-m-Y'); if ($dateInMonth === $currentDate) {
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?>> ?>>
@ -641,7 +657,27 @@
</tr> </tr>
<?php <?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
} }
?> ?>
@ -728,9 +764,8 @@
var updateTrpSandUseStockDetails = tableToJson(); 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({ $.ajax({
data: { data: {
updateTrpSandUseStockDetails updateTrpSandUseStockDetails
@ -740,22 +775,19 @@
success: function(data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide(); showMessage(data);
console.log(data);
alert(data);
window.location.reload();
} }
}, },
error: function(xhr, status, error) { 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 Code:", xhr.status);
console.error("Error Message:", error); console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText); console.error("Response Text:", xhr.responseText);
}, },
complete: function() { complete: function() {
$('#loader').hide(); console.log("Request completed.");
} }
}); });
@ -795,6 +827,14 @@
function roughStockChange(tdElement) { function roughStockChange(tdElement) {
try { 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("just an alert from RoughStockChange..!!")
console.log(tdElement.innerText) console.log(tdElement.innerText)
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
@ -803,6 +843,10 @@
let total = (Number(roughStock) + Number(fineStock)); let total = (Number(roughStock) + Number(fineStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total; 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) { } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
@ -812,14 +856,24 @@
function fineStockChange(tdElement) { function fineStockChange(tdElement) {
try { try {
console.log("just an alert from fineStockChange..!!") let basicCheck =checkIsNumber(tdElement.innerText.trim());
console.log(tdElement.innerText)
if(basicCheck == 0){
alert("Kindly Enter Numbers only..!!");
return ;
}
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText); let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText);
let fineStock = validateInput(tdElement.innerText); let fineStock = validateInput(tdElement.innerText);
let total = (Number(roughStock) + Number(fineStock)); let total = (Number(roughStock) + Number(fineStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total; 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) { } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
@ -851,6 +905,17 @@
return input; return input;
} }
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script> </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 let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
@ -954,22 +1033,29 @@
</script> </script>
<script> <script>
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$(document).ready(function() { $(document).ready(function() {
$('#month').datepicker({ $('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025" format: 'M-yyyy',
minViewMode: 1, // Month-Year Picker viewMode: 'months',
minViewMode: 'months',
autoclose: true, autoclose: true,
todayHighlight: true, orientation: 'bottom',
orientation: "auto" // Adjusts automatically, or use "top" / "bottom" startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() { }).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus $(this).datepicker('show'); // Ensure it opens on focus
}); });
$('#month').change(function() {
$('#changeMonthForm').submit();
})
}); });
</script> </script>
@ -1058,3 +1144,49 @@
}); });
</script> </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" <a style="cursor:pointer;" data-toggle="tooltip"
title="<?= $record->SupplierID ?> - Click here to delete Supplier details" title="<?= $record->SupplierID ?> - Click here to delete Supplier details"
class="auditor-restricted-btn"
onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i onclick="deletesupplier('<?php echo $record->SupplierID; ?>')"><i
class="fa fa-trash" class="fa fa-trash"
style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp; style="color:#02a8b5;"></i>&nbsp;&nbsp;&nbsp;

View File

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

View File

@ -248,7 +248,7 @@
$time = $createddate->format('h:i A'); $time = $createddate->format('h:i A');
?> ?>
<tr id="<?php echo $index ?>" > <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 align="center"><?php echo $time; ?></td>
<td style="cursor:pointer; color:#0bb2b5" > <td style="cursor:pointer; color:#0bb2b5" >
@ -267,7 +267,7 @@
</td> </td>
<td><?php echo $record->SupplierName ?></td> <td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td> <td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php <td align="left" style="padding-left: 0.4%"><?php
$invdate = $record->DeliveryChellanDate; $invdate = $record->DeliveryChellanDate;
if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){ if(!$invdate || $invdate == 'null' || $invdate === '0000-00-00 00:00:00'){
echo ""; echo "";
@ -282,9 +282,13 @@
<td align="right"><?php echo (int)$record->NetWeight ?></td> <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->taxable_value ?></td>
<td align="right"><?php echo (int)$record->gst_amount ?></td> <td align="right"><?php echo number_format((float)$record->gst_amount, 2, '.', ''); ?></td>
<td align="right"><?php echo ((int)$record->taxable_value + (int)$record->gst_amount) ?></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->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td> <td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></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> --> <!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
<?php if(($record->isIgrFilePresent)){ ?> <?php if(($record->isIgrFilePresent)){ ?>
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>"> <a target="_blank" href="<?php echo base_url().'download-files?IGRNO='.$record->IGRNO; ?>">
<i class="fa fa-download" style="text-align: center;"></i> <i class="fa fa-download" style="text-align: center;"></i>
</a> </a>
&nbsp; &nbsp;
@ -497,6 +501,7 @@
<th style="width: 50px;">SNo</th> <th style="width: 50px;">SNo</th>
<th style="width: 100px;">Item Code</th> <th style="width: 100px;">Item Code</th>
<th style="width: 150px;">Item Description</th> <th style="width: 150px;">Item Description</th>
<th style="width: 50px;">HSN/SAC</th>
<th style="width: 50px;">UOM</th> <th style="width: 50px;">UOM</th>
<th style="width: 100px;">Ordered Qty</th> <th style="width: 100px;">Ordered Qty</th>
<th style="width: 100px;">Received Qty</th> <th style="width: 100px;">Received Qty</th>
@ -505,7 +510,7 @@
<th style="width: 50px;">Tax (%)</th> <th style="width: 50px;">Tax (%)</th>
<th style="width: 50px;">Taxable Amt</th> <th style="width: 50px;">Taxable Amt</th>
<th style="width: 50px;">Total 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;">Net Weight</th>
<th style="width: 25px; display:none" id="gasShortageHeader">Add Gas Shortage</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> <th style="width: 25px; display:none" id="gasShortageListHeader">Gas Shortage list</th>
@ -561,7 +566,7 @@
<div class="modal-footer"> <div class="modal-footer">
<div class="buttonContainer"> <div class="buttonContainer">
<a class="btn btn-secondary" data-dismiss="modal" value="Close">Close</a> <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> <a class="btn btn-primary" id="draftIGR" value="draftIGR">Save as Draft IGR</a>
</div> </div>
</div> </div>
@ -629,7 +634,7 @@
?> ?>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); "> <input type="file" name="WeightFile" id="WeightFile" onchange="filenames(this.name); "><br>
<label id="WeightFileLabel" style="display:none;"> <label id="WeightFileLabel" style="display:none;">
<a><span></span><small></small></a> <a><span></span><small></small></a>
@ -1253,15 +1258,16 @@
'<td style="width: 50px;" >' + i + '</td>' + '<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</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: 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: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</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;" 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: 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="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</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="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</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" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="'+item.Remarks+'"> </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>' + '<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="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' + '<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: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</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: 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: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>'; '<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>';
if (userRole == 5) { // 5 - lab staff if (userRole == 5) { // 5 - lab staff
@ -1317,13 +1324,13 @@
trIGRHTML += '<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' + 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="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</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="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>'; '<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>' ;
if (userRole == 5) { if (userRole == 5) {
trIGRHTML += '<td style="width: 100px;">' + item.Remarks + '</td>'; trIGRHTML += '<td style="width: 100px;">' + item.Remarks + '</td>';
} else { } else {
trIGRHTML += '<td style="width: 100px;">' + 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 + '">' + 'onchange="SetRemarks(' + i + ')" style="width: 75px;" value="' + item.Remarks + '">' +
'</td>'; '</td>';
} }
@ -1367,6 +1374,7 @@
'<td style="width: 50px;" >' + i + '</td>' + '<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</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: 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: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" name="Quantity">' + item.Quantity + '</td>' ; '<td style="width: 100px;" name="Quantity">' + item.Quantity + '</td>' ;
if (userRole == 5) { // 5 - lab staff if (userRole == 5) { // 5 - lab staff
@ -1376,13 +1384,13 @@
} }
trIGRHTML += '<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' + 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="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' + '<td style="width: 50px;" id="amount' + i + '">' + Number(amount).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>'; '<td style="width: 50px;" id="grand_total_amount' + i + '">' + Number(grand_total_amount).toFixed(2) + '</td>';
if (userRole == 5) { if (userRole == 5) {
trIGRHTML += '<td style="width: 100px;"> ' + item.Remarks + ' </td>'; trIGRHTML += '<td style="width: 100px;"> ' + item.Remarks + ' </td>';
} else { } else {
trIGRHTML += '<td style="width: 100px;">' + 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 + '">' + 'onchange="SetRemarks(' + i + ')" style="width: 75px;" value="' + item.Remarks + '">' +
'</td>'; '</td>';
} }
@ -1716,15 +1724,16 @@
// let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2'); // let fieldName = str.replace(/([a-z])([A-Z])/g, '$1 $2');
let sentence = " "; let sentence = " ";
if (parseInt(record.is_add) === 1) { 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") { if (record.field === "IGRStatus") {
str1 = record.new_data; str1 = record.new_data;
str2 = str1.replace(/\bIGR\b/i, '').trim(); str2 = str1.replace(/\bIGR\b/i, '').trim();
str2 = str2 == "CREATED" ? "GENERATED" : str2;
sentence += record.IGR_No + " was <b> ` " + str2 + " ` </b> by " + record.FullName + sentence += record.IGR_No + " was <b> ` " + str2 + " ` </b> by " + record.FullName +
" on " + record.indian_date + " at " + record.indian_time; " on " + record.indian_date + " at " + record.indian_time;
} else { } 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; " on " + record.indian_date + " at " + record.indian_time;
} }
} else if (parseInt(record.is_edit) === 1) { } else if (parseInt(record.is_edit) === 1) {
@ -1735,7 +1744,9 @@
let displayNewData = record.new_data === null || record.new_data === "" ? " " : record.new_data; let displayNewData = record.new_data === null || record.new_data === "" ? " " : record.new_data;
if (record.field === "IGRStatus") { if (record.field === "IGRStatus") {
displayOldData = displayOldData.replace(/\bIGR\b/i, '').trim(); displayOldData = displayOldData.replace(/\bIGR\b/i, '').trim();
displayOldData = displayOldData == "CREATED" ? "GENERATED" : displayOldData;
displayNewData = displayNewData.replace(/\bIGR\b/i, '').trim(); displayNewData = displayNewData.replace(/\bIGR\b/i, '').trim();
displayNewData = displayNewData == "CREATED" ? "GENERATED" : displayNewData;
} }
if(displayNewData || displayOldData ){ 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; 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() { $(document).ready(function() {
$("#WeightCalculator").on("shown.bs.modal", function(e) { $("#WeightCalculator").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index'); var inx = $(e.relatedTarget).data('index');
console.log(inx);
var material = $(e.relatedTarget).data('material'); var material = $(e.relatedTarget).data('material');
// console.log(material);// toolbox
var modal = $(this); var modal = $(this);
@ -1843,7 +1854,6 @@
modal.find('#WeightFileLabel a small').text(fileName); modal.find('#WeightFileLabel a small').text(fileName);
modal.find('#WeightFileLabel').show(); modal.find('#WeightFileLabel').show();
} }
console.log(fileInput);
console.log("Selected values for index:", typeof inx, inx); console.log("Selected values for index:", typeof inx, inx);
// Set modal inputs with the retrieved values // Set modal inputs with the retrieved values
@ -1854,7 +1864,6 @@
$("#NetWeight").val(v5); $("#NetWeight").val(v5);
$("#CurrentInx").val(inx); $("#CurrentInx").val(inx);
fileName
if (fileInput && fileInput.files.length > 0) { if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#WeightFile")[0]; var targetInput = $("#WeightFile")[0];
var file = fileInput.files[0]; var file = fileInput.files[0];
@ -1880,20 +1889,11 @@
var v5 = $("#NetWeight").val(); var v5 = $("#NetWeight").val();
var inx = $("#CurrentInx").val(); var inx = $("#CurrentInx").val();
var IGRNO1 = $("#IGRNO1").val(); var IGRNO1 = $("#IGRNO1").val();
var fileInput = $("#WeightFile")[0]; // Get the file input element var fileInput = $("#WeightFile")[0];
if (inx !== undefined && inx !== '') { if (inx !== undefined && inx !== '') {
console.log("Saving values for index:", inx);
// Set the values back to the hidden inputs
$("#txtGrossWeight" + inx).val(v1);
$("#txtGrossWeightDate" + inx).val(v2);
$("#txtTareWeight" + inx).val(v3);
$("#txtTareWeightDate" + inx).val(v4);
$("#txtNetWeight" + inx).val(v5);
var txtIGRLineItem = $("#txtIGRLineItem" + inx).val(); var txtIGRLineItem = $("#txtIGRLineItem" + inx).val();
// Prepare FormData
var formData = new FormData(); var formData = new FormData();
formData.append('GrossWeight', v1); formData.append('GrossWeight', v1);
formData.append('GrossWeightDate', v2); formData.append('GrossWeightDate', v2);
@ -1902,54 +1902,32 @@
formData.append('NetWeight', v5); formData.append('NetWeight', v5);
formData.append('IGR', IGRNO1); formData.append('IGR', IGRNO1);
formData.append('IGRlineitem', txtIGRLineItem); formData.append('IGRlineitem', txtIGRLineItem);
if (fileInput && fileInput.files.length > 0) { if (fileInput && fileInput.files.length > 0) {
var file = fileInput.files[0]; var file = fileInput.files[0];
formData.append('WeightFile', file); formData.append('WeightFile', file);
console.log("File selected:", file.name);
} else { } else {
console.log("No file selected or file input not found."); console.log("No file selected.");
} }
// if (fileInput && fileInput.files.length > 0) {
// var targetInput = $("#txtWeightFile" + inx)[0];
// var file = fileInput.files[0];
// // Create a new DataTransfer object
// var dataTransfer = new DataTransfer();
// dataTransfer.items.add(file);
// // Set the file to the target input
// targetInput.files = dataTransfer.files;
// formData.append('WeightFile', file);
// } else {
// console.log("No file selected or file input not found.");
// }
$.ajax({ $.ajax({
url: "<?php echo base_url() ?>updateIGRWeight", url: "<?php echo base_url('updateIGRWeight'); ?>",
type: "POST", type: "POST",
data: formData, data: formData,
contentType: false, // Don't set content type header contentType: false,
processData: false, processData: false,
success: function(data) { success: function(data) {
if (data) {
alert(data); alert(data);
} $("#WeightCalculator").modal('hide');
},
error: function(xhr, status, error) {
console.log("Upload error:", error);
} }
}); });
// Clear modal inputs }
$("#GrossWeight").val(''); }
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
$("#WeightFile").val('');
// Close the modal
$("#WeightCalculator").modal('hide');
} else {
console.log("Saving values for index: " + inx + " undefined");
}
}
</script> </script>
<script> <script>
function formatDateTime(dateString, flag) { function formatDateTime(dateString, flag) {
@ -2900,4 +2878,3 @@ $("#gasShortageCalculator, #editGasShortageCalculator").submit(function (event)
</script> </script>