stock changes 17-04-2025

This commit is contained in:
vadivelJ96 2025-04-17 17:25:16 +05:30
commit 342bcbbbaa
45 changed files with 2071 additions and 695 deletions

View File

@ -203,6 +203,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 +251,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 +326,7 @@ $routes->post('getCostCenterData', 'Inwardgateregister::getCostCenterData');
$routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile'); $routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
$routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile'); $routes->post('getAdditionalIGRFile', 'Inwardgateregister::getAdditionalIGRFile');
$routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile'); $routes->post('deleteAdditionalIGRFile', 'Inwardgateregister::deleteAdditionalIGRFile');
$routes->get( 'download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZip/$1'); $routes->get( 'download-files', 'Inwardgateregister::downloadFilesAsZip');
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile'); $routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
$routes->post('getIGRRemarks', 'Inwardgateregister::getIGRRemarks'); $routes->post('getIGRRemarks', 'Inwardgateregister::getIGRRemarks');
$routes->post('saveIGRRemarks', 'Inwardgateregister::saveIGRRemarks'); $routes->post('saveIGRRemarks', 'Inwardgateregister::saveIGRRemarks');

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

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

View File

@ -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.']; // $data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
}else{ // }else{
$data = ['status' => true, 'message' => 'There is no changes in Leave Applicationform details.']; // $data = ['status' => true, 'message' => 'There is no changes in Leave Applicationform details.'];
} // }
$data = ['status' => true, 'message' => 'Leave Applicationform details updated successfully.'];
} }
@ -1041,6 +1042,26 @@ class Monthlypay extends BaseController
} }
public function leaveStatus($leave_application_id, $status)
{
if (!empty($leave_application_id)) {
$data = [
'status' => $status,
'updated_by' => session()->get('userId')
];
$affectedRows = $this->monthlypay_model->saveleaveApplicationForm($data, $leave_application_id);
$message = ($affectedRows > 0)
? "Leave Application updated successfully."
: "No changes were made.";
return $this->response->setJSON(['status' => true, 'message' => $message]);
} else {
return $this->response->setJSON(['status' => false, 'message' => 'Invalid leave application ID.']);
}
}
public function leaveApplicationPDF($leave_application_id){ 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

@ -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);
@ -163,7 +152,7 @@ class Requisitionform extends BaseController
} }
$this->requistion_model->DeleteRequistionLineItem($ReqNo, $MaterialCode); $this->requistion_model->DeleteRequistionLineItem($ReqNo, $MaterialCode);
return $this->response->setJSON("Successfully Deleted the Line item" . $ReqNo); return $this->response->setJSON("Successfully Deleted the Line item " . $ReqNo);
} }
/** /**
@ -215,49 +204,6 @@ class Requisitionform extends BaseController
$this->loadViews("requisitionlistapproval", $this->global, $data, NULL); $this->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;
} else { // $display_message = "Requistion Saved as Draft!\nRequistion Number Is: ". $ReqNumber;
$display_message = 'Successfully Created the Requistion details.Requistion No is ' . $ReqNumber; } else if($Status == REQ_APPROVED) {
$display_message = "Successfully Updated the Requistion details as Approved!\nRequistion Number Is: ". $ReqNumber;
// $display_message = "Requistion Created Successfully!\nRequistion Number Is: ". $ReqNumber;
}else{
$display_message = "Successfully Created the Requistion details!\nRequistion Number Is: ". $ReqNumber;
} }
return $this->response->setJSON([$display_message]); 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]);
} }
} }

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

@ -337,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');
@ -221,7 +226,8 @@ class Driver_model extends Model
->where('DATE_FORMAT(`t_driver_attendance`.`date`, "%Y-%m")',$monthyear) ->where('DATE_FORMAT(`t_driver_attendance`.`date`, "%Y-%m")',$monthyear)
->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

@ -264,7 +264,8 @@ class Employeedetails_model extends Model
->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', ' ed.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'); ->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

@ -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,

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

@ -861,7 +861,7 @@ if (!empty($getlogpodtl)) {
$('#EditAfterServiceTax').val(''); $('#EditAfterServiceTax').val('');
$('#EditAfterKrishiTax').val(''); $('#EditAfterKrishiTax').val('');
$('#EditAfterSwachhTax').val(''); $('#EditAfterSwachhTax').val('');
$('#EditTotalOrderValue ').val(''); $('#EditTotalOrderValue').val('');
$('#EditRate').val(''); $('#EditRate').val('');
$("#EditItemName").val(''); $("#EditItemName").val('');
@ -1274,6 +1274,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 +1310,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="#"
@ -2547,7 +2549,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 +2585,7 @@ if (!empty($getlogpodtl)) {
$('#EditotherDescription').hide(); $('#EditotherDescription').hide();
$('#otherdescription').hide() $('#otherdescription').hide();
@ -2597,6 +2599,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 +2676,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>
@ -2781,8 +2792,13 @@ if (!empty($getlogpodtl)) {
var FrequencyValue = $("#EditFrequencyNo").val(); var FrequencyValue = $("#EditFrequencyNo").val();
var ServiceDescription = $('#EdittxtSpcialInstruction').val(); var ServiceDescription = $('#EdittxtSpcialInstruction').val();
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 +2811,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 +3135,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 +3373,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 +3435,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 +3487,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 +3533,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 +3563,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 +3571,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 +3613,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 +3652,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 +3679,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

@ -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>
@ -804,6 +805,7 @@
'<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>' +
@ -843,6 +845,7 @@
'<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>' +
@ -878,6 +881,7 @@
'<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>' +

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,31 +2943,44 @@ 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;
<thead> -ms-overflow-style: none; /* IE/Edge */
<tr> scrollbar-width: none; /* Firefox */
<th style="white-space: nowrap !important;">SNo</th> ">
<th style="white-space: nowrap !important; text-align:center !important">Requisition No</th> <table id="serviceTax" class="table table-bordered table-hover mb-0"
<th style="white-space: nowrap !important;">Item Code</th> style="background-color:#fff; font-size:12px;">
<th style="white-space: nowrap !important;">Item Description</th> <thead>
<th style="white-space: nowrap !important;">Line Item Specs</th> <tr>
<th style="white-space: nowrap !important;" class="text-right">Quantity</th> <th style="white-space: nowrap !important;">SNo</th>
<th style="white-space: nowrap !important;">UOM</th> <th style="white-space: nowrap !important; text-align:center !important">Requisition No</th>
<th style="white-space: nowrap !important;" class="text-right">Rate<?php echo "($INRSYM)" ?></th> <th style="white-space: nowrap !important;">Item Code</th>
<th style="white-space: nowrap !important;" class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th> <th style="white-space: nowrap !important;">Item Description</th>
<th style="white-space: nowrap !important;" class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th> <th style="white-space: nowrap !important; text-align:center !important">HSN/SAC</th>
<th style="white-space: nowrap !important;" class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th> <th style="white-space: nowrap !important;">Line Item Specs</th>
<th>Action</th> <th style="white-space: nowrap !important;" class="text-right">Quantity</th>
</tr> <th style="white-space: nowrap !important;">UOM</th>
</thead> <th style="white-space: nowrap !important;" class="text-right">Rate<?php echo "($INRSYM)" ?></th>
<tbody id="ServiceAppend"></tbody> <th style="white-space: nowrap !important;" class="text-right">Basic Amount<?php echo "($INRSYM)" ?></th>
<tbody id="RevenueAppend"></tbody> <th style="white-space: nowrap !important;" class="text-right">Tax Amount<?php echo "($INRSYM)" ?></th>
</table> <th style="white-space: nowrap !important;" class="text-right">Total Order Amount<?php echo "($INRSYM)" ?></th>
<th>Action</th>
</tr>
</thead>
<tbody id="ServiceAppend"></tbody>
<tbody id="RevenueAppend"></tbody>
</table>
</div>
</div> </div>
</table>
<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>
@ -6240,7 +6263,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 +6771,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 +6833,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>
@ -7007,14 +7037,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 +7056,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 +7068,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 +7163,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 +7310,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 +7716,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 +7750,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 +7779,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 +7858,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

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

@ -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 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 new_my = param_month_year ? param_month_year : "<?php echo date('M-Y'); ?>";
let monthMap = {"Jan": "01", "Feb": "02", "Mar": "03", "Apr": "04", "May": "05", "Jun": "06", "Jul": "07", "Aug": "08", "Sep": "09", "Oct": "10", "Nov": "11", "Dec": "12"};
let [month, year] = new_my.split('-');
input_date = `01-${monthMap[month]}-${year}`; 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,65 +19,88 @@
</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>
</tr> <td style="width: 1%; border: none; white-space: nowrap;">:</td>
<tr> <td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->EmpID ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Designation </td> </tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" > <?php echo ':&nbsp;'.$PayDetails[0]->Designation ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Department </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]->DeptName ?></td> <td style="width: 1%; border: none; white-space: nowrap;">:</td>
</tr> <td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->Designation ?></td>
<tr> <td style="width: 2%; border: none;"></td>
<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;">Department</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 $PayDetails[0]->DeptName ?></td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">No Of Loads </td> </tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->no_of_loads ?></td>
</tr> <tr>
<tr> <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;">Bank Name </td> <td style="width: 1%; border: none; white-space: nowrap;">:</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: 34%; border: none; white-space: nowrap;"><?php echo date('d-m-Y', strtotime($PayDetails[0]->DOJ)) ?></td>
<td><?= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' ?></td> <td style="width: 2%; border: none;"></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: 14%; border: none; white-space: nowrap;">No Of Loads</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: 1%; border: none; white-space: nowrap;">:</td>
</tr> <td style="width: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->no_of_load ?></td>
<tr> </tr>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank Acc No </td>
<td width="100px;" style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> <?php echo ':&nbsp;'.$PayDetails[0]->BankAccountNumber ?></td> <tr>
<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: 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;"> Aadhar Number</td> <td style="width: 1%; border: none; white-space: nowrap;">:</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: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->BankName ?></td>
</tr> <td style="width: 2%; border: none;"></td>
<tr> <td style="width: 14%; border: none; white-space: nowrap;">PAN Number</td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Bank IFSC </td> <td style="width: 1%; border: none; white-space: nowrap;">:</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: 34%; border: none; white-space: nowrap;"><?php echo $PayDetails[0]->Pan; ?></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> </tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Loan Balance </td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->BalanceAdvance ?></td> <tr>
</tr> <td style="width: 14%; border: none; white-space: nowrap;">Bank Acc No</td>
<tr> <td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> </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;"><?php echo '&nbsp;' ?></td> <td style="width: 2%; 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: 14%; border: none; white-space: nowrap;">Aadhar Number</td>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;">Diesel </td> <td style="width: 1%; border: none; white-space: nowrap;">:</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: 34%; border: none; white-space: nowrap;"><?php echo str_replace(' ', '', $PayDetails[0]->AadharNo); ?></td>
</tr> </tr>
<tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"> </td> <tr>
<td style="border-left: 0px ;border-bottom: 0px; border-right: 0px ;border-top: 0px ; white-space: nowrap;"><?php echo '&nbsp;'; ?></td> <td style="width: 14%; border: none; white-space: nowrap;">Bank IFSC</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: 1%; border: none; white-space: nowrap;">:</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: 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;" ><?php echo ':&nbsp;Rs&nbsp;'.$PayDetails[0]->shed_amount; ?></td> <td style="width: 2%; border: none;"></td>
</tr> <td style="width: 14%; border: none; white-space: nowrap;">Loan Balance</td>
</tbody> <td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;">&#8377;<?php echo '&nbsp;' . $PayDetails[0]->BalanceAdvance ?></td>
</tr>
<tr>
<td style="width: 14%; border: none;"></td>
<td style="width: 1%; border: none;"></td>
<td style="width: 34%; border: none;"></td>
<td style="width: 2%; border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Diesel Amount</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;">&#8377;<?php echo '&nbsp;' . $PayDetails[0]->diesel_amount; ?></td>
</tr>
<tr>
<td style="width: 14%; border: none;"></td>
<td style="width: 1%; border: none;"></td>
<td style="width: 34%; border: none;"></td>
<td style="width: 2%;border: none;"></td>
<td style="width: 14%; border: none; white-space: nowrap;">Shed Duty Amount</td>
<td style="width: 1%; border: none; white-space: nowrap;">:</td>
<td style="width: 34%; border: none; white-space: nowrap;">&#8377;<?php echo '&nbsp;' . $PayDetails[0]->shed_amount; ?></td>
</tr>
</tbody>
</table> </table>
</td> </td>
</tr> </tr>
@ -85,7 +108,7 @@
<table style="border-collapse: collapse;border-top:#fff;" cellpadding="0" cellspacing="0" border="1" width="100%" > <table style="border-collapse: collapse;border-top:#fff;" cellpadding="0" cellspacing="0" border="1" width="100%" >
<tr><th>Earnings</th><th>Amount <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></th><th>Deductions</th><th>Amount <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></th></tr> <tr><th>Earnings</th><th>Amount <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></th><th>Deductions</th><th>Amount <span style="font-family: DejaVu Sans; sans-serif;">&#8377;</span></th></tr>
<tr> <tr>
<td width="25%;">&nbsp;BASIC</td> <td width="25%;">&nbsp;BASIC</td>
<td width="20%;" style="text-align: right;" ><?php echo $PayDetails[0]->BASIC; ?>&nbsp;</td> <td width="20%;" style="text-align: right;" ><?php echo $PayDetails[0]->BASIC; ?>&nbsp;</td>
<td width="25%;">&nbsp;PF</td> <td width="25%;">&nbsp;PF</td>
<td width="30%;" style="text-align: right;" ><?php echo $pf_amount; ?>&nbsp;</td> <td width="30%;" style="text-align: right;" ><?php echo $pf_amount; ?>&nbsp;</td>

View File

@ -888,6 +888,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 +914,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"
@ -2681,8 +2683,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 +3348,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 +3436,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 +4069,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

@ -943,6 +943,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 +977,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="#"
@ -4061,8 +4063,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 +4804,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 +4952,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 +5477,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 +5845,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 +5897,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 +5964,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 +6577,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 +6623,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 +6640,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 +6734,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

@ -1279,6 +1279,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 +1305,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"
@ -1998,8 +2000,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 +2680,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 +2735,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 +2817,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

@ -1316,6 +1316,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 +1342,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"
@ -2351,9 +2353,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 +2366,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 +2375,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 +2403,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 +2428,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 +2441,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 +2500,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 +2883,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

@ -379,7 +379,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');
@ -2375,6 +2375,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 +2410,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="#"
@ -4465,6 +4467,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 +4554,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>
@ -4669,21 +4680,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 +4770,7 @@ if (!empty($getlogpodtl)) {
var cellval = tr.cells; var cellval = tr.cells;
cellval[9].innerHTML = TotalOrderValue; cellval[10].innerHTML = TotalOrderValue;
@ -5371,8 +5385,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 +5528,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 +5562,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 +5596,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 +5639,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

@ -390,7 +390,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 +443,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 +1119,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 +1160,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"
@ -1880,7 +1884,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 +1914,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 +1941,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 +1951,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 +1987,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 +2041,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

@ -372,8 +372,9 @@ 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">
@ -587,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>
@ -609,7 +610,7 @@ 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; width:10%; style="cursor: pointer; color: #02a8b5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" onmouseover="this.style.color='#016269'; width:10%;
text-align:center;"> text-align:center;">
<u>${item.MaterialCode}</u> <u>${item.MaterialCode}</u>
</td> </td>
@ -621,8 +622,12 @@ if (!empty($master)) {
<td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:10%; <td style="text-align:left; overflow: hidden;text-overflow: ellipsis;white-space: nowrap;width:10%;
text-align:center;">${item.IsActive == 1 ?"Active":"InActive"}</td> text-align:center;">${item.IsActive == 1 ?"Active":"InActive"}</td>
<td style="text-align: center; white-space: normal;">${item.MaterialName}</td>
<td style="text-align: left; white-space: nowrap;">${item.MaterialType}</td>
<td style="text-align: left; white-space: nowrap;">${item.IsActive == 1 ? "Active" : "InActive"}</td>
</tr> </tr>
`; `;
// <td>${item.HSNCODE}</td>
}); });
tableHtml += ` tableHtml += `

View File

@ -853,6 +853,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 +883,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="#"
@ -3365,8 +3367,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 +4244,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 +4334,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 +4461,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 +4547,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 +4572,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 +4818,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 +4917,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 +4951,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 +4971,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 +5040,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() {
@ -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,6 +244,7 @@ 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>
@ -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);
?> ?>
@ -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

@ -89,7 +89,7 @@
<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,24 @@
<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><?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">Draft</option>
<option value="Approved">Approve</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;
@ -258,8 +275,8 @@
$('.tooltip-trigger').tooltip(); $('.tooltip-trigger').tooltip();
$(".searchabledropdown").select2(); $(".searchabledropdown").select2();
let today = new Date().toISOString().split("T")[0]; // Format: YYYY-MM-DD let today = new Date().toISOString().split("T")[0]; // Format: YYYY-MM-DD
$("#start_date").attr("min", today); // $("#start_date").attr("min", today);
$("#end_date").attr("min", today); // $("#end_date").attr("min", today);
$('#start_date').change(function() { $('#start_date').change(function() {
let start = new Date($('#start_date').val()); let start = new Date($('#start_date').val());
let formattedStart = start.toISOString().split('T')[0]; // Convert to YYYY-MM-DD format let formattedStart = start.toISOString().split('T')[0]; // Convert to YYYY-MM-DD format
@ -555,3 +572,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

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

@ -160,6 +160,7 @@
<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>
@ -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,10 +413,10 @@
$('#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 ")
return false; return false;
} else { } else {
return true; return true;
@ -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>' +
@ -898,6 +932,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

@ -203,6 +203,12 @@
border: 1px solid #ccc;border-radius: 5px;margin-right:15px;"> 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;cursor:pointer;" 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>
@ -561,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>
@ -614,7 +620,7 @@
</td> </td>
<td id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);" <td class="monthDue" id="monthDue<?php echo $inx ?>" onkeypress="return isNumber(event);" onkeyup="driverchangeInput(event);"
<?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?> <?php if (empty($record->payroll_id)) { echo "contenteditable='true';"; } ?>
<?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated" <?php if (!empty($record->payroll_id)) { ?> title="Payslip Calculated"
style="text-align:right;color:blue;" style="text-align:right;color:blue;"
@ -634,7 +640,7 @@
<?php echo number_format(0.00, 2, '.', ''); ?> <?php echo number_format(0.00, 2, '.', ''); ?>
</td> </td>
<!-- <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?> --> <?php $totalotherDet[] = isset($Other_Deductions) ? $Other_Deductions : []; ?>
<td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);" <td id="Festival<?php echo $inx ?>" onkeypress="return isNumber(event);"
onkeyup="driverchangeInput(event);" onkeyup="driverchangeInput(event);"
@ -937,6 +943,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() {
@ -1233,7 +1265,7 @@ $(document).ready(function () {
var driverMonthSalary = driverSalaryAdd - driverSalarySub var driverMonthSalary = driverSalaryAdd - driverSalarySub
var driverSalary = Math.round(driverMonthSalary); var driverSalary = Math.round(driverMonthSalary);
console.log("Sal ",driverSalary); console.log("Driver Sal ",driverSalary);
var cals = (driverSalary).toFixed(0); var cals = (driverSalary).toFixed(0);
@ -1241,7 +1273,8 @@ $(document).ready(function () {
document.getElementById("empsal" + sno).innerHTML = cals; document.getElementById("empsal" + sno).innerHTML = cals;
// copied from calculategrandtotal() because we need those two only thats why // copied from calculategrandtotal() because we need those two only thats why
var AutoLoanDueIndex = 22; const td = document.querySelector('.monthDue');
var AutoLoanDueIndex = td ? td.cellIndex : -1;
var AutoLoanDue = 0; var AutoLoanDue = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(AutoLoanDueIndex).text(); var value = $(this).find('td').eq(AutoLoanDueIndex).text();
@ -1249,27 +1282,32 @@ $(document).ready(function () {
}); });
$('#monthloan').text(AutoLoanDue); $('#monthloan').text(AutoLoanDue);
var FestivalBonusIndex = 24; console.log("AutoLoanDue ",AutoLoanDue);
var FestivalBonusIndex = 23;
var FestivalBonus = 0; var FestivalBonus = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(FestivalBonusIndex).text(); var value = $(this).find('td').eq(FestivalBonusIndex).text();
FestivalBonus += parseFloat(value) || 0; FestivalBonus += parseFloat(value) || 0;
}); });
$('#fest').text(FestivalBonus); $('#fest').text(FestivalBonus);
console.log("FestivalBonus ",FestivalBonus);
var EstimateIndex = 25; var EstimateIndex = 24;
var Estimate = 0; var Estimate = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(EstimateIndex).text(); var value = $(this).find('td').eq(EstimateIndex).text();
Estimate += parseFloat(value) || 0; Estimate += parseFloat(value) || 0;
}); });
$('#estsal').text(Estimate); $('#estsal').text(Estimate);
console.log("Estimate ",Estimate);
} }
function calculategrandtotal() function calculategrandtotal()
{ {
var AutoLoanDueIndex = 22; const td = document.querySelector('.monthDue');
var AutoLoanDueIndex = td ? td.cellIndex : -1;
var AutoLoanDue = 0; var AutoLoanDue = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(AutoLoanDueIndex).text(); var value = $(this).find('td').eq(AutoLoanDueIndex).text();
@ -1277,7 +1315,7 @@ $(document).ready(function () {
}); });
$('#monthloan').text(AutoLoanDue); $('#monthloan').text(AutoLoanDue);
var TDSDeductionsIndex = 23; var TDSDeductionsIndex = 22;
var TDSDeductions = 0; var TDSDeductions = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(TDSDeductionsIndex).text(); var value = $(this).find('td').eq(TDSDeductionsIndex).text();
@ -1285,7 +1323,7 @@ $(document).ready(function () {
}); });
$('#other').text(TDSDeductions); $('#other').text(TDSDeductions);
var FestivalBonusIndex = 24; var FestivalBonusIndex = 23;
var FestivalBonus = 0; var FestivalBonus = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(FestivalBonusIndex).text(); var value = $(this).find('td').eq(FestivalBonusIndex).text();
@ -1293,7 +1331,7 @@ $(document).ready(function () {
}); });
$('#fest').text(FestivalBonus); $('#fest').text(FestivalBonus);
var EstimateIndex = 25; var EstimateIndex = 24;
var Estimate = 0; var Estimate = 0;
$('#monthlylistings tbody tr').each(function() { $('#monthlylistings tbody tr').each(function() {
var value = $(this).find('td').eq(EstimateIndex).text(); var value = $(this).find('td').eq(EstimateIndex).text();
@ -1306,11 +1344,10 @@ $(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"];
var parts = monthYear.split('-'); var parts = monthYear.split('-');
var monthIndex = parseInt(parts[0], 10) - 1; // Convert "03" to index 2 (March) var monthIndex = parseInt(parts[0], 10) - 1; // Convert "03" to index 2 (March)
var formattedMonthYear = monthNames[monthIndex] + '-' + parts[1]; var formattedMonthYear = monthNames[monthIndex] + '-' + parts[1];

View File

@ -94,61 +94,100 @@
</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 = `
$('#hname').val(''); <tr id="${index}" data-is-new="true">
$('#hdate').val(''); <td contenteditable='true' style="text-align:left;">${H_name}</td>
<td contenteditable='false' style="text-align:left;">${H_date}</td>
<td style="text-align:center;">
<a href='#' onclick="DeleteRow(${index})" id="Del"><span class="fas fa-trash"></span></a>
</td>
</tr>`;
$('#db').append(template);
// Clear inputs
$('#hname').val('');
$('#hdate').val('');
// Re-initialize DataTable if needed
$('#phdays').DataTable();
} }
}); });
$('#submit').click(function() { $('#submit').click(function() {
var jsondata = $('#phdays').tableToJSON(); var jsondata = $('#phdays').tableToJSON();
@ -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

@ -315,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>
@ -336,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">

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

@ -170,7 +170,7 @@ 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

View File

@ -252,7 +252,7 @@
} }
}, },
min: 0, // Minimum value for y-axis min: 0, // Minimum value for y-axis
max: 40000000 // 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

@ -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 "";
@ -301,7 +301,7 @@
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> --> <!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
<?php if(($record->isIgrFilePresent)){ ?> <?php if(($record->isIgrFilePresent)){ ?>
<a target="_blank" href="<?php echo base_url('download-files/' . $record->IGRNO); ?>"> <a target="_blank" href="<?php echo base_url().'download-files?IGRNO='.$record->IGRNO; ?>">
<i class="fa fa-download" style="text-align: center;"></i> <i class="fa fa-download" style="text-align: center;"></i>
</a> </a>
&nbsp; &nbsp;
@ -497,6 +497,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>
@ -629,7 +630,7 @@
?> ?>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
<input type="file" name="WeightFile" id="WeightFile" onchange="Copyfilenames(this.name); "> <input type="file" name="WeightFile" id="WeightFile" onchange="filenames(this.name); "><br>
<label id="WeightFileLabel" style="display:none;"> <label id="WeightFileLabel" style="display:none;">
<a><span></span><small></small></a> <a><span></span><small></small></a>
@ -1253,6 +1254,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>' +
'<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>' +
@ -1307,6 +1309,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
@ -1367,6 +1370,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
@ -1809,8 +1813,8 @@
$(document).ready(function() { $(document).ready(function() {
$("#WeightCalculator").on("shown.bs.modal", function(e) { $("#WeightCalculator").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index'); var inx = $(e.relatedTarget).data('index');
console.log(inx);
var material = $(e.relatedTarget).data('material'); var material = $(e.relatedTarget).data('material');
// console.log(material);// toolbox
var modal = $(this); var modal = $(this);
@ -1843,7 +1847,6 @@
modal.find('#WeightFileLabel a small').text(fileName); modal.find('#WeightFileLabel a small').text(fileName);
modal.find('#WeightFileLabel').show(); modal.find('#WeightFileLabel').show();
} }
console.log(fileInput);
console.log("Selected values for index:", typeof inx, inx); console.log("Selected values for index:", typeof inx, inx);
// Set modal inputs with the retrieved values // Set modal inputs with the retrieved values
@ -1854,7 +1857,6 @@
$("#NetWeight").val(v5); $("#NetWeight").val(v5);
$("#CurrentInx").val(inx); $("#CurrentInx").val(inx);
fileName
if (fileInput && fileInput.files.length > 0) { if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#WeightFile")[0]; var targetInput = $("#WeightFile")[0];
var file = fileInput.files[0]; var file = fileInput.files[0];
@ -1880,20 +1882,11 @@
var v5 = $("#NetWeight").val(); var v5 = $("#NetWeight").val();
var inx = $("#CurrentInx").val(); var inx = $("#CurrentInx").val();
var IGRNO1 = $("#IGRNO1").val(); var IGRNO1 = $("#IGRNO1").val();
var fileInput = $("#WeightFile")[0]; // Get the file input element var fileInput = $("#WeightFile")[0];
if (inx !== undefined && inx !== '') { if (inx !== undefined && inx !== '') {
console.log("Saving values for index:", inx);
// Set the values back to the hidden inputs
$("#txtGrossWeight" + inx).val(v1);
$("#txtGrossWeightDate" + inx).val(v2);
$("#txtTareWeight" + inx).val(v3);
$("#txtTareWeightDate" + inx).val(v4);
$("#txtNetWeight" + inx).val(v5);
var txtIGRLineItem = $("#txtIGRLineItem" + inx).val(); var txtIGRLineItem = $("#txtIGRLineItem" + inx).val();
// Prepare FormData
var formData = new FormData(); var formData = new FormData();
formData.append('GrossWeight', v1); formData.append('GrossWeight', v1);
formData.append('GrossWeightDate', v2); formData.append('GrossWeightDate', v2);
@ -1902,54 +1895,32 @@
formData.append('NetWeight', v5); formData.append('NetWeight', v5);
formData.append('IGR', IGRNO1); formData.append('IGR', IGRNO1);
formData.append('IGRlineitem', txtIGRLineItem); formData.append('IGRlineitem', txtIGRLineItem);
if (fileInput && fileInput.files.length > 0) { if (fileInput && fileInput.files.length > 0) {
var file = fileInput.files[0]; var file = fileInput.files[0];
formData.append('WeightFile', file); formData.append('WeightFile', file);
console.log("File selected:", file.name);
} else { } else {
console.log("No file selected or file input not found."); console.log("No file selected.");
} }
// if (fileInput && fileInput.files.length > 0) {
// var targetInput = $("#txtWeightFile" + inx)[0];
// var file = fileInput.files[0];
// // Create a new DataTransfer object
// var dataTransfer = new DataTransfer();
// dataTransfer.items.add(file);
// // Set the file to the target input
// targetInput.files = dataTransfer.files;
// formData.append('WeightFile', file);
// } else {
// console.log("No file selected or file input not found.");
// }
$.ajax({ $.ajax({
url: "<?php echo base_url() ?>updateIGRWeight", url: "<?php echo base_url('updateIGRWeight'); ?>",
type: "POST", type: "POST",
data: formData, data: formData,
contentType: false, // Don't set content type header contentType: false,
processData: false, processData: false,
success: function(data) { success: function(data) {
if (data) { alert(data);
alert(data); $("#WeightCalculator").modal('hide');
} },
error: function(xhr, status, error) {
console.log("Upload error:", error);
} }
}); });
// Clear modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
$("#WeightFile").val('');
// Close the modal
$("#WeightCalculator").modal('hide');
} else {
console.log("Saving values for index: " + inx + " undefined");
} }
} }
</script> </script>
<script> <script>
function formatDateTime(dateString, flag) { function formatDateTime(dateString, flag) {