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

This commit is contained in:
VE10-Sanjeev 2024-08-29 04:09:36 +00:00
commit 1a2ac91f71
3480 changed files with 7066 additions and 530789 deletions

10
.gitignore vendored
View File

@ -1,3 +1,8 @@
# Ignore Composer files
vendor
composer.lock
# Ignore PHPStorm files
/.idea/*
*.sublime-*
@ -52,7 +57,6 @@ Desktop.ini
*.mov
*.wmv
# Don't save phpunit under version control.
# Ignore PHPUnit files
phpunit
phpunit*.xml
@ -111,9 +115,7 @@ php_errors.log
/app/Views/*.tmp
# Ignore Composer files
vendor
composer.lock
# Ignore environment-specific settings
.env

View File

@ -31,6 +31,7 @@ $routes->get('reports', 'Report::index');
// User Routes
$routes->get('addNew', 'User::addNew');
$routes->post('fetchEmployeeDetails', 'User::fetchEmployeeDetails');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'addNewUser', 'User::addNewUser');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'userListing', 'User::userListing');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'userListing/(:num)', 'User::userListing/$1');
@ -72,6 +73,8 @@ $routes->get('exportcost', 'CostCenter::exportcost');
// Asset Detail Routes
$routes->get('assetListing', 'Assetdetails::assetListing');
$routes->get('addasset', 'Assetdetails::addasset');
$routes->get('assetdetails/editOldasset', 'Assetdetails::editOldasset');
// $routes->post('addNewasset', 'Assetdetails::addNewasset');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset', 'Assetdetails::editasset');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editOldasset/(:num)', 'Assetdetails::editasset/$1');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'editasset', 'Assetdetails::editasset');
@ -259,6 +262,17 @@ $routes->get('download-files/(:segment)', 'Inwardgateregister::downloadFilesAsZi
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
// Non IGR / Expense
$routes->get('ListIGR', 'Expense::index');
$routes->post('addExpense', 'Expense::addExpense');
$routes->post('editExpense', 'Expense::editExpense');
$routes->post('getExpenseDetails', 'Expense::getExpenseDetails');
$routes->get('uploads/(:any)', 'Expense::downloads/$1');
$routes->post('deleteFile', 'Expense::deleteFile');
$routes->get('downloadFile/(:any)', 'Expense::downloads/$1');
// Application OGR Page
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'AddOgr', 'Inwardgateregister::addoutwardgateregister');
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'ViewOgr', 'Inwardgateregister::ViewOgr');

View File

@ -66,7 +66,7 @@ class Assetdetails extends BaseController
$data['AssetStatus'] = $this->assetdetails_model->getConfigValue('C015');
$data['po'] = $this->assetdetails_model->getPO();
//print_r($data);die();
// print_r($data);die();
$this->global['pageTitle'] = 'Add Asset';
$this->loadViews("addasset", $this->global, $data, NULL);
@ -186,47 +186,48 @@ class Assetdetails extends BaseController
function addNewasset()
{
$this->validator->setRules([
'AssetName' => 'trim|required',
'Department' => 'trim|callback_Department_validate',
'Location' => 'trim|required',
'User' => 'trim|required',
'SupplierName' => 'trim|callback_Supplier_validate',
'DateOfCommission' => 'trim|required',
'Assetvalue' => 'trim|required',
'AssetStatus' => 'trim|callback_Asset_validate'
]);
// $this->validator->setRules([
// 'AssetName' => 'trim|required',
// 'Department' => 'trim|callback_Department_validate',
// 'Location' => 'trim|required',
// 'User' => 'trim|required',
// 'SupplierName' => 'trim|callback_Supplier_validate',
// 'DateOfCommission' => 'trim|required',
// 'Assetvalue' => 'trim|required',
// 'AssetStatus' => 'trim|callback_Asset_validate'
// ]);
$this->validator->setMessage([
'AssetName' => [
'required' => 'Please enter Asset Name.'
],
'Department' => [
'Department_validate' => 'Please select a valid Department.'
],
'Location' => [
'required' => 'Please enter Location.'
],
'User' => [
'required' => 'Please enter User.'
],
'SupplierName' => [
'Supplier_validate' => 'Please select a valid Supplier.'
],
'DateOfCommission' => [
'required' => 'Please enter Date of Commission.'
],
'Assetvalue' => [
'required' => 'Please enter Asset Value.'
],
'AssetStatus' => [
'Asset_validate' => 'Please select a valid Asset Status.'
]
]);
// $this->validator->setMessage([
// 'AssetName' => [
// 'required' => 'Please enter Asset Name.'
// ],
// 'Department' => [
// 'Department_validate' => 'Please select a valid Department.'
// ],
// 'Location' => [
// 'required' => 'Please enter Location.'
// ],
// 'User' => [
// 'required' => 'Please enter User.'
// ],
// 'SupplierName' => [
// 'Supplier_validate' => 'Please select a valid Supplier.'
// ],
// 'DateOfCommission' => [
// 'required' => 'Please enter Date of Commission.'
// ],
// 'Assetvalue' => [
// 'required' => 'Please enter Asset Value.'
// ],
// 'AssetStatus' => [
// 'Asset_validate' => 'Please select a valid Asset Status.'
// ]
// ]);
if (!$this->validator->run()) {
$this->addasset();
// if (!$this->validator->run()) {
if (false) {
// $this->addasset();
} else {
$assetName = $this->request->getPost('AssetName');
$AssetName = (!empty($assetName)) ? strtoupper((string)$assetName) : "";
@ -273,11 +274,11 @@ class Assetdetails extends BaseController
if ($result > 0) {
// $this->session->set_flashdata('success', 'New Asset created successfully');
echo "<script>alert('Asset Created successfully!');</script>";
redirect('assetListing', 'refresh');
} else {
// $this->session->set_flashdata('failed', 'Asset Created Failed!');
echo "<script>alert('Asset Not Created!');</script>";
redirect('assetListing', 'refresh');
}
return redirect()->route('assetListing');
}
}
/**
@ -325,49 +326,50 @@ class Assetdetails extends BaseController
$Asset_Code = $this->request->getPost('AssetCode');
$this->validator->setRules([
'AssetName' => 'trim|required',
'Description' => 'trim|required',
'Department' => 'trim|callback_Department_validate',
'Location' => 'trim|required',
'User' => 'trim|required',
'SupplierName' => 'trim|callback_Supplier_validate',
'DateOfCommission' => 'trim|required',
'Assetvalue' => 'trim|required',
'AssetStatus' => 'trim|callback_Asset_validate'
]);
// $this->validator->setRules([
// 'AssetName' => 'trim|required',
// 'Description' => 'trim|required',
// 'Department' => 'trim|callback_Department_validate',
// 'Location' => 'trim|required',
// 'User' => 'trim|required',
// 'SupplierName' => 'trim|callback_Supplier_validate',
// 'DateOfCommission' => 'trim|required',
// 'Assetvalue' => 'trim|required',
// 'AssetStatus' => 'trim|callback_Asset_validate'
// ]);
$this->validator->setMessage([
'AssetName' => [
'required' => 'Please enter Asset Name.'
],
'Description' => [
'required' => 'Please enter Description.'
],
'Department' => [
'Department_validate' => 'Please select a valid Department.'
],
'Location' => [
'required' => 'Please enter Location.'
],
'User' => [
'required' => 'Please enter User.'
],
'SupplierName' => [
'Supplier_validate' => 'Please select a valid Supplier.'
],
'DateOfCommission' => [
'required' => 'Please enter Date of Commission.'
],
'Assetvalue' => [
'required' => 'Please enter Asset Value.'
],
'AssetStatus' => [
'Asset_validate' => 'Please select a valid Asset Status.'
]
]);
// $this->validator->setMessage([
// 'AssetName' => [
// 'required' => 'Please enter Asset Name.'
// ],
// 'Description' => [
// 'required' => 'Please enter Description.'
// ],
// 'Department' => [
// 'Department_validate' => 'Please select a valid Department.'
// ],
// 'Location' => [
// 'required' => 'Please enter Location.'
// ],
// 'User' => [
// 'required' => 'Please enter User.'
// ],
// 'SupplierName' => [
// 'Supplier_validate' => 'Please select a valid Supplier.'
// ],
// 'DateOfCommission' => [
// 'required' => 'Please enter Date of Commission.'
// ],
// 'Assetvalue' => [
// 'required' => 'Please enter Asset Value.'
// ],
// 'AssetStatus' => [
// 'Asset_validate' => 'Please select a valid Asset Status.'
// ]
// ]);
if ($this->validator->run() == FALSE) {
// if ($this->validator->run() == FALSE) {
if (FALSE) {
$this->editOldasset($Asset_Code);
} else {
@ -419,11 +421,10 @@ class Assetdetails extends BaseController
if ($result == true) {
echo "<script>alert('Asset updated successfully!');</script>";
redirect('assetListing', 'refresh');
} else {
echo "<script>alert('Asset Not updated !');</script>";
redirect('assetListing', 'refresh');
}
return redirect()->route('assetListing');
}
}

View File

@ -203,36 +203,7 @@ class Employeedetails extends BaseController
function AddNewEmployee()
{
$validation = \Config\Services::validation();
// $this->validator->setRules([
// 'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'emailid'=> 'trim|required|valid_email',
// 'gender'=> 'callback_Gender_validate',
// 'MartialStatus'=> 'callback_Martial_validate',
// 'bloodgroup'=>'callback_Blood_validate',
// 'emergencycontactnumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'desigination'=> 'callback_Des_validate',
// 'departmentname'=> 'callback_Dep_validate',
// 'eduqualifaction'=> 'callback_select_validate',
// 'referrercontno'=> 'trim|min_length[10]|max_length[10]',
// 'aadharno'=> 'trim|min_length[14]|max_length[14]',
// 'panno'=> 'trim|min_length[10]|max_length[10]',
// 'passportno'=> 'trim|min_length[9]|max_length[9]',
// 'accountno'=> 'trim|min_length[10]|max_length[20]',
// 'pfno'=> 'trim|min_length[22]|max_length[22]',
// 'esino'=> 'trim|min_length[10]|max_length[10]']);
// if ($this->validator->run() == FALSE) {
// $this->addemployee();
// //echo 'Validate method called';
// } else {
//echo 'Validate not method called';
$photo = $this->request->getFile('photo');
$Picture = "";
if ($photo->isValid() && !$photo->hasMoved()) {
@ -371,15 +342,11 @@ class Employeedetails extends BaseController
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
$Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
$Food_Allowances = $this->request->getPost('Food_Allowances');
$Incentives = $this->request->getPost('Incentives');
$CreateBy = $this->session->get('userId');
$emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
$emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Created_By' => $CreateBy);
$this->emppaydate_model->addNewemppay($emppay);
@ -803,34 +770,21 @@ class Employeedetails extends BaseController
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
$Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
$Food_Allowances = $this->request->getPost('Food_Allowances');
$Incentives = $this->request->getPost('Incentives');
$CreateBy = $this->session->get('userId');
$emppay = array('EmpID' => $EmpId, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
$emppay = array('EmpID' => $EmpId, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Created_By' => $CreateBy);
$empPayUpdate = $this->emppaydate_model->editemppay($emppay);
if ($result + $empPayUpdate > 0) {
// $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!');
$this->session->setFlashdata('success', 'You Have Successfully updated the Employee Record!');
// echo "<script>alert('You Have Successfully updated the Employee Record!');</script>";
} else {
// $this->session->set_flashdata('Error', $EmpId . 'Employee details not saved');
$this->session->setFlashdata('error', 'Record Not Updated!');
// echo "<script>alert('Record Not Updated!');</script>";
}
return redirect()->route('employeeListing');
// redirect('employeeListing');
// }
}
function exportemployee()

View File

@ -56,13 +56,9 @@ class Emppaydate extends BaseController
*/
function emppayListing()
{
$data['userRecords'] = $this->emppaydate_model->emppayListing();
$this->global['pageTitle'] = 'Employee Pay List';
$this->global['pageTitle'] = 'Employee Loan List';
$this->loadViews("emppayListing", $this->global, $data, NULL);
}
@ -71,12 +67,8 @@ class Emppaydate extends BaseController
*/
function addemppaydate()
{
$q = "addemppaydate";
$result['empdetails'] = $this->payroll_model->getEmpID($q);
$result['empdetails'] = $this->payroll_model->getEmpID();
$this->global['pageTitle'] = 'Add Employee Pay';
@ -88,71 +80,29 @@ class Emppaydate extends BaseController
{
helper('form'); //$this->load->library('form_validation');
$EmpID = $this->request->getPost('EmpID');
// $this->validator->setRules([
// 'ContactNumber'=> 'trim|required|min_length[10]|max_length[10]',
// 'EmpID'=> 'trim|required',
// 'HRA_Rate'=> 'trim|required',
// 'HRA_Amount'=> 'trim|required',
// 'Basic_Pay'=> 'trim|required',
// 'Total_salary'=> 'trim|required',
// 'Allowances'=> 'trim|required',
// 'PF_Rate'=> 'trim|required',
// 'ESI_Rate'=> 'trim|required',
// 'Food_Allowances'=> 'trim|required',
// 'Incentives'=> 'trim|required']);
// if ($this->validator->run() == FALSE || $EmpID == -1) {
// $this->addemppaydate();
// } else {
$EmpID = $this->request->getPost('EmpID');
$Total_Salary = $this->request->getPost('Total_salary');
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
$Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
$Food_Allowances = $this->request->getPost('Food_Allowances');
$Incentives = $this->request->getPost('Incentives');
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
if (!empty($Load_Issued_date)) {
$Load_Issued_date = $Load_Issued_date = format_date($Load_Issued_date);
} else {
$Load_Issued_date = null;
}
if (!empty($Load_Issued_date)) { $Load_Issued_date = format_date($Load_Issued_date); } else { $Load_Issued_date = null; }
$Due_Amount = $this->request->getPost('monthly_due');
$Due_Started = $this->request->getPost('due_started');
if (!empty($Due_Started)) {
$Due_Started = $Due_Started = format_date($Due_Started);
} else {
$Due_Started = null;
}
if (!empty($Due_Started)) {$Due_Started = format_date($Due_Started);} else { $Due_Started = null; }
$No_Of_Dues = $this->request->getPost('no_of_due');
$Paid_due = $this->request->getPost('paid_due');
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
$CreateBy = $this->session->get('userId');
$chked = $this->request->getPost('is_Active');
$IsActive = '1';
$emppay = array('EmpID' => $EmpID, 'TotalSalary' => $Total_Salary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Created_By' => $CreateBy);
$loandetails = array('EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Created_By' => $CreateBy);
$result = $this->emppaydate_model->addNewemppay($emppay);
if ($Loan_Amount != 0) {
$result2 = $this->emppaydate_model->addLoanInfo($loandetails, 'add');
if ($result2 > 0) {
@ -161,17 +111,8 @@ class Emppaydate extends BaseController
echo "<script>alert('Something Went Wrong..! Loan Information Not Saved. Try later..!');</script>";
}
}
if ($result > 0) {
echo "<script type='text/javascript'>alert('Employee Pay List Created successfully!');
window.location = '".base_url()."emppayListings';</script>";
} else {
echo "<script type='text/javascript'>alert('Employee Pay List Not Created!');
window.location = '".base_url()."emppayListings';</script>";
}
//}
// }
}
/**
@ -197,72 +138,26 @@ class Emppaydate extends BaseController
{
helper('form'); //$this->load->library('form_validation');
$Pay_Data_ID = $this->request->getPost('Pay_Data_ID');
//'Pay_Data_ID'=>'trim|required';
// $this->validator->setRules([
// 'EmpID'=> 'trim|required',
// 'Total_Salary'=> 'trim|required',
// 'Basic_Pay'=> 'trim|required',
// 'HRA_Rate'=> 'trim|required',
// 'Allowances'=> 'trim|required',
// 'PF_Rate'=> 'trim|required',
// 'ESI_Rate'=> 'trim|required',
// 'Food_Allowances'=> 'trim|required',
// 'Incentives'=> 'trim|required']);
// if ($this->validator->run() == FALSE) {
// $this->editOldemppay($Pay_Data_ID);
// } else {
$Pay_Data_ID = $this->request->getPost('Pay_Data_ID');
$EmpID = $this->request->getPost('EmpID');
$TotalSalary = $this->request->getPost('Total_Salary');
$Basic_Pay = $this->request->getPost('Basic_Pay');
$HRA_Rate = $this->request->getPost('HRA_Rate');
$HRA_Amount = $this->request->getPost('HRA_Amount');
$Allowances = $this->request->getPost('Allowances');
$PF_Rate = $this->request->getPost('PF_Rate');
$ESI_Rate = $this->request->getPost('ESI_Rate');
$loan_ID = $this->request->getPost('loanid');
$Loan_Amount = $this->request->getPost('Loan_Amount');
$Load_Issued_date = $this->request->getPost('loan_issued_date');
if (!empty($Load_Issued_date)) {
$Load_Issued_date = format_date($Load_Issued_date);
} else {
$Load_Issued_date = null;
}
if (!empty($Load_Issued_date)) {$Load_Issued_date = format_date($Load_Issued_date);} else { $Load_Issued_date = null; }
$Due_Amount = $this->request->getPost('monthly_due');
$Due_Started = $this->request->getPost('due_started');
if (!empty($Due_Started)) {
$Due_Started = format_date($Due_Started);
} else {
$Due_Started = null;
}
//echo $Load_Issued_date. "-" . $Due_Started;die();
if (!empty($Due_Started)) {$Due_Started = format_date($Due_Started); } else { $Due_Started = null; }
$No_Of_Dues = $this->request->getPost('no_of_due');
$Paid_due = $this->request->getPost('paid_due');
$Remaining_Due = $this->request->getPost('remaining_due');
$Paid_Amount = $this->request->getPost('Paid_Amount');
$is_Active = $this->request->getPost('is_Active');
$Last_Mod_By = $this->session->get('userId');
$Last_Mod_Time = date('d-m-Y h:i:sa');
$Food_Allowances = $this->request->getPost('Food_Allowances');
$Incentives = $this->request->getPost('Incentives');
$emppay = array('Pay_Data_ID' => $Pay_Data_ID, 'EmpID' => $EmpID, 'TotalSalary' => $TotalSalary, 'Basic_Pay' => $Basic_Pay, 'HRA_Rate' => $HRA_Rate, 'HRA_Amount' => $HRA_Amount, 'Allowances' => $Allowances, 'PF_Rate' => $PF_Rate, 'ESI_Rate' => $ESI_Rate, 'Food_Allowances' => $Food_Allowances, 'Incentives' => $Incentives, 'Last_Mod_By' => $Last_Mod_By);
$loandetails = array('Loan_ID' => $loan_ID, 'EmpID' => $EmpID, 'Loan_Amount' => $Loan_Amount, 'Loan_Issued_Date' => $Load_Issued_date, 'Monthly_Due' => $Due_Amount, 'Due_Start_Date' => $Due_Started, 'No_of_Dues' => $No_Of_Dues, 'Paid_Due' => $Paid_due, 'Remaining_Due' => $Remaining_Due, 'Paid_Amount' => $Paid_Amount, 'is_Active' => 1, 'Last_Mod_By' => $Last_Mod_By);
@ -284,18 +179,8 @@ class Emppaydate extends BaseController
}
$result = $this->emppaydate_model->editemppay($emppay);
if ($result == true) {
echo "<script type='text/javascript'>alert('Employee Status Updated Sucessfully..!');
window.location = '".base_url()."emppayListings';</script>";
} else {
echo "<script type='text/javascript'>alert('Update Failed..!';
window.location = '".base_url()."emppayListings';</script>";
}
// redirect('emppaydate/emppayListing');
// }
}

170
app/Controllers/Expense.php Normal file
View File

@ -0,0 +1,170 @@
<?php
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\Expense_model;
use App\Models\Supplier_model;
class Expense extends BaseController
{
protected $expense_model;
protected $supplier_model;
protected $session;
public function __construct()
{
parent::__construct();
$this->expense_model = new Expense_model();
$this->supplier_model = new Supplier_model();
$this->session = session();
helper('form');
$this->isLoggedIn();
}
public function index()
{
$data['expense_list'] = $this->expense_model->getAllExpense();
$data['supplier_list'] = json_encode($this->supplier_model->supplierlisting());
$this->global['pageTitle'] = 'Non IGR / Expense List';
$this->loadViews("expense_list", $this->global, $data, NULL);
}
public function addExpense()
{
$file = $this->request->getFile('transporterfile');
$fileName = '';
if ($file->isValid() && !$file->hasMoved()) {
$fileName = $file->getRandomName();
$file->move(WRITEPATH . 'uploads', $fileName);
}
$status = $this->request->getPost('status');
$paymentMethod = $status === 'Paid' ? $this->request->getPost('payment_method') : 0;
$data = [
'transporter_file' => $fileName,
'supplier_id' => $this->request->getPost('supplierid'),
'remarks' => $this->request->getPost('remarks'),
'cost' => $this->request->getPost('cost'),
'gst' => $this->request->getPost('gst'),
'total' => (int)$this->request->getPost('gst') + (int)$this->request->getPost('cost'),
'status' => $status,
'payment_method' => $paymentMethod
];
$insert_id = $this->expense_model->insertExpense($data);
if ($insert_id) {
return json_encode('true');
} else {
return json_encode('false');
}
}
public function getExpenseDetails()
{
$id = $this->request->getPost('id');
if ($id) {
$expense = $this->expense_model->getExpenseById($id);
echo json_encode($expense);
} else {
echo json_encode(['error' => 'Invalid ID']);
}
}
public function editExpense()
{
$id = $this->request->getPost('id');
$file = $this->request->getFile('transporterfile');
$fileName = '';
if ($file->isValid() && !$file->hasMoved()) {
$fileName = $file->getRandomName();
$file->move(WRITEPATH . 'uploads', $fileName);
} else {
$fileName = $this->request->getPost('existing_file'); // Use existing file if no new file is uploaded
}
$status = $this->request->getPost('status');
$paymentMethod = $status === 'Paid' ? $this->request->getPost('payment_method') : 0;
$data = [
'supplier_id' => $this->request->getPost('supplierid'),
'remarks' => $this->request->getPost('remarks'),
'cost' => $this->request->getPost('cost'),
'gst' => $this->request->getPost('gst'),
'total' => (int)$this->request->getPost('gst') + (int)$this->request->getPost('cost'),
'status' => $status,
'payment_method' => $paymentMethod
];
if(!empty($fileName)){
$data['transporter_file'] = $fileName;
}
$data['payment_method'] = $this->request->getPost('payment_method');
if ($id) {
$result = $this->expense_model->updateExpense($id, $data);
if ($result) {
echo json_encode(['success' => 'Expense updated successfully']);
} else {
echo json_encode(['error' => 'Failed to update expense']);
}
} else {
echo json_encode(['error' => 'Invalid ID']);
}
}
public function downloads($filename)
{
$path = WRITEPATH . 'uploads/' . $filename;
if (file_exists($path)) {
return $this->response->download($path, null);
} else {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound('File not found');
}
}
public function deleteFile()
{
$fileName = $this->request->getPost('file_name');
$expenseId = $this->request->getPost('expense_id');
if ($fileName && $expenseId) {
// Construct the file path
$path = WRITEPATH . 'uploads/' . $fileName;
// Begin transaction
$db = \Config\Database::connect();
$db->transBegin();
try {
// Delete the file from the folder
if (file_exists($path)) {
if (!unlink($path)) {
throw new \Exception('Unable to delete file from the folder.');
}
}
// Update the database to set transporter_file to null
$this->expense_model->deleteFile($expenseId);
// Commit transaction
$db->transCommit();
echo json_encode(['success' => true]);
} catch (\Exception $e) {
// Rollback transaction
$db->transRollback();
echo json_encode(['success' => false, 'message' => $e->getMessage()]);
}
} else {
echo json_encode(['success' => false, 'message' => 'Invalid parameters.']);
}
}
}

View File

@ -138,6 +138,7 @@ class Monthlypay extends BaseController
}
$begin->modify('+1 day');
}
// dd( $sundayarray);
$noofsundays = count($sundayarray);
$publicholidaysarray = $this->monthlypay_model->getPublicHoldays($current);
@ -150,6 +151,7 @@ class Monthlypay extends BaseController
$data['datefordropdown'] = $current;
$data['attendance'] = $this->monthlypay_model->monthlyAttendance($current);
$data['emppay'] = $this->monthlypay_model->getEmpPayDetails($current, $string);
$this->global['pageTitle'] = 'Monthly Attendance';
$this->loadViews("attendance", $this->global, $data, NULL);
}
@ -264,6 +266,7 @@ class Monthlypay extends BaseController
$paidleave = $data['Paid Leave'];
$daysworked = $data['Days Worked'];
$absent = $data['Absent'];
$sundayCount = $data['Total Sunday'];
$monthattendance = array(
'Month_Year' => $Month_Year, 'NoofDays' => $NoofDays, 'EmpID' => $EmpID, 'WH1' => $W1H, 'OT1' => $W1OT, 'WH2' => $W2H, 'OT2' => $W2OT, 'WH3' => $W3H, 'OT3' => $W3OT,
@ -272,7 +275,7 @@ class Monthlypay extends BaseController
'WH17' => $W17H, 'OT17' => $W17OT, 'WH18' => $W18H, 'OT18' => $W18OT, 'WH19' => $W19H, 'OT19' => $W19OT, 'WH20' => $W20H, 'OT20' => $W20OT, 'WH21' => $W21H, 'OT21' => $W21OT, 'WH22' => $W22H, 'OT22' => $W22OT,
'WH23' => $W23H, 'OT23' => $W23OT, 'WH24' => $W24H, 'OT24' => $W24OT, 'WH25' => $W25H, 'OT25' => $W25OT, 'WH26' => $W26H, 'OT26' => $W26OT, 'WH27' => $W27H, 'OT27' => $W27OT, 'WH28' => $W28H, 'OT28' => $W28OT,
'WH29' => $W29H, 'OT29' => $W29OT, 'WH30' => $W30H, 'OT30' => $W30OT, 'WH31' => $W31H, 'OT31' => $W31OT, 'Total_WHrs' => $totalworkinghrs, 'Total_OTHrs' => $totalothrs, 'Paid_Leave' => $paidleave,
'Days_Worked' => $daysworked, 'Absent' => $absent, 'Created_by' => $CreateBy
'Days_Worked' => $daysworked, 'Absent' => $absent, 'sunday_count' => $sundayCount , 'Created_by' => $CreateBy
);

View File

@ -504,15 +504,16 @@ class Payslip extends BaseController
public function monthlyInputs()
{
$current = date("m-Y");
// echo $current;
$data['month'] = $this->monthlypay_model->monthlyListing($current);
// $data['fresh'] = $this-> monthlypay_model->getEmpPayDetails($current);
$data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
// dd($data['fresh']);
$employeeSalary = [];
$esi = [];
$pf = [];
$ot = [];
foreach ($data['fresh'] as $value) {
@ -520,34 +521,25 @@ class Payslip extends BaseController
$HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay;
$TotalSalary = $value->TotalSalary;
$Food_Allowances = $value->Food_Allowances;
$Days_worked = $value->Days_worked; // working day
$LOP_Days = $value->LOP_Days; // not working day
$Sunday = $value->sunday_count; // Sunday count
$LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day
$Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE
$Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
$MasterIncentives = $value->MasterIncentives; //Master values get
// echo 'master'.$MasterIncentives;
$due_start_date = $value->DueDate;
$paydate = $current; //From POST parm
$pmonth = substr($paydate, 0, 2);
$pyear = substr($paydate, -4);
$pday = cal_days_in_month(CAL_GREGORIAN, $pmonth, $pyear);
$paymonth = $pyear . '-' . $pmonth . '-' . $pday;
$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;
@ -563,89 +555,76 @@ class Payslip extends BaseController
if ($Monthly_Due > $Balance_Amount) {
// current= Balance_Amount - autoLoan;
//alert('hi');
$loan = $Balance_Amount;
}
$Allowances = $value->Allowances;
$HRA_Rate = $value->HRA_Rate;
$PF_Rate = $value->PF_Rate;
$ESI_Rate = $value->ESI_Rate;
$MonthIncentive = $value->MonthlyIncentives; //t_monthly_pay_inputs,for change month
$Incentive = 0;
if (empty($MonthIncentive)) {
$Incentive = $MasterIncentives;
} else {
$Incentive = $MonthIncentive;
}
// echo $Incentive;
$daySalarys = $Days_worked + $Paid_leave;
//echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
//$Allowances = $allowances * $values;
$dayFood_Allowance = $Food_Allowances * $Days_worked;
$daySalary = $Basic_Pay / $NoofDays;
/**per day salary working hour**/
//echo $daySalary.'<br/>';
$totalDaysWorked = ($Days_worked + $Sunday) + $Paid_leave;
$dayBasic = $Basic_Pay / $NoofDays;
$dayHra = $HRA_Amount / $NoofDays;
/** per day hra amount **/
//echo $dayHra.'<br/>';
$onehoursSalary = ($dayBasic + $dayHra) / 8;
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($OT_Hrs_Worked != 0) {
$totSalayOT = $OT_Hrs_Worked * $onehoursSalary;
} else {
$totSalayOT = 0;
}
$currentDaySalary = $daySalary * $daySalarys;
/** current day salary working days calculation**/
$currentDayHra = $dayHra * $daySalarys;
/** total working days hra calculations**/
// echo $currentDayHra.'<br/>';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
if ($TotalSalary <= 20000) {
$esiAmount = $currentDatePF * $ESI_Rate / 100;
/** esiamount not elgiable for 20000 **/
} else {
$esiAmount = 0;
//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;
}
$pfAmount = $currentDaySalary * $PF_Rate / 100;
if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $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 = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive;
$empSalaryAdd = $currentDayBasic + $currentDayHra + $totSalayOT;
$empSalarySub = $esiAmount + $pfAmount + $loan;
$salaryInCurrentday = $empSalaryAdd - $empSalarySub;
// echo $esiAmount .'</br>';
// echo $pfAmount .'</br>';
// echo $loan .'</br>';
// echo $empSalarySub .'</br>';
// echo $empSalaryAdd .'</br>';
// echo $salaryInCurrentday .'</br>';
// die;
$employeeSalary[] = round($salaryInCurrentday);
$esi[] = number_format($esiAmount,2);
$pf[] = number_format($pfAmount,2);
$ot[] = number_format($totSalayOT,2);
}
$data['empSalary'] = $employeeSalary;
//echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$data['esi'] = $esi;
$data['pf'] = $pf;
$data['over_time'] = $ot;
// dd($data);
$this->global['pageTitle'] = 'Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global, $data, NULL);
}
@ -657,30 +636,29 @@ class Payslip extends BaseController
$current = $this->request->getPost('monthyear');
$data['month'] = $this->monthlypay_model->monthlyListing($current);
//print_r($data['month']);
$data['dropdownvalue'] = $current;
$data['fresh'] = $this->monthlypay_model->getEmpPayDetailsforMonthInputs($current);
// dd($data['fresh']);
//dd($data['fresh']);
$employeeSalary = [];
$esi = [];
$pf = [];
$ot = [];
foreach ($data['fresh'] as $value) {
//print_r($value);
//die();
$NoofDays = $value->NoofDays; //Month day 30,31,28
$HRA_Amount = $value->HRA_Amount;
$Basic_Pay = $value->Basic_Pay;
$TotalSalary = $value->TotalSalary;
$Food_Allowances = $value->Food_Allowances;
$Days_worked = $value->Days_worked; // working day
$LOP_Days = $value->LOP_Days; // not working day
$Sunday = $value->sunday_count; // Sunday count
$LOP_Days = $value->NoofDays - ($Days_worked + $Sunday); // not working day
$Paid_leave = $value->Paid_leave; // leave day
$OT_Hrs_Worked = $value->OT_Hrs_Worked; //OT hours
$Monthly_Due = $value->Monthly_Due; // AUTO LOAN DUE
$Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
$due_start_date = $value->DueDate;
$paydate = $current; //From POST parm
@ -693,18 +671,10 @@ class Payslip extends BaseController
$pday = cal_days_in_month(CAL_GREGORIAN, $pmonth, $pyear);
$paymonth = $pyear . '-' . $pmonth . '-' . $pday;
$Loan_Recovered = $value->Loan_Recovered; //MANUAL LOAN DUE
$MasterIncentives = $value->MasterIncentives; //Master values get
// echo 'master'.$MasterIncentives;
$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;
@ -713,7 +683,6 @@ class Payslip extends BaseController
$loan = $Monthly_Due;
}
} else if ($Loan_Recovered >= 0.00) {
if (strtotime($due_start_date) <= strtotime($paymonth)) {
$loan = $Loan_Recovered;
}
@ -721,87 +690,75 @@ class Payslip extends BaseController
if ($Monthly_Due > $Balance_Amount) {
// current= Balance_Amount - autoLoan;
//alert('hi');
$loan = $Balance_Amount;
}
$Allowances = $value->Allowances;
$HRA_Rate = $value->HRA_Rate;
$PF_Rate = $value->PF_Rate;
$ESI_Rate = $value->ESI_Rate;
$MonthIncentive = $value->MonthlyIncentives; //t_monthly_pay_inputs,for change month
$Incentive = 0;
if (empty($MonthIncentive)) {
$Incentive = $MasterIncentives;
} else {
$Incentive = $MonthIncentive;
}
// echo $Incentive;
$daySalarys = $Days_worked + $Paid_leave;
//echo "hra amount";print_r(array($HRA_Amount,$Basic_Pay,$totalsalary));
//$Allowances = $allowances * $values;
$dayFood_Allowance = $Food_Allowances * $Days_worked;
$daySalary = $Basic_Pay / $NoofDays;
/**per day salary working hour**/
//echo $daySalary.'<br/>';
$totalDaysWorked = ($Days_worked + $Sunday) + $Paid_leave;
$dayBasic = $Basic_Pay / $NoofDays;
$dayHra = $HRA_Amount / $NoofDays;
/** per day hra amount **/
//echo $dayHra.'<br/>';
$onehoursSalary = ($dayBasic + $dayHra) / 8;
$onehoursSalary = ($daySalary + $dayHra) / 8;
/**one hour salay ot calculation**/
if ($OT_Hrs_Worked != 0) {
$totSalayOT = $OT_Hrs_Worked * $onehoursSalary;
} else {
$totSalayOT = 0;
}
$currentDaySalary = $daySalary * $daySalarys;
/** current day salary working days calculation**/
$currentDayHra = $dayHra * $daySalarys;
/** total working days hra calculations**/
// echo $currentDayHra.'<br/>';
$currentDatePF = $currentDaySalary + $currentDayHra + $totSalayOT;
/** current date pf calculation**/
if ($TotalSalary <= 20000) {
$esiAmount = $currentDatePF * $ESI_Rate / 100;
/** esiamount not elgiable for 20000 **/
} else {
$esiAmount = 0;
//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;
}
$pfAmount = $currentDaySalary * $PF_Rate / 100;
//$totalSalary = $currentDayBasic + $currentDayHra + $totSalayOT;
if ($value->esi_applicable == 1) { $esiAmount = $currentDayBasic * $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 = $currentDaySalary + $totSalayOT + $currentDayHra + $dayFood_Allowance + $Allowances + $Incentive;
$empSalaryAdd = $currentDayBasic + $currentDayHra + $totSalayOT;
$empSalarySub = $esiAmount + $pfAmount + $loan;
$salaryInCurrentday = $empSalaryAdd - $empSalarySub;
// echo $esiAmount .'</br>';
// echo $pfAmount .'</br>';
// echo $loan .'</br>';
// echo $empSalarySub .'</br>';
// echo $empSalaryAdd .'</br>';
// echo $salaryInCurrentday .'</br>';
// die;
$employeeSalary[] = round($salaryInCurrentday);
$esi[] = number_format($esiAmount,2);
$pf[] = number_format($pfAmount,2);
$ot[] = number_format($totSalayOT,2);
}
$data['empSalary'] = $employeeSalary;
$data['esi'] = $esi;
$data['pf'] = $pf;
$data['over_time'] = $ot;
// dd($data);
//echo sizeof($data['fresh'])."-".sizeof($data['empSalary']);die;
$this->global['pageTitle'] = 'Payroll Monthly Inputs';
$this->loadViews("monthlypayinputs", $this->global, $data, NULL);
@ -847,9 +804,9 @@ class Payslip extends BaseController
$ErrorFlag = 0;
$Emp = $j['Employee'];
$EmpID = substr($Emp, 0, 4);
$EmpID = $j['Emp ID'];
//$Name = $j['Employee Name'];
//echo $EmpID; die;
@ -858,10 +815,10 @@ class Payslip extends BaseController
$LOP_Days = $j['LOP Days'];
$Paid_leave = $j['Paid Leave'];
$OT_Hrs_Worked = $j['OT Hrs'];
$Loan_Recovered = $j['Manual Loan Due ₹'];
$Incentives = $j['Incentives in ₹'];
$Loan_Recovered = $j['Auto Loan Due ₹'];
// $Incentives = $j['Incentives in ₹'];
$Festival_Bonus = $j['Festival Bonus in ₹'];
$Other_Deductions = $j['Other Deductions in ₹'];
$Other_Deductions = $j['TDS Deductions in ₹'];
$Estimate = $j['Estimate in ₹'];
$Created_By = $this->session->get('userId');
@ -906,11 +863,11 @@ class Payslip extends BaseController
}
}
$Incentives_first = explode(".", $Incentives);
if (!is_numeric($Incentives) || (strlen((string)$Incentives)) > 8 || (strlen((string)$Incentives_first[0])) > 5) {
//echo $EmpID . "-Loan Recoverd Invalid Data!";
$ErrorFlag++;
}
// $Incentives_first = explode(".", $Incentives);
// if (!is_numeric($Incentives) || (strlen((string)$Incentives)) > 8 || (strlen((string)$Incentives_first[0])) > 5) {
// //echo $EmpID . "-Loan Recoverd Invalid Data!";
// $ErrorFlag++;
// }
$Festivalbonus_first = explode(".", $Festival_Bonus);
if (!is_numeric($Festival_Bonus) || (strlen((string)$Festival_Bonus)) > 8 || (strlen((string)$Festivalbonus_first[0])) > 5) {
@ -944,29 +901,24 @@ class Payslip extends BaseController
foreach ($json as $index => $j) {
$Emp = $j['Employee'];
// $EmpID = substr($Emp, 0, 4);
$parts = explode("-", $Emp);
$EmpID = $parts[0];
//$Name = $j['Employee'];
$EmpID = $j['Emp ID'];
$DaysWorked = $j['Days Worked'];
$LOP_Days = $j['LOP Days'];
$Paid_leave = $j['Paid Leave'];
$OT_Hrs_Worked = $j['OT Hrs'];
$Loan_Recovered = isset($j['Manual Loan Due ₹']) ? $j['Manual Loan Due ₹'] : 0.00;
if (is_string($Loan_Recovered)) {
$Loan_Recovered = strtoupper($Loan_Recovered);
}
$Incentives = isset($j['Incentives in ₹']) ? $j['Incentives in ₹'] : 0.00 ;
$LOP_Days = isset($j['LOP Days']) ? $j['LOP Days'] : 0.00;
$Paid_leave = isset($j['Paid Leave']) ? $j['Paid Leave'] : 0.00;
$OT_Hrs_Worked = isset($j['OT Hrs']) ? $j['OT Hrs'] : 0.00;
$Loan_Recovered = isset($j['Auto Loan Due ₹']) ? $j['Auto Loan Due ₹'] : 0.00;
// if (is_string($Loan_Recovered)) {
// $Loan_Recovered = strtoupper($Loan_Recovered);
// }
// $Incentives = isset($j['Incentives in ₹']) ? $j['Incentives in ₹'] : 0.00 ;
$Festival_Bonus = isset($j['Festival Bonus in ₹']) ? $j['Festival Bonus in ₹'] : 0.00;
$Other_Deductions = isset($j['Other Deductions in ₹']) ? $j['Other Deductions in ₹'] : 0.00;
$tds_Deductions = isset($j['TDS Deductions in ₹']) ? $j['TDS Deductions in ₹'] : 0.00;
$Estimate = isset($j['Estimate in ₹']) ? $j['Estimate in ₹'] : 0.00;
$Created_By = $this->session->get('userId');
$monthlypaydata = array('Month_Year' => $month, 'EmpID' => $EmpID, 'Days_worked' => $DaysWorked, 'LOP_Days' => $LOP_Days, 'Paid_leave' => $Paid_leave, 'OT_Hrs_Worked' => $OT_Hrs_Worked, 'Loan_Recovered' => $Loan_Recovered, 'Incentives' => $Incentives, 'Festival_Bonus' => $Festival_Bonus, 'Other_Deductions' => $Other_Deductions, 'Estimate' => $Estimate, 'Created_By' => $Created_By);
$monthlypaydata = array('Month_Year' => $month, 'EmpID' => $EmpID, 'Days_worked' => $DaysWorked, 'LOP_Days' => $LOP_Days, 'Paid_leave' => $Paid_leave, 'OT_Hrs_Worked' => $OT_Hrs_Worked, 'Festival_Bonus' => $Festival_Bonus, 'Other_Deductions' => $tds_Deductions, 'Estimate' => $Estimate, 'Created_By' => $Created_By ,'Loan_Recovered'=>$Loan_Recovered);
// print_r($monthlypaydata); die;
$result = $this->monthlypay_model->saveMonthlyData_model($monthlypaydata);
$total = $total + $result;
@ -1016,8 +968,6 @@ class Payslip extends BaseController
$Data['Payon'] = $this->payroll_model->getPayOn();
$this->global['pageTitle'] = 'Payroll Generater';
$this->loadViews("payslipgenerate", $this->global, $Data, NULL);
@ -1038,6 +988,7 @@ class Payslip extends BaseController
$id = $this->request->getPost('id1');
$result = $this->payroll_model->getEmployeelist2($id);
$HTML = "";
if (count($result) > 0) {

View File

@ -917,14 +917,10 @@ class User extends BaseController
// else
// {
$data['EmpList'] = $this->user_model->getAllEmployees();
$data['roles'] = $this->user_model->getUserRoles();
// $data['Department'] = $this->costcenter_model->getDepartment();
$this->global['pageTitle'] = 'Add New User';
$this->loadViews("addUser", $this->global, $data, NULL);
// }
}
@ -1637,4 +1633,19 @@ class User extends BaseController
}
// END zoho API
}
function fetchEmployeeDetails() {
$EmpID = $this->request->getPost('EmpID');
if (!$EmpID) {
return $this->response->setJSON(['success' => false, 'message' => 'Employee ID not provided']);
}
$userInfo = $this->user_model->findEmp($EmpID);
if ($userInfo) {
return $this->response->setJSON(['success' => true, 'userInfo' => $userInfo]);
} else {
return $this->response->setJSON(['success' => false, 'message' => 'Employee not found']);
}
}
}

View File

@ -15,11 +15,12 @@ class Emppaydate_model extends Model
*/
function emppayListing()
{
$builder = $this->db->table('t_emp_pay_data')
->select('t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.LastName')
->join('t_employee_details','t_emp_pay_data.EmpID=t_employee_details.EmpID');
$builder = $this->db->table('t_loan_master')
->select('t_loan_master.*,t_emp_pay_data.*,t_employee_details.FirstName')
->join('t_employee_details','t_loan_master.EmpID = t_employee_details.EmpID','LEFT')
->join('t_emp_pay_data','t_loan_master.EmpID = t_emp_pay_data.EmpID','LEFT');
$query =$builder->get();
$result = $query->getResult();
$result = $query->getResult();
return $result;
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class Expense_model extends Model
{
protected $table = 't_expense'; // Table name
protected $primaryKey = 'id'; // Primary key
protected $allowedFields = [
'transporter_file', 'supplier_id', 'remarks', 'cost', 'gst', 'total', 'status', 'payment_method'
];
// Retrieve all active expenses
public function getAllExpense() {
return $this->join('t_supplierdetailsn', 't_expense.supplier_id = t_supplierdetailsn.SupplierID')
->where('t_expense.isactive', 1)
->orderBy('t_expense.created_on', 'DESC')
->findAll();
}
// Insert new expense
public function insertExpense($data) {
return $this->insert($data) ? $this->insertID() : false;
}
// Get expense by ID
public function getExpenseById($id) {
return $this->where($this->primaryKey, $id)->first(); // Use primary key
}
// Update expense by ID
public function updateExpense($id, $data) {
return $this->update($id, $data); // Use primary key
}
public function deleteFile($expenseId)
{
// Update the database to set transporter_file to null
return $this->update($expenseId, ['transporter_file' => null]);
}
}
?>

View File

@ -100,7 +100,7 @@ class Monthlypay_model extends Model
//echo $lastdate;
//left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and month(t_payroll.PayOn) = month(?) and year(t_payroll.PayOn) = year(?)
$sql = "select t_emp_pay_data.EmpID, t_emp_pay_data.Incentives as MasterIncentives,t_emp_pay_data.*,t_employee_details.FirstName,t_employee_details.LastName,t_employee_details.DateofJoining,t_employee_details.Designation,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_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.Key,t_monthly_pay_inputs.Incentives as MonthlyIncentives,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount
$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.Key,t_monthly_pay_inputs.Incentives as MonthlyIncentives,t_monthly_pay_inputs.Loan_Recovered,t_monthly_pay_inputs.Estimate,t_monthly_pay_inputs.Festival_Bonus,t_monthly_pay_inputs.Other_Deductions,t_loan_history .Balance_Amount
from t_emp_pay_data
left join t_employee_details on t_employee_details.EmpID = t_emp_pay_data.EmpID
left join t_payroll on t_employee_details.EmpID = t_payroll.EmpID and t_payroll.PayOn = ?
@ -206,7 +206,7 @@ class Monthlypay_model extends Model
$count = $res[0]['count'];
}
// print_r($data);die;
if ($count == 0) {
$builder = $this->db->table('t_monthly_pay_inputs');

View File

@ -373,14 +373,12 @@ class Payroll_model extends Model
$this->db->table('t_payroll')->delete(['PayOn' => $PayOn]);
}
function getEmpID($q = '')
function getEmpID()
{
$builder = $this->db->table('t_employee_details')
->select('EmpID,FirstName,LastName');
if ($q == "addemppaydate") {
$builder->where('EmpID NOT IN (SELECT EmpID from t_emp_pay_data)', NULL, FALSE);
}
$query = $builder->get();
return $query->getResult();
}

View File

@ -1654,18 +1654,16 @@ QuantityRejected,ROUND(Quantity-ReceivedQuantity)as PendingQty,Per,
{
$subQuery = 'SELECT distinct LineItem.LineItemNo,LineItem.Per,LineItem.ServiceMaterialDescription,Req.ReqNo,Mat.MaterialCode,Mat.MaterialName,LineItem.ServiceMaterialDescription,LineItem.ServiceFrequency,
Mat.UOM,Quantity,ReceivedQuantity,Rate,Req.Status,Tax.*,
ROUND((RMCIncludingCustomersPerKG*Quantity),2)as Taxamount,LandingCharge,HighSeasSalesCharge,CustomDuty,ExciseDuty,ExciseDutyEdCess,CustomEdCess,POMast.ExchangeRate,POMast.ExchangeRateCalculatedon,POMast.TotalOrderValue as BasicValue,POMast.CapitalRange,AfterLandingCharge,AfterHighSeasSalesCharge,AfterCustomDuty,AfterExciseDuty,AfterExciseDutyEdCess,AddlExciseDuty,AfterAddlExciseDuty,Grossdutypayable,AvailableModvat,Grossexpensesduetocustomduty,purchaseratePerKG,CustomDutyExpensesPerKG,RMCIncludingCustomersPerKG,QuantityKG,BasicPriceInMTon,ProductPrice,CustomSHCess,AfterCustomSHCess,AfterExciseDutySHCess,ExciseDutySHCess,AfterCustomEdCess,ROUND((POMast.ExchangeRate*BasicPriceInMTon*Quantity),2) as BasicINRValue,Tax.TotalValue as ImportTotalValue,Tax.FreightType,Tax.NoOfTrip,Tax.FreightValue,Tax.AfterFreightValue,POMast.CurrencyType,
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join t_import_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
left join t_employee_details emp on Req.Requestedby = emp.EmpID
join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
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,
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
left join t_import_tax Tax on Tax.LineItemNo = LineItem.LineItemNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
left join t_employee_details emp on Req.Requestedby = emp.EmpID
left join t_departmentdetails Dept on Req.RequestedDept = Dept.DEPCode where LineItem.PONO =?';
//print_r($subQuery);
$query = $this->db->query($subQuery, array($PONO));
@ -1720,7 +1718,7 @@ left join t_employee_details emp on Req.Requestedby = emp.EmpID
Req.CostCenterCode,Dept.DepartmentName FROM t_purchaseorder_lineitem LineItem
join t_purchaseorder_master POMast on POMast.PONO = LineItem.PONO
join t_materialmaster Mat on Mat.MaterialCode = LineItem.MaterialCode
join t_service_tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo
left join t_service_tax ServiceTax on ServiceTax.LineItemNo = LineItem.LineItemNo
join t_requestion_master Req on Req.ReqNo = LineItem.ReqNo
join t_employee_details emp on Req.Requestedby = emp.EmpID

View File

@ -304,4 +304,18 @@ GROUP BY financial_year ";
return $r;
}
}
function findEmp($EmpId)
{
$builder = $this->db->table('tbl_users')
->select('tbl_users.*, t_employee_details.*')
->join('t_employee_details', 'tbl_users.EmpID = t_employee_details.EmpID' ,'left')
->where('tbl_users.EmpID', $EmpId);
$query = $builder->get();
return $query->getResult();
}
}

View File

@ -394,7 +394,7 @@ function onlyAlphabets(evt) {
function validatePF() {
var regpf = /^([a-zA-Z]){5}([0-9]){17}$/;
var regpf = /^\d{12}$/;
var PF = $('#pfno').val();
@ -465,7 +465,7 @@ legend {
</b>
</div>
<div class="col-md-5" style="margin-top: 20px;margin-bottom: 10px;text-align:right;">
<a href="<?php echo base_url() ?>employeeListing" class="btn btn-cancel" value="Back">Back</a>
<a href="<?php echo base_url() ?>employeeListing" class="btn btn-dark waves-effect waves-light" value="Back">Back</a>
</div>
<div class="col-md-1"></div>
</div>
@ -906,44 +906,7 @@ legend {
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="Allowances">Allowances</span>
<input type="text" name="Allowances"
value="<?php echo set_value('Allowances'); ?>"
class="form-control num" style="text-transform:uppercase;"
pattern="([0-9]{1,5}([.][0-9]{1,2})?)"
title="Enter the Valid Allowances, Minimum 1 digit, Maximum 5 digits" />
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Food_Allowances">Food Allowances(Per Day)</span>
<input type="text" name="Food_Allowances"
value="<?php echo set_value('Food_Allowances'); ?>"
class="form-control num"
pattern="([0-9]{1,3}([.][0-9]{1,2})?)"
onfocusout="validateFood();"
title="Enter the Valid Food Allowances, Minimum 1 Digit, Maximum 3 Digits" />
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Incentives">Incentives</span>
<input type="text" name="Incentives"
value="<?php echo set_value('Incentives'); ?>"
class="form-control num" style="text-transform:uppercase;"
pattern="([0-9]{1,5}([.][0-9]{1,2})?)"
title="Enter the Valid Allowances, Minimum 1 digit, Maximum 5 digits" />
</div>
</div>
<div class="col-md-3"></div>
</div>
<div class="col-md-12">
<div class="col-md-3">
@ -1005,8 +968,8 @@ legend {
<input type="text" id="pfno" name="pfno" maxlength="22"
onchange="validatePF();" class="form-control"
style="text-transform:uppercase"
pattern="([a-zA-Z]){5}([0-9]){17}"
title=" 5 Character and 17 Digit number (ex:ABCDE12345678901234567)"
pattern="\d{12}"
title="12 Digit number"
onkeypress="return alpha(event);">
</div>
</div>

View File

@ -46,7 +46,7 @@
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>supplierlisting">&nbsp;&nbsp;<span class="bold">Back</span></a>
<a class="btn btn-dark waves-effect waves-light" href="<?php echo base_url(); ?>supplierlisting"><span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
@ -161,7 +161,7 @@
<div class="form-row" style="margin-top:20px">
<div class=" col-md-4">
<label class="col-form-label" for="Bank_Address">Bank Address<span class="badge">*</span></label>
<input type="text" id="bankaddress" name="bankaddress" maxlength="200" class="form-control">
<input type="text" id="bankaddress" name="bankaddress" maxlength="200" class="form-control" required>
</div>
<div class=" col-md-4">
<label for="Cert_BANK">Select Bank Document<br/><small>(only .pdf, .doc, .png, .jpg)</small></label>

View File

@ -12,8 +12,8 @@
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>userListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
@ -21,263 +21,257 @@
<div class="row">
<div class="col-12">
<div class="p-2">
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewUser" method="post">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="form-row">
<div class=" col-md-3">
<label class="col-form-label" for="EmployeeID">Employee ID</label>
<select class="form-control required select" id="EmpList" name="EmpList">
<form role="form" id="addUser" action="<?php echo base_url() ?>addNewUser" method="post">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="form-row">
<div class=" col-md-3">
<label class="col-form-label" for="EmployeeID">Employee ID</label>
<select class="form-control required select" id="EmpList" name="EmpList" required>
<option value="">Select Emp ID</option>
<?php
if(!empty($EmpList))
{
foreach ($EmpList as $EID)
{
if (!empty($EmpList)) {
foreach ($EmpList as $EID) {
$EmpID = $EID->EmpID;
// if ($_POST['EmpList'] == $EmpID) {
// echo "<option value=\"".$EmpID."\" selected=\"selected\">".$EmpID.' - '. $EID->FirstName."</option>";
// } else{
echo "<option value=\"".$EmpID."\">".$EmpID.' - '. $EID->FirstName ."</option>";
// }
// if ($_POST['EmpList'] == $EmpID) {
// echo "<option value=\"".$EmpID."\" selected=\"selected\">".$EmpID.' - '. $EID->FirstName."</option>";
// } else{
echo "<option value=\"" . $EmpID . "\">" . $EmpID . ' - ' . $EID->FirstName . "</option>";
// }
}
}
?>
</select>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="FirstName">First Name</label>
<div class="col-md-3">
<label class="col-form-label" for="FirstName">First Name</label>
<input type="text" class="form-control required" readonly id="FirstName" name="FirstName" maxlength="128">
</div>
<div class="col-md-3">
<label class="col-form-label" for="LastName">Last Name</label>
<div class="col-md-3">
<label class="col-form-label" for="LastName">Last Name</label>
<input type="text" class="form-control required" readonly id="LastName" name="LastName" maxlength="128">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Designation">Designation</label>
<input type="text" class="form-control required " readonly id="Designation" name="Designation" maxlength="128">
<label class="col-form-label" for="Designation">Designation</label>
<input type="text" class="form-control required " readonly id="Designation" name="Designation" maxlength="128">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="Emailaddress">Email address</label>
<input type="text" class="form-control required " readonly id="MailID" name="MailID" maxlength="128">
</div>
<div class="col-md-3">
<label for="ContactNumber">Contact Number</label>
<input type="text" class="form-control required digits" readonly id="ContactNo" name="ContactNo" minlength="10"maxlength="10">
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="Emailaddress">Email address</label>
<input type="text" class="form-control required " readonly id="MailID" name="MailID" maxlength="128">
</div>
<div class="col-md-3">
<div class="col-md-3">
<label for="ContactNumber">Contact Number</label>
<input type="text" class="form-control required digits" readonly id="ContactNo" name="ContactNo" minlength="10" maxlength="10">
</div>
<div class="col-md-3">
<label for="Role">Role</label>
<select class="form-control required" id="role" name="role">
<select class="form-control required" id="role" name="role" required>
<option value="0">Select Role</option>
<?php
if(!empty($roles))
{
foreach ($roles as $rl)
{
?>
if (!empty($roles)) {
foreach ($roles as $rl) {
?>
<option value="<?php echo $rl->roleId ?>"><?php echo $rl->role ?></option>
<?php
<?php
}
}
?>
</select>
</select>
</div>
<div class="col-md-3">
<label for="Department">Department</label>
<select class="form-control required" id="role" name="role">
<select class="form-control required" id="Department" name="Department">
<option value="0">Select Department</option>
<?php
if(!empty($departments))
{
foreach ($departments as $dt)
{
?>
if (!empty($departments)) {
foreach ($departments as $dt) {
?>
<option value="<?php echo $dt->departmentId ?>"><?php echo $dt->departments ?></option>
<?php
<?php
}
}
?>
</select>
</select>
</div>
</div>
</div>
<div class="form-row" style="margin-top:20px">
</div>
<div class="form-row" style="margin-top:20px">
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="Password">Password</label>
<input type="password" class="form-control required" id="password" required name="password" maxlength="10">
<label for="Password">Password</label>
<input type="password" class="form-control required" id="password" required name="password" maxlength="10">
</div>
<div class="col-md-3">
<label for="ConfirmPassword">Confirm Password</label>
<input type="password" class="form-control required equalTo" required id="cpassword" name="cpassword" maxlength="10">
<div class="col-md-3">
<label for="ConfirmPassword">Confirm Password</label>
<input type="password" class="form-control required equalTo" required id="cpassword" name="cpassword" maxlength="10">
</div>
</div>
</div>
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
</div>
</div>
</form>
</div>
</div>
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
</div>
</div>
</form>
</div>
</div>
<?php
$listErrors = session()->getFlashdata('listErrors');
if ($listErrors) {
?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
</div>
</div>
<?php
$listErrors = session()->getFlashdata('listErrors');
if($listErrors)
{
?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end row -->
<?php } ?>
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
</div>
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<!-- <script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script> -->
<script>
$(document).ready(function() {
$('#EmpList').select2();
$("#EmpList").change(function() {
var empID = $(this).val();
console.log(empID);
if (empID) {
$.ajax({
url: "<?php echo base_url() ?>fetchEmployeeDetails",
type: 'POST',
data: { EmpID: empID },
success: function(data) {
console.log(data);
if (data.success) {
console.log(data.userInfo[0].FirstName);
$("#FirstName").val(data.userInfo[0].FirstName);
$("#LastName").val(data.userInfo[0].LastName);
$("#Designation").val(data.userInfo[0].Designation);
$("#MailID").val(data.userInfo[0].EmailId);
$("#ContactNo").val(data.userInfo[0].ContactNumber);
$("#Department").val(data.userInfo[0].DepartmentName);
} else {
alert('Employee not found');
}
},
error: function() {
alert('Failed to fetch employee details');
}
});
} else {
// Clear fields if no employee ID is selected
$("#FirstName").val('');
$("#LastName").val('');
$("#Designation").val('');
$("#MailID").val('');
$("#ContactNo").val('');
$("#Department").val('');
}
});
});
$('#addPop').click(function() {
if ($('#distriList option:selected').val() != null) {
if ($('#distriList option:selected').val() == 0) {
alert('please select Department');
} else {
var tempSelect = $('#distriList option:selected').val();
var tempText = $('#distriList option:selected').text();
var o = new Option(tempText, tempSelect);
var hidval = tempSelect;
var orgVal = $('#txtSelectedDepartment').val();
var Selectedval = ''
if (orgVal != '') {
Selectedval = orgVal + ':' + hidval;
} else {
Selectedval = hidval
}
$('#txtSelectedDepartment').val(Selectedval);
$(o).html(tempText);
$("#selectDistriList").append(o);
$('#distriList option:selected').remove();
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
$("#selectDistriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
tempSelect = '';
tempText = '';
Selectedval = '';
}
} else {
alert("Before add please select any position.");
}
});
</script>
<script>
$('#EmpList').select2();
$('#EmpList').change(function() {
var id = $('#EmpList').val();
var y = <?php echo json_encode($EmpList, JSON_PRETTY_PRINT) ?>;
function Validate() {
var isValid = true;
if(id != "0")
{
$.each(y, function(idx, obj) {
if(obj.EmpID === id)
{
$("#FirstName").val(obj.FirstName);
$("#LastName").val(obj.LastName);
$("#Designation").val(obj.Designation);
$("#Department").val(obj.DepartmentName);
$("#MailID").val(obj.EmailId);
$("#ContactNo").val(obj.ContactNumber);
}
});
}
else
{
alert('Please select Employee Details');
$("#FirstName").val('');
$("#LastName").val('');
$("#Designation").val('');
$("#Department").val('');
$("#MailID").val('');
$("#ContactNo").val('');
return false;
}
});
var fname = document.getElementById('FirstName').value;
if (!fname) {
alert('First Name is required');
isValid = false;
}
var email = document.getElementById('MailID').value;
var emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailPattern.test(email)) {
alert('Invalid email address');
isValid = false;
}
var password = document.getElementById('password').value;
var cpassword = document.getElementById('cpassword').value;
if (password !== cpassword) {
alert('Passwords do not match');
isValid = false;
}
return isValid;
}
</script>
$('#addPop').click(function ()
{
if ($('#distriList option:selected').val() != null)
{
if($('#distriList option:selected').val()==0 )
{
alert('please select Department');
}
else
{
var tempSelect = $('#distriList option:selected').val();
var tempText = $('#distriList option:selected').text();
var o = new Option(tempText,tempSelect);
var hidval = tempSelect;
var orgVal = $('#txtSelectedDepartment').val();
var Selectedval = ''
if(orgVal != '')
{
Selectedval = orgVal + ':' + hidval;
}
else
{
Selectedval = hidval
}
$('#txtSelectedDepartment').val(Selectedval);
$(o).html(tempText);
$("#selectDistriList").append(o);
$('#distriList option:selected').remove();
$("#distriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
$("#selectDistriList").attr('selectedIndex', '-1').find("option:selected").removeAttr("selected");
tempSelect = '';
tempText = '';
Selectedval = '';
}
}
else
{
alert("Before add please select any position.");
}
});
</script>

View File

@ -1,95 +1,93 @@
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Add Asset Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>supplierlisting">&nbsp;&nbsp;<span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="p-2">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Add Asset Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-dark waves-effect waves-light" href="<?php echo base_url(); ?>assetListing"><span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="p-2">
<form role="form" id="addAsset" action="<?php echo base_url() ?>addNewasset" method="post">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="form-row">
<div class="box-body">
<!-- Supplier Information -->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="form-row">
<div class=" col-md-3">
<label class="col-form-label" for="AssetName">Asset Name<span class="badge">*</span></label>
<input type="text" class="form-control " required style="text-transform:uppercase;" id="AssetName" name="AssetName" value="<?php echo isset($_POST['AssetName']) ? $_POST['AssetName'] : '' ?>">
<input type="text" class="form-control " required style="text-transform:uppercase;" id="AssetName" name="AssetName" value="<?php echo isset($_POST['AssetName']) ? $_POST['AssetName'] : '' ?>">
</div>
<div class=" col-md-3">
<label class="col-form-label" for="AssetDescription">Asset Description<span class="badge">*</span></label>
<input type="text" class="form-control required" id="Description" required name="Description" value="<?php echo isset($_POST['Description']) ? $_POST['Description'] : '' ?>">
<input type="text" class="form-control required" id="Description" required name="Description" value="<?php echo isset($_POST['Description']) ? $_POST['Description'] : '' ?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Asset User">Asset User<span class="badge">*</span></label>
<input type="text" class="form-control required" required id="User" name="User" value= "<?php echo isset($_POST['User']) ? $_POST['User'] : '' ?>">
<input type="text" class="form-control required" required id="User" name="User" value="<?php echo isset($_POST['User']) ? $_POST['User'] : '' ?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="AssetLocation">Asset Location<span class="badge">*</span></label>
<input type="text" class="form-control required" required id="Location" name="Location" value= "<?php echo isset($_POST['Location']) ? $_POST['Location'] : '' ?>">
<input type="text" class="form-control required" required id="Location" name="Location" value="<?php echo isset($_POST['Location']) ? $_POST['Location'] : '' ?>">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3" >
<label for="PurchaseOrderNumber">Purchase Order Number<span class="badge">*</span></label>
<select class="form-control required " required id="PONO" required name="PONO">
<option value="" >Select PO Number</option>
<?php
echo "////***////";
print_r($po);
if(!empty($po))
{
foreach ($po as $po)
{
$PONO = $po->PONO;
// if ($_POST['PONO'] == $PONO)
// {
// echo "<option value=\"".$PONO."\" selected=\"selected\">".$PONO.' - '. $SID->PONO."</option>";
// }
// else
// {
echo "<option value=\"".$PONO."\">".$PONO.' '. $SID->PONO ."</option>";
// }
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="PurchaseOrderNumber">Purchase Order Number<span class="badge">*</span></label>
<select class="form-control required " required id="PONO" required name="PONO">
<option value="">Select PO Number</option>
<?php
echo "////***////";
print_r($po);
if (!empty($po)) {
foreach ($po as $po) {
$PONO = $po->PONO;
// if ($_POST['PONO'] == $PONO)
// {
// echo "<option value=\"".$PONO."\" selected=\"selected\">".$PONO.' - '. $SID->PONO."</option>";
// }
// else
// {
echo "<option value=\"" . $PONO . "\">" . $PONO . "</option>";
// }
}
}
}
?>
</select>
?>
</select>
</div>
<div class="col-md-3">
<label for="SelectMaterialCode">Select Material Code</label>
<div class="col-md-3">
<label for="SelectMaterialCode">Select Material Code</label>
<select class="form-control required select2" required="" id="SelectMaterialCode" name="lineitem">
<option value="-1">Select Material Code</option>
<option value="-1">Select Material Code</option>
</select>
</div>
<div class="col-md-3">
<label for="UOM">UOM</label>
<input type="text" class="form-control required" id="UOM" readonly name="UOM" value="">
<input type="text" class="form-control required" id="UOM" readonly name="UOM" value="">
</div>
<div class="col-md-3">
<label for="Quantity">Quantity</label>
<input type="text" class="form-control required" id="Quantity" name="Quantity" value="">
<input type="text" class="form-control required" id="Quantity" name="Quantity" value="">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="Quantity">Description</label>
<input style="height: 70px;" type="text" class="form-control required" id="PODescription" readonly name="PODescription" value="<?php echo isset($_POST['PODescription']) ? $_POST['PODescription'] : '' ?>">
<input style="height: 70px;" type="text" class="form-control required" id="PODescription" readonly name="PODescription" value="<?php echo isset($_POST['PODescription']) ? $_POST['PODescription'] : '' ?>">
</div>
</div>
<div class="form-row" style="margin-top:20px">
@ -99,355 +97,337 @@
<input type="text" class="form-control required" id="AssetDept" readonly name="" value="">
</div>
<div class="col-md-3">
<label for="Quantity">Purchase Date</label>
<input id="DateOfPurchase" name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DateOfPurchase']) ? $_POST['DateOfPurchase'] : '' ?>">
<label for="Quantity">Purchase Date<span style="color:red">*</span></label>
<input type="date" id="DateOfPurchase" name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo isset($_POST['DateOfPurchase']) ? $_POST['DateOfPurchase'] : '' ?>">
</div>
<div class="col-md-3">
<label for="SupplierName">Supplier Name</label>
<input type="hidden" name="SupplierName" id="SupID">
<input id="SupplierName" readonly name="" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['SupplierName']) ? $_POST['SupplierName'] : '' ?>">
<input id="SupplierName" readonly name="" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo isset($_POST['SupplierName']) ? $_POST['SupplierName'] : '' ?>">
</div>
<div class="col-md-3">
<label for="DeliveryDate">Delivery Date</label>
<input id="DeliveryDate" readonly name="DeliveryDate" maxlength="10" class="form-control" >
<input id="DeliveryDate" readonly name="DeliveryDate" maxlength="10" class="form-control">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label for="DateOfCommission">Date Of Commission<span style="color:red">*</span></label>
<input id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo isset($_POST['DateOfCommission']) ? $_POST['DateOfCommission'] : '' ?>">
<input type="date" id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value="<?php echo isset($_POST['DateOfCommission']) ? $_POST['DateOfCommission'] : '' ?>">
</div>
<div class="col-md-3">
<label for="AssetValue">Asset Value</label>
<input type="text" class="form-control" id="Assetvalue" name="Assetvalue"onkeypress="return isNumberKey(event)" title="Please Enter currency value" maxlength="255" value= "<?php echo isset($_POST['Assetvalue']) ? $_POST['Assetvalue'] : '' ?>">
</div>
<input type="text" class="form-control" id="Assetvalue" name="Assetvalue" onkeypress="return isNumberKey(event)" title="Please Enter currency value" maxlength="255" value="<?php echo isset($_POST['Assetvalue']) ? $_POST['Assetvalue'] : '' ?>">
</div>
<div class="col-md-3">
<label for="Asset Status">Asset Status</label>
<select class="form-control required select2" required id="AssetStatus" name="AssetStatus">
<option value="" >Select Asset Status</option>
<select class="form-control required select2" required id="AssetStatus" name="AssetStatus">
<option value="">Select Asset Status</option>
<?php
if(!empty($AssetStatus))
{
foreach ($AssetStatus as $SID)
{
if (!empty($AssetStatus)) {
foreach ($AssetStatus as $SID) {
$AssetValue = $SID->ConfigValue;
// if ($_POST['AssetStatus'] == $AssetValue)
// {
// echo "<option value=\"".$AssetValue."\" selected=\"selected\">".$AssetValue."</option>";
// }
// else
// {
echo "<option value=\"".$AssetValue."\">".$AssetValue."</option>";
// }
// if ($_POST['AssetStatus'] == $AssetValue)
// {
// echo "<option value=\"".$AssetValue."\" selected=\"selected\">".$AssetValue."</option>";
// }
// else
// {
echo "<option value=\"" . $AssetValue . "\">" . $AssetValue . "</option>";
// }
}
}
?>
</select>
</select>
</div>
<div class="col-md-3">
<label for="Remarks">Remarks</label>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value= "<?php echo isset($_POST['Remarks']) ? $_POST['Remarks'] : '' ?>">
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value="<?php echo isset($_POST['Remarks']) ? $_POST['Remarks'] : '' ?>">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo (isset($_POST['isactive']) ? 'checked' : '') ?>> <label for="">IsActive</label>
<input type="checkbox" id="isactive" name="isactive" <?php echo (isset($_POST['isactive']) ? 'checked' : '') ?>> <label for="">IsActive</label>
</div>
</div>
</div>
<div class="col-md-12 text-right">
</div>
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
</div>
</div>
</form>
</div>
</div>
<?php
$listErrors = session()->getFlashdata('listErrors');
if($listErrors)
{
?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
</div>
</div>
</form>
</div>
</div>
<?php } ?>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
$listErrors = session()->getFlashdata('listErrors');
if ($listErrors) {
?>
<div class="row">
<div class="col-md-12">
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
<?php } ?>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
</div>
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<script>
$('#PONO').on('change',function(){
var PONO = $(this).val();
$('#SupplierName').val('');
$('#SupID').val('');
$('#MaterialCode').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#depcode').val('');
$('#AssetDept').val('');
$('#DateOfPurchase').val('');
$('#DeliveryDate').val('');
$('#PODescription').val('');
$('#Assetvalue').val('');
// alert(PONO);
if(PONO){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getpodetails",
data:'PONO='+PONO,
dataType: 'json',
success:function(data){
//alert(data);
var line ='';
$('#PONO').on('change', function() {
var PONO = $(this).val();
$('#SupplierName').val('');
$('#SupID').val('');
$('#MaterialCode').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#depcode').val('');
$('#AssetDept').val('');
$('#DateOfPurchase').val('');
$('#DeliveryDate').val('');
$('#PODescription').val('');
$('#Assetvalue').val('');
// alert(PONO);
if (PONO) {
$.ajax({
type: 'POST',
url: "<?php echo base_url() ?>assetdetails/getpodetails",
data: 'PONO=' + PONO,
dataType: 'json',
success: function(data) {
//alert(data);
var line = '';
$('#SelectMaterialCode').empty();
//alert('before');
$.each(data, function (i, item) {
//alert(item);
$.each(data, function(i, item) {
//alert(item);
//line ='<option>select Material Code</option>';
//line ='<option>select Material Code</option>';
//line +='<option value='+item.LineItemNo+'>'+item.LineItemNo+'-'+item.MaterialCode+'</option>';
//$('#DeliveryDate').val(item.DeliveryDate);
line+=item;
$('#SelectMaterialCode').append(line);
//$('#DeliveryDate').val(item.DeliveryDate);
line += item;
$('#SelectMaterialCode').append(line);
});
}
});
}
});
}
});
$('#SelectMaterialCode').on('change',function(){
var line = $(this).val();
});
$('#SelectMaterialCode').on('change', function() {
var line = $(this).val();
//line +='<option>select Material Code</option>'
if(line){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getline",
data:'line='+line,
success:function(data){
// alert(data);
var id = $('#SelectMaterialCode').val();
$.each(JSON.parse(data), function (i, item) {
if(id == item.LineItemNo){
$('#DateOfPurchase').val(item.PODate);
if(item.DeliveryDate != null )
{
var date = new Date(item.DeliveryDate);
var date1 = (date.getDate()+ '-' + (date.getMonth() + 1)+ '-' + date.getFullYear());
if(item.DeliveryDate == '0000-00-00' || item.DeliveryDate == '30-11--0001')
{
$('#DeliveryDate').val('');
}
else
{
//alert(item.DeliveryDate+ ',' + date1);
$("#DeliveryDate").val(date1);
}
if (line) {
$.ajax({
type: 'POST',
url: "<?php echo base_url() ?>assetdetails/getline",
data: 'line=' + line,
success: function(data) {
// alert(data);
//var correctDate = [DDate.getDate(),DDate.getMonth()+1,DDate.getFullYear()].join("/");
//alert(correctDate);
var id = $('#SelectMaterialCode').val();
$.each(JSON.parse(data), function(i, item) {
if (id == item.LineItemNo) {
}
else
{
$('#DeliveryDate').val('');
}
$('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID);
$('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName);
//alert(item.TotalValue);
$('#Assetvalue').val(item.TotalValue);
var date = new Date(item.PODate);
var date3 = (date.getDate()+ '-' + (date.getMonth() + 1)+ '-' + date.getFullYear());
$("#DateOfPurchase").val(date3);
}
//line ='<option>'+item.LineItemNo+'</option>';
// $('#POLineItem').append(line);
});
}
});
$('#DateOfPurchase').val(item.PODate);
if (item.DeliveryDate != null) {
var date = new Date(item.DeliveryDate);
var date1 = (date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullYear());
if (item.DeliveryDate == '0000-00-00' || item.DeliveryDate == '30-11--0001') {
$('#DeliveryDate').val('');
} else {
//alert(item.DeliveryDate+ ',' + date1);
$("#DeliveryDate").val(date1);
}
//var correctDate = [DDate.getDate(),DDate.getMonth()+1,DDate.getFullYear()].join("/");
//alert(correctDate);
} else {
$('#DeliveryDate').val('');
}
$('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID);
$('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName);
//alert(item.TotalValue);
$('#Assetvalue').val(item.TotalValue);
var date = new Date(item.PODate);
var date3 = (date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullYear());
$("#DateOfPurchase").val(date3);
}
//line ='<option>'+item.LineItemNo+'</option>';
// $('#POLineItem').append(line);
});
}
});
}
});
function validate()
{
if($("#AssetName").val().length <1)
{
alert('Please Enter the AssetName');
$("#AssetName").focus();
return false;
}
if($('#Description').val().length <1)
{
alert('Please Enter the Asset Description');
$("#Description").focus();
return false;
});
function validate() {
if ($("#AssetName").val().length < 1) {
alert('Please Enter the AssetName');
$("#AssetName").focus();
return false;
}
if ($('#Description').val().length < 1) {
alert('Please Enter the Asset Description');
$("#Description").focus();
return false;
}
if ($('#User').val().length < 1) {
alert('Please Enter the Asset User');
$("#User").focus();
return false;
}
if ($('#Location').val().length < 1) {
alert('Please Enter the Asset Location');
$("#Location").focus();
return false;
}
if ($("#PONO option:selected").val() == "") {
alert('Please Select PO Number ');
$("#PONO").focus();
return false;
}
if ($("option:selected", $("#SelectMaterialCode")).val() == '-1') {
alert('Please Select MaterialCode');
return false;
}
if ($('#DateOfCommission').val().length < 1) {
alert('Please Enter the DateOfCommission');
$("#DateOfCommission").focus();
return false;
}
if ($("option:selected", $("#AssetStatus")).val() == '-1') {
alert('Please Select AssetStatus');
return false;
}
}
if($('#User').val().length <1)
{
alert('Please Enter the Asset User');
$("#User").focus();
return false;
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear();
var SIAStartYear = year - 2015;
var mindt = year - 70;
var maxdt = year - 15;
// $("#PONO").select2();
// $("#SelectMaterialCode").select2();
//$("#AssetStatus").select2();
$("#DateOfCommission").datepicker({
minDate: new Date(year - SIAStartYear, 1, 1),
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
});
$("#DateOfPurchase").datepicker({
minDate: new Date(year - SIAStartYear, 1, 1),
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
});
});
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31 &&
(charCode < 48 || charCode > 57))
return false;
return true;
}
if($('#Location').val().length <1)
{
alert('Please Enter the Asset Location');
$("#Location").focus();
return false;
}
if($("#PONO option:selected").val() == "")
{
alert('Please Select PO Number ');
$("#PONO").focus();
return false;
}
if($("option:selected", $("#SelectMaterialCode")).val() == '-1')
{
alert('Please Select MaterialCode');
return false;
}
if($('#DateOfCommission').val().length <1)
{
alert('Please Enter the DateOfCommission');
$("#DateOfCommission").focus();
return false;
}
if($("option:selected", $("#AssetStatus")).val() == '-1')
{
alert('Please Select AssetStatus');
return false;
}
}
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear() ;
var SIAStartYear = year - 2015;
var mindt = year-70;
var maxdt = year-15;
// $("#PONO").select2();
// $("#SelectMaterialCode").select2();
//$("#AssetStatus").select2();
$("#DateOfCommission").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
});
$("#DateOfPurchase").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
});
});
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
</script>

View File

@ -1,81 +1,82 @@
<style>
th{
th {
background-color: #ddd;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Add Config Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>configlisting">&nbsp;&nbsp;<span class="bold">Back</span></a>
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" id="adddepartment" action="<?php echo base_url() ?>savedepartment" method="post">
<div class="form-row" style="margin-top:10px">
<div class=" col-md-3">
<label class="col-form-label" for="ConfigurationName">Configuration Name</label>
<?php
$data = array('name' => 'configurationname', 'value' => set_value('configurationname'), 'id' => 'configurationname', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data); ?>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class=" col-md-3">
<label class="col-form-label" for="Comments">Comments</label>
<?php
$data = array('name' => 'Comments', 'value' => set_value('Comments'), 'id' => 'Comments', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12 text-right">
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;" class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Configuration</a>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12">
<table id="configtable" class="table table-bordered table-hover responsive-utilities jambo_table" style="background-color:#fff;font-size:12px;" >
<thead>
<th>S.NO</th>
<th>Configuration Value</th>
<th>Action</th>
</thead>
<tbody id="tempAppend">
<!--<tr>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"> Add Config Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-dark waves-effect waves-light" href="<?php echo base_url(); ?>configlisting"><span class="bold">Back</span></a>
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" id="addconfig" action="<?php echo base_url() ?>configurationctrl/saveconfig" method="post">
<div class="form-row" style="margin-top:10px">
<div class=" col-md-3">
<label class="col-form-label" for="ConfigurationName">Configuration Name</label>
<?php
$data = array('name' => 'configurationname', 'value' => set_value('configurationname'), 'id' => 'configurationname', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data); ?>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class=" col-md-3">
<label class="col-form-label" for="Comments">Comments</label>
<?php
$data = array('name' => 'Comments', 'value' => set_value('Comments'), 'id' => 'Comments', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data);
?>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12 text-right">
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;" class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Configuration</a>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12">
<table id="configtable" class="table table-bordered table-hover responsive-utilities jambo_table" style="background-color:#fff;font-size:12px;">
<thead>
<th>S.NO</th>
<th>Configuration Value</th>
<th>Action</th>
</thead>
<tbody id="tempAppend">
<!--<tr>
<td>001</td>
<td>100</td>
@ -84,127 +85,127 @@
<a><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>-->
</tbody>
</tbody>
</table>
<input type="hidden" name="newhidden" id="newhidden" />
</div>
</table>
<input type="hidden" name="newhidden" id="newhidden" />
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
</div>
</form>
</div>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white; margin-right: 15px;width: 80px;" value="Reset" />
<input type="submit" onclick="return Validate();" value="Submit" class="btn btn-success">
</div>
</form>
</div>
<!-- end row -->
</div>
</div> <!-- end card -->
</div><!-- end col -->
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
</div>
t <!-- end row -->
</div> <!-- container -->
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
</div>
t <!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
<div class="modal fade" id="AddConfiguration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Add Configuration</center>
</h4>
</div>
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Add Configuration</center>
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<!-- Modal Body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<form class="form-horizontal" role="form">
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Configuration Value :
</div>
<div class="col-md-5">
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Configuration Value :
</div>
<div class="col-md-5">
<input class="form-control" name="ConfigValue" class="form-control" id="ConfigValue" type="text">
<input class="form-control" name="ConfigValue" class="form-control" id="ConfigValue" type="text">
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success font tempClickAdd" ID="tempClickAdd" style="margin-top: -24px;"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add</span></a>
</div>
</div>
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success font tempClickAdd" ID="tempClickAdd" style="margin-top: -24px;"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add</span></a>
</div>
</div>
</div>
</div>
<div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Edit Configuration</center>
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Configuration Value :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'EditConfigValue', 'value' => set_value('EditConfigValue'), 'id' => 'EditConfigValue', 'class' => 'form-control');
echo form_input($data);
?>
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Edit Configuration</center>
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Configuration Value :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'EditConfigValue', 'value' => set_value('EditConfigValue'), 'id' => 'EditConfigValue', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success font tempClickEdit" ID="tempClickEdit" style="margin-top: -24px;"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Edit</span></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success font tempClickEdit" ID="tempClickEdit" style="margin-top: -24px;"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Edit</span></a>
</div>
</div>
</div>
</div>
<script type="text/html" id="tempList">
<tr id="<%=index%>">
@ -376,5 +377,4 @@
}
}
</script>
</script>

View File

@ -20,7 +20,7 @@
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>departmentListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
<a class="btn btn-dark waves-effect waves-light" href="<?php echo base_url(); ?>departmentListing"><span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->

View File

@ -1,25 +1,30 @@
<script>
$(document).ready(function(){
$(document).ready(function() {
$("#loan_issued_date").datepicker({
minDate : 'now',
// maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
$("#due_started").datepicker({
minDate :'now',
//maxDate : 'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+1'
});
$("#loan_issued_date").datepicker({
minDate: 'now',
// maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+0'
});
$("#due_started").datepicker({
minDate: 'now',
//maxDate : 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
yearRange: '-100:+1'
});
});
</script>
<style type="text/css">
.num {
text-align:right;
.num {
text-align: right;
}
</style>
@ -27,293 +32,151 @@ $("#due_started").datepicker({
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<center><b><h3 class="box-title">Add Employee Pay</h3></b></center>
<center><b>
<h3 class="box-title">Add Employee Pay</h3>
</b></center>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url() ?>emppayListings" class="btn btn-success" value="Back"/>Back</a>
</div>
<br>
<div style="text-align:right;">
<a href="<?php echo base_url() ?>emppayListings" class="btn btn-success" value="Back" />Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<!-- general form elements -->
<div class="box box-success">
<!-- form start -->
<form role="form" id="addemppaydate" action="<?php echo base_url() ?>emppaydate/addNewemppay" method="post" name="addform" >
<form role="form" id="addemppaydate" action="<?php echo base_url() ?>emppaydate/addNewemppay"
method="post" name="addform">
<div class="box-body">
<div class="col-md-12">
<legend>Pay Details</legend>
</div>
<div class="row">
<!--<div class="col-md-4">
<div class="form-group">
<label for="Pay_Data_ID">Pay Data ID:</label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Pay_Data_ID','value' => set_value('Pay_Data_ID'), 'class' => 'form-control' ,'style'=>'text-transform:uppercase;');
echo form_input($data);
?>
</div>
</div>
</div>-->
<div class="col-md-12">
<legend>Loan Details</legend>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<span for="EmpID">Employee ID</span><font color="Red">*</font>
<span for="EmpID">Employee ID</span>
<font color="Red">*</font>
<div class="form-group">
<?php
<?php
$Employee = array("-1"=>'Select Employee');
if(!empty($empdetails)){
foreach($empdetails as $emp){
$EmpID=$emp->EmpID;
$Employee+= array($EmpID => $emp->EmpID . "-" . $emp->FirstName . "-" . $emp->LastName);
// $Employee = array_merge($Employee,$Employee1);
$Employee+= array($EmpID => $emp->EmpID . "-" . $emp->FirstName);
}
}
//$data=array('name'=>'EmpID','value'=>$Employee,'id'=>'EmpID','class' => 'form-control');
$js = array('id'=> 'emp');
echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control"',$js);
//echo form_dropdown($data);
?>
</div>
echo form_dropdown('EmpID', $Employee,set_value('EmpID'),'class="form-control"',$js);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Basic_Pay">Total Salary</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Total_salary','id' => 'Total_salary','value' => set_value('Total_salary'),'pattern' => '([0-9]{1,8}([.][0-9]{1,2})?)', 'class' => 'form-control num', 'style'=>'text-transform:uppercase;','title' => 'Enter Valid Total salary Amount,Minimum Four Digit Positive Number','onchange'=>'calculalteHRA();');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Basic_Pay">Basic Pay</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Basic_Pay','id' => 'Basic_Pay','value' => set_value('Basic_Pay'),'pattern' => '[0-9]{4,6}', 'class' => 'form-control num', 'style'=>'text-transform:uppercase;','title' => 'Enter Valid Basic Pay Amount,Minimum Four Digit Positive Number','readonly'=>'readonly');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="HRA_Rate">HRA Rate(%)</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'HRA_Rate','id'=>'HRA_Rate','value' => set_value('HRA_Rate'), 'class' => 'form-control num','style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,2}([.][0-9]{1,2})?)', 'title'=>'Enter the Valid HRA Rate,Minimum 1 digit,Maximum 2 digit','onfocusout'=>'validateHRA();','onchange'=>'calculalteHRA();');
echo form_input($data);
?>
</div>
</div>
</div>
</div><!--row completed div-->
<div class="row">
<div class="col-md-3">
<div class="form-group">
<span for="HRA_Rate">HRA Amount</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'HRA_Amount','id'=>'HRA_Amount','value' => set_value('HRA_Amount'), 'class' => 'form-control num','style'=>'text-transform:uppercase;','readonly'=>'readonly');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Allowances">Allowances</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Allowances','value' => set_value('Allowances'), 'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,5}([.][0-9]{1,2})?)','title'=>'Enter the Valid Allowances,Minimum 1 digit , Maximum 5 digit ');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="PF_Rate">PF Rate(%)</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'PF_Rate','value' => set_value('PF_Rate'),'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,2}([.][0-9]{1,2})?)', 'title'=>'Enter the valid PF Rate,Minimum 1 digit,Maximum 2 digit');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="ESI_Rate">ESI Rate(%)</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'ESI_Rate','value' => set_value('ESI_Rate'), 'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,2}([.][0-9]{1,2})?)','title'=>'Enter the Valid ESI Rate,Minimum 1 digit,Maximum 2 digit');
echo form_input($data);
?>
</div>
</div>
</div>
</div><!--row completed div-->
<div class="row">
<!--for food allowances-->
<div class="col-md-3">
<div class="form-group">
<span for="Food_Allowances">Food Allowances(Per Day)</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Food_Allowances','value' => set_value('Food_Allowances'), 'class' => 'form-control num','pattern'=>'([0-9]{1,3}([.][0-9]{1,2})?)','onfocusout'=>'validateFood();', 'title'=>'Enter the Valid Food Allowances,Minimun 1 Digit,Maximum 3 Digit');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Incentives">Incentives</span><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Incentives','value' => set_value('Incentives'), 'class' => 'form-control num' ,'style'=>'text-transform:uppercase;','pattern'=>'([0-9]{1,5}([.][0-9]{1,2})?)','title'=>'Enter the Valid Allowances,Minimum 1 digit , Maximum 5 digit ');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
<!--row completed div-->
<div class="col-md-12">
<legend>Loan Details</legend>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Pay_Data_ID">Loan Amount</span>
<input type="text" class="form-control num" id="Loan_Amount" name="Loan_Amount" value="0.00" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
<span for="Pay_Data_ID">Loan Amount</span>
<input type="text" class="form-control num" id="Loan_Amount"
name="Loan_Amount" value="0.00" pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 4 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="EmpID">Loan Issue(d) Date</span>
<input type="text" class="form-control num" id="loan_issued_date" name="loan_issued_date" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Monthly Due</span>
<input type="text" value="0.00" class="form-control num" id="monthly_due" name="monthly_due" value="" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
<span for="EmpID">Loan Issue(d) Date</span>
<input type="text" class="form-control num" id="loan_issued_date"
name="loan_issued_date" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Due Started</span>
<input type="text" class="form-control requried num" id="due_started" name="due_started" value="" onchange="dateCalulation();">
</div>
<span for="Basic_Pay">Monthly Due</span>
<input type="text" value="0.00" class="form-control num" id="monthly_due"
name="monthly_due" value="" pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 1 digit,Maximum 6 Digit" onchange="duecalculation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">No Of Due(s)</span>
<input type="text" value="0" class="form-control requried num" id="no_of_due" name="no_of_due" value="" pattern="[0-9]{1,2}" title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
<span for="Basic_Pay">Due Started</span>
<input type="text" class="form-control requried num" id="due_started"
name="due_started" value="" onchange="dateCalulation();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Paid Amount</span>
<input type="text" value="0.00" class="form-control requried num" id="Paid_Amount" name="Paid_Amount" value="0" pattern="([0-9]{1,7}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
<span for="Basic_Pay">No Of Due(s)</span>
<input type="text" value="0" class="form-control requried num"
id="no_of_due" name="no_of_due" value="" pattern="[0-9]{1,2}"
title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<input type="hidden" id="remaining_due" name="remaining_due" value="0">
<input type="hidden" id="paid_due" name="paid_due" value="0">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Paid Amount</span>
<input type="text" value="0.00" class="form-control requried num"
id="Paid_Amount" name="Paid_Amount" value="0"
pattern="([0-9]{1,7}([.][0-9]{1,2})?)"
title="Minimum 1 digit,Maximum 2 Digit" readonly>
</div>
</div>
</div>
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-success" value="Submit" onmouseover="finalCheck();"/>
<input type="reset" class="btn btn-success" value="Reset" />
</div>
<input type="hidden" id="remaining_due" name="remaining_due" value="0">
<input type="hidden" id="paid_due" name="paid_due" value="0">
</div>
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-success" value="Submit"
onmouseover="finalCheck();" />
<input type="reset" class="btn btn-success" value="Reset" />
</div>
</div><!-- /.box-body -->
</form><!-- form closed -->
</div><!-- -->
</div><!-- -->
<div class="col-md-4">
@ -325,7 +188,7 @@ $("#due_started").datepicker({
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
@ -338,119 +201,103 @@ $("#due_started").datepicker({
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?> </div>
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?>
</div>
</div>
</div>
</div> <!-- first row closed-->
</div> <!-- first row closed-->
</section>
</div><!--content-wrapper closed-->
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
</div>
<!--content-wrapper closed-->
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<script>
function calculalteHRA()
{
//var empid=document.getElementById('emp').value;
//alert(empid);
function calculalteHRA() {
//var empid=document.getElementById('emp').value;
//alert(empid);
var Totalsalary = document.getElementById('Total_salary').value;
var HRA=document.getElementById('HRA_Rate').value;
//if(EmpID == -1){alert("Select Employee ID..!");}
if(HRA==''){
alert("Please Enter HRA RATE..");
document.getElementById('HRA_Rate').focus();
}else if(Totalsalary==''){
alert("Please Enter Total Salary..");
document.getElementById('total_salary').focus();
}
else{
var temp=(Totalsalary*(HRA/100));
var basic=Totalsalary-temp;
document.getElementById('Basic_Pay').value=basic;
document.getElementById('HRA_Amount').value=temp;
}
var HRA = document.getElementById('HRA_Rate').value;
//if(EmpID == -1){alert("Select Employee ID..!");}
if (HRA == '') {
alert("Please Enter HRA RATE..");
document.getElementById('HRA_Rate').focus();
} else if (Totalsalary == '') {
alert("Please Enter Total Salary..");
document.getElementById('total_salary').focus();
} else {
var temp = (Totalsalary * (HRA / 100));
var basic = Totalsalary - temp;
document.getElementById('Basic_Pay').value = basic;
document.getElementById('HRA_Amount').value = temp;
}
}
function duecalculation()
{
var totaldue=0;
var loan=document.getElementById('Loan_Amount').value;
var due=document.getElementById('monthly_due').value;
if(loan != 0)
{
if(due == 0)
{
alert("Enter Monthly Due Amount....!");
$('#monthly_due').focus();
}
else
{
totaldue=loan/due;
if(totaldue < 1)
{
alert("Please Enter Correct Due Amount..!");
$('#monthly_due').focus();
}
else{
document.getElementById('no_of_due').value=Math.ceil(totaldue);
var noofdues=document.getElementById('no_of_due').value;
$('#remaining_due').val(noofdues);
}
}
}//else if(loan == "" || loan == 0)
//alert(totaldue);
dateCalulation();
function duecalculation() {
var totaldue = 0;
var loan = document.getElementById('Loan_Amount').value;
var due = document.getElementById('monthly_due').value;
if (loan != 0) {
if (due == 0) {
alert("Enter Monthly Due Amount....!");
$('#monthly_due').focus();
} else {
totaldue = loan / due;
if (totaldue < 1) {
alert("Please Enter Correct Due Amount..!");
$('#monthly_due').focus();
} else {
document.getElementById('no_of_due').value = Math.ceil(totaldue);
var noofdues = document.getElementById('no_of_due').value;
$('#remaining_due').val(noofdues);
}
}
} //else if(loan == "" || loan == 0)
//alert(totaldue);
dateCalulation();
}
function dateCalulation()
{
//alert('j');
var loanamount=document.getElementById('Loan_Amount').value;
if(loanamount == 0.00 || loanamount == "")
{
$('#loan_issued_date').val("");
$('#due_started').val("");
$('#monthly_due').val("0.00");
$('#remaining_due').val(0);
$('#no_of_due').val(0);
$('#Loan_Amount').val("0.00");
$('#paid_due').val(0);
$('#Paid_Amount').val("0.00");
}
function dateCalulation() {
//alert('j');
var loanamount = document.getElementById('Loan_Amount').value;
if (loanamount == 0.00 || loanamount == "") {
$('#loan_issued_date').val("");
$('#due_started').val("");
$('#monthly_due').val("0.00");
$('#remaining_due').val(0);
$('#no_of_due').val(0);
$('#Loan_Amount').val("0.00");
$('#paid_due').val(0);
$('#Paid_Amount').val("0.00");
}
}
function finalCheck()
{
var loanamount=document.getElementById('Loan_Amount').value;
if(loanamount != "" && loanamount != 0.00)
{
var idate=document.getElementById('loan_issued_date').value;
var due=document.getElementById('monthly_due').value;
var dsdate=document.getElementById('due_started').value;
if(idate == "" || due == "" || due == 0.00 || dsdate == ""){
alert("Enter All Loan Information Correctly...!");
}
}
function finalCheck() {
var loanamount = document.getElementById('Loan_Amount').value;
if (loanamount != "" && loanamount != 0.00) {
var idate = document.getElementById('loan_issued_date').value;
var due = document.getElementById('monthly_due').value;
var dsdate = document.getElementById('due_started').value;
if (idate == "" || due == "" || due == 0.00 || dsdate == "") {
alert("Enter All Loan Information Correctly...!");
}
}
}
</script>
</script>

View File

@ -69,14 +69,7 @@
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="view_inward_gate_register" class="table dt-responsive nowrap w-100">
<thead>
</thead>
<tbody>
</tbody>
</table>
<table class="table table-bordered table-hover" id="asset_list_table" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>

View File

@ -329,6 +329,7 @@ $currentday = date('d');
<th class="celda_encabezado_general" >Paid Leave</th>
<th class="celda_encabezado_general" >Days Worked</th>
<th class="celda_encabezado_general" >Absent</th>
<th class="celda_encabezado_general" >Total Sunday</th>
</tr>
@ -391,6 +392,7 @@ $currentday = date('d');
<td class="celda_normal" id="<?php echo $row.'PL';?>"><?php if(!empty($a->Paid_Leave)){echo number_format($a->Paid_Leave,2,'.','.');}else{echo "0.00";}?></td>
<td class="celda_normal" id="<?php echo $row.'DW';?>"><?php if(!empty($a->Days_Worked)){echo $a->Days_Worked;}else{echo "0.00";}?></td>
<td class="celda_normal"id="<?php echo $row.'AB';?>"><?php if(!empty($a->Absent)){echo $a->Absent;}else{echo "0.00";}?></td>
<td class="celda_normal"id="<?php echo $row.'TS';?>"><?php if(!empty($noofsundays)){echo $noofsundays;}else{echo "0";}?></td>
</tr>
<?php }?>
@ -428,29 +430,28 @@ $currentday = date('d');
//alert(s);
if(s == 0){
resetFinalValues();
resetFinalValues();
var Totalnoofdays = <?php echo $monthdays?>;
var alldata = $("#attendance").tableToJSON();
// alert(JSON.stringify(alldata));
alldata=JSON.stringify(alldata);
// alert(alldata);
var month = $('#month').val();
var currentmonth = month.substr(0,3);
var currentyear = month.substr(4,4);
// alert(currentyear);
var montharray = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var currentmonth = jQuery.inArray(currentmonth,montharray);//!== -1
currentmonth++;
var currentmonth = jQuery.inArray(currentmonth,montharray);//!== -1
currentmonth++;
//alert(currentmonth);
var currentdate = '01-'+currentmonth+'-'+currentyear;
var currentdate = '01-'+currentmonth+'-'+currentyear;
var totaldata = 0;
$('.content').loader('show');
$.ajax({
data:{param1:alldata,param2:currentdate,param3:Totalnoofdays},
data:{param1:alldata,param2:currentdate,param3:Totalnoofdays},
//dataType:"json",
type:"POST",
url:"<?php echo base_url() ?>monthlypay/saveAttendance",
@ -643,11 +644,13 @@ function myFunction(p,i,v)
var totalworkingHrs=0;
var sundayWorkingHr=0;
var totalOTHrs = 0;
var paidleave = 0;
var totalDaysWorked=0;
var absent = 0;
var sundays = <?php echo $noofsundays?>;
var sundaysArray = <?php echo json_encode($sundayarray); ?>;
var publicholidays = <?php echo $noofpublicholidays?>;
var totaldays = <?php echo $monthdays?>;
@ -681,12 +684,30 @@ function myFunction(p,i,v)
var str1 = str.substr(-1);
var str2 = str.substr(-2);
var str3 = str.substr(-3);
if(str1 == 'W')
{
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
totalworkingHrs += current;
sundayValidation = false;
let dateInt = +str3.replace(/\D/g, '');
sundaysArray.forEach(element => {
if(+element == dateInt){
sundayValidation = true;
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
sundayWorkingHr += current;
}
});
if(sundayValidation == false){
var current = value.textContent == '' ? 0:parseFloat(value.textContent);
totalworkingHrs += current;
}
if(current == 0){absent++;}
}
else
{
@ -702,28 +723,29 @@ function myFunction(p,i,v)
// break;
});
// if(paidleave == 1 )
// {
// absent = 0;
// alert('if');
// }
// if(paidleave == 0)
// {
// absent = 0;
// alert('else if');
// }
// else
// {
// // absent = paidleave-0;
// // paidleave = 0;
// absent = paidleave;
// paidleave = 0;
// alert('else');
// }
// if(paidleave == 0)
// {
// absent = 0;
// alert('else if');
// }
// else
// {
// // absent = paidleave-0;
// // paidleave = 0;
// absent = paidleave;
// paidleave = 0;
// alert('else');
// }
TotalOT = totalOTHrs + sundayWorkingHr;
document.getElementById(totalhrsid).textContent = parseFloat(totalworkingHrs).toFixed(2);// == ''?0:parseFloat(totalworkingHrs));
document.getElementById(totalothrsid).textContent = parseFloat(totalOTHrs).toFixed(2);// == ''?0:parseFloat(totalOTHrs));
document.getElementById(totalothrsid).textContent = parseFloat(TotalOT).toFixed(2);// == ''?0:parseFloat(totalOTHrs));
document.getElementById(paidleaveid).textContent = parseFloat(paidleave).toFixed(2);
document.getElementById(daysworkedid).textContent = parseFloat((totalworkingHrs/8)).toFixed(2);
document.getElementById(absentid).textContent = parseFloat(absent).toFixed(2);

View File

@ -469,7 +469,7 @@ function ValidateUA() {
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>supplierlisting">&nbsp;&nbsp;<span class="bold">Back</span></a>
<a class="btn btn-cancel" href="<?php echo base_url(); ?>supplierlisting"><span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->

View File

@ -39,22 +39,22 @@
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Configuration Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
</div>
</div>
<?php
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Configuration Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-success" href="<?php echo base_url(); ?>addconfig">Add New Configuration</a>
</div>
</div>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
@ -74,73 +74,73 @@
</div>
<?php } ?>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="config_list_table" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Create Date</th>
<th>Configuration ID</th>
<th>Configuration Name</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<td><?php echo $record->Config_ID ?></td>
<td><?php echo $record->ConfigName ?></td>
<td><?php echo $record->Comments ?> </td>
<!-- <td><?php echo $record->CreatedDate ?></td> -->
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table id="config_list_table" class="table dt-responsive nowrap w-100">
<thead>
<tr>
<th>Create Date</th>
<th>Configuration ID</th>
<th>Configuration Name</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($userRecords)) {
foreach ($userRecords as $record) {
?>
<tr>
<?php if (date('d-m-Y', strtotime($record->CreatedDate)) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record->CreatedDate));
} ?>
<td align="right"><?php echo $cdate; ?> </td>
<td><?php echo $record->Config_ID ?></td>
<td><?php echo $record->ConfigName ?></td>
<td><?php echo $record->Comments ?> </td>
<!-- <td><?php echo $record->CreatedDate ?></td> -->
<!-- <td align="right"><?php $dt = new DateTime($record->CreatedDate);
$CreatedDate = $dt->format('d-m-Y');
echo $CreatedDate ?> </td> -->
<!-- <td align="right"><?php $dt = new DateTime($record->CreatedDate);
$CreatedDate = $dt->format('d-m-Y');
echo $CreatedDate ?> </td> -->
<td><a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"><i class="fa fa-pencil"></i>&nbsp;&nbsp;&nbsp;</a>
<!-- <a><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> -->
</td>
<td><a href="<?php echo base_url() . 'configurationctrl/editconfig?ConfigID=' . $record->Config_ID; ?>"><i class="fas fa-pencil-alt"></i>&nbsp;&nbsp;&nbsp;</a>
<!-- <a><i class="fa fa-trash"></i>&nbsp;&nbsp;&nbsp;</a> -->
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
</section>
@ -171,78 +171,83 @@
var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
};
// Initialize the DataTable
var table = $('#config_list_table').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options
responsive: true, // Responsive table
order: [[0, 'desc']], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
],
pageLength: 10, // Default rows per page
lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [
[0, 'desc']
], // Default ordering (column index 0, descending)
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>', // Next button icon
previous: '<i class="fas fa-angle-left"></i>' // Previous button icon
}
}
});
// Date range filter function
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
// Return true if the date is within the range
return date >= startDate && date <= endDate;
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0]; // Assuming the date is in the first column
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range
return date >= startDate && date <= endDate;
}
);
// Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
e.preventDefault();
table.draw(); // Redraw the table to apply the filter
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
$("#fromDate").val('');
$("#toDate").val('');
table.draw(); // Redraw the table to clear the filter
});
// Automatically focus and open the To Date picker when From Date is selected
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
// Set the min attribute of the To Date input to the selected From Date
toDateInput.min = fromDate;
// Optionally reset the To Date input if the current value is before the new min date
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
});
</script>

View File

@ -494,7 +494,7 @@ function validateESI() {
}
function validatePF() {
var regpf = /^([a-zA-Z]){5}([0-9]){17}?$/;
var regpf = /^\d{12}$/;
var PF = $('#pfno').val();
@ -1198,47 +1198,6 @@ legend {
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<span for="Allowances">Allowances</span>
<input type="text" name="Allowances"
value="<?php echo $empPay->Allowances; ?>"
class="form-control num"
style="text-transform:uppercase;"
pattern="([0-9]{1,5}([.][0-9]{1,2})?)"
title="Enter the Valid Allowances, Minimum 1 digit, Maximum 5 digits" />
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Food_Allowances">Food Allowances(Per Day)</span>
<input type="text" name="Food_Allowances"
value="<?php echo $empPay->Food_Allowances; ?>"
class="form-control num"
pattern="([0-9]{1,3}([.][0-9]{1,2})?)"
onfocusout="validateFood();"
title="Enter the Valid Food Allowances, Minimum 1 Digit, Maximum 3 Digits" />
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<span for="Incentives">Incentives</span>
<input type="text" name="Incentives"
value="<?php echo $empPay->Incentives; ?>"
class="form-control num"
style="text-transform:uppercase;"
pattern="([0-9]{1,5}([.][0-9]{1,2})?)"
title="Enter the Valid Allowances, Minimum 1 digit, Maximum 5 digits" />
</div>
</div>
<div class="col-md-3"></div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
@ -1307,8 +1266,8 @@ legend {
value="<?php echo $pfno; ?>"
onchange="validatePF();" class="form-control"
style="text-transform:uppercase"
pattern="([a-zA-Z]){5}([0-9]){17}"
title=" 5 Character and 17 Digit number (ex:ABCDE12345678901234567)"
pattern="\d{12}"
title="12 Digit number"
onkeypress="return alpha(event);">
</div>
</div>

View File

@ -38,244 +38,115 @@ if(!empty($EmpList))
?>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Edit User <?= ' - '.$EmpId; ?> Details</center>
</h1>
<ol class="breadcrumb">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>userListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</ol>
</section><br>
<section class="content">
<br/>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div id="content"></div>
<div class="box box-success">
<!-- form start -->
<form role="form" action="<?php echo base_url() ?>editUser" method="post" id="editUser" role="form">
<div class="box-body">
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="fname">Employee ID</label>
<input type="text" class="form-control required" value="<?php echo $EmpId ?>" readonly id="EmpList" name="EmpList" maxlength="128">
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit User <?= ' - '.$EmpId; ?> Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>userListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" action="<?php echo base_url() ?>editUser" method="post" id="editUser">
<div class="box-body">
<div class="form-row">
<div class="col-md-3">
<label class="col-form-label" for="EmpList">Employee ID</label>
<input type="text" class="form-control required" value="<?php echo $EmpId ?>" readonly id="EmpList" name="EmpList" maxlength="128">
</div>
<div class="col-md-3">
<label class="col-form-label" for="FirstName">First Name</label>
<input type="text" class="form-control required" value="<?php echo $FirstName ?>" readonly id="FirstName" name="FirstName" maxlength="128">
</div>
<div class="col-md-3">
<label class="col-form-label" for="LastName">Last Name</label>
<input type="text" class="form-control required" value="<?php echo $LastName ?>" readonly id="LastName" name="LastName" maxlength="128">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Designation">Designation</label>
<input type="text" class="form-control required" value="<?php echo $Designation ?>" readonly id="Designation" name="Designation" maxlength="128">
</div>
</div>
<div class="form-row">
<div class="col-md-3">
<label class="col-form-label" for="Department">Department</label>
<input type="text" class="form-control required" value="<?php echo $Department ?>" readonly id="Department" name="Department" minlength="10" maxlength="10">
</div>
<div class="col-md-3">
<label for="MailID">Email address</label>
<input type="text" class="form-control required email" value="<?php echo $EmailId ?>" readonly id="MailID" name="MailID" maxlength="128">
</div>
<div class="col-md-3">
<label for="ContactNo">Contact Number</label>
<input type="text" class="form-control required digits" value="<?php echo $ContactNo ?>" readonly id="ContactNo" name="ContactNo" minlength="10" maxlength="10">
</div>
<div class="col-md-3">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" required name="password" maxlength="10">
</div>
</div>
<div class="form-row">
<div class="col-md-3">
<label for="cpassword">Confirm Password</label>
<input type="password" class="form-control equalTo" id="cpassword" name="cpassword" maxlength="10">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="fname">First Name</label>
<input type="text" class="form-control required" value="<?php echo $FirstName ?>" readonly id="FirstName" name="FirstName" maxlength="128">
</div>
<div class="form-group text-right mt-3">
<input type="hidden" name="txtSelectedDepartment" id="txtSelectedDepartment">
<input type="hidden" name="txtEmpid" id="txtEmpid" value="<?php echo $EmpId ?>">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red;color: white;margin-right: 15px;" value="Reset">
<input type="submit" class="btn btn-success" value="Submit">
</div>
<div class="col-md-2">
<div class="form-group">
<label for="fname">Last Name</label>
<input type="text" class="form-control required" value="<?php echo $LastName ?>" readonly id="LastName" name="LastName" maxlength="128">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="email">Designation</label>
<input type="text" class="form-control required " value="<?php echo $Designation ?>" readonly id="Designation" name="Designation" maxlength="128">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="mobile">Department</label>
<input type="text" class="form-control required" value="<?php echo $Department ?>" readonly id="Department" name="Department" minlength="10"maxlength="10">
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<label for="email">Email address</label>
<input type="text" class="form-control required email" value="<?php echo $EmailId ?>" readonly id="MailID" name="MailID" maxlength="128">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="mobile">Contact Number</label>
<input type="text" class="form-control required digits" value="<?php echo $ContactNo ?>" readonly id="ContactNo" name="ContactNo" minlength="10"maxlength="10">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" required name="password" maxlength="10">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="cpassword">Confirm Password</label>
<input type="password" class="form-control equalTo" id="cpassword" name="cpassword" maxlength="10">
</div>
</div>
<div class="col-md-2">
<div class="form-group" style="display:none;">
<label for="role">Role</label>
<select class="form-control required" id="role" name="role">
<option value="<?php echo $Role ?>"><?php echo $RoleName ?></option>
<?php
if(!empty($roles))
{
foreach ($roles as $rl)
{
?>
<option value="<?php echo $rl->roleId ?>"><?php echo $rl->role ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="col-md-6">
<div class="col-md-4">
<label>Department</label>
<div>
</form>
<?php
$options = array("0"=>'Select Department',
"1"=>'System Administrator');
// print_r($Departmentlist);
if(!empty($Departmentlist))
{
foreach ($Departmentlist as $SID):
$options[$SID->DEPCode] = $SID->DEPCode.' '.' - '.' '.$SID->DepartmentName;
endforeach;
}
echo form_multiselect('distriList', $options,set_value('distriList', array()),'id="distriList"' ,'class="form-control required"','required="true"');
?>
$listErrors = session()->getFlashdata('listErrors');
if ($listErrors) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('listErrors'); ?>
</div>
<?php } ?>
<?php
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
</div>
</div>
<div class="col-md-4">
<center>
<a style="color:white" href="javascript:void(0);" id="addPop"><button type="button" style="margin: 30px 0px 0px 15px;" class="btn btn-success">Add</button></a><br>
<a style="color:white" href="javascript:void(0);" id="removePop"><button type="button" style="margin: 10px 0px 0px 15px;" class="btn btn-success">Remove</button></a><br>
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
</center>
</div>
<div class="col-md-4">
<b>&nbsp;</b>
<?php
$option["0"] = 'Selected Department';
//print_r($AccessDept);
if(!empty($AccessDept))
{
foreach ($AccessDept as $SID):
if($SID->AssDep == '1')
{
$option[$SID->AssDep] = "01-System Administrator";
}
else
{
$option[$SID->AssDep] = $SID->AssDep.' '.' - '.' '.$SID->DepartmentName;
}
endforeach;
}
echo form_multiselect('selectDistriList[]', $option,set_value('selectDistriList[]', array()),'id="selectDistriList"','size="10"');
?>
</div>
</div>
</div>
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<input type="hidden" name="txtSelectedDepartment" id="txtSelectedDepartment" />
<input type="hidden" name="txtEmpid" id="txtEmpid" value="<?php echo $EmpId?>" />
<input type="reset" class="btn btn-cancel" value="Cancel" />
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</form>
</div>
</div>
</div>
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?> </div>
</div>
</div>
</section>
</div>
<script src="<?php echo base_url(); ?>public/assets/js/editUser.js" type="text/javascript"></script>

View File

@ -11,81 +11,72 @@ $DateOfPurchase = '';
$DateOfCommison = '';
$AssetValue = '';
$AssetStatus = '';
$IsActive ='';
$IsActive = '';
$Remarks = '';
$DepartmentName ='';
$Department ='';
$DepartmentName = '';
$Department = '';
$SupplierCode = '';
$MaterialCode = '';
$PONO = '';
$POLineItem='';
$Quantity='';
$POLineItem = '';
$Quantity = '';
$UOM = '';
$MaterialName='';
$DeliveryDate='';
$MaterialName = '';
$DeliveryDate = '';
$DDate = '';
if(!empty($assetList))
{
foreach ($assetList as $Asset)
{
//print_r($Asset);die();
$AssetCode = $Asset->AssetCode;
$AssetName = $Asset->AssetName;
$Description = $Asset->Description;
if (!empty($assetList)) {
foreach ($assetList as $Asset) {
//print_r($Asset);die();
$AssetCode = $Asset->AssetCode;
$AssetName = $Asset->AssetName;
$Description = $Asset->Description;
$Department = $Asset->DEPCode;
$DepartmentName = $Asset->DepartmentName;
$Location = $Asset->Location;
$User = $Asset->UserName;
$SupplierName = $Asset->SupplierName;
$Location = $Asset->Location;
$User = $Asset->UserName;
$SupplierName = $Asset->SupplierName;
$SupplierCode = $Asset->SupplierCode;
$DateOfPurchase = $Asset->DateOfPurchase;//print_r($Asset->DateOfPurchase);
if($DateOfPurchase != '' && $DateOfPurchase != '0000-00-00 00:00:00' ) {
$PODate = new DateTime($DateOfPurchase);
$DateOfPurchase = $PODate->format('d-m-Y');
}
else {
$DateOfPurchase = '';
}
$DateOfCommison = $Asset->DateOfCommison;
if($DateOfCommison != '' && $DateOfCommison != '0000-00-00 00:00:00' ) {
$DateOfCommission= new DateTime($Asset->DateOfCommison, new DateTimeZone('Asia/Kolkata'));
$DateOfCommison = $DateOfCommission->format('d-m-Y');
}
else {
$DateOfCommison = '';
}
$DateOfPurchase = $Asset->DateOfPurchase; //print_r($Asset->DateOfPurchase);
if ($DateOfPurchase != '' && $DateOfPurchase != '0000-00-00 00:00:00') {
$PODate = new DateTime($DateOfPurchase);
$DateOfPurchase = $PODate->format('d-m-Y');
} else {
$DateOfPurchase = '';
}
$DateOfCommison = $Asset->DateOfCommison;
if ($DateOfCommison != '' && $DateOfCommison != '0000-00-00 00:00:00') {
$DateOfCommission = new DateTime($Asset->DateOfCommison, new DateTimeZone('Asia/Kolkata'));
$DateOfCommison = $DateOfCommission->format('d-m-Y');
} else {
$DateOfCommison = '';
}
$AssetValue = $Asset->AssetValue;
$AssetStatus = $Asset->AssetStatus;
$MaterialCode = $Asset->MaterialCode;
$PONO = $Asset->PONO;
$POLineItem = $Asset->POLineItem;
$Quantity = $Asset->Quantity;
$MaterialName = $Asset->MaterialName;
$UOM = $Asset->UOM;
$DDt = $Asset->DeliveryDate;
if($DDt != '' && $DDt != '0000-00-00 00:00:00'){
$DDate = new DateTime($DDt, new DateTimeZone('Asia/Kolkata'));
$DeliveryDate = $DDate->format('d-m-Y');
}
else
{
$DeliveryDate = '';
}
$AssetStatus = $Asset->AssetStatus;
$MaterialCode = $Asset->MaterialCode;
$PONO = $Asset->PONO;
$POLineItem = $Asset->POLineItem;
$Quantity = $Asset->Quantity;
$MaterialName = $Asset->MaterialName;
$UOM = $Asset->UOM;
$DDt = $Asset->DeliveryDate;
if ($DDt != '' && $DDt != '0000-00-00 00:00:00') {
$DDate = new DateTime($DDt, new DateTimeZone('Asia/Kolkata'));
$DeliveryDate = $DDate->format('d-m-Y');
} else {
$DeliveryDate = '';
}
$Remarks = $Asset->Remarks;
$Remarks = $Asset->Remarks;
$chk = $Asset->IsActive;
if($chk == 1)
{
$IsActive = 'checked';
}
else
{
$IsActive = '';
}
if ($chk == 1) {
$IsActive = 'checked';
} else {
$IsActive = '';
}
// if($DateOfPurchase != '')
// {
// $dtpurchase = new DateTime($DateOfPurchase);
@ -96,479 +87,322 @@ if(!empty($assetList))
// $dtCommission = new DateTime($DateOfCommission);
// $DOCommission = $dtCommission ->format('Y-m-d');
// }
}
}
}
?>
<script>
<script>
$(function() {
var d = new Date();
$(function() {
var d = new Date();
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear();
var SIAStartYear = year - 2015;
var mindt = year - 70;
var maxdt = year - 15;
var month = d.getMonth();
var day = d.getDate();
var year = d.getFullYear() ;
var SIAStartYear = year - 2015;
var mindt = year-70;
var maxdt = year-15;
// $("#PONO").select2();
// $("#SelectMaterialCode").select2();
// $("#AssetStatus").select2();
$("#DateOfCommission").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
// $("#PONO").select2();
// $("#SelectMaterialCode").select2();
// $("#AssetStatus").select2();
$("#DateOfCommission").datepicker({
minDate: new Date(year - SIAStartYear, 1, 1),
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
});
$("#DateOfPurchase").datepicker({
minDate : new Date(year-SIAStartYear,1,1),
maxDate :'now',
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
});
$("#DateOfPurchase").datepicker({
minDate: new Date(year - SIAStartYear, 1, 1),
maxDate: 'now',
dateFormat: 'dd-mm-yy',
changeMonth: true,
changeYear: true,
});
});
});
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31
&& (charCode < 48 || charCode > 57))
return false;
return true;
}
});
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31 &&
(charCode < 48 || charCode > 57))
return false;
return true;
}
</script>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center> Edit Asset Details-<?php echo $AssetCode ; ?></center>
</h1>
</section>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url()?>assetListing" class="btn btn-success"value="Back">Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-success">
<!-- form start -->
<form role="form" id="addAsset" action="<?php echo base_url() ?>editasset" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Asset_Name">Asset Name</span><span style="color:red">*</span>
</b>
<input type="text" class="form-control required" id="AssetName" name="AssetName" value="<?php echo $AssetName;?>" style="text-transform:uppercase;">
<input type="hidden" name="AssetCode" id="AssetCode" class="form-control" readonly value="<?php echo $AssetCode;?>">
<div class="content-page">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Asset Details - <?php echo $AssetCode; ?></h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>assetListing"><span class="bold">Back</span></a>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" id="addAsset" action="<?php echo base_url() ?>editasset" method="post">
<div class="form-row">
<div class="col-md-3">
<label for="AssetName">Asset Name <span class="badge">*</span></label>
<input type="text" class="form-control" id="AssetName" name="AssetName" value="<?php echo $AssetName; ?>" style="text-transform:uppercase;" required>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Description">Asset Description</span><span style="color:red">*</span></b>
<input type="text" class="form-control required" id="Description" name="Description"
value="<?php echo $Description; ?>">
<div class="col-md-3">
<label for="Description">Asset Description <span class="badge">*</span></label>
<input type="text" class="form-control" id="Description" name="Description" value="<?php echo $Description; ?>" required>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="AssetOwner">Asset User</span><span style="color:red">*</span></b>
<input type="text" class="form-control required" id="User" name="User" value="<?php echo $User;?>">
<div class="col-md-3">
<label for="User">Asset User <span class="badge">*</span></label>
<input type="text" class="form-control" id="User" name="User" value="<?php echo $User; ?>" required>
</div>
<div class="col-md-3">
<label for="Location">Asset Location <span class="badge">*</span></label>
<input type="text" class="form-control" id="Location" name="Location" value="<?php echo $Location; ?>" required>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Location">Asset Location</span><span style="color:red">*</span></b>
<input type="text" class="form-control required" id="Location" name="Location"
value="<?php echo $Location;?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b>
<span for="PONO">Purchase Order Number</span><span style="color:red">*</span></b>
<select class="form-control required select2" id="PONO" name="PONO">
<option value="<?php echo $PONO;?>"><?php echo $PONO;?></option>
<?php
if(!empty($PO))
{
foreach ($PO as $po)
{
$PONO1 = $po->PONO;
if(trim($PONO1) != trim($PONO))
{
if ($_POST['PONO'] == $PONO1)
{
echo "<option value=\"".$PONO1."\" selected=\"selected\">". $po->PONO."</option>";
}
else
{
echo "<option value=\"".$PONO1."\">". $po->PONO ."</option>";
}
}
<div class="form-row mt-3">
<div class="col-md-3">
<label for="PONO">Purchase Order Number <span class="badge">*</span></label>
<select class="form-control select2" id="PONO" name="PONO" required>
<option value="<?php echo $PONO; ?>"><?php echo $PONO; ?></option>
<?php if (!empty($PO)) {
foreach ($PO as $po) {
$PONO1 = $po->PONO;
if (trim($PONO1) != trim($PONO)) {
echo "<option value=\"" . $PONO1 . "\">" . $PONO1 . "</option>";
}
}
?>
</select>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<b>
<span for="SelectMaterialCode" value=""> select Material Code</span>
</b>
<select class="form-control required select2" id="SelectMaterialCode" name="lineitem">
<option value="<?php echo $POLineItem;?>"><?php echo $POLineItem;?></option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>
<span for="MaterialCode">Material Code</span></b>
<input type="text" class="form-control required" id="MaterialCode" readonly name="MaterialCode" value="<?php echo $MaterialCode;?>">
</div>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<b>
<span for="UOM">UOM</span></b>
<input type="text" class="form-control required" id="UOM"value="<?php echo $UOM;?>"readonly name="UOM" value="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>
<span for="Quantity">Quantity</span></b>
<input type="text" class="form-control required" id="Quantity" value="<?php echo $Quantity;?>" name="Quantity" value="">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Description">Description</span></b>
<input type="text" class="form-control required" id="PODescription" readonly name="PODescription" value="<?php echo $MaterialName;?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<input type="hidden" name="AssetDept" id="depcode" value="<?php echo $Department?>">
<b>
<span for="AssetDept">Asset Department</span></b>
<input type="text" class="form-control required" value="<?php echo $DepartmentName;?>" id="AssetDept" readonly>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="DateOfPurchase">Purchase Date</span></b>
<input id="DateOfPurchase" required name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DateOfPurchase;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="DateOfPurchase">Supplier Name</span></b>
<input type="hidden" name="SupplierName" id="SupID" value="<?php echo $SupplierCode;?>">
<input id="SupplierName" readonly onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $SupplierName; ?>">
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group"><b>
<span for="DeliveryDate">Delivery Date</span></b>
<input id="DeliveryDate" readonly name="DeliveryDate" maxlength="10" class="form-control" value= "<?php echo $DeliveryDate;?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group"><b>
<span for="DateOfCommission">Date Of Commission</span></b>
<input id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DateOfCommison;?>">
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group"><b>
<span for="Assetvalue">Asset Value</span>
</b> <input type="text" class="form-control required" id="Assetvalue" name="Assetvalue" onkeypress="return isNumberKey(event)" maxlength="255" value="<?php echo $AssetValue;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group"><b>
<span for="AssetStatus">Asset Status</span></b>
<select class="form-control required" id="AssetStatus" name="AssetStatus">
<option value="<?php echo $AssetStatus; ?>"><?php echo $AssetStatus; ?></option>
<?php
if(!empty($AssetStatusList))
{
foreach ($AssetStatusList as $SID)
{
?>
<option value="<?php echo $SID->ConfigValue; ?>"> <?php echo $SID->ConfigValue ?></option>
<?php
}
}
?>
} ?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group"><b>
<span for="Remarks">Remarks</span>
</b>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value="<?php echo $Remarks; ?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive ?> > IsActive
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<input type="submit" class="btn btn-success" value="Submit" />
<a href="<?php echo base_url()?>assetListing" class="btn btn-success" id="cancel" value="Cancel">Cancel</a>
</div>
<div class="col-md-3">
<label for="SelectMaterialCode">Select Material Code</label>
<select class="form-control select2" id="SelectMaterialCode" name="lineitem">
<option value="<?php echo $POLineItem; ?>"><?php echo $POLineItem; ?></option>
</select>
</div>
<div class="col-md-3">
<label for="UOM">UOM</label>
<input type="text" class="form-control" id="UOM" name="UOM" value="<?php echo $UOM; ?>" readonly>
</div>
<div class="col-md-3">
<label for="Quantity">Quantity</label>
<input type="text" class="form-control" id="Quantity" name="Quantity" value="<?php echo $Quantity; ?>">
</div>
</div>
<div class="form-row mt-3">
<div class="col-md-3">
<label for="PODescription">Description</label>
<input type="text" class="form-control" id="PODescription" name="PODescription" value="<?php echo $MaterialName; ?>" readonly>
</div>
<div class="col-md-3">
<label for="AssetDept">Asset Department</label>
<input type="text" class="form-control" id="AssetDept" name="AssetDept" value="<?php echo $DepartmentName; ?>" readonly>
</div>
<div class="col-md-3">
<label for="DateOfPurchase">Purchase Date</label>
<input type="text" class="form-control" id="DateOfPurchase" name="DateOfPurchase" value="<?php echo $DateOfPurchase; ?>" required onkeypress="return false;">
</div>
<div class="col-md-3">
<label for="SupplierName">Supplier Name</label>
<input type="text" class="form-control" id="SupplierName" name="SupplierName" value="<?php echo $SupplierName; ?>" readonly>
</div>
</div>
<div class="form-row mt-3">
<div class="col-md-3">
<label for="DeliveryDate">Delivery Date</label>
<input type="text" class="form-control" id="DeliveryDate" name="DeliveryDate" value="<?php echo $DeliveryDate; ?>" readonly>
</div>
<div class="col-md-3">
<label for="DateOfCommission">Date Of Commission <span class="badge">*</span></label>
<input type="text" class="form-control" id="DateOfCommission" name="DateOfCommission" value="<?php echo $DateOfCommison; ?>" required onkeypress="return false;">
</div>
<div class="col-md-3">
<label for="AssetValue">Asset Value</label>
<input type="text" class="form-control" id="Assetvalue" name="Assetvalue" value="<?php echo $AssetValue; ?>" onkeypress="return isNumberKey(event)" maxlength="255">
</div>
<div class="col-md-3">
<label for="AssetStatus">Asset Status</label>
<select class="form-control select2" id="AssetStatus" name="AssetStatus">
<option value="<?php echo $AssetStatus; ?>"><?php echo $AssetStatus; ?></option>
<?php if (!empty($AssetStatusList)) {
foreach ($AssetStatusList as $SID) {
echo "<option value=\"" . $SID->ConfigValue . "\">" . $SID->ConfigValue . "</option>";
}
} ?>
</select>
</div>
</div>
<div class="form-row mt-3">
<div class="col-md-3">
<label for="Remarks">Remarks</label>
<input type="text" class="form-control" id="Remarks" name="Remarks" value="<?php echo $Remarks; ?>" maxlength="500">
</div>
<div class="col-md-3">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="isactive" name="isactive" <?php echo $IsActive ? 'checked' : ''; ?>>
<label class="form-check-label" for="isactive">Is Active</label>
</div>
</div>
</div>
<div class="form-row mt-4 text-right">
<div class="col-md-12">
<button type="submit" class="btn btn-success">Submit</button>
<a href="<?php echo base_url() ?>assetListing" class="btn btn-cancel">Cancel</a>
</div>
</div>
</form>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?> </div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<script>
<script>
$('#PONO').on('change', function() {
$('#PONO').on('change',function(){
var PONO = $(this).val();
$('#SupplierName').val('');
$('#SupID').val('');
$('#MaterialCode').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#depcode').val('');
$('#AssetDept').val('');
$('#DateOfPurchase').val('');
$('#DeliveryDate').val('');
$('#PODescription').val('');
$('#Assetvalue').val('');
// alert(PONO);
if(PONO){
//alert("INSIDE IF");
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getpodetails",
data:'PONO='+PONO,
dataType: 'json',
success:function(data){
//alert(data);
var line ='';
var PONO = $(this).val();
$('#SupplierName').val('');
$('#SupID').val('');
$('#MaterialCode').val('');
$('#UOM').val('');
$('#Quantity').val('');
$('#depcode').val('');
$('#AssetDept').val('');
$('#DateOfPurchase').val('');
$('#DeliveryDate').val('');
$('#PODescription').val('');
$('#Assetvalue').val('');
// alert(PONO);
if (PONO) {
//alert("INSIDE IF");
$.ajax({
type: 'POST',
url: "<?php echo base_url() ?>assetdetails/getpodetails",
data: 'PONO=' + PONO,
dataType: 'json',
success: function(data) {
//alert(data);
var line = '';
$('#SelectMaterialCode').empty();
//alert('before');
$.each(data, function (i, item) {
//alert(item);
$.each(data, function(i, item) {
//alert(item);
//line ='<option>select Material Code</option>';
//line ='<option>select Material Code</option>';
//line +='<option value='+item.LineItemNo+'>'+item.LineItemNo+'-'+item.MaterialCode+'</option>';
//$('#DeliveryDate').val(item.DeliveryDate);
line+=item;
$('#SelectMaterialCode').append(line);
//$('#DeliveryDate').val(item.DeliveryDate);
line += item;
$('#SelectMaterialCode').append(line);
});
}
});
}
});
}
});
$('#SelectMaterialCode').on('change',function(){
var line = $(this).val();
});
$('#SelectMaterialCode').on('change', function() {
var line = $(this).val();
//line +='<option>select Material Code</option>'
if(line){
$.ajax({
type:'POST',
url:"<?php echo base_url() ?>assetdetails/getline",
data:'line='+line,
success:function(data){
//alert(data);
var id = $('#SelectMaterialCode').val();
$.each(JSON.parse(data), function (i, item) {
if(id == item.LineItemNo){
$('#DateOfPurchase').val(item.PODate);
if(item.DeliveryDate != null )
{
var date = new Date(item.DeliveryDate);
var date1 = (date.getDate()+ '-' + (date.getMonth() + 1)+ '-' + date.getFullYear());
if(item.DeliveryDate == '0000-00-00' || item.DeliveryDate == '30-11--0001')
{
$('#DeliveryDate').val('');
}
else
{
//alert(item.DeliveryDate+ ',' + date1);
$("#DeliveryDate").val(date1);
}
if (line) {
$.ajax({
type: 'POST',
url: "<?php echo base_url() ?>assetdetails/getline",
data: 'line=' + line,
success: function(data) {
//alert(data);
//var correctDate = [DDate.getDate(),DDate.getMonth()+1,DDate.getFullYear()].join("/");
//alert(correctDate);
var id = $('#SelectMaterialCode').val();
$.each(JSON.parse(data), function(i, item) {
if (id == item.LineItemNo) {
}
else
{
$('#DeliveryDate').val('');
}
$('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID);
$('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName);
$('#Assetvalue').val(item.TotalValue);
//var date = new Date(item.DeliveryDate);
// var date1 = (date.getDate()+ '/' + (date.getMonth() + 1)+ '/' + date.getFullYear());
var date = new Date(item.PODate);
var date3 = (date.getDate()+ '-' + (date.getMonth() + 1)+ '-' + date.getFullYear());
$("#DateOfPurchase").val(date3);
}
//line ='<option>'+item.LineItemNo+'</option>';
// $('#POLineItem').append(line);
});
}
});
$('#DateOfPurchase').val(item.PODate);
if (item.DeliveryDate != null) {
var date = new Date(item.DeliveryDate);
var date1 = (date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullYear());
if (item.DeliveryDate == '0000-00-00' || item.DeliveryDate == '30-11--0001') {
$('#DeliveryDate').val('');
} else {
//alert(item.DeliveryDate+ ',' + date1);
$("#DeliveryDate").val(date1);
}
//var correctDate = [DDate.getDate(),DDate.getMonth()+1,DDate.getFullYear()].join("/");
//alert(correctDate);
} else {
$('#DeliveryDate').val('');
}
$('#SupplierName').val(item.SupplierName);
$('#SupID').val(item.SupplierID);
$('#MaterialCode').val(item.MaterialCode);
$('#UOM').val(item.UOM);
$('#Quantity').val(item.Quantity);
$('#depcode').val(item.Departmentcode);
$('#AssetDept').val(item.DepartmentName);
$('#PODescription').val(item.MaterialName);
$('#Assetvalue').val(item.TotalValue);
//var date = new Date(item.DeliveryDate);
// var date1 = (date.getDate()+ '/' + (date.getMonth() + 1)+ '/' + date.getFullYear());
var date = new Date(item.PODate);
var date3 = (date.getDate() + '-' + (date.getMonth() + 1) + '-' + date.getFullYear());
$("#DateOfPurchase").val(date3);
}
//line ='<option>'+item.LineItemNo+'</option>';
// $('#POLineItem').append(line);
});
}
});
}
});
});
</script>

View File

@ -145,7 +145,7 @@ if(!empty($emppay))
<section class="content-header">
<h1>
<!--title-->
<center>Edit Salary Payment Details</center>
<center>Edit Loan Details</center>
</h1>
</section>
@ -165,15 +165,15 @@ if(!empty($emppay))
<form role="form" id="edit" action="<?php echo base_url() ?>emppaydate/editemppay" method="post">
<div class="box-body">
<div class="col-md-12">
<legend>Pay Details</legend>
<div class="col-md-12">
<legend>Loan Details</legend>
</div>
<div class="row">
<div class="row">
<input type="hidden" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
<input type="hidden" readonly id="Pay_Data_ID" name="Pay_Data_ID" value="<?php echo $Pay_Data_ID; ?>">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
@ -182,117 +182,6 @@ if(!empty($emppay))
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for ="Employee">Employee Name</span>
<input type="text" class="form-control" id="Empname" name="Empname" value="<?php echo $Empname; ?>" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Total Salary</span><font color="Red">*</font>
<input type="text" class="form-control requried num" id="Total_Salary" name="Total_Salary" value="<?php echo number_format($TotalSalary,0,'',''); ?>" pattern="([0-9]{1,8}([.][0-9]{1,2})?)" title="Minimum 4 digit,Maximum 6 Digit" onchange="calculateBasic();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Basic_Pay">Basic Pay</span><font color="Red">*</font>
<input type="text" class="form-control requried num" id="Basic_Pay" name="Basic_Pay" value="<?php echo $Basic_Pay; ?>" readonly>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="HRA_Rate">HRA_Rate(%)</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="HRA_Rate" name="HRA_Rate" value="<?php echo $HRA_Rate; ?>" pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit" onchange="calculateBasic();">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="HRA_Rate">HRA_Amount</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="HRA_Amount" name="HRA_Amount" value="<?php echo number_format($HRA_Amount,0,'',''); ?>" readonly>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Allowances">Allowances</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="Allowances" name="Allowances" value="<?php echo $Allowances; ?>" pattern="([0-9]{1,5}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 4 Digit">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="PF_Rate">PF_Rate(%)</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="PF_Rate" name="PF_Rate" value="<?php echo $PF_Rate; ?>" pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="ESI_Rate">ESI_Rate(%)</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="ESI_Rate" name="ESI_Rate" value="<?php echo $ESI_Rate; ?>" pattern="([0-9]{1,2}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 2 Digit">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for ="Food_Allowances">Food Allowances(Per Day)</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="Food_Allowances" name="Food_Allowances" value="<?php echo $Food_Allowances; ?>" pattern="([0-9]{1,3}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 3 Digit">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<div class="form-group">
<span for="Incentives">Incentives</span><font color="Red">*</font>
<input type="text" class="form-control required num" id="Incentives" name="Incentives" value="<?php echo ($Incentives) ?>" pattern="([0-9]{1,5}([.][0-9]{1,2})?)" title="Minimum 1 digit,Maximum 5 Digit">
</div>
</div>
</div>
</div>
<div class="col-md-12">
<legend>Loan Details</legend>
</div>
<div class="row">
<div class="col-md-3">
<div class="form-group">

View File

@ -100,233 +100,187 @@ if ($total <= $reorder) {
}
</style>
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center> </center>
</h1>
</section>
<section class="content-header">
<h1>
<center> Edit Material - <?php echo $MaterialCode; ?> Details</center>
</h1>
<ol class="breadcrumb">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>rawmaterialListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</ol>
</section> <br />
<section class="content">
<!-- <div class="row"> -->
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-success">
<!-- form start -->
<form role="form" action="<?php echo base_url() ?>rawmaterialdetails/editRawmaterial" method="post" id="editRawmaterial" role="form">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-2">
<div class="form-group">
<label for="RMcode">MaterialCode</label>
<input type="text" class="form-control" readonly id="RMcode" name="RMcode" maxlength="255" value="<?php echo $MaterialCode; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="MaterialName">Material Name</label>
<font color="Red">*</font>
<input type="text" class="form-control required " id="MaterialName" name="MaterialName" maxlength="255" value="<?php echo htmlentities($MaterialName); ?>">
<input type="hidden" class="form-control required " id="MaterialCode" value="<?php echo $MaterialCode; ?>" name="MaterialCode" maxlength="255">
</div>
</div>
<!-- <div class="col-md-2">
<div class="form-group">
<label for="MaterialType">Material Type</label>
<input type="text" class="form-control" readonly id="MaterialType" name="MaterialType" value="<?php echo $MaterialType; ?>">
</div>
</div> -->
<div class="col-md-2">
<div class="form-group">
<label for="MaterialType">Material Type</label>
<font color="Red">*</font>
<select class="form-control select2" required id="MaterialType" name="MaterialType">
<?php
if (!empty($material)) {
foreach ($material as $SID) {
?>
<option value="<?= $SID->ConfigValue ?>" <?php if (($MaterialType === $SID->ConfigValue)) echo "selected"; ?>>
<?php echo $SID->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group autoSearch" id="mc">
<label for="Matcate">Material Caterogy</label>
<font color="Red">*</font>
<input type="text" class="form-control required " required id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory; ?>" maxlength="255">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="UOM">Unit of Measurement</label>
<font color="Red">*</font>
<!-- <select class="form-control select2 required " required id="UOM" name="UOM">
<option value=" ">Select UOM</option>
</select> -->
<select class="form-control required select2" id="UOM" name="UOM"> <!-- onchange="changeTextBox();" -->
<option value="<?php echo $UOM; ?>"><?php echo $UOM; ?></option>
<?php
if (!empty($UOMList)) {
foreach ($UOMList as $UM) {
?>
<option value="<?php echo $UM->ConfigValue; ?>"><?php echo $UM->ConfigValue ?>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- Start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Material - <?php echo $MaterialCode; ?> Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>rawmaterialListing">
<span class="bold">Back</span>
</a>
</div>
</div>
<!-- End page title -->
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<label for="HSNcode">HSN code</label>
<input type="text" class="form-control" id="HSNcode" name="HSNcode" maxlength="8" value="<?php echo $HSNcode; ?>" onkeypress="return isNumberKey(event)">
</div>
</div>
<?php
if ($openstock != "") {
?>
<div class="col-md-3">
<div class="form-group autoSearch" id="mc">
<label for="Matcate">Opening Stock</label>
<input type="text" class="form-control required " id="openstock" name="openstock" value="<?php echo $openstock; ?>" maxlength="255">
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" action="<?php echo base_url() ?>rawmaterialdetails/editRawmaterial" method="post" id="editRawmaterial">
<div class="box-body">
<!-- Material Information -->
<div class="row">
<div class="col-md-12">
<div class="form-row mb-3">
<div class="col-md-3">
<div class="form-group">
<label for="RMcode">Material Code</label>
<input type="text" class="form-control" readonly id="RMcode" name="RMcode" maxlength="255" value="<?php echo $MaterialCode; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="MaterialName">Material Name <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="MaterialName" name="MaterialName" maxlength="255" value="<?php echo htmlentities($MaterialName); ?>" required>
<input type="hidden" class="form-control" id="MaterialCode" name="MaterialCode" maxlength="255" value="<?php echo $MaterialCode; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="MaterialType">Material Type <span class="text-danger">*</span></label>
<select class="form-control select2" id="MaterialType" name="MaterialType" required>
<?php
if (!empty($material)) {
foreach ($material as $SID) {
?>
<option value="<?= $SID->ConfigValue ?>" <?php if ($MaterialType === $SID->ConfigValue) echo "selected"; ?>>
<?php echo $SID->ConfigValue ?>
</option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="MaterialCategory">Material Category <span class="text-danger">*</span></label>
<input type="text" class="form-control" id="MaterialCategory" name="MaterialCategory" value="<?php echo $MaterialCategory; ?>" maxlength="255" required>
</div>
</div>
</div>
<div class="form-row mb-3">
<div class="col-md-3">
<div class="form-group">
<label for="UOM">Unit of Measurement <span class="text-danger">*</span></label>
<select class="form-control select2" id="UOM" name="UOM" required>
<option value="<?php echo $UOM; ?>"><?php echo $UOM; ?></option>
<?php
if (!empty($UOMList)) {
foreach ($UOMList as $UM) {
?>
<option value="<?php echo $UM->ConfigValue; ?>"><?php echo $UM->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
</div>
</div>
<?php
<div class="col-md-3">
<div class="form-group">
<label for="HSNcode">HSN Code</label>
<input type="text" class="form-control" id="HSNcode" name="HSNcode" maxlength="8" value="<?php echo $HSNcode; ?>" onkeypress="return isNumberKey(event)">
</div>
</div>
<?php if ($openstock != "") { ?>
<div class="col-md-3">
<div class="form-group">
<label for="openstock">Opening Stock</label>
<input type="text" class="form-control" id="openstock" name="openstock" value="<?php echo $openstock; ?>" maxlength="255">
</div>
</div>
<?php } else { ?>
<div class="col-md-3">
<div class="form-group">
<label for="openstock">Opening Stock</label>
<input type="text" class="form-control" id="openstock" name="openstock" maxlength="255">
</div>
</div>
<?php } ?>
} else {
?>
<div class="col-md-3">
<div class="form-group">
<label for="conversionfactor">Opening Stock</label>
<input type="text" class="form-control" id="openstock" name="openstock" maxlength="255">
<?php if ($date != "") { ?>
<div class="col-md-3">
<div class="form-group">
<label>Open Stock Date</label>
<input type="text" name="Date" id="Date" class="form-control" value="<?php echo $date; ?>" readonly>
</div>
</div>
<?php } else { ?>
<div class="col-md-3">
<div class="form-group">
<label>Open Stock Date</label>
<input type="text" name="Date" id="Date" class="form-control" readonly>
</div>
</div>
<?php } ?>
</div>
<div class="form-row mb-3">
<div class="col-md-3">
<div class="form-group">
<label for="reorder">Reorder Level</label>
<input type="text" class="form-control" id="reorder" name="reorder" value="<?php echo $reorder; ?>" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="currentstock">Current Stock</label>
<input type="text" class="form-control" id="currentstock" name="currentstock" readonly value="<?php echo $total; ?>" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="avg_price">Average Price</label>
<input type="text" class="form-control" id="avg_price" name="avg_price" readonly value="<?php echo $Average_Value ?>" maxlength="255">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="remarks">Remarks</label>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255" value="<?php echo $remarks; ?>">
</div>
</div>
</div>
<div class="form-row mb-3">
<div class="col-md-2">
<div class="form-group">
<label for="isactive">Is Active</label><br />
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive; ?>>
</div>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
if ($date != "") {
?>
<div class="col-md-3">
<label>Open Stock Date</label>
<?php
// $data = array('name' => 'Date','value' => set_value('Date',$date), 'class' => 'form-control','readonly'=>'true', 'onkeypress'=>'return false;');
$data = array('name' => 'Date', 'id' => 'Date', 'value' => set_value('Date', $date), 'class' => 'form-control', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
<?php
} else {
?>
<div class="col-md-3">
<label>Open Stock Date</label>
<?php
$data = array('name' => 'Date', 'id' => 'Date', 'class' => 'form-control', 'onkeypress' => 'return false;');
echo form_input($data);
?>
</div>
<?php
}
?>
<div class="col-md-3">
<div class="form-group">
<label for="conversionfactor">Reorder Level</label>
<input type="text" class="form-control" id="reorder" value="<?php echo $reorder; ?>" name="reorder" maxlength="255">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<label for="conversionfactor">Current Stock</label>
<input type="text" class="form-control" id="currentstock" readonly value="<?php echo $total; ?>" name="currentstock" maxlength="255">
</div>
<div class="box-footer text-right">
<a href="<?php echo base_url() ?>rawmaterialListing" class="btn btn-cancel">Cancel</a>
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</form>
</div><!-- /.card-body -->
</div><!-- /.card -->
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div><!-- /.content -->
</div><!-- /.content-page -->
<div class="col-md-3">
<div class="form-group">
<label for="conversionfactor">Average Price</label>
<input type="text" class="form-control" id="avg_price" readonly value="<?php echo $Average_Value ?>" name="avg_price" maxlength="255">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label for="remarks">Remarks</label>
<input type="text" class="form-control" id="remarks" name="remarks" maxlength="255" value="<?php echo $remarks; ?>">
</div>
</div>
<div class="col-md-2">
<div class="form-group">
<label for="Active">IsActive</label> <br />
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive; ?>>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer" style="text-align:right">
<a href="<?php echo base_url() ?>rawmaterialListing" class="btn btn-cancel" value="Cancel" />Cancel</a>
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</form>
</div><!-- /.box-body -->
</div>
</div>
</div>
</section>
</div>
<script src="<?php echo base_url(); ?>public/assets/js/editUser.js" type="text/javascript"></script>
<script>

View File

@ -233,7 +233,7 @@ if (!empty($supplier)) {
<style>
legend {
border-bottom: 2px solid #FFF !important;
margin-left: -2%;
margin-left: 0%;
}
.text-right {
@ -245,219 +245,224 @@ if (!empty($supplier)) {
background-color: #fff;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center> Edit <?php echo $SupplierName; ?> Details</center>
</h1>
<ol class="breadcrumb">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>supplierlisting">&nbsp;&nbsp;<span class="bold">Back</span></a>
</ol>
</section>
<br/>
<section class="content" id="content">
<div class="row">
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-success">
<div class="row" style="font-size:11px; padding-left:38px;">
<div class="col-md-12">
<form class="form-horizontal" role="form" id="UpdateSupplier" action="<?php echo base_url() ?>editsupplier" method="post" role="form" enctype="multipart/form-data">
<div class="box-body">
<?php if((int)$chk){ ?>
<div class="col-md-12 text-right">
<input type="checkbox" id="isactive" <?php echo $IsActive; ?> name="isactive"> IsActive
</div>
<?php } ?>
<!-- Form Name -->
<legend>Supplier Information</legend>
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-2">
<span for="SupplierID">Supplier ID</span>
<input type="text" name="SupplierID" id="SupplierID" class="form-control" readonly value="<?php echo $SupplierID; ?>">
</div>
<div class="col-md-3">
<span for="SupplierName">Supplier Name</span><span class="badge">*</span>
<input type="text" name="SupplierName" maxlength="100" id="supplierName" class="form-control" required value="<?php echo $SupplierName; ?>">
</div>
<div class="col-md-2">
<span for="ContactNumber">Contact Number</span><span class="badge">*</span>
<input type="text" name="ContactNumber" onchange="return getContactNumberValidation();" id="ContactNumber" required maxlength="13" class="form-control" value="<?php echo $ContactNumber; ?>" title="Please Enter Contact Number (or) Telephone Number" onkeypress="return isNumberKey(event)">
</div>
<div class="col-md-2">
<span for="AlternateContactNumber">Alternate Contact Number</span>
<input type="text" name="AlternateContactNumber" onchange="return getValidAlternateNumber();" id="AlternateContactNumber" maxlength="13" class="form-control" value="<?php echo $AlternateContactNumber; ?>" title="Please Enter Contact Number (or) Telephone Number" onkeypress="return isNumberKey(event)">
</div>
<div class="col-md-3">
<span for="EmailAddress">Email ID</span><span class="badge">*</span>
<input type="email" name="emailid" id="emailid" pattern="([A-Z0-9_\-\.])+\@([A-Z0-9_\-\.])+\.([A-Z]{2,4})" required maxlength="100" class="form-control" value="<?php echo $EmailAddress; ?>" title="Please Enter valid mail address" onchange="validateEmail();">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-6"><span for="SupplierType">Supplier Type :</span><!--<span class="badge">*</span>-->
&ensp;
<input type="checkbox" id="service" <?php echo $IsService; ?> name="service" value="1"> <b>SERVICE &ensp;</b>
<input type="checkbox" id="rawmaterial" <?php echo $IsRawMaterial; ?> name="rawmaterial" value="1"> <b>RAW MATERIALS &ensp;</b>
<input type="checkbox" id="maintanance" <?php echo $IsMaintanance; ?> name="maintanance" value="1"> <b>MAINTENANCE &ensp;</b>
</div>
</div>
<!-- Address Section -->
<!-- Form Name -->
<legend>Address Details</legend>
<!-- Text input-->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-12">
<span for="Address2">Address</span><span class="badge">*</span>
<input type="text" class="form-control required" id="Address" name="Address" maxlength="500" required value="<?php echo $Address; ?>">
</div>
</div>
<legend>Tax Related Data</legend>
<!-- Text input-->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-3"><span for="GSTNo">GST Number</span><!--<span class="badge">*</span>-->
<input type="text" id="GSTNo" name="GSTNo" onchange="validateGST();" maxlength="15" class="form-control" value="<?php echo $GSTNO; ?>" pattern="([0-9]){2}([A-Za-z]){5}([0-9]){4}([A-Za-z]){1}([0-9]){1}([Zz]){1}([A-Za-z0-9]){1}" style="text-transform:uppercase;" title="Please Enter 2 Digit Number and 5 Character and 4 Digit Numbers and 1 Character and 1 Number and 'Z' Character and 1 Number (or) Character " onkeypress="return alphaNumberic(event)">
</div>
<div class="col-md-3"><span for="PAN">PAN</span> <!--<span class="badge">*</span>-->
<input type="text" id="panno" maxlength="10" name="panno" onchange="validatePAN();" class="form-control" value="<?php echo $PAN; ?>" title="Please Enter 5 Character and 4 digit numbers and 1 Character format (Character must be in caps format)" pattern="([A-Za-z]){5}([0-9]){4}([A-Za-z]){1}" onkeypress="return alphaNumberic(event)" style="text-transform:uppercase;">
</div>
<div class="col-md-3">
<input type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="Cert_GST" name="Cert_GST"/>
<label for="Cert_GST">Select GST Document<br/><small>(only .pdf, .doc, .png, .jpg)</small></label>
<input type="hidden" id="hidden_Cert_GST" name="hidden_Cert_GST" value="<?php echo $hidden_Cert_GST; ?>"/>
</div>
<?php if($hidden_Cert_GST){ ?>
<div class="col-md-3">
<u><a title="previously uploaded GST Document" href="<?php echo base_url().'public/uploads/images/' . $hidden_Cert_GST ?>"><span>previously uploaded GST Document - </span><small><?= $hidden_Cert_GST; ?></small></a></u>
</div>
<?php } ?>
</div>
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-6"><span for="MSMENo">MSME Number</span>
<input type="text" id="MSMENo" name="MSME" class="form-control" value="<?php echo $MSME; ?>" maxlength="30">
</div>
<div class="col-md-3">
<input type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="Cert_MSME" name="Cert_MSME"/>
<label for="Cert_MSME">Select MSME Document<br/><small>(only .pdf, .doc, .png, .jpg)</small></label>
<input type="hidden" id="hidden_Cert_MSME" name="hidden_Cert_MSME" value="<?php echo $hidden_Cert_MSME; ?>"/>
</div>
<?php if($hidden_Cert_MSME){ ?>
<div class="col-md-3">
<u> <a title="previously uploaded MSME Document" href="<?php echo base_url().'public/uploads/images/' . $hidden_Cert_MSME ?>"><span>previously uploaded MSME Document - </span><small><?= $hidden_Cert_MSME; ?></small></a></u>
</div>
<?php } ?>
</div>
<legend>Bank Details</legend>
<!-- Text input-->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-3"><span>Account Number</span><span class="badge">*</span>
<input type="text" id="accno" maxlength="20" name="accno" value="<?php echo $accno; ?>" class="form-control" onkeypress="return isNumberKey(event)" required>
</div>
<div class="col-md-3"><span>IFSC Code</span><span class="badge">*</span>
<input type="text" id="ifsc" name="ifsc" value="<?php echo $IFSCCode; ?>" class="form-control" maxlength="12" style="text-transform: uppercase" required>
</div>
<div class="col-md-3"><span>Bank Branch Name</span>
<input type="text" id="branchname" name="branchname" value="<?php echo $branchname; ?>" class="form-control" maxlength="200">
</div>
<div class="col-md-3"><span>Bank Address</span>
<input type="text" id="bankaddress" name="bankaddress" value="<?php echo $bankaddress; ?>" class="form-control" maxlength="200">
</div>
</div>
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-3">
<input type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="Cert_BANK" name="Cert_BANK"/>
<label for="Cert_BANK">Select Bank Document<br/><small>(only .pdf, .doc, .png, .jpg)</small></label>
<input type="hidden" id="hidden_Cert_BANK" name="hidden_Cert_BANK" value="<?php echo $hidden_Cert_BANK; ?>"/>
</div>
<?php if($hidden_Cert_BANK){ ?>
<div class="col-md-3">
<u><a title="previously uploaded Bank Document" href="<?php echo base_url().'public/uploads/images/' . $hidden_Cert_BANK ?>"><span>previously uploaded BANK Document - </span><small><?= $hidden_Cert_BANK; ?></small></a></u>
</div>
<?php } ?>
</div>
<!-- Text input-->
<legend>Payment Details</legend>
<!-- Text input-->
<div class="col-md-12" style="margin-bottom: 27px;">
<div class="col-md-3">
<span for="payablefrom">Payable Terms</span>
<select class="form-control required select2" id="PaymentTerms" name="PaymentTerms" onchange="payment_hidden();"><!-- placeholder="Select ">-->
<option value="<?php echo $PaymentTerms; ?>"><?php echo $PaymentTerms; ?></option>
<?php
if (!empty($payment)) {
foreach ($payment as $pm) {
?>
<option value="<?php echo $pm->PaymentID ?>"><?php echo $pm->PaymentTerms ?></option>
<?php
}
}
?>
</select>
<input type="hidden" id="paymentid" name="paymentid" value="<?php echo $PaymentId; ?>">
<!--<input type="hidden" id="paymentname" name="paymentname" value="<?php echo $PaymentId; ?>"> -->
</div>
</div>
<div class="col-md-12 text-right">
<a href="<?php echo base_url() ?>supplierlisting" class="btn btn-cancel" value="Cancel" />Cancel</a>
<?php if((int)$chk){ ?>
<input type="submit" onclick="validate();" value="Submit" class="btn btn-success">
<?php } ?>
</div>
</div>
</form>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
</div>
</div>
<div class="col-md-4">
<div class="content-page">
<div class="content">
<?php helper('form'); ?>
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('error'); ?>
</div>
if ($error) { ?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true"><EFBFBD></button>
<?php echo session()->getFlashdata('success'); ?>
</div>
if ($success) { ?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- Start Content-->
<div class="container-fluid">
<div class="box box-success">
<?php if (!empty($validation)) : ?>
<div class="alert alert-danger">
<ul>
<?php foreach ($validation as $error) : ?>
<li><?= esc($error) ?></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<!-- form start -->
</div>
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Supplier Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>supplierlisting"><span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="p-2">
<form class="form-horizontal" role="form" id="UpdateSupplier" action="<?php echo base_url() ?>editsupplier" method="post" enctype="multipart/form-data">
<div class="box-body">
<?php if ((int)$chk) { ?>
<div class="col-md-12 text-right">
<input type="checkbox" id="isactive" <?php echo $IsActive; ?> name="isactive"> IsActive
</div>
<?php } ?>
<!-- Supplier Information -->
<legend>Supplier Information</legend>
<div class="form-row">
<div class="col-md-3">
<label class="col-form-label" for="SupplierName">Supplier Name<span class="badge">*</span></label>
<input type="text" name="SupplierName" maxlength="100" id="supplierName" class="form-control" required value="<?php echo $SupplierName; ?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="ContactNumber">Contact Number<span class="badge">*</span></label>
<input type="text" name="ContactNumber" onchange="return getContactNumberValidation();" id="ContactNumber" required maxlength="13" class="form-control" value="<?php echo $ContactNumber; ?>" title="Please Enter Mobile Number (or) Telephone Number" onkeypress="return isNumberKey(event)">
</div>
<div class="col-md-3">
<label class="col-form-label" for="AlternateContactNumber">Alternate Contact Number</label>
<input type="text" name="AlternateContactNumber" onchange="return getValidAlternateNumber();" id="AlternateContactNumber" maxlength="13" class="form-control" value="<?php echo $AlternateContactNumber; ?>" title="Please Enter Mobile Number (or) Telephone Number" onkeypress="return isNumberKey(event)">
</div>
<div class="col-md-3">
<label class="col-form-label" for="EmailAddress">Email ID<span class="badge">*</span></label>
<input type="email" name="emailid" id="emailid" required maxlength="100" class="form-control" value="<?php echo $EmailAddress; ?>" title="Please Enter valid mail address" onchange="validateEmail();">
</div>
</div>
<div class="form-row" style="margin-top:20px;">
<div class="col-md-12">
<label for="SupplierType">Supplier Type</label>
</div>
<div class="col-md-3">
<input type="checkbox" id="service" <?php echo $IsService; ?> name="service" value="1"> <b>SERVICE</b>
</div>
<div class="col-md-3">
<input type="checkbox" id="rawmaterial" <?php echo $IsRawMaterial; ?> name="rawmaterial" value="1"> <b>RAW MATERIALS</b>
</div>
<div class="col-md-3">
<input type="checkbox" id="maintanance" <?php echo $IsMaintanance; ?> name="maintanance" value="1"> <b>MAINTENANCE</b>
</div>
</div>
<!-- Address Section -->
<legend style="margin-top:30px;">Address Details</legend>
<div class="form-row">
<div class="col-md-12">
<label for="Address2">Address<span class="badge">*</span></label>
<input type="text" class="form-control" id="Address" name="Address" maxlength="500" required value="<?php echo $Address; ?>">
</div>
</div>
<!-- Tax Related Data -->
<legend style="margin-top:30px;">Tax Related Data</legend>
<div class="form-row">
<div class="col-md-3">
<label for="GSTNo">GST Number</label>
<input type="text" id="GSTNo" name="GSTNo" onchange="validateGST();" maxlength="15" class="form-control" value="<?php echo $GSTNO; ?>" pattern="([0-9]){2}([A-Za-z]){5}([0-9]){4}([A-Za-z]){1}([0-9]){1}([Zz]){1}([A-Za-z0-9]){1}" style="text-transform:uppercase;" title="Please Enter 2 Digit Number and 5 Character and 4 Digit Numbers and 1 Character and 1 Number and 'Z' Character and 1 Number (or) Character " onkeypress="return alphaNumberic(event)">
</div>
<div class="col-md-3">
<label for="PAN">PAN</label>
<input type="text" id="panno" maxlength="10" name="panno" onchange="validatePAN();" class="form-control" value="<?php echo $PAN; ?>" title="Please Enter 5 Character and 4 digit numbers and 1 Character format (Character must be in caps format)" pattern="([A-Za-z]){5}([0-9]){4}([A-Za-z]){1}" onkeypress="return alphaNumberic(event)" style="text-transform:uppercase;">
</div>
<div class="col-md-3">
<input type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="Cert_GST" name="Cert_GST" />
<label for="Cert_GST">Select GST Document<br /><small>(only .pdf, .doc, .png, .jpg)</small></label>
<input type="hidden" id="hidden_Cert_GST" name="hidden_Cert_GST" value="<?php echo $hidden_Cert_GST; ?>" />
</div>
<?php if ($hidden_Cert_GST) { ?>
<div class="col-md-3">
<u><a title="previously uploaded GST Document" href="<?php echo base_url() . 'public/uploads/images/' . $hidden_Cert_GST ?>"><span>previously uploaded GST Document - </span><small><?= $hidden_Cert_GST; ?></small></a></u>
</div>
<?php } ?>
</div>
<legend>Bank Details</legend>
<!-- Bank Details Inputs -->
<div class="form-row" style="margin-bottom: 27px;">
<div class="col-md-3">
<label for="accno">Account Number <span class="badge">*</span></label>
<input type="text" id="accno" maxlength="20" name="accno" value="<?php echo $accno; ?>" class="form-control" onkeypress="return isNumberKey(event)" required>
</div>
<div class="col-md-3">
<label for="ifsc">IFSC Code <span class="badge">*</span></label>
<input type="text" id="ifsc" name="ifsc" value="<?php echo $IFSCCode; ?>" class="form-control" maxlength="12" style="text-transform: uppercase" required>
</div>
<div class="col-md-3">
<label for="branchname">Bank Branch Name</label>
<input type="text" id="branchname" name="branchname" value="<?php echo $branchname; ?>" class="form-control" maxlength="200">
</div>
<div class="col-md-3">
<label for="bankaddress">Bank Address</label>
<input type="text" id="bankaddress" name="bankaddress" value="<?php echo $bankaddress; ?>" class="form-control" maxlength="200">
</div>
</div>
<!-- Bank Document Upload -->
<div class="form-row" style="margin-bottom: 27px;">
<div class="col-md-3">
<input type="file" size="20" accept=".docx,.pdf,.doc,.jpg,.png" id="Cert_BANK" name="Cert_BANK" />
<label for="Cert_BANK">Select Bank Document<br /><small>(only .pdf, .doc, .png, .jpg)</small></label>
<input type="hidden" id="hidden_Cert_BANK" name="hidden_Cert_BANK" value="<?php echo $hidden_Cert_BANK; ?>" />
</div>
<?php if ($hidden_Cert_BANK) { ?>
<div class="col-md-3">
<u>
<a title="Previously uploaded Bank Document" href="<?php echo base_url() . 'public/uploads/images/' . $hidden_Cert_BANK ?>">
<span>Previously uploaded BANK Document - </span>
<small><?php echo $hidden_Cert_BANK; ?></small>
</a>
</u>
</div>
<?php } ?>
</div>
<!-- Payment Details -->
<legend>Payment Details</legend>
<!-- Payable Terms Selection -->
<div class="form-row" style="margin-bottom: 27px;">
<div class="col-md-3">
<label for="payablefrom">Payable Terms</label>
<select class="form-control required select2" id="PaymentTerms" name="PaymentTerms" onchange="payment_hidden();">
<option value="<?php echo $PaymentTerms; ?>"><?php echo $PaymentTerms; ?></option>
<?php
if (!empty($payment)) {
foreach ($payment as $pm) { ?>
<option value="<?php echo $pm->PaymentID; ?>"><?php echo $pm->PaymentTerms; ?></option>
<?php
}
}
?>
</select>
<input type="hidden" id="paymentid" name="paymentid" value="<?php echo $PaymentId; ?>">
<!-- Uncomment the next line if you need the payment name in hidden input -->
<!-- <input type="hidden" id="paymentname" name="paymentname" value="<?php echo $PaymentId; ?>"> -->
</div>
</div>
<br />
<div class="col-md-12">
<div class="form-group row text-right">
<div class="col-12">
<button type="submit" class="btn btn-info pull-right">Submit</button>
</div>
</div>
</div>
<!-- /.box-footer -->
</div>
</form>
</div> <!-- end p-2 -->
</div> <!-- end col -->
</div> <!-- end row -->
</div> <!-- end card-body -->
</div> <!-- end card -->
</div> <!-- end col -->
</div> <!-- end row -->
</div> <!-- end container-fluid -->
</div> <!-- end content -->
</div> <!-- end content-page -->
<div class="row">
<div class="col-md-12">
<?php // echo validation_errors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true"><3E></button></div>'); ?>
</div>
</div>
</div>
</div>
</section>
</div>
<script>
function payment_hidden() {
var term = document.getElementById("PaymentTerms");
@ -510,33 +515,34 @@ if (!empty($supplier)) {
var supplier = suppliername.replace(/ /g, '');
$('#content').loader('show');
$.ajax({
type: "POST",
url: "<?= base_url() . 'supplierExist' ?>",
data: { id: supplier },
success: function(data) {
var count = data.length;
if (count > 2) {
$('#content').loader('hide');
alert('supplier already existed ! ');
var related_supplier = "";
$.each(data, function(i, obj) {
related_supplier += obj.SupplierID + " - " + obj.SupplierName + " - " + obj.Address + "\n";
});
alert("'" + suppliername + "' - related supplier are , " + " \n \n" + related_supplier);
$("#supplierName").focus();
} else {
$('#content').loader('hide');
// alert('This is New Supplier! ');
}
console.log(data);
},
error: function() {
$('#content').loader('hide');
// alert("Error Occur");
console.log("an error occur supplierExist")
}
});
});
type: "POST",
url: "<?= base_url() . 'supplierExist' ?>",
data: {
id: supplier
},
success: function(data) {
var count = data.length;
if (count > 2) {
$('#content').loader('hide');
alert('supplier already existed ! ');
var related_supplier = "";
$.each(data, function(i, obj) {
related_supplier += obj.SupplierID + " - " + obj.SupplierName + " - " + obj.Address + "\n";
});
alert("'" + suppliername + "' - related supplier are , " + " \n \n" + related_supplier);
$("#supplierName").focus();
} else {
$('#content').loader('hide');
// alert('This is New Supplier! ');
}
console.log(data);
},
error: function() {
$('#content').loader('hide');
// alert("Error Occur");
console.log("an error occur supplierExist")
}
});
});
</script>

View File

@ -101,293 +101,185 @@ if(!empty($assetList))
?>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center><?= 'Edit Asset - ' .$AssetCode; ?> Details</center>
</h1>
<ol class="breadcrumb">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>assetListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</ol>
</section><br>
<section class="content">
<div style="text-align:right;">
<a href="<?php echo base_url()?>assetListing" class="btn btn-cancel"value="Back">Back</a>
</div>
<br>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box box-success">
<!-- form start -->
<form role="form" id="addAsset" action="<?php echo base_url() ?>editasset" method="post">
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Asset_Name">Asset Name</span><span style="color:red">*</span>
</b>
<input type="text" class="form-control required" id="AssetName" name="AssetName" value="<?php echo $AssetName;?>" style="text-transform:uppercase;">
<input type="hidden" name="AssetCode" id="AssetCode" class="form-control" readonly value="<?php echo $AssetCode;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Description">Asset Description</span><span style="color:red">*</span></b>
<input type="text" class="form-control required" id="Description" name="Description"
value="<?php echo $Description; ?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="AssetOwner">Asset User</span><span style="color:red">*</span></b>
<input type="text" class="form-control required" id="User" name="User" value="<?php echo $User;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Location">Asset Location</span><span style="color:red">*</span></b>
<input type="text" class="form-control required" id="Location" name="Location"
value="<?php echo $Location;?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<b>
<span for="PONO">Purchase Order Number</span><span style="color:red">*</span></b>
<select class="form-control required select2" id="PONO" name="PONO">
<option value="<?php echo $PONO;?>"><?php echo $PONO;?></option>
<?php
if(!empty($PO))
{
foreach ($PO as $po)
{
$PONO1 = $po->PONO;
if(trim($PONO1) != trim($PONO))
{
if ($_POST['PONO'] == $PONO1)
{
echo "<option value=\"".$PONO1."\" selected=\"selected\">". $po->PONO."</option>";
}
else
{
echo "<option value=\"".$PONO1."\">". $po->PONO ."</option>";
}
}
}
}
?>
</select>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<b>
<span for="SelectMaterialCode" value=""> select Material Code</span>
</b>
<select class="form-control required select2" id="SelectMaterialCode" name="lineitem">
<option value="<?php echo $POLineItem;?>"><?php echo $POLineItem;?></option>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>
<span for="MaterialCode">Material Code</span></b>
<input type="text" class="form-control required" id="MaterialCode" readonly name="MaterialCode" value="<?php echo $MaterialCode;?>">
</div>
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group">
<b>
<span for="UOM">UOM</span></b>
<input type="text" class="form-control required" id="UOM"value="<?php echo $UOM;?>"readonly name="UOM" value="">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<b>
<span for="Quantity">Quantity</span></b>
<input type="text" class="form-control required" id="Quantity" value="<?php echo $Quantity;?>" name="Quantity" value="">
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="Description">Description</span></b>
<input type="text" class="form-control required" id="PODescription" readonly name="PODescription" value="<?php echo $MaterialName;?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<input type="hidden" name="AssetDept" id="depcode" value="<?php echo $Department?>">
<b>
<span for="AssetDept">Asset Department</span></b>
<input type="text" class="form-control required" value="<?php echo $DepartmentName;?>" id="AssetDept" readonly>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="DateOfPurchase">Purchase Date</span></b>
<input id="DateOfPurchase" required name="DateOfPurchase" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DateOfPurchase;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<b>
<span for="DateOfPurchase">Supplier Name</span></b>
<input type="hidden" name="SupplierName" id="SupID" value="<?php echo $SupplierCode;?>">
<input id="SupplierName" readonly onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $SupplierName; ?>">
</div>
</div>
<div class="col-md-3" style="padding:0px;">
<div class="col-md-6">
<div class="form-group"><b>
<span for="DeliveryDate">Delivery Date</span></b>
<input id="DeliveryDate" readonly name="DeliveryDate" maxlength="10" class="form-control" value= "<?php echo $DeliveryDate;?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group"><b>
<span for="DateOfCommission">Date Of Commission</span></b>
<input id="DateOfCommission" required name="DateOfCommission" onkeypress="return false;" maxlength="10" class="form-control" value= "<?php echo $DateOfCommison;?>">
</div>
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group"><b>
<span for="Assetvalue">Asset Value</span>
</b> <input type="text" class="form-control required" id="Assetvalue" name="Assetvalue" onkeypress="return isNumberKey(event)" maxlength="255" value="<?php echo $AssetValue;?>">
</div>
</div>
<div class="col-md-3">
<div class="form-group"><b>
<span for="AssetStatus">Asset Status</span></b>
<select class="form-control required" id="AssetStatus" name="AssetStatus">
<option value="<?php echo $AssetStatus; ?>"><?php echo $AssetStatus; ?></option>
<?php
if(!empty($AssetStatusList))
{
foreach ($AssetStatusList as $SID)
{
?>
<option value="<?php echo $SID->ConfigValue; ?>"> <?php echo $SID->ConfigValue ?></option>
<?php
}
}
?>
</select>
</div>
</div>
<div class="col-md-6">
<div class="form-group"><b>
<span for="Remarks">Remarks</span>
</b>
<input type="text" class="form-control required" id="Remarks" name="Remarks" maxlength="500" value="<?php echo $Remarks; ?>">
</div>
</div>
</div>
<div class="col-md-12">
<div class="col-md-3">
<input type="checkbox" id="isactive" name="isactive" <?php echo $IsActive ?> > IsActive
</div>
</div>
</div><!-- /.box-body -->
<div class="box-footer" style="text-align:right">
<a href="<?php echo base_url()?>assetListing" class="btn btn-cancel" id="cancel" value="Cancel">Cancel</a>
<input type="submit" class="btn btn-success" value="Submit" />
</div>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title text-center"><?= 'Edit Asset - ' . $AssetCode; ?> Details</h4>
</div>
</div>
</form>
</div>
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?> </div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>assetListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" id="addAsset" action="<?php echo base_url() ?>editasset" method="post">
<div class="box-body">
<div class="form-row">
<div class="col-md-3">
<label class="col-form-label" for="AssetName">Asset Name<span class="badge">*</span></label>
<input type="text" class="form-control" id="AssetName" name="AssetName" value="<?php echo $AssetName;?>" style="text-transform:uppercase;">
<input type="hidden" name="AssetCode" id="AssetCode" class="form-control" readonly value="<?php echo $AssetCode;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Description">Asset Description<span class="badge">*</span></label>
<input type="text" class="form-control" id="Description" name="Description" value="<?php echo $Description; ?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="User">Asset User<span class="badge">*</span></label>
<input type="text" class="form-control" id="User" name="User" value="<?php echo $User;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Location">Asset Location<span class="badge">*</span></label>
<input type="text" class="form-control" id="Location" name="Location" value="<?php echo $Location;?>">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label class="col-form-label" for="PONO">Purchase Order Number<span class="badge">*</span></label>
<select class="form-control select2" id="PONO" name="PONO">
<option value="<?php echo $PONO;?>"><?php echo $PONO;?></option>
<?php if(!empty($purchaseOrder))
{
foreach($purchaseOrder as $order)
{ ?>
<option value="<?php echo $order->purchase_orderno; ?>"><?php echo $order->purchase_orderno; ?></option>
<?php }
}?>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="Category">Asset Category<span class="badge">*</span></label>
<select class="form-control select2" id="Category" name="Category">
<option value="<?php echo $Category;?>"><?php echo $CategoryName;?></option>
<?php if(!empty($categories))
{
foreach($categories as $cat)
{ ?>
<option value="<?php echo $cat->id; ?>"><?php echo $cat->name; ?></option>
<?php }
}?>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="AssetType">Asset Type<span class="badge">*</span></label>
<select class="form-control select2" id="AssetType" name="AssetType">
<option value="<?php echo $AssetType;?>"><?php echo $AssetType;?></option>
<option value="Fixed">Fixed</option>
<option value="Consumable">Consumable</option>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="AssetSubType">Asset Sub-Type<span class="badge">*</span></label>
<select class="form-control select2" id="AssetSubType" name="AssetSubType">
<option value="<?php echo $AssetSubType;?>"><?php echo $AssetSubType;?></option>
<option value="Individual">Individual</option>
<option value="Common">Common</option>
</select>
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label class="col-form-label" for="PDate">Purchase Date<span class="badge">*</span></label>
<input type="text" class="form-control" id="PDate" name="PDate" value="<?php echo $PDate;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Vendor">Vendor<span class="badge">*</span></label>
<select class="form-control select2" id="Vendor" name="Vendor">
<option value="<?php echo $Vendor;?>"><?php echo $VendorName;?></option>
<?php if(!empty($vendors))
{
foreach($vendors as $vendor)
{ ?>
<option value="<?php echo $vendor->id; ?>"><?php echo $vendor->name; ?></option>
<?php }
}?>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="Rate">Rate<span class="badge">*</span></label>
<input type="text" class="form-control" id="Rate" name="Rate" value="<?php echo $Rate;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Life">Life<span class="badge">*</span></label>
<input type="text" class="form-control" id="Life" name="Life" value="<?php echo $Life;?>">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label class="col-form-label" for="AssetDept">Asset Department</label>
<input type="text" class="form-control" value="<?php echo $DepartmentName;?>" id="AssetDept" readonly>
<input type="hidden" name="AssetDept" id="depcode" value="<?php echo $Department?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="AssetOwner">Asset Owner</label>
<select class="form-control select2" id="AssetOwner" name="AssetOwner">
<option value="<?php echo $AssetOwner;?>"><?php echo $AssetOwnerName;?></option>
<?php if(!empty($owners))
{
foreach($owners as $owner)
{ ?>
<option value="<?php echo $owner->id; ?>"><?php echo $owner->name; ?></option>
<?php }
}?>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="VendorWarranty">Vendor Warranty</label>
<input type="text" class="form-control" id="VendorWarranty" name="VendorWarranty" value="<?php echo $VendorWarranty;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="AMC">AMC Details</label>
<input type="text" class="form-control" id="AMC" name="AMC" value="<?php echo $AMC;?>">
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-3">
<label class="col-form-label" for="AssetLocation">Current Asset Location</label>
<input type="text" class="form-control" id="AssetLocation" name="AssetLocation" value="<?php echo $AssetLocation;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Custodian">Custodian Name</label>
<input type="text" class="form-control" id="Custodian" name="Custodian" value="<?php echo $Custodian;?>">
</div>
<div class="col-md-3">
<label class="col-form-label" for="Condition">Condition</label>
<select class="form-control select2" id="Condition" name="Condition">
<option value="<?php echo $Condition;?>"><?php echo $Condition;?></option>
<option value="Good">Good</option>
<option value="Average">Average</option>
<option value="Poor">Poor</option>
</select>
</div>
<div class="col-md-3">
<label class="col-form-label" for="Remarks">Remarks</label>
<textarea class="form-control" id="Remarks" name="Remarks"><?php echo $Remarks;?></textarea>
</div>
</div>
<div class="form-row" style="margin-top:20px">
<div class="col-md-12 text-right">
<a href="<?php echo base_url()?>assetListing" class="btn btn-cancel" id="cancel" value="Cancel">Cancel</a>
<input type="submit" class="btn btn-success" value="Submit" />
</div>
</div>
</div><!-- /.box-body -->
</form>
</div><!-- /.card-body -->
</div><!-- /.card -->
</div><!-- /.col -->
</div><!-- /.row -->
</div><!-- /.container-fluid -->
</div><!-- /.content -->
</div><!-- /.content-page -->
<script src="<?php echo base_url(); ?>public/assets/js/addUser.js" type="text/javascript"></script>
<script>

View File

@ -19,267 +19,244 @@ if (!empty($master)) {
}
?>
<div class="content-wrapper" style="min-height: 537px;">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Edit Config <?= ' - '.$ConfigName; ?> Details</center>
</h1>
<ol class="breadcrumb">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>configlisting">&nbsp;&nbsp;<span class="bold">Back</span></a>
</ol>
</section><br>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Config <?= ' - ' . $ConfigName; ?> Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>configlisting"><span class="bold">Back</span></a>
</div>
</div>
<section class="content">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<!-- left column -->
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) {
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if ($success) {
?>
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?php
$attributes = array('class' => 'form-horizontal', 'id' => 'editConfig');
echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes); ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>');
?> </div>
</div>
</div>
<div class="col-md-12">
<div class="box box-success">
<!-- form start -->
<?php
$attributes = array('class' => 'form-label-left editConfig ', 'name' => 'editConfig', 'id' => 'editConfig');
<div class="form-row" style="margin-top:10px">
<div class="col-md-3">
<label class="col-form-label" for="ConfigId">Configuration ID</label>
<font color="Red">*</font>
<?php
$data = array('name' => 'ConfigId', 'value' => set_value('ConfigId', $ConfigId), 'id' => 'ConfigId', 'class' => 'form-control', 'required' => 'true', 'readonly' => 'true');
echo form_input($data);
?>
</div>
echo form_open(base_url() . 'configurationctrl/updateconfig', $attributes); ?>
<div class="col-md-3">
<label class="col-form-label" for="ConfigName">Configuration Name</label>
<font color="Red">*</font>
<?php
$data = array('name' => 'ConfigName', 'value' => set_value('ConfigName', $ConfigName), 'id' => 'ConfigName', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data);
?>
</div>
<div class="box-body">
<div class="row">
<div class="col-md-12">
<div class="col-md-3">
<div class="form-group">
<label for="CostName">Configuration ID </label><font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'ConfigId', 'value' => set_value('ConfigId', $ConfigId), 'id' => 'ConfigId', 'class' => 'form-control', 'required' => 'true', 'readonly' => 'true', 'onclick' => 'al();');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="Description">Configuration Name</label>
<font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'ConfigName', 'value' => set_value('ConfigName', $ConfigName), 'id' => 'CostName', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20'); //'style'=>'text-transform:uppercase;'
echo form_input($data);
?>
</div>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label for="Remarks">Comments</label>
<font color="Red">*</font>
<div class="form-group">
<?php
$data = array('name' => 'Remarks', 'value' => set_value('Remarks', $Comments), 'id' => 'CostName', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data);
?>
</div>
</div>
</div>
</div>
</div>
<br>
<div col="row">
<div style="text-align:right">
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;" class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Configuration</a>
<!-- Modal -->
<div class="modal fade" id="AddConfiguration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Add Configuration</center>
</h4>
</div>
<div class="col-md-3">
<label class="col-form-label" for="Remarks">Comments</label>
<font color="Red">*</font>
<?php
$data = array('name' => 'Remarks', 'value' => set_value('Remarks', $Comments), 'id' => 'Remarks', 'class' => 'form-control', 'required' => 'true', 'maxlength' => '20');
echo form_input($data);
?>
</div>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="form-row" style="margin-top:10px">
<div class="col-md-12 text-right">
<a data-toggle="modal" href="#AddConfiguration" style="margin-right: 10px;" class="btn btn-success"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add Configuration</a>
</div>
</div>
<form class="form-horizontal" role="form">
<div class="form-row" style="margin-top:10px">
<div class="col-md-12">
<table id="configtable" class="table table-bordered table-hover responsive-utilities jambo_table" style="background-color:#fff;font-size:12px;">
<thead>
<tr>
<th>S.NO</th>
<th>Config Value</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tempAppend">
<?php if (!empty($master && $child)) {
$index = 0;
foreach ($child as $con) {
$index++;
?>
<input type="hidden" name="DbKey<?php echo $index ?>" id="DbKey<?php echo $index ?>" value="<?php echo $con->Key ?>">
<input type="hidden" name="configVal<?php echo $index ?>" id="configVal<?php echo $index ?>" value="<?php echo $con->ConfigValue ?>">
<tr>
<td><?php echo $index; ?></td>
<td><?php echo $con->ConfigValue; ?></td>
<td><a data-target='#Edit' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#Edit"><i class="fas fa-pencil-alt" data-toggle="tooltip" title="Click here to view/Edit the Budget details"></i>&nbsp;&nbsp;&nbsp;</a></td>
</tr>
<?php }
} ?>
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $index ?>" />
</tbody>
</table>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Configuration Value :
</div>
<div class="col-md-5">
<div class="form-row text-right" style="margin-top:10px; text-align:right">
<div class="col-md-12 text-right">
<a href="<?php echo base_url() ?>configlisting" class="btn btn-cancel">Cancel</a>
<input type="submit" class="btn btn-success" value="Update" />
</div>
</div>
</div>
</div>
</div>
</div>
<input class="form-control" name="AddConfigValue" class="form-control" id="AddConfigValue" type="text">
<!-- Modal For Add Configuration -->
<div class="modal fade" id="AddConfiguration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Add Configuration</center>
</h4>
</div>
</div>
</div>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Configuration Value :
</div>
<div class="col-md-5">
<input class="form-control" name="AddConfigValue" id="AddConfigValue" type="text">
</div>
</div>
</div>
</form>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal">Cancel</a>
<a class="btn btn-success font tempClickAdd" id="tempClickAdd"><i class="fa fa-plus"></i>&nbsp;&nbsp;Add</a>
</div>
</div>
</div>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success font tempClickAdd" ID="tempClickAdd" style="margin-top: -24px;"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add</span></a>
</div>
</div>
</div>
</div>
</div>
</div><br>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="configtable" class="table table-bordered table-hover responsive-utilities jambo_table" style="background-color:#fff;font-size:12px;">
<thead>
<th>S.NO</th>
<th>Config Value</th>
<th>Action</th>
</thead>
<tbody id="tempAppend">
<?php if (!empty($master && $child)) {
$index = 0;
foreach ($child as $con) {
?>
<?php $index = $index + 1; ?>
<input type="hidden" name="DbKey<?php echo $index ?>" id="DbKey<?php echo $index ?>" value="<?php echo $con->Key ?>">
<input type="hidden" name="configVal<?php echo $index ?>" id="configVal<?php echo $index ?>" value="<?php echo $con->ConfigValue ?>">
<tr>
<td><?php echo $index; ?></td>
<td><?php echo $con->ConfigValue; ?></td>
<td><a data-target='#Edit' data-id="<?php echo $index; ?>" data-userid="<?php echo $index; ?>" data-toggle="modal" href="#Edit"><i class="fa fa-pencil" data-toggle="tooltip" title="Click here to view/Edit the Budget details"></i>&nbsp;&nbsp;&nbsp;</a></td>
</tr>
<?php
}
}
<!-- Modal For Edit Configuration -->
<div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Edit Config</center>
</h4>
</div>
?>
<input type="hidden" name="txtRowCount" id="txtRowCount" value="<?php echo $index ?>" />
<!-- Modal Body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
S.NO :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'key', 'value' => set_value('key'), 'id' => 'key', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
</tbody>
</table>
<!-- Modal For edit -->
<div class="modal fade" id="Edit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
<center> Edit Config</center>
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Config ID :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'Config_ID', 'value' => set_value('Config_ID'), 'id' => 'Config_ID', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<form class="form-horizontal" role="form">
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
S.NO :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'key', 'value' => set_value('key'), 'id' => 'key', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Config Value :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'configValue', 'value' => set_value('configValue'), 'id' => 'configValue', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Config ID :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'Config_ID', 'value' => set_value('Config_ID'), 'id' => 'Config_ID', 'class' => 'form-control', 'readonly' => 'true');
echo form_input($data);
?>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-md-3 col-md-offset-2">
Config Value :
</div>
<div class="col-md-5">
<?php
$data = array('name' => 'EditConfigValue', 'value' => set_value('EditConfigValue'), 'id' => 'EditConfigValue', 'class' => 'form-control');
echo form_input($data);
?>
</div>
</div>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal" style="margin-top: -24px;" value="Cancel">Cancel</a>
<a class="btn btn-success font tempClickEdit" ID="tempClickEdit" style="margin-top: -24px;"><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Update</span></a>
</div>
</div>
</div>
</div>
</div>
<div class="box-footer" style="text-align:right">
<a href="<?php echo base_url() ?>configlisting" class="btn btn-cancel" id="cancel" value="Cancel">Cancel</a>
<input type="submit" class="btn btn-success" value="Update" />
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</section>
<!-- Modal Footer -->
<div class="modal-footer">
<a class="btn btn-cancel" data-dismiss="modal">Cancel</a>
<a class="btn btn-success font tempClickUpdate" id="tempClickUpdate"><i class="fa fa-pencil"></i>&nbsp;&nbsp;Update</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/html" id="tempList">
<tr id="<%=index%>">
@ -296,153 +273,153 @@ if (!empty($master)) {
</td>
</tr>
</script>
<script>
var index = $('#txtRowCount').val();
var userid = '';
<script>
var index = $('#txtRowCount').val();
var userid = '';
$("#Edit").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
$('#key').val($('#configtable tr:eq(' + userid + ') td:eq(0)').text());
$('#Config_ID').val($('#ConfigId').val());
$('#EditConfigValue').val($('#configtable tr:eq(' + userid + ') td:eq(1)').text());
$('#ConfigVal'+userid).val($('#configtable tr:eq(' + userid + ') td:eq(1)').text());
$("#Edit").on("shown.bs.modal", function(e) {
userid = $(e.relatedTarget).data('userid');
$('#key').val($('#configtable tr:eq(' + userid + ') td:eq(0)').text());
$('#Config_ID').val($('#ConfigId').val());
$('#EditConfigValue').val($('#configtable tr:eq(' + userid + ') td:eq(1)').text());
$('#ConfigVal' + userid).val($('#configtable tr:eq(' + userid + ') td:eq(1)').text());
});
});
$('.tempClickAdd').click(function() {
$('.tempClickAdd').click(function() {
var cid = $('#ConfigId').val()
var cid = $('#ConfigId').val()
if ($("#AddConfigValue").val() != '-1') {
if ($("#AddConfigValue").val() != '-1') {
$('#AddConfigValue').show();
var ConfigValue = $("#AddConfigValue").val();
$('#AddConfigValue').val('');
$('#AddConfigValue').show();
index = parseInt(index) + 1;
var temp = index;
var ConfigValue = $("#AddConfigValue").val();
$('#AddConfigValue').val('');
var template = jQuery("#tempList").html();
$('#tempAppend').append(_.template(template, {
index: temp,
ConfigValue: ConfigValue,
}));
var theForm = $(".editConfig");
addHidden(theForm, "DbKey" + temp, 0);
addHidden(theForm, "configVal" + temp, ConfigValue);
$('#txtRowCount').val(temp);
//CountRows();
} else {
alert('Please enter all the values');
}
});
index = parseInt(index) + 1;
var temp = index;
function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;
'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
var template = jQuery("#tempList").html();
$('#tempAppend').append(_.template(template, {
index: temp,
ConfigValue: ConfigValue,
}));
var theForm = $(".editConfig");
addHidden(theForm, "DbKey" + temp, 0);
addHidden(theForm, "configVal" + temp, ConfigValue);
$('#txtRowCount').val(temp);
//CountRows();
} else {
alert('Please enter all the values');
}
$('.tempClickEdit').click(function() {
});
if ($("#EditConfigValue").val() != '') {
function addHidden(theForm, key, value) {
// Create a hidden input element, and append it to the form:
var input = document.createElement('input');
input.type = 'hidden';
input.name = key;
'name-as-seen-at-the-server';
input.value = value;
theForm.append(input);
}
$('.tempClickEdit').click(function() {
var temp = index;
var ConfigValue = $("#EditConfigValue").val();
//alert(userid);
$('#configtable tr:eq(' + userid + ') td:eq(1)').text(ConfigValue);
//alert($('#hConfigValue'+userid).val());
//$('#hConfigValue'+userid).val(ConfigValue);
$('#Config_ID' + userid).val($('#ConfigId').val());
$('#EditConfigValue' + userid).val(ConfigValue);
$("#configVal" + userid).val(ConfigValue);
} else {
alert('Please enter all the values');
}
});
if ($("#EditConfigValue").val() != '') {
function ConfirmDelete() {
var x = confirm("Are you sure you want to delete?");
if (x)
return true;
else
return false;
var temp = index;
var ConfigValue = $("#EditConfigValue").val();
//alert(userid);
$('#configtable tr:eq(' + userid + ') td:eq(1)').text(ConfigValue);
//alert($('#hConfigValue'+userid).val());
//$('#hConfigValue'+userid).val(ConfigValue);
$('#Config_ID' + userid).val($('#ConfigId').val());
$('#EditConfigValue' + userid).val(ConfigValue);
$("#configVal" + userid).val(ConfigValue);
} else {
alert('Please enter all the values');
}
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31 &&
(charCode < 48 || charCode > 57))
return false;
});
function ConfirmDelete() {
var x = confirm("Are you sure you want to delete?");
if (x)
return true;
}
</script>
else
return false;
}
<script>
//var baseurl = "<?php print base_url(); ?>";
$(".editConfig").submit(function(e) {
if (validate()) {
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31 &&
(charCode < 48 || charCode > 57))
return false;
$('#content').loader('show');
$.ajax({
data: $('.editConfig').serialize(),
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configedit",
success: function(data) {
return true;
}
</script>
<script>
//var baseurl = "<?php print base_url(); ?>";
$(".editConfig").submit(function(e) {
if (validate()) {
$('#content').loader('show');
$.ajax({
data: $('.editConfig').serialize(),
type: 'POST',
url: "<?php echo base_url(); ?>configurationctrl/configedit",
success: function(data) {
//alert(data);
if (data) {
$('#content').loader('hide');
//alert(data);
if (data) {
$('#content').loader('hide');
//alert(data);
$('#txtSelectedDepartment').val('');
$('#txtRowCount').val('');
$('#txtSelectedDepartment').val('');
$('#txtRowCount').val('');
//window.location = baseurl + 'CostCenter/CostListing';
}
//window.location = baseurl + 'CostCenter/CostListing';
}
});
//$('#content').loader('hide');
}
});
function validate() {
if ($("option:selected", $("#ApprovedBy")).val() == '-1') {
alert('Please Select Approver Names');
return false;
} else {
return true;
}
}
});
//$('#content').loader('hide');
}
</script>
});
function validate() {
if ($("option:selected", $("#ApprovedBy")).val() == '-1') {
alert('Please Select Approver Names');
return false;
} else {
return true;
}
}
</script>

View File

@ -82,6 +82,9 @@ if(!empty($department))
color:#00c0ef ! important;
} */
legend {
margin-left: 0% !important;
}
.pad{
padding-bottom:1%;
}
@ -90,117 +93,96 @@ if(!empty($department))
color:red; background-color:#fff;
}
</style>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center> Edit Department - <?php echo $DepartmentName; ?> Details</center>
</h1>
<ol class="breadcrumb">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>departmentListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</ol>
</section><br/>
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-12">
<!-- general form elements -->
<div class="box">
<!-- form start -->
<div class="row">
<div class="col-md-10 col-md-offset-1"> <!--style="border:3px solid #00d976;;">-->
<form class="form-horizontal" role="form" id="Updatedepartment" action="<?php echo base_url() ?>editdepartment" method="post" role="form"><br/>
<fieldset>
<!-- Form Name -->
<legend>Department Information</legend>
<div class="col-md-2 pad">
<span for="DEPCode">Department Code</span>
<input type="text" name="DEPCode" id="DEPCode" class="form-control" readonly value="<?php echo $DEPCode;?>">
</div>
<div class="col-md-4 pad">
<span for="DepartmentName">Department Name</span><span class="badge">*</span>
<input type="text" name="DepartmentName" id="DepartmentName" class="form-control" required value="<?php echo $DepartmentName;?>">
</div>
<div class="col-md-3 pad">
<span for="HeadDept">Head Department</span>
<select class="form-control required" id="HeadDept" name="HeadDept">
<option value="<?php echo $HeadDept?>"><?php echo $HeadDept?></option>
<?php
if(!empty($depcode))
{
foreach ($depcode as $DC)
{
?>
<option value="<?php echo $DC->DEPCode?>"><?php echo $DC->DEPCode ?> - <?php echo $DC->DepartmentName ?></option>
<?php
}
}
?>
</select>
</div>
<div class="col-md-offset-1 col-md-2">
<div class="form-group">
<span for="Active">Is Active</span> <br>
<input type="checkbox" id="IsActive" name="IsActive" <?php echo $IsActive;?> >
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Edit Department - <?php echo $DepartmentName; ?> Details</h4>
</div>
</div>
<div class="col-6 text-right">
<a class="btn btn-cancel" href="<?php echo base_url(); ?>departmentListing">&nbsp;&nbsp;<span class="bold">Back</span></a>
</div>
</div>
<!-- end page title -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form role="form" id="Updatedepartment" action="<?php echo base_url() ?>editdepartment" method="post">
<div class="box-body">
<!-- Department Information -->
<legend>Department Information</legend>
<div class="form-row" style="margin-top:10px">
<div class="col-md-3">
<label class="col-form-label" for="DEPCode">Department Code</label>
<input type="text" name="DEPCode" id="DEPCode" class="form-control" readonly value="<?php echo $DEPCode; ?>">
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-3">
<label class="col-form-label" for="DepartmentName">Department Name<span class="badge">*</span></label>
<input type="text" name="DepartmentName" id="DepartmentName" class="form-control" required value="<?php echo $DepartmentName; ?>">
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-3">
<label class="col-form-label" for="HeadDept">Head Department</label>
<select class="form-control required" id="HeadDept" name="HeadDept">
<option value="<?php echo $HeadDept; ?>"><?php echo $HeadDept; ?></option>
<?php if (!empty($depcode)) {
foreach ($depcode as $DC) { ?>
<option value="<?php echo $DC->DEPCode; ?>"><?php echo $DC->DEPCode . " - " . $DC->DepartmentName; ?></option>
<?php }
} ?>
</select>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-2">
<label class="col-form-label" for="IsActive">Is Active</label><br>
<input type="checkbox" id="IsActive" name="IsActive" <?php echo $IsActive; ?>>
</div>
</div>
<div class="form-row" style="margin-top:10px">
<div class="col-md-12 text-right">
<input type="reset" id="reset" class="btn btn-reset" style="background-color: red; color: white; margin-right: 15px; width: 80px;" value="Reset" />
<input type="submit" value="Update" class="btn btn-success">
</div>
</div>
</div>
</form>
<div class="row">
<div class="col-md-12">
<?php
helper('form');
$error = session()->getFlashdata('error');
if ($error) { ?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php }
$success = session()->getFlashdata('success');
if ($success) { ?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
</div>
</div>
<div class="form-group">
<div class="col-md-3 col-md-offset-9">
<div class="pull-right">
<input type="submit" value="Update" class="btn btn-success">
</div>
</div>
</div> <!-- end card -->
</div><!-- end col -->
</div>
</div>
</fieldset>
</form>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
</div>
</div>
<div class="col-md-4">
<?php
helper('form');
$error = session()->getFlashdata('error');
if($error)
{
?>
<div class="alert alert-danger alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('error'); ?>
</div>
<?php } ?>
<?php
$success = session()->getFlashdata('success');
if($success)
{
?>
<div class="alert alert-success alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo session()->getFlashdata('success'); ?>
</div>
<?php } ?>
<div class="row">
<div class="col-md-12">
<?php // \Config\Services::validation()->listErrors('<div class="alert alert-danger alert-dismissable">', ' <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button></div>'); ?> </div>
</div>
</div>
</div>
</section>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
</div>

View File

@ -34,6 +34,19 @@ if (!empty($ReqPOType)) {
$strReqPOType = $ReqPOType;
}
?>
<style>
.btn-soft-primary {
color: white;
background-color: rgb(42, 206, 150);
border-color: rgb(42, 206, 150);
}
.btn-soft-primary:hover {
background-color: rgb(32, 176, 130); /* Slightly darker shade for hover */
border-color: rgb(32, 176, 130);
}
</style>
<script type="text/javascript">
window.onload = function() {
var serviceScheduleType = '<?php echo $serviceSchedule; ?>';
@ -216,13 +229,13 @@ if (!empty($ReqPOType)) {
<div class="form-row float-right">
<?php if ($Status == REQ_DRAFT) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect Save" onclick="Save(0)" id="Save">Save As Draft</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" onclick="Save(1)" id="submit">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" onclick="Save(2)" id="submit">Approve</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect Save" " id="Save">Save As Draft</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" id="submit1">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" id="submit2">Approve</button>&nbsp;&nbsp;
<?php } else if ($Status == REQ_PENDING_APPROVAL) { ?>
<input type="reset" value="Reset" class="btn btn-secondary waves-effect" onclick="window.location.reload();">&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" onclick="Save(1)" id="submit">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" onclick="Save(2)" id="submit">Approve</button>&nbsp;&nbsp;
<button type="button" class="btn btn-primary waves-effect submit" id="submit1">Submit</button>&nbsp;&nbsp;
<button type="button" class="btn btn-soft-primary waves-effect waves-light submit" id="submit2">Approve</button>&nbsp;&nbsp;
<?php } ?>
</div>
<?php echo form_close(); ?>
@ -518,72 +531,82 @@ if (!empty($ReqPOType)) {
userid = '';
}
}
$(document).ready(function() {
$('#submit2').on('click', function() {
Save(2);
});
$('#submit1').on('click', function() {
Save(1);
});
$('#Save').on('click', function() {
Save(0);
});
function Save(status) {
if (status == '0') {
stat = '<?php echo REQ_DRAFT; ?>';
}
if (status == '1') {
stat = '<?php echo REQ_PENDING_APPROVAL; ?>';
}
if (status == '2') {
stat = '<?php echo REQ_APPROVED; ?>'
}
//alert($('#MaterialCode4').val());
function Save(status) {
if (status == '0') {
stat = '<?php echo REQ_DRAFT; ?>';
}
if (status == '1') {
stat = '<?php echo REQ_PENDING_APPROVAL; ?>';
}
if (status == '2') {
stat = '<?php echo REQ_APPROVED; ?>'
}
//alert($('#MaterialCode4').val());
if (validate()) {
if (document.getElementById('Items').rows.length < 2) {
alert('Please Select Line item to update the Requisition');
$('#Deliverydt').focus();
return false;
} else {
//alert(document.getElementById('Items').rows.length);
// $('#content').loader('show');
$('#txtStatus').val(stat);
var serviceSchedule = '';
var servicePeriod = '';
var noOfService = '';
if ($('#RequestType').val() == 'SERVICE') {
if ($('#ScheduleType').val() == 'Recurring') {
serviceSchedule = $('#ScheduleType').val();
servicePeriod = $('#ServiceOptions').val();
noOfService = $('#ServiceNo').val();
} else {
serviceSchedule = $('#ScheduleType').val();
servicePeriod = '';
noOfService = 0;
}
if (validate()) {
if (document.getElementById('Items').rows.length < 2) {
alert('Please Select Line item to update the Requisition');
$('#Deliverydt').focus();
return false;
} else {
//alert(document.getElementById('Items').rows.length);
// $('#content').loader('show');
$('#txtStatus').val(stat);
var serviceSchedule = '';
var servicePeriod = '';
var noOfService = '';
}
$.ajax({
data: $('.requistion').serialize() + "&serviceSchedule=" + serviceSchedule + "&servicePeriod=" + servicePeriod + "&noOfService=" + noOfService,
type: "POST",
url: "<?php echo base_url() ?>EditRequisition",
success: function(data) {
if (data) {
// $('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
window.location = "Requisition";
if ($('#RequestType').val() == 'SERVICE') {
if ($('#ScheduleType').val() == 'Recurring') {
serviceSchedule = $('#ScheduleType').val();
servicePeriod = $('#ServiceOptions').val();
noOfService = $('#ServiceNo').val();
} else {
alert("Error");
serviceSchedule = $('#ScheduleType').val();
servicePeriod = '';
noOfService = 0;
}
} else {
var serviceSchedule = '';
var servicePeriod = '';
var noOfService = '';
}
$.ajax({
data: $('.requistion').serialize() + "&serviceSchedule=" + serviceSchedule + "&servicePeriod=" + servicePeriod + "&noOfService=" + noOfService,
type: "POST",
url: "<?php echo base_url() ?>EditRequisition",
success: function(data) {
if (data) {
// $('#content').loader('hide');
alert(data);
$('#txtRowCount').val('');
$('#txtDeletedRow').val('');
});
window.location = "Requisition";
} else {
alert("Error");
}
}
});
}
}
}
}
});
function validate() {
if ($("option:selected", $("#RequestType")).val() == '-1') {

View File

@ -4,14 +4,14 @@
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
<center>Employee Salary Details</center>
<center>Employee Loan Details</center>
</h1>
</section>
<section class="content">
<div class="row">
<div class="col-xs-12 text-right">
<div class="form-group">
<a class="btn btn-success" href="<?php echo base_url(); ?>emppaydate/addemppaydate">Add New Employee Pay List</a>
<a class="btn btn-success" href="<?php echo base_url(); ?>emppaydate/addemppaydate">Create New Loan</a>
</div>
</div>
</div>
@ -25,49 +25,39 @@
<table id="datatable" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;text-align: right;" >
<thead style="background-color: #ddd;">
<tr >
<th width="7%">Emp ID</th>
<th width="8%">Emp Name</th>
<th width="8%"> Total Sal in </th>
<th width="8%">Basic Pay in </th>
<th width="8%">HRA Rate in %</th>
<th width="8%">HRA Amt in </th>
<th width="9%">Allowances in </th>
<th width="8%">PF Ratein %</th>
<th width="8%">ESI Rate in %</th>
<th width="8%">Food Allow in </th>
<th width="15%">Employee</th>
<th width="7%"> Total Sal in </th>
<th width="7%"> Loan Amt in </th>
<th width="7%"> Loan Issued Date</th>
<th width="7%"> Monthly Due Amt in </th>
<th width="7%"> No Of Dues</th>
<th width="7%"> Paid Dues</th>
<th width="7%"> Remaining Dues</th>
<th width="7%"> Paid Amt in </th>
<th width="7%">Action</th>
</tr>
</thead>
<?php
if(!empty($userRecords))
{
//print_r($userRecords);
foreach($userRecords as $record)
{
?>
<tr>
<td style="text-align: left;"><?php echo $record->EmpID ?></td>
<td style="text-align: left;"><?php echo $record->FirstName ." ". $record->LastName?></td>
<td><?php echo $record->TotalSalary; ?></td>
<td><?php echo $record->Basic_Pay ?></td>
<td><?php echo $record->HRA_Rate ?></td>
<td><?php echo $record->HRA_Amount; ?></td>
if(!empty($userRecords)) { foreach($userRecords as $record) { ?>
<tr>
<td style="text-align: left;"><?php echo $record->EmpID ?>-<?php echo $record->FirstName;?></td>
<td><?php echo $record->TotalSalary; ?></td>
<td><?php echo $record->Loan_Amount; ?></td>
<td><?php echo $record->Loan_Issued_Date; ?></td>
<td><?php echo $record->Monthly_Due; ?></td>
<td><?php echo $record->No_of_Dues; ?></td>
<td><?php echo $record->Paid_Due; ?></td>
<td><?php echo $record->Remaining_Due; ?></td>
<td><?php echo $record->Paid_Amount; ?></td>
<td><?php echo $record->Allowances ?></td>
<td><?php echo $record->PF_Rate ?></td>
<td><?php echo $record->ESI_Rate ?></td>
<td><?php echo $record->Food_Allowances ?></td>
<td>
<a href="<?php echo base_url().'emppaydate/editOldemppay/'.$record->Pay_Data_ID; ?>"><i class="btn btn-success">EDIT</i></a>
</td>
</tr>
<?php
}
}
?>
<td>
<a href="<?php echo base_url().'emppaydate/editOldemppay/'.$record->Pay_Data_ID; ?>"><i class="btn btn-success">EDIT</i></a>
</td>
</tr>
<?php } }?>
</table>
</div><!-- /.box-body -->

500
app/Views/expense_list.php Normal file
View File

@ -0,0 +1,500 @@
<!-- Include jQuery first -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Include jQuery Validation plugin -->
<script src="https://cdn.jsdelivr.net/jquery.validation/1.19.3/jquery.validate.min.js"></script>
<style>
.form-group {
padding-bottom: 0%;
}
.Date-filter-form {
display: flex;
align-items: center;
gap: 10px;
/* Adjust the gap as needed */
}
.Date-filter-form input,
.Date-filter-form button {
padding: 5px;
font-size: 14px;
}
.Date-filter-form button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}
.Date-filter-form button:hover {
background-color: #0056b3;
}
.icon-button {
background: none;
border: none;
cursor: pointer;
color: #007bff;
font-size: 18px;
}
.icon-button:hover {
color: #0056b3;
}
.delete_button{
border: none;
background-color: white;
color: red;
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title">Expense List</h4>
</div>
</div>
<div class="col-6 text-right">
<a id="addExpense" class="btn btn-success" data-toggle="modal" href="#expenseModal">Add New Expense</a>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div>
</form>
<div class="card-body">
<table class="table table-bordered table-hover" id="expense_list_table" style="background-color:#fff;font-size:12px;">
<thead style="background-color: #ddd;">
<tr>
<th align="right">Created Date</th>
<!-- <th align="right">Expense Id</th> -->
<th align="right">Supplier Name</th>
<th align="right">GST</th>
<th align="right">Cost</th>
<th align="right">Total</th>
<th align="right">Status</th>
<th align="right">Payment Method</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($expense_list)) {
foreach ($expense_list as $record) {
$fileExists = 0;
$fileUrl = '';
if ($record['transporter_file']) {
$fileExists = 1;
$fileUrl = base_url('uploads/') . $record['transporter_file'];
}
// Create download link and delete button
?>
<tr>
<?php if (date('d-m-Y', strtotime($record['created_on'])) == "30-11--0001") {
$cdate = '00-00-0000';
} else {
$cdate = date('d-m-Y', strtotime($record['created_on']));
}
?>
<td><?php echo $cdate; ?></td>
<!-- <td><?php echo $record['id']; ?></td> -->
<td><?php echo $record['SupplierName']; ?></td>
<td><?php echo $record['gst']; ?></td>
<td><?php echo $record['cost']; ?></td>
<td><?php echo $record['total']; ?></td>
<td><?php echo $record['status']; ?></td>
<td><?php echo $record['payment_method']; ?></td>
<td>
<?php if($fileExists == 1){ ?>
<button title="Download FIle" class="download_button" onclick="downloadFile('<?php echo $record['id']; ?>', '<?php echo $record['transporter_file']; ?>')" style="border: none;background-color: white;color: #02a8b5;">
<i class="fas fa-file-download"></i>
</button>
<button title="Delete File" id="deleteFile" class="delete_button" data-value="<?php echo $record['id'] ?>" data-id="<?php echo $record['id'] ?>" data-file="<?php echo $record['transporter_file'] ?>"><i class="fas fa-trash"></i></button>
<?php } ?>
<button title="Edit" class="edit-button" data-toggle="modal" data-target="#expenseModal" data-id="<?php echo $record['id']; ?>" style="border: none;background-color: white;color: #02a8b5;" >
<i class="fas fa-pencil-alt"></i>
</button>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div> <!-- end card body-->
</div> <!-- end card -->
</div><!-- end col-->
</div>
</div>
</div> <!-- container -->
</div> <!-- content -->
</div>
<div id="expenseModal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Add Expense</h4>
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true">×</button>
</div>
<div class="modal-body p-4">
<form id="expenseForm" class="form-horizontal" role="form">
<input type="hidden" name="id" id="id">
<div class="form-group row">
<div class="col-md-5">
<label for="transporterfile" class="col-form-label">Transporter File:</label>
<input type="file" name="transporterfile" id="transporterfile" class="form-control">
<input type="hidden" name="transporterfile_name" id="transporterfile_name">
<small id="fileHelp" class="form-text text-muted">
Current file: <span id="currentFileName"></span>
</small>
</div>
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="supplierid" class="col-form-label">Supplier :</label>
<select name="supplierid" id="supplierid" class="form-control" required>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-5">
<label for="gst" class="col-form-label">Tax:</label>
<input type="number" name="gst" id="gst" class="form-control" >
</div>
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="cost" class="col-form-label">Cost:</label>
<input type="number" name="cost" id="cost" class="form-control">
</div>
</div>
<div class="form-group row">
<div class="col-md-5">
<label for="status" class="col-form-label">Status:</label>
<select name="status" id="status_id" class="form-control" required>
<option>Select Status</option>
<option value="Payment Pending">Payment Pending</option>
<option value="Paid">Paid</option>
</select>
</div>
<div class="col-md-1">
</div>
<div class="col-md-5">
<label for="payment_method" class="col-form-label">Payment Method:</label>
<select name="payment_method" id="payment_method" class="form-control" required>
<option>Select Payment Method</option>
<option value="Cash">Cash</option>
<option value="Online">Online</option>
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-12">
<label for="remarks" class="col-form-label">Remarks:</label>
<!-- <input type="text" name="remarks" id="remarks" class="form-control"> -->
<textarea name="remarks" id="remarks" class="form-control"></textarea>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary waves-effect" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-info waves-effect waves-light tempClick" id="tempClick">Submit</button>
</div>
</div>
</div>
</div><!-- /.modal -->
<script>
function downloadFile(fileId, fileName) {
window.location.href = 'downloadFile/' + fileName;
}
$(document).ready(function() {
// Function to toggle payment method based on status
function togglePaymentMethod() {
var status = $('#status_id').val();
console.log(status);
if (status === 'Paid') {
$('#payment_method').prop('disabled', false); // Enable payment method
} else {
$('#payment_method').prop('disabled', true).val(''); // Disable payment method and clear value
}
}
// Trigger the toggle function on page load
togglePaymentMethod();
// Trigger the toggle function whenever the status changes
$('#status_id').on('change', function() {
togglePaymentMethod();
});
});
$(document).ready(function() {
$('#supplierid').select2();
var formActionUrl = '';
// Event handler for file input change
$('#transporterfile').on('change', function() {
var fileName = $(this).val().split('\\').pop(); // Get the file name
$('#file-name-display').text(fileName); // Display the file name
});
function togglePaymentMethodEdit() {
var status = $('#status_id').val();
console.log(status);
if (status === 'Paid') {
$('#payment_method').prop('disabled', false); // Enable payment method
} else {
$('#payment_method').prop('disabled', true).val(''); // Disable payment method and clear value
}
}
$(document).on('click', '.edit-button', function() {
$('.modal-title').html('Edit Expense');
var expenseId = $(this).data('id');
var supplier_list = [<?php echo $supplier_list; ?>];
$('#supplierid').empty(); // Clear the supplier dropdown
$('#supplierid').append('<option>Select Supplier</option>');
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url().'editExpense' ?>'; // Set action URL for adding
$.ajax({
url: '<?php echo base_url().'getExpenseDetails'; ?>',
type: 'POST',
data: { id: expenseId },
success: function(response) {
var expense = JSON.parse(response);
$('#id').val(expense.id);
$('#transporterfile').val(''); // Clear the file input
$('#currentFileName').text(''); // Clear the file name display
$('#supplierid').val(expense.supplier_id).trigger('change');
$('#remarks').val(expense.remarks);
$('#cost').val(expense.cost);
$('#gst').val(expense.gst);
$('#total').val(expense.total);
$('#status_id').val(expense.status);
$('#payment_method').val(expense.payment_method);
// Clear any existing file link and delete button
$('#transporterfile').next('.download_button').remove();
$('#transporterfile').next('.delete_button').remove();
if (expense.transporter_file) {
$('#transporterfile_name').val(expense.transporter_file); // Set the hidden input value
$('#currentFileName').text(expense.transporter_file); // Display the existing file name
// Construct the full URL to the file
var fileUrl = '<?php echo base_url('uploads/'); ?>' + expense.transporter_file;
// Create download link and delete button
var fileLink = '<a class="download_button" href="' + fileUrl + '" target="_blank" download="' + expense.transporter_file + '"><i class=" fas fa-file-download"></i></a>';
var deleteButton = '<button id="deleteFile" class="delete_button" data-value="' + expense.id +'" data-id="' + expense.id + '" data-file="' + expense.transporter_file + '"><i class="fas fa-trash"></i></button>';
// Add the file link and delete button
$('#transporterfile').after(fileLink + ' ' + deleteButton);
} else {
$('#transporterfile_name').val(''); // Clear hidden input if no file
}
togglePaymentMethodEdit();
}
});
});
$(document).on('click', '#addExpense', function () {
$('.download_button').remove();
$('.delete_button').remove();
$('.modal-title').html('Add Expense');
$('#transporterfile').val(''); // Clear the file input
$('#currentFileName').text(''); // Clear the file name display
$('#supplierid').val('').trigger('change');
$('#remarks').val('');
$('#cost').val('');
$('#gst').val('');
$('#total').val('');
$('#status_id').val('');
$('#payment_method').val('');
var supplier_list = [<?php echo $supplier_list; ?>];
$('#supplierid').empty(); // Clear the supplier dropdown
$('#supplierid').append('<option>Select Supplier</option>');
supplier_list[0].forEach(function(supplier) {
$('#supplierid').append('<option value="' + supplier.SupplierID + '">' + supplier.SupplierName + '</option>');
});
formActionUrl = '<?php echo base_url().'addExpense' ?>'; // Set action URL for adding
togglePaymentMethodEdit();
});
// Handle form submission
$('#tempClick').on('click', function(e) {
e.preventDefault();
// Native HTML5 form validation
if ($('#expenseForm')[0].checkValidity()) {
var formData = new FormData($('#expenseForm')[0]); // Use FormData to handle file upload
console.log(formActionUrl);
$.ajax({
url: formActionUrl,
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log(response);
if (response) {
$('#expenseModal').modal('hide');
$('#expenseForm')[0].reset();
$('#file-name-display').text(''); // Clear the file name display
window.location.reload();
} else {
console.log(response);
}
},
error: function(xhr, status, error) {
alert('An error occurred: ' + error);
}
});
} else {
// If form is invalid, show native validation messages
$('#expenseForm')[0].reportValidity();
}
});
// DataTable initialization and date range filter logic (unchanged)
var table = $('#expense_list_table').DataTable({
dom: 'Blfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
pageLength: 10,
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ],
responsive: true,
order: [[0, 'desc']],
language: {
paginate: {
next: '<i class="fas fa-angle-right"></i>',
previous: '<i class="fas fa-angle-left"></i>'
}
}
});
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val();
if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter
}
var dateStr = data[0];
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
var startDate = new Date(fromDate);
var endDate = new Date(toDate);
startDate.setDate(startDate.getDate() - 1);
endDate.setHours(23, 59, 59, 999);
return date >= startDate && date <= endDate;
}
);
$("#DateRangeFilter").submit(function(e) {
e.preventDefault();
table.draw();
});
$("#resetButton").click(function() {
$("#fromDate").val('');
$("#toDate").val('');
table.draw();
});
document.getElementById('fromDate').addEventListener('change', function() {
var fromDate = this.value;
var toDateInput = document.getElementById('toDate');
toDateInput.min = fromDate;
if (toDateInput.value < fromDate) {
toDateInput.value = fromDate;
}
});
});
$(document).on('click', '#deleteFile', function() {
var fileName = $(this).data('file');
var expenseId = $(this).data('value');
$.ajax({
url: '<?php echo base_url('deleteFile'); ?>',
type: 'POST',
data: { file_name: fileName, expense_id: expenseId },
success: function(response) {
console.log(response);
var result = JSON.parse(response);
if (result.success) {
alert('File deleted successfully.');
$('#currentFileName').text('');
$('#transporterfile_name').val('');
$('#deleteFile').remove(); // Remove the delete button
$('#transporterfile').next('a').remove(); // Remove the download link
} else {
alert('Failed to delete the file: ' + result.message);
}
},
error: function() {
alert('Error deleting the file.');
}
});
});
</script>
<script>
document.getElementById('transporterfile').addEventListener('change', function() {
var fileName = this.files[0].name;
document.getElementById('currentFileName').textContent = fileName;
});
</script>

View File

@ -63,6 +63,7 @@
<script src="<?php echo base_url(); ?>public/new_assets/libs/select2/js/select2.min.js"></script>
<!-- <script src="<?php echo base_url(); ?>public/new_assets/js/validation.js" type="text/javascript"></script> -->
<script>

View File

@ -59,6 +59,40 @@
<link href="https://cdn.jsdelivr.net/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet">
<style>
/* Select2 Input Hight Set */
.select2-selection.select2-selection--single{
height: calc(1.5em + .9rem + 2px);
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 37px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
top: 7px;
}
/* Select2 Height End */
/* .navbar-custom{
height: 55px;
}
.logo-box .logo {
line-height: 55px;
}
.navbar-custom .topnav-menu .nav-link{
max-height: 55px;
line-height: 55px;
}
@media (min-width: 992px) {
.topnav {
height: 45px;
margin-top: 55px;
}
}
.topnav .navbar-nav .nav-link{
line-height: 15px;
} */
.navbar-custom {
background-color: #4f7c97 !important;
}
th{
background-color: #ddd !important;
}
@ -66,17 +100,17 @@
border: 1px solid grey;
border-radius: 4px !important;
}
legend {
border-bottom: 2px solid #FFF !important;
margin-left: -2%;
}
.form-group {
padding-bottom: 4%;
}
.badge {
color: red;
background-color: #fff;
}
legend {
border-bottom: 2px solid #FFF !important;
margin-left: -2%;
}
.form-group {
/* padding-bottom: 4%; */
}
.badge {
color: red;
background-color: #fff;
}
.btn-cancel {
background-color: grey; /* Red color */
color: white;
@ -399,6 +433,9 @@
<a href="<?php echo base_url(); ?>ViewIGR" class="dropdown-item">View Inward Gate Register</a>
</div>
</div>
<div class="dropdown">
<a href="<?php echo base_url(); ?>ListIGR" class="dropdown-item"><i class="ri-file-list-3-line align-middle mr-1"></i> Non IGR / Expense</a>
</div>
</div>
</li>

View File

@ -2,9 +2,11 @@
<script type="text/javascript" src="<?php echo base_url(); ?>public/assets/Autocomplete/jquery.autocomplete.js"></script>
<style>
#MaterialRcvdDate, #InvoiceDate {
#MaterialRcvdDate,
#InvoiceDate {
text-align: left;
}
.autocomplete-suggestion {
cursor: pointer;
background-color: skyblue;
@ -113,7 +115,7 @@
'PONO',
$options,
set_value('PONO'),
'class="form-control searchabledropdown" id="PONO" data-toggle="select2" required="true"'
'class="form-control searchabledropdown" id="PONO" data-toggle="select2" required="true" onchange="yourFunctionName()"'
);
?>
<span class="help-block"></span>
@ -137,12 +139,13 @@
<div class="form-group col-md-4">
<label class="col-form-label">Invoice Date<span class="text-danger">*</span></label>
<div class="input-group">
<input type="text" class="form-control" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="InvoiceDate" name="InvoiceDate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off">
<div class="input-group-append">
<input type="date" class="form-control" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="InvoiceDate" name="InvoiceDate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off">
<!-- <input type="text" class="form-control" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="InvoiceDate" name="InvoiceDate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off"> -->
<!-- <div class="input-group-append">
<span class="input-group-text">
<i class="ri-calendar-event-fill"></i>
</span>
</div>
</div> -->
</div><!-- input-group -->
<!-- <input type="date" class="form-control" id="invoiceDate" name="invoice_date" value="<?= isset($invoice_details['invoice_date']) ? $invoice_details['invoice_date'] : '' ?>" max="<?= date('d/m/Y'); ?>" required> -->
@ -158,12 +161,13 @@
<div class="form-group col-md-4">
<label class="col-form-label">Material Received Date<span class="text-danger">*</span></label>
<div class="input-group">
<input type="text" class="form-control" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="MaterialRcvdDate" name="MaterialRcvdDate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off">
<input type="date" class="form-control" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="MaterialRcvdDate" name="MaterialRcvdDate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off">
<!-- <input type="text" class="form-control" data-provide="datepicker" data-date-format="dd/mm/yyyy" data-date-autoclose="true" id="MaterialRcvdDate" name="MaterialRcvdDate" data-date-end-date="<?= date('d/m/Y'); ?>" required autocomplete="off">
<div class="input-group-append">
<span class="input-group-text">
<i class="ri-calendar-event-fill"></i>
</span>
</div>
</div> -->
</div>
<?php
// $data = array('name' => 'MaterialRcvdDate', 'value' => set_value('MaterialRcvdDate'), 'id' => 'MaterialRcvdDate', 'class' => 'form-control num', 'required' => 'true', 'autocomplete' => 'off');
@ -172,7 +176,7 @@
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label class="col-form-label">Vechicle Number</label>
<?php
@ -180,7 +184,7 @@
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label class="col-form-label">Transporter Name</label>
<?php
$option = array(0 => 'Transporter Name');
@ -193,14 +197,14 @@
?>
</div>
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label class="col-form-label">Driver Name</label>
<?php
$data = array('name' => 'DriverName', 'value' => set_value('DriverName'), 'id' => 'DriverName', 'class' => 'form-control', 'maxlength' => '50', 'autocomplete' => 'off');
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<div class="form-group col-md-4">
<label class="col-form-label">Driver Mobile Number</label>
<?php
$data = array('name' => 'DriverMobileNumber', 'value' => set_value('DriverMobileNumber'), 'id' => 'DriverMobileNumber', 'class' => 'form-control', 'maxlength' => '50', 'autocomplete' => 'off');
@ -270,7 +274,7 @@
</div>
<div id="weight-calc-modal" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Weight Calculator<span id="WeightTitle"></span></h4>
@ -722,75 +726,41 @@
}
</script>
<script>
$("#weight-calc-modal").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index');
var material = $(e.relatedTarget).data('material');
$(document).ready(function() {
$("#weight-calc-modal").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index');
var material = $(e.relatedTarget).data('material');
$('#WeightTitle').text(" ( " + material + " )");
$('#WeightTitle').text(" ( " + material + " )");
// Clear the modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
// Clear the modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
// Retrieve values from hidden inputs
var v1 = $("#txtGrossWeight" + inx).val();
var v2 = $("#txtGrossWeightDate" + inx).val();
var v3 = $("#txtTareWeight" + inx).val();
var v4 = $("#txtTareWeightDate" + inx).val();
var v5 = $("#txtNetWeight" + inx).val();
var fileInput = $("#txtWeightFile" + inx)[0];
// Retrieve values from hidden inputs
var v1 = $("#txtGrossWeight" + inx).val();
var v2 = $("#txtGrossWeightDate" + inx).val();
var v3 = $("#txtTareWeight" + inx).val();
var v4 = $("#txtTareWeightDate" + inx).val();
var v5 = $("#txtNetWeight" + inx).val();
var fileInput = $("#txtWeightFile" + inx)[0];
console.log("Selected values for index:", typeof inx, inx);
// Set modal inputs with the retrieved values
$("#GrossWeight").val(v1);
$("#GrossWeightDate").val(v2);
$("#TareWeight").val(v3);
$("#TareWeightDate").val(v4);
$("#NetWeight").val(v5);
$("#CurrentInx").val(inx);
if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#WeightFile")[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;
} else {
console.log("No file selected or file input not found.");
}
});
function modalSave() {
var v1 = $("#GrossWeight").val();
var v2 = $("#GrossWeightDate").val();
var v3 = $("#TareWeight").val();
var v4 = $("#TareWeightDate").val();
var v5 = $("#NetWeight").val();
var inx = $("#CurrentInx").val();
var fileInput = $("#WeightFile")[0]; // Get the file input element
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);
console.log("Selected values for index:", typeof inx, inx);
// Set modal inputs with the retrieved values
$("#GrossWeight").val(v1);
$("#GrossWeightDate").val(v2);
$("#TareWeight").val(v3);
$("#TareWeightDate").val(v4);
$("#NetWeight").val(v5);
$("#CurrentInx").val(inx);
if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#txtWeightFile" + inx)[0];
var targetInput = $("#WeightFile")[0];
var file = fileInput.files[0];
// Create a new DataTransfer object
@ -803,22 +773,61 @@
} else {
console.log("No file selected or file input not found.");
}
});
});
function modalSave() {
var v1 = $("#GrossWeight").val();
var v2 = $("#GrossWeightDate").val();
var v3 = $("#TareWeight").val();
var v4 = $("#TareWeightDate").val();
var v5 = $("#NetWeight").val();
var inx = $("#CurrentInx").val();
var fileInput = $("#WeightFile")[0]; // Get the file input element
console.log("inx");
console.log(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);
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;
} else {
console.log("No file selected or file input not found.");
}
// Clear modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
$("#WeightFile").val('');
// Clear modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
$("#WeightFile").val('');
// Close the modal
$("#weight-calc-modal").modal('hide');
} else {
console.log("Saving values for index: " + inx + " undefined");
// Close the modal
$("#weight-calc-modal").modal('hide');
} else {
console.log("Saving values for index: " + inx + " undefined");
}
}
}
</script>
<script>
function appendFilesFileds(data) {
@ -867,4 +876,191 @@
"autoWidth": false
});
});
function yourFunctionName() {
removeHidden();
$("#IGRappend").empty();
$('#txtRowCount').val('');
var id = $('#PONO').val();
var status = '';
var isOpenOrder = 0;
if (id != '-1') {
// $('#content').loader('show');
var y = <?php echo json_encode($PO_NO, JSON_PRETTY_PRINT) ?>;
$.each(y, function(idx, obj) {
if (id == obj.PONO) {
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
var newUrl = baseUrl + '?PONO=' + obj.PONO + '&ReqType=' + obj.POType;
$('#printLink').attr('href', newUrl);
$("#po").val(obj.PONO);
$("#Sup").val(obj.SupplierName);
$("#hiddenIsOpenOrder").val(obj.IsOpenOrder);
isOpenOrder = parseInt(obj.IsOpenOrder ? obj.IsOpenOrder : "0", 2);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder);
var button_text_for_IGRDraftLink = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Open IGR";
$('#IGRDraftLink').text(button_text_for_IGRDraftLink);
//$("#Add").val(obj.Address);
$("#del").val(obj.DeliveryDate);
//$("#ser").val(obj.ServiceDescription);
status = obj.status;
ostatus = obj.OGR_Status;
formatted_PODate = obj.formatted_PODate;
formatted_IsOpenOrder = obj.formatted_IsOpenOrder;
}
});
$.ajax({
data: {
id: id
},
type: "POST",
url: "<?php echo base_url() ?>GetIGRLineItemDetails",
success: function(data) {
// console.log(data);
// $('#content').loader('hide');
// alert(data);
var trHTML = '';
var j = 0;
var showTable = false;
$.each(JSON.parse(data), function(i, item) {
showTable = true;
if (showTable) {
i = i + 1;
j = j + 1;
trHTML += '<tr>' +
'<td align="right">' + j + '</td>' +
'<td name="MaterialName" id="MaterialCode" >' + item.MaterialCode + '</td>' +
'<td>' + item.MaterialName + '</td>' +
'<td name="UOM">' + item.UOM + '</td>' +
'<td name="Quantity1' + i + '" id="Quantity_1' + i + '">' + item.Quantity + '</td>' +
'<td name="ReceivedQuantity' + i + '" id="ReceivedQuantity' + i + '">' + item.ReceivedQuantity + '</td>' +
'<td name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder === 0 || isNaN(isOpenOrder)) ? item.PendingQty : 0) + '</td>' +
'<td data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="" onkeypress="return isNumberKey(event);" autocomplete="off"></td>' +
'<td><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" autocomplete="off"> </td>' +
'<td><a target="_blank" data-toggle="modal" data-target="#weight-calc-modal" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'</tr>';
$('#txtRowCount').val(i);
$('<input>').attr({
type: 'hidden',
id: 'MaterialCode' + i,
value: item.MaterialCode,
name: 'MaterialCode' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtQuantityAsPerInvoice' + i,
name: 'txtQuantityAsPerInvoice' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'OrderedQuantity' + i,
value: item.Quantity,
name: 'OrderedQuantity' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtReceivedQuantity' + i,
name: 'txtReceivedQuantity' + i,
value: item.ReceivedQuantity
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtRemarks' + i,
name: 'txtRemarks' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtPendingQty' + i,
name: 'txtPendingQty' + i,
value: ((isOpenOrder === 0 || isNaN(isOpenOrder)) ? item.PendingQty : 0)
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtGrossWeight' + i,
value: item.GrossWeight,
name: 'txtGrossWeight' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtGrossWeightDate' + i,
value: item.GrossWeightDate,
name: 'txtGrossWeightDate' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtTareWeight' + i,
value: item.TareWeight,
name: 'txtTareWeight' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtTareWeightDate' + i,
value: item.TareWeightDate,
name: 'txtTareWeightDate' + i
}).appendTo('form');
$('<input>').attr({
type: 'hidden',
id: 'txtNetWeight' + i,
value: item.NetWeight,
name: 'txtNetWeight' + i
}).appendTo('form');
$('<input>').attr({
type: 'file',
id: 'txtWeightFile' + i,
value: item.WeightFile,
name: 'txtWeightFile' + i,
style: 'display:none;' // This makes the input hidden
}).appendTo('form'); // Make sure the form has the id 'IGR'
if (item.PendingQty == 0.00) {
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
}
$("#IGRLink").show();
} else {
if (JSON.parse(data).length == 1 && item.PendingQty == 0) {
$("#IGRLink").hide();
//alert('The Order is new completed!!');
}
}
});
$("#IGRappend").empty();
$('#IGRappend').append(trHTML);
}
});
if ((status == '<?php echo IGR_CREATED ?>' || status == '<?php echo MRIR_CREATED ?>' || status == '<?php echo MRIR_APPROVED ?>')) {
alert('The Order is completed!!');
$("#IGRLink").hide();
} else {
$("#IGRLink").show();
}
} else {
alert('Please Select the Purchase Order Number to Create IGR');
}
}
</script>

View File

@ -1,110 +1,144 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Resico (India) Pvt Ltd | Admin System Log in</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- <link href="<?php echo base_url(); ?>public/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- <link href="<?php echo base_url(); ?>public/assets/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" /> -->
<!-- <link href="<?php echo base_url(); ?>public/assets/dist/css/skins/skin-green.min.css" rel="stylesheet" type="text/css" /> -->
<!-- web favicon -->
<!-- This is needed for IE -->
<link rel="icon" href="<?php echo base_url(); ?>public/assets/dist/img/RI_favicon.png"/>
<link href="<?php echo base_url(); ?>public/new_assets/css/bootstrap-creative.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/app-creative.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta content="A fully featured admin theme which can be used to build CRM, CMS, etc." name="description" />
<meta content="Coderthemes" name="author" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- App favicon -->
<link rel="shortcut icon" href="<?php echo base_url(); ?>public/new_assets/images/RI_favicon.png">
<link href="<?php echo base_url(); ?>public/new_assets/css/bootstrap-creative-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/app-creative-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<!-- App css -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"
type="text/css" />
<link href="<?php echo base_url(); ?>public/new_assets/css/bootstrap-creative.min.css" rel="stylesheet"
type="text/css" id="bs-default-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/app-creative.min.css" rel="stylesheet" type="text/css"
id="app-default-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/bootstrap-creative-dark.min.css" rel="stylesheet"
type="text/css" id="bs-dark-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/app-creative-dark.min.css" rel="stylesheet"
type="text/css" id="app-dark-stylesheet" />
<!-- icons -->
<link href="<?php echo base_url(); ?>public/new_assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<style>
.debug-bar-dinlineBlock {display: none !important;}
.a-tag-link {
color: #00a65a;
transition: color 0.3s ease;
}
.a-tag-link:hover {
color: #ff0000;
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="loading">
<div class="account-pages mt-5 mb-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5">
<div class="card">
</head>
<div class="card-body p-4">
<div class="text-center w-75 m-auto">
<div class="auth-logo">
<a href="index.html" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="<?php echo base_url('public/new_assets/images/RI_logo.png'); ?> " alt="" height="60">
</span>
</a>
<a href="index.html" class="logo logo-light text-center">
<span class="logo-lg">cfd
<img src="<?php echo base_url(); ?> " alt="" height="22">
</span>
</a>
</div>
</div>
<form action="<?php echo base_url(); ?>loginMe" method="post">
<div class="form-group mb-3">
<label for="emailaddress">Email address</label>
<input type="email" class="form-control" placeholder="Enter your email" name="email" required="" />
</div>
<div class="form-group mb-3">
<label for="password">Password</label>
<div class="input-group input-group-merge">
<input type="password" class="form-control" placeholder="Enter your password" name="password" id="password" required />
<div class="input-group-append" data-password="false">
<div class="input-group-text">
<span class="password-eye"></span>
</div>
</div>
</div>
</div>
<div class="form-group mb-0 text-center">
<input type="submit" class="btn btn-primary btn-block" value="Sign In" />
<body class="loading auth-fluid-pages pb-0">
</div>
<div class="login-bg">
<div class="auth-fluid">
<!-- Auth fluid right content -->
<div class="auth-fluid-right">
<div class="auth-user-testimonial">
<h3 class="mb-3 text-white">Welcome to Resico!</h3>
<p class="lead font-weight-normal">
<i class="mdi mdi-format-quote-open"></i>
Resico (India) Pvt Ltd has marked its presence in the domestic market
as one of the renowned Manufacturers and Suppliers of washed graded dry Silica sand.
Backed by the modern technology, our company has gained the trust of the clients present all across the country.
Our washed graded dry Silica sand is extensively used in various industrial applications.
<i class="mdi mdi-format-quote-close"></i>
</p>
</div> <!-- end auth-user-testimonial-->
</div>
<!-- end Auth fluid right content -->
</form>
<!--Auth fluid left content -->
<div class="auth-fluid-form-box">
<div class="align-items-center d-flex h-100">
<div class="card-body">
</div> <!-- end card-body -->
</div>
<!-- end card -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<!-- Logo -->
<div class="auth-brand text-center text-lg-left">
<div class="auth-logo">
<a href="index.html" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="<?php echo base_url('public/new_assets/images/RI_logo.png'); ?> " alt=""
height="60">
</span>
</a>
<a href="index.html" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="<?php echo base_url(); ?> " alt="" height="22">
</span>
</a>
<footer class="footer footer-alt">
<script>document.write(new Date().getFullYear())</script> &copy; Resico <a href="" class="text-dark"></a>
</footer>
<a href="index.html" class="logo logo-light text-center">
<span class="logo-lg">
<img src="<?php echo base_url('public/new_assets/images/RI_logo.png'); ?> " alt=""
height="60">
</span>
</a>
<a href="index.html" class="logo logo-light text-center">
<span class="logo-lg">
<img src="<?php echo base_url(); ?> " alt="" height="22">
</span>
</a>
</div>
</div>
<!-- Vendor js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/vendor.min.js"></script>
<!-- title-->
<h4 class="mt-0">Sign In</h4>
<br>
<!-- App js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/app.min.js"></script>
<!-- form -->
<form action="<?php echo base_url(); ?>loginMe" method="post">
<div class="form-group">
<label for="emailaddress">Email address</label>
<input type="email" class="form-control" placeholder="Enter your email" name="email"
required="" />
</div>
<div class="form-group">
<a href="auth-recoverpw-2.html" class="text-muted float-right"><small>Forgot your
password?</small></a>
<label for="password">Password</label>
<div class="input-group input-group-merge">
<input type="password" class="form-control" placeholder="Enter your password"
name="password" id="password" required />
<div class="input-group-append" data-password="false">
<div class="input-group-text">
<span class="password-eye"></span>
</div>
</div>
</div>
</div>
<div class="form-group mb-0 text-center">
<button class="btn btn-primary btn-block" type="submit">Log In </button>
</div>
</form>
<!-- end form-->
</div> <!-- end .card-body -->
</div> <!-- end .align-items-center.d-flex.h-100-->
</div>
<!-- end auth-fluid-form-box-->
</div>
</div>
<!-- end auth-fluid-->
<!-- Vendor js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/vendor.min.js"></script>
<!-- App js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/app.min.js"></script>
</body>
</html>
</html>

112
app/Views/login_old.php Normal file
View File

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Resico (India) Pvt Ltd | Admin System Log in</title>
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<!-- <link href="<?php echo base_url(); ?>public/assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<!-- <link href="<?php echo base_url(); ?>public/assets/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css" /> -->
<!-- <link href="<?php echo base_url(); ?>public/assets/dist/css/skins/skin-green.min.css" rel="stylesheet" type="text/css" /> -->
<!-- web favicon -->
<!-- This is needed for IE -->
<link rel="icon" href="<?php echo base_url(); ?>public/assets/dist/img/RI_favicon.png"/>
<link href="<?php echo base_url(); ?>public/new_assets/css/bootstrap-creative.min.css" rel="stylesheet" type="text/css" id="bs-default-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/app-creative.min.css" rel="stylesheet" type="text/css" id="app-default-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/bootstrap-creative-dark.min.css" rel="stylesheet" type="text/css" id="bs-dark-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/app-creative-dark.min.css" rel="stylesheet" type="text/css" id="app-dark-stylesheet" />
<link href="<?php echo base_url(); ?>public/new_assets/css/icons.min.css" rel="stylesheet" type="text/css" />
<style>
.debug-bar-dinlineBlock {display: none !important;}
.a-tag-link {
color: #00a65a;
transition: color 0.3s ease;
}
.a-tag-link:hover {
color: #ff0000;
}
</style>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="loading">
<div class="account-pages mt-5 mb-5">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8 col-lg-6 col-xl-5">
<div class="card">
<div class="card-body p-4">
<div class="text-center w-75 m-auto">
<div class="auth-logo">
<a href="index.html" class="logo logo-dark text-center">
<span class="logo-lg">
<img src="<?php echo base_url('public/new_assets/images/RI_logo.png'); ?> " alt="" height="60">
</span>
</a>
<a href="index.html" class="logo logo-light text-center">
<span class="logo-lg">
<img src="<?php echo base_url(); ?> " alt="" height="22">
</span>
</a>
</div>
</div>
<form action="<?php echo base_url(); ?>loginMe" method="post">
<div class="form-group mb-3">
<label for="emailaddress">Email address</label>
<input type="email" class="form-control" placeholder="Enter your email" name="email" required="" />
</div>
<div class="form-group mb-3">
<label for="password">Password</label>
<div class="input-group input-group-merge">
<input type="password" class="form-control" placeholder="Enter your password" name="password" id="password" required />
<div class="input-group-append" data-password="false">
<div class="input-group-text">
<span class="password-eye"></span>
</div>
</div>
</div>
</div>
<div class="form-group mb-0 text-center">
<input type="submit" class="btn btn-primary btn-block" value="Sign In" />
</div>
</form>
</div> <!-- end card-body -->
</div>
<!-- end card -->
</div> <!-- end col -->
</div>
<!-- end row -->
</div>
<!-- end container -->
</div>
<!-- end page -->
<footer class="footer footer-alt">
<script>document.write(new Date().getFullYear())</script> &copy; Resico <a href="" class="text-dark"></a>
</footer>
<!-- Vendor js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/vendor.min.js"></script>
<!-- App js -->
<script src="<?php echo base_url(); ?>public/new_assets/js/app.min.js"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,19 @@ if (!empty($Emp)) {
}
}
?>
<style>
.btn-soft-primary {
color: white;
background-color: rgb(42, 206, 150);
border-color: rgb(42, 206, 150);
}
.btn-soft-primary:hover {
background-color: rgb(32, 176, 130); /* Slightly darker shade for hover */
border-color: rgb(32, 176, 130);
}
</style>
<div class="content-page">
<div class="content">
<!-- Start Content-->

View File

@ -1,6 +1,6 @@
<style>
.modal {
padding-right: 25% ! important;
/* padding-right: 25% ! important; */
}
.num {
@ -8,7 +8,7 @@
}
.modal-content {
width: 800px ! important;
/* width: 800px ! important; */
}
th {
@ -250,7 +250,7 @@
<!-- box closed here -->
<!-- Igr modal fade -->
<div id="Igrshow" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
@ -443,8 +443,8 @@
<!-- WeightCalculator modal fade -->
<div id="WeightCalculator" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-dialog modal-lg">
<div class="modal-content" style="border: 1px solid #ddd; margin-top: 73px; box-shadow: 0 0 40px rgb(0 0 0 / 43%);">
<div class="modal-header">
<h4 class="modal-title">Weight Calculator <span id="WeightTitle"></span></h4>
<button type="button" class="close" data-dismiss="modal"
@ -570,189 +570,157 @@
<script>
$("#Igrshow").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('id');
var igr = $(e.relatedTarget).data('userid');
var igrstatus = $(e.relatedTarget).data('igrstatus');
$(document).ready(function() {
$("#Igrshow").on("shown.bs.modal", function(e) {
console.log("hello");
var inx = $(e.relatedTarget).data('id');
var igr = $(e.relatedTarget).data('userid');
var igrstatus = $(e.relatedTarget).data('igrstatus');
// alert(igrstatus);
var buttonContainer = $(".buttonContainer");
var modal = $(this); // Reference to the modal itself
var invoiceDateInput = modal.find('#Invoice_Date');
var invoiceNoInput = modal.find('#Invoice_No');
var MaterialRcvdDateInput = modal.find('#MaterialRcvdDate');
var VehicleNoInput = modal.find('#Vehicle_No');
var TransporterIdInput = modal.find('#Transporter_Id');
var DriverInput = modal.find('#Driver_Name');
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
var MasterFileInput = modal.find('#MasterFile');
modal.find('#MasterFileLabel').hide();
// alert(igrstatus);
var buttonContainer = $(".buttonContainer");
var modal = $(this); // Reference to the modal itself
var invoiceDateInput = modal.find('#Invoice_Date');
var invoiceNoInput = modal.find('#Invoice_No');
var MaterialRcvdDateInput = modal.find('#MaterialRcvdDate');
var VehicleNoInput = modal.find('#Vehicle_No');
var TransporterIdInput = modal.find('#Transporter_Id');
var DriverInput = modal.find('#Driver_Name');
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
var MasterFileInput = modal.find('#MasterFile');
modal.find('#MasterFileLabel').hide();
var userRole = "<?php echo (int)$userRole; ?>";
if (userRole != 1) {
if (igrstatus == "ST074") {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
$(".a_tag_for_mrir").css("display", "block");
VehicleNoInput.prop('readonly', false);
DriverInput.prop('readonly', false);
DriverMobileNumberInput.prop('readonly', false);
MaterialRcvdDateInput.prop('readonly', false);
invoiceDateInput.prop('readonly', false);
invoiceNoInput.prop('readonly', false);
} else {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
$(".a_tag_for_mrir").css("display", "none");
VehicleNoInput.prop('readonly', true);
DriverInput.prop('readonly', true);
DriverMobileNumberInput.prop('readonly', true);
MaterialRcvdDateInput.prop('readonly', true);
invoiceDateInput.prop('readonly', true);
invoiceNoInput.prop('readonly', true);
}
} else {
$(".a_tag_for_mrir").css("display", "none");
if (igrstatus == "ST074") {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
} else {
buttonContainer.find("#draftIGR").css("display", "none");
}
}
$("#tbleIGRAppend").empty();
$('#content').loader('show');
$.ajax({
data: {
id: igr
},
type: "POST",
url: "<?php echo base_url() ?>ViewIGRDetails",
success: function(data) {
// success:function(data) {
$('#content').loader('hide');
var parsedData = JSON.parse(data);
console.log(parsedData);
if (parsedData['details'].length === 0) {
console.log("No data available");
// Reset all relevant fields and table
$('#IgrshowTitle').text('');
$("#IGRNO1").val('');
$("#PONO1").val('');
$("#txtIGRLineItem").val('');
$('#printLink').attr('href', '#');
$('.help-block').text('');
$("#Vehicle_No").val('');
$("#Transporter_Id").val('');
$("#Driver_Name").val('');
$("#DriverMobileNumber").val('');
$("#IGRStatus").val('');
$("#PONo").val('');
$("#Supplier").val('');
$("#Add1").val('');
$("#Invoice_No").val('');
$("#Invoice_Date").val('');
$("#MaterialRcvdDate").val('');
$("#ser").val('');
$("#tbleIGRAppend").empty(); // Clear the table
// Hide the MasterFileLabel if no data
modal.find('#MasterFileLabel').hide();
return; // Exit the function early
var userRole = "<?php echo (int)$userRole; ?>";
if (userRole != 1) {
if (igrstatus == "ST074") {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
$(".a_tag_for_mrir").css("display", "block");
VehicleNoInput.prop('readonly', false);
DriverInput.prop('readonly', false);
DriverMobileNumberInput.prop('readonly', false);
MaterialRcvdDateInput.prop('readonly', false);
invoiceDateInput.prop('readonly', false);
invoiceNoInput.prop('readonly', false);
} else {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
$(".a_tag_for_mrir").css("display", "none");
VehicleNoInput.prop('readonly', true);
DriverInput.prop('readonly', true);
DriverMobileNumberInput.prop('readonly', true);
MaterialRcvdDateInput.prop('readonly', true);
invoiceDateInput.prop('readonly', true);
invoiceNoInput.prop('readonly', true);
}
} else {
$(".a_tag_for_mrir").css("display", "none");
if (igrstatus == "ST074") {
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
} else {
buttonContainer.find("#draftIGR").css("display", "none");
}
}
var trIGRHTML = '';
$("#tbleIGRAppend").empty();
// $('#content').loader('show');
$.each(parsedData['details'], function(i, item) {
if (igr == item.IGRNO) {
console.log(item);
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
$("#IGRNO1").val(item.IGRNO);
$("#PONO1").val(item.PONO);
$("#txtIGRLineItem").val(item.IGRItemNo);
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
$('#printLink').attr('href', newUrl);
var isOpenOrder = parseInt(item.IsOpenOrder ? item.IsOpenOrder : "0", 2);
console.log(item.IsOpenOrder);
console.log(isOpenOrder);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder);
var button_text_for_IGRDraft = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Open IGR";
$('#draftIGR').text(button_text_for_IGRDraft);
$("#hiddenIsOpenOrder").val(isOpenOrder);
$("#Vehicle_No").val(item.VehicleNo);
$("#Transporter_Id").val(item.TransporterId);
$("#Driver_Name").val(item.DriverName);
$("#DriverMobileNumber").val(item.DriverMobileNumber);
$("#IGRStatus").val(item.IGRStatus);
$("#PONo").val(item.PONO);
$("#Supplier").val(item.SupplierName);
$("#Add1").val(item.Address);
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
console.log(typeof item.MasterFile);
$.ajax({
data: {
id: igr
},
type: "POST",
url: "<?php echo base_url() ?>ViewIGRDetails",
success: function(data) {
// success:function(data) {
// $('#content').loader('hide');
var parsedData = JSON.parse(data);
console.log(parsedData);
if (parsedData['details'].length === 0) {
console.log("No data available");
// Reset all relevant fields and table
$('#IgrshowTitle').text('');
$("#IGRNO1").val('');
$("#PONO1").val('');
$("#txtIGRLineItem").val('');
$('#printLink').attr('href', '#');
$('.help-block').text('');
$("#Vehicle_No").val('');
$("#Transporter_Id").val('');
$("#Driver_Name").val('');
$("#DriverMobileNumber").val('');
$("#IGRStatus").val('');
$("#PONo").val('');
$("#Supplier").val('');
$("#Add1").val('');
$("#Invoice_No").val('');
$("#Invoice_Date").val('');
$("#MaterialRcvdDate").val('');
$("#ser").val('');
$("#tbleIGRAppend").empty(); // Clear the table
// Hide the MasterFileLabel if no data
modal.find('#MasterFileLabel').hide();
if (typeof item.MasterFile == 'string') {
if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") {
modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile);
modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File');
modal.find('#MasterFileLabel a').attr('target', '_blank');
modal.find('#MasterFileLabel a span').text('previously uploaded - ');
modal.find('#MasterFileLabel a small').text(item.MasterFile);
modal.find('#MasterFileLabel').show();
}
} else {
return; // Exit the function early
}
var trIGRHTML = '';
$.each(parsedData['details'], function(i, item) {
if (igr == item.IGRNO) {
console.log(item);
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
$("#IGRNO1").val(item.IGRNO);
$("#PONO1").val(item.PONO);
$("#txtIGRLineItem").val(item.IGRItemNo);
var baseUrl = '<?php echo base_url(); ?>purchaseorder/CreatePOPrint';
var newUrl = baseUrl + '?PONO=' + item.PONO + '&ReqType=' + item.POType;
$('#printLink').attr('href', newUrl);
var isOpenOrder = parseInt(item.IsOpenOrder ? item.IsOpenOrder : "0", 2);
console.log(item.IsOpenOrder);
console.log(isOpenOrder);
var formatted_IsOpenOrder = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "" : "Open";
$('.help-block').text(formatted_IsOpenOrder);
var button_text_for_IGRDraft = (isOpenOrder === 0 || isNaN(isOpenOrder)) ? "Save as Draft IGR" : "Save as Open IGR";
$('#draftIGR').text(button_text_for_IGRDraft);
$("#hiddenIsOpenOrder").val(isOpenOrder);
$("#Vehicle_No").val(item.VehicleNo);
$("#Transporter_Id").val(item.TransporterId);
$("#Driver_Name").val(item.DriverName);
$("#DriverMobileNumber").val(item.DriverMobileNumber);
$("#IGRStatus").val(item.IGRStatus);
$("#PONo").val(item.PONO);
$("#Supplier").val(item.SupplierName);
$("#Add1").val(item.Address);
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
console.log(typeof item.MasterFile);
modal.find('#MasterFileLabel').hide();
}
// Format dates
var dcd = new Date(item.DeliveryChellanDate);
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
$("#Invoice_Date").val(dcd2);
console.log(item.MaterialRcvdDate)
var Mat_rcv_date = (item.MaterialRcvdDate == 'null') ? ' ' : formatDateTime(item.MaterialRcvdDate, 1);
$("#MaterialRcvdDate").val(Mat_rcv_date);
console.log(item.MaterialRcvdDate)
var gross_rcv_date = (item.GrossWeightDate == 'null') ? ' ' : formatDateTime(item.GrossWeightDate, 2);
$("#ser").val(item.ServiceDescription);
i = i + 1;
// userrole is system admin also know as admin (if)
if (userRole == 1) {
$("#pendingQuantityHeader").css("display", "table-cell");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 150px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
if (typeof item.MasterFile == 'string') {
if (item.MasterFile !== null && item.MasterFile !== undefined && item.MasterFile.trim() !== "") {
modal.find('#MasterFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + item.MasterFile);
modal.find('#MasterFileLabel a').attr('title', 'previously uploaded IGR Master File');
modal.find('#MasterFileLabel a').attr('target', '_blank');
modal.find('#MasterFileLabel a span').text('previously uploaded - ');
modal.find('#MasterFileLabel a small').text(item.MasterFile);
modal.find('#MasterFileLabel').show();
}
} else {
modal.find('#MasterFileLabel').hide();
}
}
// userrole is security based on status we show and here (else if)
else if (userRole !== 1) {
if (igrstatus === "ST074") {
// Format dates
var dcd = new Date(item.DeliveryChellanDate);
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
$("#Invoice_Date").val(dcd2);
console.log(item.MaterialRcvdDate)
var Mat_rcv_date = (item.MaterialRcvdDate == 'null') ? ' ' : formatDateTime(item.MaterialRcvdDate, 1);
$("#MaterialRcvdDate").val(Mat_rcv_date);
console.log(item.MaterialRcvdDate)
var gross_rcv_date = (item.GrossWeightDate == 'null') ? ' ' : formatDateTime(item.GrossWeightDate, 2);
$("#ser").val(item.ServiceDescription);
i = i + 1;
// userrole is system admin also know as admin (if)
if (userRole == 1) {
$("#pendingQuantityHeader").css("display", "table-cell");
trIGRHTML += '<tr>' +
@ -784,52 +752,88 @@
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
}
} else {
$("#pendingQuantityHeader").css("display", "none");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" name="Quantity">' + item.Quantity + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
'<td style="width: 150px;">' + item.Remarks + '</td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
}
// userrole is security based on status we show and here (else if)
else if (userRole !== 1) {
if (igrstatus === "ST074") {
$("#pendingQuantityHeader").css("display", "table-cell");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 150px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '" style="display:none;">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
$('#QuantityAsPerInvoice' + i).attr('readonly', 'true');
}
} else {
$("#pendingQuantityHeader").css("display", "none");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" align="right">' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 200px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" align="right" name="Quantity">' + item.Quantity + '</td>' +
'<td style="width: 100px;" align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
'<td style="width: 150px;">' + item.Remarks + '</td>' +
'<td style="width: 50px;"><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="' + i + '" data-material="' + item.MaterialName + '" data-igrstatus = "' + igrstatus + '"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' +
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
'<input type="file" id="txtWeightFile' + i + '" name="txtWeightFile' + i + '"value="' + item.WeightFile + '">' +
'<input type="hidden" id="txtWeightFileName' + i + '" name="txtWeightFileName' + i + '"value="' + item.WeightFile + '">' +
'</tr>';
}
}
}
}
});
$("#tbleIGRAppend").empty();
$("#tbleIGRAppend").append(trIGRHTML);
if (parsedData['files'].length !== 0) {
$.each(parsedData['files'], function(i, item) {
appendExistingFilesFileds(item)
});
$("#tbleIGRAppend").empty();
$("#tbleIGRAppend").append(trIGRHTML);
if (parsedData['files'].length !== 0) {
$.each(parsedData['files'], function(i, item) {
appendExistingFilesFileds(item)
});
}
}
}
});
});
});
</script>
</script>
<script>
$('#update').click(function() {
$('#content').loader('show');
// $('#content').loader('show');
var igrno = $("#IGRNO1").val();
var materialrcv_date = $("#MaterialRcvdDate").val();
var inv_date = $("#Invoice_Date").val();
@ -843,13 +847,13 @@
type: "POST",
url: "<?php echo base_url() ?>UpdateIGR",
success: function(data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
}
});
});
$('#draftIGR').click(function() {
$('#content').loader('show');
// $('#content').loader('show');
var igrno = $("#IGRNO1").val();
var pono = $("#PONO1").val();
var status = 0;
@ -905,14 +909,14 @@
processData: false,
contentType: false,
success: function(data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
location.reload();
}
});
});
$('#generateIGR').click(function() {
$('#content').loader('show');
// $('#content').loader('show');
var igrno = $("#IGRNO1").val();
var pono = $("#PONO1").val();
var status = 1;
@ -965,7 +969,7 @@
processData: false,
contentType: false,
success: function(data) {
$('#content').loader('hide');
// $('#content').loader('hide');
alert(data);
location.reload();
}
@ -1122,71 +1126,72 @@
$("#TareWeightDate").val($("#clock").text());
}
}
$("#WeightCalculator").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index');
console.log(inx);
var material = $(e.relatedTarget).data('material');
var modal = $(this);
$(document).ready(function() {
$("#WeightCalculator").on("shown.bs.modal", function(e) {
var inx = $(e.relatedTarget).data('index');
console.log(inx);
var material = $(e.relatedTarget).data('material');
var modal = $(this);
$('#WeightTitle').text(" ( " + material + " )");
$('#WeightTitle').text(" ( " + material + " )");
// Clear the modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
$("#WeightFile").val('');
// Clear the modal inputs
$("#GrossWeight").val('');
$("#GrossWeightDate").val('');
$("#TareWeight").val('');
$("#TareWeightDate").val('');
$("#NetWeight").val('');
$("#WeightFile").val('');
// Retrieve values from hidden inputs
var v1 = $("#txtGrossWeight" + inx).val();
var v2 = $("#txtGrossWeightDate" + inx).val();
var v3 = $("#txtTareWeight" + inx).val();
var v4 = $("#txtTareWeightDate" + inx).val();
var v5 = $("#txtNetWeight" + inx).val();
var fileInput = $("#txtWeightFile" + inx)[0];
var fileName = $("#txtWeightFileName" + inx).val();
modal.find('#WeightFileLabel').hide();
console.log(typeof fileName);
if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") {
modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File');
modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + fileName);
modal.find('#WeightFileLabel a').attr('target', '_blank');
modal.find('#WeightFileLabel a span').text('previously uploaded - ');
modal.find('#WeightFileLabel a small').text(fileName);
modal.find('#WeightFileLabel').show();
}
console.log(fileInput);
console.log("Selected values for index:", typeof inx, inx);
// Retrieve values from hidden inputs
var v1 = $("#txtGrossWeight" + inx).val();
var v2 = $("#txtGrossWeightDate" + inx).val();
var v3 = $("#txtTareWeight" + inx).val();
var v4 = $("#txtTareWeightDate" + inx).val();
var v5 = $("#txtNetWeight" + inx).val();
var fileInput = $("#txtWeightFile" + inx)[0];
var fileName = $("#txtWeightFileName" + inx).val();
modal.find('#WeightFileLabel').hide();
console.log(typeof fileName);
if (fileName !== 'null' && fileName !== undefined && fileName.trim() !== "") {
modal.find('#WeightFileLabel a').attr('title', 'previously uploaded IGR Weight File');
modal.find('#WeightFileLabel a').attr('href', '<?php echo base_url() ?>' + 'public/uploads/Igrfiles/' + fileName);
modal.find('#WeightFileLabel a').attr('target', '_blank');
modal.find('#WeightFileLabel a span').text('previously uploaded - ');
modal.find('#WeightFileLabel a small').text(fileName);
modal.find('#WeightFileLabel').show();
}
console.log(fileInput);
console.log("Selected values for index:", typeof inx, inx);
// Set modal inputs with the retrieved values
$("#GrossWeight").val(v1);
$("#GrossWeightDate").val(v2);
$("#TareWeight").val(v3);
$("#TareWeightDate").val(v4);
$("#NetWeight").val(v5);
$("#CurrentInx").val(inx);
// Set modal inputs with the retrieved values
$("#GrossWeight").val(v1);
$("#GrossWeightDate").val(v2);
$("#TareWeight").val(v3);
$("#TareWeightDate").val(v4);
$("#NetWeight").val(v5);
$("#CurrentInx").val(inx);
fileName
if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#WeightFile")[0];
var file = fileInput.files[0];
fileName
if (fileInput && fileInput.files.length > 0) {
var targetInput = $("#WeightFile")[0];
var file = fileInput.files[0];
// Create a new DataTransfer object
var dataTransfer = new DataTransfer();
dataTransfer.items.add(file);
// Create a new DataTransfer object
var dataTransfer = new DataTransfer();
dataTransfer.items.add(file);
// Set the file to the target input
targetInput.files = dataTransfer.files;
// Set the file to the target input
targetInput.files = dataTransfer.files;
} else {
console.log("No file selected or file input not found.");
}
} else {
console.log("No file selected or file input not found.");
}
});
});
function modalSave() {
var v1 = $("#GrossWeight").val();
var v2 = $("#GrossWeightDate").val();
@ -1427,7 +1432,7 @@
formData.append('count', counter);
formData.append('igr', igr);
$('.content').loader('show');
// $('.content').loader('show');
$.ajax({
data: formData,
type: "POST",
@ -1441,7 +1446,7 @@
billNo = chars[1] != undefined ? chars[1] : "";
alert('File uploaded successfully.');
addToTable(counter, billNo, file.name);
$('.content').loader('hide');
// $('.content').loader('hide');
$('#billModel').modal('hide');
}
}
@ -1600,6 +1605,7 @@ function appendExistingFilesFileds(data){
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table
order: [
[0, 'desc']
], // Default ordering (column index 0, ascending)

View File

@ -8,6 +8,7 @@
* @author Kishor Mali
*/
$(document).ready(function(){
var addUserForm = $("#addUser");
@ -16,7 +17,7 @@ $(document).ready(function(){
rules:{
fname :{ required : true },
email : { required : true, email : true, remote : { url : baseURL + "checkEmailExists", type :"post"} },
email : { required : true, email : true, remote : { url : "checkEmailExists", type :"post"} },
password : { required : true },
cpassword : {required : true, equalTo: "#password"},
mobile : { required : true, digits : true },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

1368
public/new_assets/js/jquery.validate.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,469 @@
/**
* @author Kishor Mali
*/
$(document).ready(function(){
jQuery.validator.addMethod("notEqualTo", function(value, element)
{
if(value == $('#mobile1').val() && $('#mobile1').val() != "")
{
return false;
}
else
{
return true;
}
},"");
jQuery.validator.addMethod("lessThanBrothers", function(value, element)
{
if(value <= $('#no_of_brothers').val())
{
return true;
}
else
{
return false;
}
},"");
jQuery.validator.addMethod("lessThanSisters", function(value, element)
{
if(value <= $('#no_of_sisters').val())
{
return true;
}
else
{
return false;
}
},"");
jQuery.validator.addMethod("selected", function(value, element)
{
if(value == 0) { return false; }
else { return true; }
},"This field is required.");
jQuery.validator.addMethod("greaterThan", function(value, element)
{
var value = parseFloat(value);
var smaller = parseFloat($("#part_anual_income_from").val());
if(value < smaller)
{ return false; }
else
{ return true; }
},"To Salary is must greater than from.");
jQuery.validator.addMethod("acceptImgExtension", function(value, element)
{
if(value == "")
{
return true;
}
else
{
var extension = (value.substring(value.lastIndexOf('.') + 1)).toLowerCase();
if(extension == 'jpg'|| extension=='png' || extension == "jpeg" || extension == "gif")
{ return true; }
else
{ return false; }
}
}, "");
jQuery.validator.addMethod("acceptDocExtension", function(value, element)
{
if(value == "")
{
return true;
}
else
{
var extension = (value.substring(value.lastIndexOf('.') + 1)).toLowerCase();
if(extension == 'jpg'|| extension=='png' || extension == "jpeg" || extension == "gif")
{ return true; }
else
{ return false; }
}
}, "");
jQuery.validator.addMethod("checkUsername", function(value, element)
{
var response;
var post_url_check_username = baseurl + "user/checkUsernameExist/";
$.ajax({
type: "POST",
url: post_url_check_username,
data: {username : value},
dataType: "json",
async: false
}).done(function(result){
//alert(result.status);
if(result.status == true){
response = false;
}else{
response = true;
}
});
return response;
}, "Username already taken.");
jQuery.validator.addMethod("checkEmailExist", function(value, element)
{
var response = false;
var post_url_check_email = baseurl +"user/checkEmailExist/";
$.ajax({
type: "POST",
url: post_url_check_email,
data: {email : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true){
response = false;
}else{
response = true;
}
});
return response;
}, "Email already taken.");
jQuery.validator.addMethod("checkMobileExist", function(value, element)
{
var response = false;
var post_url_check_mobile = baseurl + "user/checkMobileExist/";
$.ajax({
type: "POST",
url: post_url_check_mobile,
data: {mob : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true){
response = false;
}else{
response = true;
}
});
return response;
}, "Mobile number already registered.");
jQuery.validator.addMethod("checkMobileExist2", function(value, element)
{
var response = false;
var post_url_check_mobile2 = baseurl + "user/checkMobileExist2/";
if(value == "")
{
response = true;
}
else
{
$.ajax({
type: "POST",
url: post_url_check_mobile2,
data: {mob : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true)
{
response = false;
}else
{
response = true;
}
});
}
return response;
}, "Mobile number already registered.");
jQuery.validator.addMethod("checkPhoneExist", function(value, element)
{
var response = false;
var post_url_check_phone = baseurl +"user/checkPhoneExist/";
if(value == "")
{
response = true;
}
else
{
$.ajax({
type: "POST",
url: post_url_check_phone,
data: {mob : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true)
{
response = false;
}else
{
response = true;
}
});
}
return response;
}, "Phone number already registered.");
jQuery.validator.addMethod('checkMobileExist1Same', function(value, element)
{
var response = false;
var post_url_check_phone = baseurl +"profile/checkMobileExist1Same/";
if(value == "")
{
response = true;
}
else
{
$.ajax({
type: "POST",
url: post_url_check_phone,
data: {mob : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true)
{
response = false;
}else
{
response = true;
}
});
}
return response;
}, "Mobile number already registered.");
jQuery.validator.addMethod('checkMobileExist2Same', function(value, element)
{
var response = false;
var post_url_check_mobile2 = baseurl + "profile/checkMobileExist2Same/";
if(value == "")
{
response = true;
}
else
{
$.ajax({
type: "POST",
url: post_url_check_mobile2,
data: {mob : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true)
{
response = false;
}else
{
response = true;
}
});
}
return response;
}, "Mobile number already registered.");
jQuery.validator.addMethod('checkPhoneExistSame', function(value, element)
{
var response = false;
var post_url_check_mobile2 = baseurl + "profile/checkPhoneExistSame/";
if(value == "")
{
response = true;
}
else
{
$.ajax({
type: "POST",
url: post_url_check_mobile2,
data: {mob : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true)
{
response = false;
}else
{
response = true;
}
});
}
return response;
},"Phone number already registered.");
jQuery.validator.addMethod('checkDateFormat', function(value, element){
var stringPattern = /^(?:(?:31(\/|-|\.)(?:0?[13578]|1[02]))\1|(?:(?:29|30)(\/|-|\.)(?:0?[1,3-9]|1[0-2])\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})$|^(?:29(\/|-|\.)0?2\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))$|^(?:0?[1-9]|1\d|2[0-8])(\/|-|\.)(?:(?:0?[1-9])|(?:1[0-2]))\4(?:(?:1[6-9]|[2-9]\d)?\d{2})$/gm;
if(stringPattern.test(value))
{
return true;
}
else
{
return false;
}
},"Please enter correct date.");
jQuery.validator.addMethod('checkWhiteSpaces', function(value, element){
var stringPattern = /\s/;
if(stringPattern.test(value))
{
return false;
}
else
{
return true;
}
},"Spaces are not allowed in username.");
jQuery.validator.addMethod('checkDateDifference', function(value, element){
var birthYear = parseInt( value.substring(value.lastIndexOf('/') + 1)),
dateNow = new Date(),
dateDiff = dateNow.getFullYear() - birthYear;
if(dateDiff < 17)
{
return false;
}
else
{
return true;
}
},"Please enter less than 18 years of current date.");
/* Make checkboxes work like radio buttons - Start
$('.radio_eating').click(function() {
selectedBox = this.id;
$('.radio_eating').each(function() {
if ( this.id == selectedBox )
{
this.checked = true;
}
else
{
this.checked = false;
};
});
});
$('.radio_drinking').click(function() {
selectedBox = this.id;
$('.radio_drinking').each(function() {
if ( this.id == selectedBox )
{
this.checked = true;
}
else
{
this.checked = false;
};
});
});
$('.radio_smoking').click(function() {
selectedBox = this.id;
$('.radio_smoking').each(function() {
if ( this.id == selectedBox )
{
this.checked = true;
}
else
{
this.checked = false;
};
});
});
*/
/* Physical Disability Textbox enable disable - Start */
$('#physical_status').prop('disabled',true);
$('#chk_physical_status').click(function()
{
if($('#chk_physical_status').prop('checked') == false)
{
$('#physical_status').prop('disabled',true);
}
else
{
$('#physical_status').prop('disabled',false);
}
});
/* Physical Disability Textbox enable disable - End */
jQuery.validator.addMethod("checkEmailExistFranchise", function(value, element)
{
var response = false;
var post_url_check_email_franchise = baseurl +"franchise/franchise/checkEmailExist/";
$.ajax({
type: "POST",
url: post_url_check_email_franchise,
data: {email : value},
dataType: "json",
async: false
}).done(function(result){
if(result.status == true){
response = false;
}else{
response = true;
}
});
return response;
}, "Email already taken.");
});

View File

Before

Width:  |  Height:  |  Size: 157 KiB

After

Width:  |  Height:  |  Size: 157 KiB

25
vendor/autoload.php vendored
View File

@ -1,25 +0,0 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitb6668d4a545a8f860d35d17ef0fdd011::getLoader();

View File

@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../friendsofphp/php-cs-fixer/php-cs-fixer)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/friendsofphp/php-cs-fixer/php-cs-fixer');
}
}
return include __DIR__ . '/..'.'/friendsofphp/php-cs-fixer/php-cs-fixer';

119
vendor/bin/php-parse vendored
View File

@ -1,119 +0,0 @@
#!/usr/bin/env php
<?php
/**
* Proxy PHP file generated by Composer
*
* This file includes the referenced bin path (../nikic/php-parser/bin/php-parse)
* using a stream wrapper to prevent the shebang from being output on PHP<8
*
* @generated
*/
namespace Composer;
$GLOBALS['_composer_bin_dir'] = __DIR__;
$GLOBALS['_composer_autoload_path'] = __DIR__ . '/..'.'/autoload.php';
if (PHP_VERSION_ID < 80000) {
if (!class_exists('Composer\BinProxyWrapper')) {
/**
* @internal
*/
final class BinProxyWrapper
{
private $handle;
private $position;
private $realpath;
public function stream_open($path, $mode, $options, &$opened_path)
{
// get rid of phpvfscomposer:// prefix for __FILE__ & __DIR__ resolution
$opened_path = substr($path, 17);
$this->realpath = realpath($opened_path) ?: $opened_path;
$opened_path = $this->realpath;
$this->handle = fopen($this->realpath, $mode);
$this->position = 0;
return (bool) $this->handle;
}
public function stream_read($count)
{
$data = fread($this->handle, $count);
if ($this->position === 0) {
$data = preg_replace('{^#!.*\r?\n}', '', $data);
}
$this->position += strlen($data);
return $data;
}
public function stream_cast($castAs)
{
return $this->handle;
}
public function stream_close()
{
fclose($this->handle);
}
public function stream_lock($operation)
{
return $operation ? flock($this->handle, $operation) : true;
}
public function stream_seek($offset, $whence)
{
if (0 === fseek($this->handle, $offset, $whence)) {
$this->position = ftell($this->handle);
return true;
}
return false;
}
public function stream_tell()
{
return $this->position;
}
public function stream_eof()
{
return feof($this->handle);
}
public function stream_stat()
{
return array();
}
public function stream_set_option($option, $arg1, $arg2)
{
return true;
}
public function url_stat($path, $flags)
{
$path = substr($path, 17);
if (file_exists($path)) {
return stat($path);
}
return false;
}
}
}
if (
(function_exists('stream_get_wrappers') && in_array('phpvfscomposer', stream_get_wrappers(), true))
|| (function_exists('stream_wrapper_register') && stream_wrapper_register('phpvfscomposer', 'Composer\BinProxyWrapper'))
) {
return include("phpvfscomposer://" . __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse');
}
}
return include __DIR__ . '/..'.'/nikic/php-parser/bin/php-parse';

View File

@ -1,190 +0,0 @@
# Changelog
All notable changes to this library will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.8.1](https://github.com/CodeIgniter/coding-standard/compare/v1.8.0...v1.8.1) - 2024-08-05
- Add `keep_annotations` option for `php_unit_attributes`
- Add `php_unit_assert_new_names` fixer
- Bump dependencies
## [v1.8.0](https://github.com/CodeIgniter/coding-standard/compare/v1.7.16...v1.8.0) - 2024-06-16
- Enable rules for PHP 8.1 (#20)
## [v1.7.16](https://github.com/CodeIgniter/coding-standard/compare/v1.7.15...v1.7.16) - 2024-05-18
- Disable `php_unit_attributes` for now
- Fix cs-config to v3.18 for now
- Disable `ordered_attributes` for PHP <8.0
## [v1.7.15](https://github.com/CodeIgniter/coding-standard/compare/v1.7.14...v1.7.15) - 2024-03-24
- Remove deprecated option of `nullable_type_declaration_for_default_null_value`
## [v1.7.14](https://github.com/CodeIgniter/coding-standard/compare/v1.7.13...v1.7.14) - 2024-02-25
- Bump php-cs-fixer to v3.49
- Enable `string_implicit_backslashes` fixer
- Add/remove property-read and property-write
- Enable `phpdoc_list_type`
- Bump to php-cs-fixer v3.50
- Enable `allow_hidden_params` option
- also align `@phpstan-type` and `@phpstan-var`
- Enable `phpdoc_array_type`
## [v1.7.13](https://github.com/CodeIgniter/coding-standard/compare/v1.7.12...v1.7.13) - 2024-01-27
- Update GHA workflows
- Bump to php-cs-fixer v3.47
- Disable all new rules in v3.47
- Apply new options to `phpdoc_align` fixer
- Bump actions/cache from 3 to 4 (#17)
## [v1.7.12](https://github.com/CodeIgniter/coding-standard/compare/v1.7.11...v1.7.12) - 2023-12-29
- Bump php-cs-fixer to v3.43
- Enable other options of `fully_qualified_strict_types`
- Disable `class_keyword`
- Disable option for `statement_indentation`
- Use default for option of `unary_operator_spaces`
## [v1.7.11](https://github.com/CodeIgniter/coding-standard/compare/v1.7.10...v1.7.11) - 2023-10-13
- Bump to php-cs-fixer v3.35
## [v1.7.10](https://github.com/CodeIgniter/coding-standard/compare/v1.7.9...v1.7.10) - 2023-10-01
- Bump to php-cs-fixer v3.34
- Bump to php-cs-fixer v3.30
- Fix tag name in release
## [v1.7.9](https://github.com/CodeIgniter/coding-standard/compare/v1.7.8...v1.7.9) - 2023-09-18
- Update release.yml
- Add `long_to_shorthand_operator` (#13)
- Bump actions/checkout from 3 to 4 (#12)
## [v1.7.8](https://github.com/CodeIgniter/coding-standard/compare/v1.7.7...v1.7.8) - 2023-08-30
- Add `case_sensitive` option to order fixers
## [v1.7.7](https://github.com/CodeIgniter/coding-standard/compare/v1.7.6...v1.7.7) - 2023-08-15
- Specify force option for `php_unit_data_provider_static` fixer
## [v1.7.6](https://github.com/CodeIgniter/coding-standard/compare/v1.7.5...v1.7.6) - 2023-08-15
- Enable 'php_unit_data_provider_static'
- Add new fixers in php-cs-fixer v3.23
- Add `yield_from_array_to_yields`
- Enable `php_unit_data_provider_name`
- Use all available checked tokens for `no_extra_blank_lines`
- Configure `php_unit_data_provider_return_type`
- Remove parallel.timeout in phpstan.neon.dist
## [v1.7.5](https://github.com/CodeIgniter/coding-standard/compare/v1.7.4...v1.7.5) - 2023-07-15
- Configure new fixers in php-cs-fixer v3.20
## [v1.7.4](https://github.com/CodeIgniter/coding-standard/compare/v1.7.3...v1.7.4) - 2023-06-19
- Bump php-cs-fixer to v3.18
- fix: ruleset deprecated on `v3.18` (#10)
- Add case_sensitive option to ordered_class_elements
- Add missing rules
## [v1.7.3](https://github.com/CodeIgniter/coding-standard/compare/v1.7.2...v1.7.3) - 2023-05-05
- Replace `single_space_after_construct` with `single_space_around_construct`
- Remove deprecated `braces` rules
- Bump php-cs-fixer to v3.16
## [v1.7.2](https://github.com/CodeIgniter/coding-standard/compare/v1.7.1...v1.7.2) - 2023-03-05
- Bump php-cs-fixer to v3.14
## [v1.7.1](https://github.com/CodeIgniter/coding-standard/compare/v1.7.0...v1.7.1) - 2022-12-22
- Fix php-cs-fixer version to 3.13.0
## [v1.7.0](https://github.com/CodeIgniter/coding-standard/compare/v1.6.2...v1.7.0) - 2022-11-01
- Bump php-cs-fixer to v3.13
- Add 'case_sensitive' option to 'general_phpdoc_annotation_remove'
- Add 'closure_fn_spacing' option to 'function_declaration'
## [v1.6.2](https://github.com/CodeIgniter/coding-standard/compare/v1.6.1...v1.6.2) - 2022-10-30
- Grouped `runTestsInSeparateProcess`, `runInSeparateProcess`, `preserveGlobalState` together
## [v1.6.1](https://github.com/CodeIgniter/coding-standard/compare/v1.6.0...v1.6.1) - 2022-10-20
- Changed `@internal` description of class CodeIgniter4 to avoid warnings in phpstorm
## [v1.6.0](https://github.com/CodeIgniter/coding-standard/compare/v1.5.0...v1.6.0) - 2022-10-15
- Bump php-cs-fixer version to v3.12 minimum
- Enable `no_useless_concat_operator`
- Update action workflows
## [v1.5.0](https://github.com/CodeIgniter/coding-standard/compare/v1.4.0...v1.5.0) - 2022-09-13
- Enable `ensure_single_space` option of `whitespace_after_comma_in_array`
- Use the `space_multiple_catch` option of `types_spaces`
- Fix multi-lines
- Add `group_to_single_imports` option to `single_import_per_statement`
- chore: fix editorconfig (#4)
- docs: add CONTRIBUTING.md (#3)
- Enable `date_time_create_from_format_call`
- Add options to `new_with_braces`
- Add `order` option to `phpdoc_order`
- Add the `trailing_comma_single_line` option to `function_declaration`
- Enable `curly_braces_position`
- Enable `single_line_comment_spacing`
- Enable `no_trailing_comma_in_singleline`
- Normalize composer.json
- Add "static analysis" Composer keyword (#2)
- Add `inline_constructor_arguments` option to `class_definition`
- Enable `statement_indentation`
- Enable `no_useless_nullsafe_operator`
- Enable `no_multiple_statements_per_line`
- Enable `control_structure_braces`
- Enable `blank_line_between_import_groups`
- Remove deprecated fixers
- Configure `groups` option in `phpdoc_separation` rule
- Bump php-cs-fixer version
## [v1.4.0](https://github.com/CodeIgniter/coding-standard/compare/v1.3.0...v1.4.0) - 2022-02-09
- Permit use of latest php-cs-fixer v3.6.0
## [v1.3.0](https://github.com/CodeIgniter/coding-standard/compare/v1.2.0...v1.3.0) - 2022-01-15
- Fix GHA workflows
- Bump versions
- PHP 7.4 minimum
- friendsofphp/php-cs-fixer v3.4.0
- phpstan/phpstan v1.0 minimum
- Enable `ordered_class_elements` rule
- Enable `global_namespace_import` rule (#1)
- Use `GITHUB_TOKEN` so that secrets can be passed to PRs
## [v1.2.0](https://github.com/CodeIgniter/coding-standard/compare/v1.1.0...v1.2.0) - 2021-10-18
- Bump `friendsofphp/php-cs-fixer` to v3.2 minimum
- Change behavior of `class_attributes_separation` rule
- Add support for new fixers added in php-cs-fixer v3.2.0
- Enable `no_alternative_syntax` rule
## [v1.1.0](https://github.com/CodeIgniter/coding-standard/compare/v1.0.0...v1.1.0) - 2021-08-31
- Bump to `friendsofphp/php-cs-fixer` v3.1.0
- Fix release script
- Bump to `nexusphp/cs-config` v3.3.0
## [v1.0.0](https://github.com/CodeIgniter/coding-standard/releases/tag/v1.0.0) - 2021-08-29
Initial release.

View File

@ -1,10 +0,0 @@
# Contributing to CodeIgniter Coding Standard
CodeIgniter Coding Standard is a community driven project and accepts contributions of
code and documentation from the community.
If you'd like to contribute, please read the [Contributing to CodeIgniter](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/README.md)
guide in the [main repository](https://github.com/codeigniter4/CodeIgniter4).
If you are going to contribute to this repository, please report bugs or send PRs
to this repository instead of the main repository.

View File

@ -1,21 +0,0 @@
MIT License
Copyright (c) 2021 CodeIgniter Foundation and John Paul E. Balandan, CPA
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,115 +0,0 @@
# CodeIgniter Coding Standard
[![Unit Tests](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpunit.yml/badge.svg)](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpunit.yml)
[![Coding Standards](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-coding-standards.yml/badge.svg)](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-coding-standards.yml)
[![PHPStan Static Analysis](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpstan.yml/badge.svg)](https://github.com/CodeIgniter/coding-standard/actions/workflows/test-phpstan.yml)
[![PHPStan level](https://img.shields.io/badge/PHPStan-max%20level-brightgreen)](phpstan.neon.dist)
[![Coverage Status](https://coveralls.io/repos/github/CodeIgniter/coding-standard/badge.svg?branch=develop)](https://coveralls.io/github/CodeIgniter/coding-standard?branch=develop)
[![Latest Stable Version](http://poser.pugx.org/codeigniter/coding-standard/v)](https://packagist.org/packages/codeigniter/coding-standard)
[![License](https://img.shields.io/github/license/codeigniter/coding-standard)](LICENSE)
[![Total Downloads](http://poser.pugx.org/codeigniter/coding-standard/downloads)](https://packagist.org/packages/codeigniter/coding-standard)
This library holds the official coding standards of CodeIgniter based
on [PHP CS Fixer][1] and powered by [Nexus CS Config][2].
## Installation
You can add this library as a local, per-project dependency to your project
using [Composer](https://getcomposer.org/):
composer require codeigniter/coding-standard
If you only need this library during development, for instance to run your project's test suite,
then you should add it as a development-time dependency:
composer require --dev codeigniter/coding-standard
## Setup
To start, let us create a `.php-cs-fixer.dist.php` file at the root of your project.
```php
<?php
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
return Factory::create(new CodeIgniter4())->forProjects();
```
This minimal setup will return a default instance of `PhpCsFixer\Config` containing all rules applicable
for the CodeIgniter organization.
Then, in your terminal, run the following command:
```console
$ vendor/bin/php-cs-fixer fix --verbose
```
## Adding License Headers
The default setup will not configure a license header in files. License headers can be especially useful
for library authors to assert copyright. To add license headers in your PHP files, you can simply provide
your name and name of library. Optionally, you can also provide your email and starting license year.
```diff
<?php
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
-return Factory::create(new CodeIgniter4())->forProjects();
+return Factory::create(new CodeIgniter4())->forLibrary(
+ 'CodeIgniter 4 framework',
+ 'CodeIgniter Foundation',
+ 'admin@codeigniter.com',
+ 2021,
+);
```
## Providing Overriding Rules and Options
The list of enabled rules can be found in the [`CodeIgniter\CodingStandard\CodeIgniter4`][3] class. If you
feel the rule is not applicable to you or you want to modify it, you can do so by providing an array of
overriding rules to the second parameter of `Factory::create()`.
Similarly, you can further modify the `PhpCsFixer\Config` instance returned by using the available options.
All available options are fully supported by [Nexus CS Config][2] and abstracted by simply providing an
array of key-value pairs in the third parameter of `Factory::create()`.
```diff
<?php
use CodeIgniter\CodingStandard\CodeIgniter4;
use Nexus\CsConfig\Factory;
-return Factory::create(new CodeIgniter4())->forProjects();
+return Factory::create(new CodeIgniter4(), [], [
+ 'usingCache' => false,
+])->forProjects();
```
You can check out this library's own [`.php-cs-fixer.dist.php`][4] for inspiration on how it is done.
For more detailed documentation on all available options, you can check [here][2].
## Contributing
All forms of contributions are welcome!
Since the rules here will be propagated and used within the CodeIgniter organization, all proposed rules
and modifications to existing rules should have a proof-of-concept (POC) PR sent first to
the [CodeIgniter4][5] repository with possible changes to the code styles applied there. Once accepted
there, you can send in a PR here to apply those rules.
## License
This work is open-sourced under the MIT license.
[1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer
[2]: https://github.com/NexusPHP/cs-config
[3]: src/CodeIgniter4.php
[4]: .php-cs-fixer.dist.php
[5]: https://github.com/codeigniter4/CodeIgniter4

View File

@ -1,49 +0,0 @@
{
"name": "codeigniter/coding-standard",
"description": "Official Coding Standards for CodeIgniter based on PHP CS Fixer",
"license": "MIT",
"type": "library",
"keywords": [
"phpcs",
"static analysis"
],
"authors": [
{
"name": "John Paul E. Balandan, CPA",
"email": "paulbalandan@gmail.com"
}
],
"support": {
"forum": "http://forum.codeigniter.com/",
"source": "https://github.com/CodeIgniter/coding-standard",
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^8.1",
"ext-tokenizer": "*",
"friendsofphp/php-cs-fixer": "^3.61.1",
"nexusphp/cs-config": "^3.24"
},
"require-dev": {
"nexusphp/tachycardia": "^2.3",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^10.5 || ^11.2"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"CodeIgniter\\CodingStandard\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"CodeIgniter\\CodingStandard\\Tests\\": "tests/"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
}
}

View File

@ -1,703 +0,0 @@
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) 2021 CodeIgniter Foundation <admin@codeigniter.com>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\CodingStandard;
use Nexus\CsConfig\Ruleset\AbstractRuleset;
/**
* Defines the ruleset used for the CodeIgniter4 organization.
*
* {@internal Use of this class is not covered by the backward compatibility promise for CodeIgniter4.}
*/
final class CodeIgniter4 extends AbstractRuleset
{
public function __construct()
{
$this->name = 'CodeIgniter4 Coding Standards';
$this->rules = [
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'],
'array_indentation' => true,
'array_push' => true,
'array_syntax' => ['syntax' => 'short'],
'assign_null_coalescing_to_coalesce_equal' => true,
'attribute_empty_parentheses' => false,
'backtick_to_shell_exec' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
'operators' => [
'=' => 'align_single_space_minimal',
'=>' => 'align_single_space_minimal',
'||' => 'align_single_space_minimal',
'.=' => 'align_single_space_minimal',
],
],
'blank_line_after_namespace' => true,
'blank_line_after_opening_tag' => true,
'blank_line_before_statement' => [
'statements' => [
'case',
'continue',
'declare',
'default',
'do',
'exit',
'for',
'foreach',
'goto',
'return',
'switch',
'throw',
'try',
'while',
'yield',
'yield_from',
],
],
'blank_line_between_import_groups' => true,
'blank_lines_before_namespace' => [
'min_line_breaks' => 2,
'max_line_breaks' => 2,
],
'braces_position' => [
'control_structures_opening_brace' => 'same_line',
'functions_opening_brace' => 'next_line_unless_newline_at_signature_end',
'anonymous_functions_opening_brace' => 'same_line',
'classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
'anonymous_classes_opening_brace' => 'same_line',
'allow_single_line_empty_anonymous_classes' => true,
'allow_single_line_anonymous_functions' => true,
],
'cast_spaces' => ['space' => 'single'],
'class_attributes_separation' => [
'elements' => [
'const' => 'none',
'property' => 'none',
'method' => 'one',
'trait_import' => 'none',
],
],
'class_definition' => [
'multi_line_extends_each_single_line' => true,
'single_item_single_line' => true,
'single_line' => true,
'space_before_parenthesis' => true,
'inline_constructor_arguments' => true,
],
'class_keyword' => false,
'class_reference_name_casing' => true,
'clean_namespace' => true,
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'combine_nested_dirname' => true,
'comment_to_phpdoc' => [
'ignored_tags' => [
'todo',
'codeCoverageIgnore',
'codeCoverageIgnoreStart',
'codeCoverageIgnoreEnd',
'phpstan-ignore-line',
'phpstan-ignore-next-line',
],
],
'compact_nullable_type_declaration' => true,
'concat_space' => ['spacing' => 'one'],
'constant_case' => ['case' => 'lower'],
'control_structure_braces' => true,
'control_structure_continuation_position' => ['position' => 'same_line'],
'date_time_create_from_format_call' => true,
'date_time_immutable' => false,
'declare_equal_normalize' => ['space' => 'none'],
'declare_parentheses' => true,
'declare_strict_types' => false,
'dir_constant' => true,
'doctrine_annotation_array_assignment' => false,
'doctrine_annotation_braces' => false,
'doctrine_annotation_indentation' => false,
'doctrine_annotation_spaces' => false,
'echo_tag_syntax' => [
'format' => 'short',
'long_function' => 'echo',
'shorten_simple_statements_only' => false,
],
'elseif' => true,
'empty_loop_body' => ['style' => 'braces'],
'empty_loop_condition' => ['style' => 'while'],
'encoding' => true,
'ereg_to_preg' => true,
'error_suppression' => [
'mute_deprecation_error' => true,
'noise_remaining_usages' => false,
'noise_remaining_usages_exclude' => [],
],
'explicit_indirect_variable' => true,
'explicit_string_variable' => true,
'final_class' => false,
'final_internal_class' => [
'exclude' => ['no-final'],
'include' => ['internal'],
'consider_absent_docblock_as_internal_class' => false,
],
'final_public_method_for_abstract_class' => false,
'fopen_flag_order' => true,
'fopen_flags' => ['b_mode' => true],
'full_opening_tag' => true,
'fully_qualified_strict_types' => [
'import_symbols' => false,
'leading_backslash_in_global_namespace' => false,
'phpdoc_tags' => [
'param',
'phpstan-param',
'phpstan-property',
'phpstan-property-read',
'phpstan-property-write',
'phpstan-return',
'phpstan-var',
'property',
'property-read',
'property-write',
'psalm-param',
'psalm-property',
'psalm-property-read',
'psalm-property-write',
'psalm-return',
'psalm-var',
'return',
'throws',
'var',
],
],
'function_declaration' => [
'closure_function_spacing' => 'one',
'closure_fn_spacing' => 'one',
'trailing_comma_single_line' => false,
],
'function_to_constant' => [
'functions' => [
'get_called_class',
'get_class',
'get_class_this',
'php_sapi_name',
'phpversion',
'pi',
],
],
'general_phpdoc_annotation_remove' => [
'annotations' => [
'author',
'package',
'subpackage',
],
'case_sensitive' => false,
],
'general_phpdoc_tag_rename' => [
'case_sensitive' => false,
'fix_annotation' => true,
'fix_inline' => true,
'replacements' => ['inheritDocs' => 'inheritDoc'],
],
'get_class_to_class_keyword' => false,
'global_namespace_import' => [
'import_constants' => false,
'import_functions' => false,
'import_classes' => true,
],
'group_import' => false,
'header_comment' => false, // false by default
'heredoc_closing_marker' => false,
'heredoc_indentation' => ['indentation' => 'start_plus_one'],
'heredoc_to_nowdoc' => true,
'implode_call' => true,
'include' => true,
'increment_style' => ['style' => 'post'],
'indentation_type' => true,
'integer_literal_case' => true,
'is_null' => true,
'lambda_not_used_import' => true,
'line_ending' => true,
'linebreak_after_opening_tag' => true,
'list_syntax' => ['syntax' => 'short'],
'logical_operators' => true,
'long_to_shorthand_operator' => true,
'lowercase_cast' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'magic_method_casing' => true,
'mb_str_functions' => false,
'method_argument_space' => [
'keep_multiple_spaces_after_comma' => false,
'on_multiline' => 'ensure_fully_multiline',
'after_heredoc' => false,
'attribute_placement' => 'standalone',
],
'method_chaining_indentation' => true,
'modernize_strpos' => true,
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'multiline_string_to_heredoc' => false,
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'],
'native_constant_invocation' => false,
'native_function_casing' => true,
'native_function_invocation' => false,
'native_type_declaration_casing' => true,
'new_with_parentheses' => [
'named_class' => true,
'anonymous_class' => true,
],
'no_alias_functions' => ['sets' => ['@all']],
'no_alias_language_construct_call' => true,
'no_alternative_syntax' => ['fix_non_monolithic_code' => false],
'no_binary_string' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_break_comment' => ['comment_text' => 'no break'],
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => [
'tokens' => [
'attribute',
'break',
'case',
'continue',
'curly_brace_block',
'default',
'extra',
'parenthesis_brace_block',
'return',
'square_brace_block',
'switch',
'throw',
'use',
],
],
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => 'echo'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiple_statements_per_line' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_space_around_double_colon' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => ['positions' => ['inside', 'outside']],
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_hidden_params' => true,
'allow_mixed' => true,
'allow_unused_params' => true,
'remove_inheritdoc' => false,
],
'no_trailing_comma_in_singleline' => [
'elements' => [
'arguments',
'array_destructuring',
'array',
'group_import',
],
],
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_trailing_whitespace_in_string' => true,
'no_unneeded_braces' => ['namespaces' => true],
'no_unneeded_control_parentheses' => [
'statements' => [
'break',
'clone',
'continue',
'echo_print',
'return',
'switch_case',
'yield',
],
],
'no_unneeded_final_method' => ['private_methods' => true],
'no_unneeded_import_alias' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_cast' => true,
'no_unset_on_property' => false,
'no_unused_imports' => true,
'no_useless_concat_operator' => ['juggle_simple_strings' => true],
'no_useless_else' => true,
'no_useless_nullsafe_operator' => true,
'no_useless_return' => true,
'no_useless_sprintf' => true,
'no_whitespace_before_comma_in_array' => ['after_heredoc' => true],
'no_whitespace_in_blank_line' => true,
'non_printable_character' => ['use_escape_sequences_in_strings' => true],
'normalize_index_brace' => true,
'not_operator_with_space' => false,
'not_operator_with_successor_space' => true,
'nullable_type_declaration' => ['syntax' => 'question_mark'],
'nullable_type_declaration_for_default_null_value' => true,
'numeric_literal_separator' => false,
'object_operator_without_whitespace' => true,
'octal_notation' => false, // requires 8.1+
'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'],
'ordered_attributes' => ['order' => [], 'sort_algorithm' => 'alpha'],
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant',
'property',
'method',
],
'sort_algorithm' => 'none',
'case_sensitive' => false,
],
'ordered_imports' => [
'sort_algorithm' => 'alpha',
'imports_order' => ['class', 'function', 'const'],
'case_sensitive' => false,
],
'ordered_interfaces' => false,
'ordered_traits' => false,
'ordered_types' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'alpha',
'case_sensitive' => false,
],
'php_unit_assert_new_names' => true,
'php_unit_attributes' => [
'keep_annotations' => false,
],
'php_unit_construct' => [
'assertions' => [
'assertSame',
'assertEquals',
'assertNotEquals',
'assertNotSame',
],
],
'php_unit_data_provider_name' => [
'prefix' => 'provide',
'suffix' => '',
],
'php_unit_data_provider_return_type' => true,
'php_unit_data_provider_static' => ['force' => true],
'php_unit_dedicate_assert' => ['target' => 'newest'],
'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'],
'php_unit_expectation' => ['target' => 'newest'],
'php_unit_fqcn_annotation' => true,
'php_unit_internal_class' => ['types' => ['normal', 'final']],
'php_unit_method_casing' => ['case' => 'camel_case'],
'php_unit_mock' => ['target' => 'newest'],
'php_unit_mock_short_will_return' => true,
'php_unit_namespaced' => ['target' => 'newest'],
'php_unit_no_expectation_annotation' => [
'target' => 'newest',
'use_class_const' => true,
],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_size_class' => false,
'php_unit_strict' => [
'assertions' => [
'assertAttributeEquals',
'assertAttributeNotEquals',
'assertEquals',
'assertNotEquals',
],
],
'php_unit_test_annotation' => ['style' => 'prefix'],
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
'methods' => [],
],
'php_unit_test_class_requires_covers' => false,
'phpdoc_add_missing_param_annotation' => ['only_untyped' => true],
'phpdoc_align' => [
'align' => 'vertical',
'spacing' => 1,
'tags' => [
'method',
'param',
'phpstan-assert',
'phpstan-assert-if-true',
'phpstan-assert-if-false',
'phpstan-param',
'phpstan-property',
'phpstan-return',
'phpstan-type',
'phpstan-var',
'property',
'property-read',
'property-write',
'return',
'throws',
'type',
'var',
],
],
'phpdoc_annotation_without_dot' => false,
'phpdoc_array_type' => true,
'phpdoc_indent' => true,
'phpdoc_inline_tag_normalizer' => [
'tags' => [
'example',
'id',
'internal',
'inheritdoc',
'inheritdocs',
'link',
'source',
'toc',
'tutorial',
],
],
'phpdoc_line_span' => [
'const' => 'multi',
'method' => 'multi',
'property' => 'multi',
],
'phpdoc_list_type' => true,
'phpdoc_no_access' => true,
'phpdoc_no_alias_tag' => [
'replacements' => [
'type' => 'var',
'link' => 'see',
],
],
'phpdoc_no_empty_return' => false,
'phpdoc_no_package' => true,
'phpdoc_no_useless_inheritdoc' => true,
'phpdoc_order' => [
'order' => ['param', 'return', 'throws'],
],
'phpdoc_order_by_value' => [
'annotations' => [
'author',
'covers',
'coversNothing',
'dataProvider',
'depends',
'group',
'internal',
'method',
'property',
'property-read',
'property-write',
'requires',
'throws',
'uses',
],
],
'phpdoc_param_order' => false,
'phpdoc_readonly_class_comment_to_keyword' => false,
'phpdoc_return_self_reference' => [
'replacements' => [
'this' => '$this',
'@this' => '$this',
'$self' => 'self',
'@self' => 'self',
'$static' => 'static',
'@static' => 'static',
],
],
'phpdoc_scalar' => [
'types' => [
'boolean',
'callback',
'double',
'integer',
'real',
'str',
],
],
'phpdoc_separation' => [
'groups' => [
['immutable', 'psalm-immutable'],
['param', 'phpstan-param', 'psalm-param'],
['phpstan-pure', 'psalm-pure'],
['readonly', 'psalm-readonly'],
['return', 'phpstan-return', 'psalm-return'],
['runTestsInSeparateProcess', 'runInSeparateProcess', 'preserveGlobalState'],
['template', 'phpstan-template', 'psalm-template'],
['template-covariant', 'phpstan-template-covariant', 'psalm-template-covariant'],
['phpstan-type', 'psalm-type'],
['var', 'phpstan-var', 'psalm-var'],
],
'skip_unlisted_annotations' => true,
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_summary' => false,
'phpdoc_tag_casing' => ['tags' => ['inheritDoc']],
'phpdoc_tag_type' => ['tags' => ['inheritDoc' => 'inline']],
'phpdoc_to_comment' => false,
'phpdoc_to_param_type' => false,
'phpdoc_to_property_type' => false,
'phpdoc_to_return_type' => false,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => ['groups' => ['simple', 'alias', 'meta']],
'phpdoc_types_order' => [
'null_adjustment' => 'always_last',
'sort_algorithm' => 'alpha',
'case_sensitive' => false,
],
'phpdoc_var_annotation_correct_order' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'psr_autoloading' => ['dir' => null],
'random_api_migration' => [
'replacements' => [
'getrandmax' => 'mt_getrandmax',
'rand' => 'mt_rand',
'srand' => 'mt_srand',
],
],
'regular_callable_call' => true,
'return_assignment' => true,
'return_to_yield_from' => false,
'return_type_declaration' => ['space_before' => 'none'],
'self_accessor' => false,
'self_static_accessor' => true,
'semicolon_after_instruction' => false,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'simple_to_complex_string_variable' => true,
'simplified_if_return' => true,
'simplified_null_return' => false,
'single_blank_line_at_eof' => true,
'single_class_element_per_statement' => ['elements' => ['const', 'property']],
'single_import_per_statement' => ['group_to_single_imports' => true],
'single_line_after_imports' => true,
'single_line_comment_spacing' => true,
'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']],
'single_line_empty_body' => false,
'single_line_throw' => false,
'single_quote' => ['strings_containing_single_quote_chars' => false],
'single_space_around_construct' => [
'constructs_contain_a_single_space' => ['yield_from'],
'constructs_preceded_by_a_single_space' => ['use_lambda'],
'constructs_followed_by_a_single_space' => [
'abstract',
'as',
'attribute',
'break',
'case',
'catch',
'class',
'clone',
'comment',
'const',
'const_import',
'continue',
'do',
'echo',
'else',
'elseif',
'enum',
'extends',
'final',
'finally',
'for',
'foreach',
'function',
'function_import',
'global',
'goto',
'if',
'implements',
'include',
'include_once',
'instanceof',
'insteadof',
'interface',
'match',
'named_argument',
'namespace',
'new',
'open_tag_with_echo',
'php_doc',
'php_open',
'print',
'private',
'protected',
'public',
'readonly',
'require',
'require_once',
'return',
'static',
'switch',
'throw',
'trait',
'try',
'type_colon',
'use',
'use_lambda',
'use_trait',
'var',
'while',
'yield',
'yield_from',
],
],
'single_trait_insert_per_statement' => true,
'space_after_semicolon' => ['remove_in_empty_for_expressions' => true],
'spaces_inside_parentheses' => ['space' => 'none'],
'standardize_increment' => true,
'standardize_not_equals' => true,
'statement_indentation' => ['stick_comment_to_next_continuous_control_statement' => false],
'static_lambda' => true,
'strict_comparison' => true,
'strict_param' => true,
'string_implicit_backslashes' => [
'double_quoted' => 'escape',
'heredoc' => 'escape',
'single_quoted' => 'ignore',
],
'string_length_to_empty' => true,
'string_line_ending' => true,
'switch_case_semicolon_to_colon' => true,
'switch_case_space' => true,
'switch_continue_to_break' => true,
'ternary_operator_spaces' => true,
'ternary_to_elvis_operator' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline' => [
'after_heredoc' => true,
'elements' => ['arrays'],
],
'trim_array_spaces' => true,
'type_declaration_spaces' => ['elements' => ['function', 'property']],
'types_spaces' => [
'space' => 'none',
'space_multiple_catch' => 'none',
],
'unary_operator_spaces' => ['only_dec_inc' => false],
'use_arrow_functions' => true,
'visibility_required' => ['elements' => ['const', 'method', 'property']],
'void_return' => false, // changes method signature
'whitespace_after_comma_in_array' => ['ensure_single_space' => true],
'yield_from_array_to_yields' => false,
'yoda_style' => [
'equal' => false,
'identical' => null,
'less_and_greater' => false,
'always_move_variable' => false,
],
];
$this->requiredPHPVersion = 80100;
$this->autoActivateIsRiskyAllowed = true;
}
}

View File

@ -1,579 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

View File

@ -1,359 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
}

View File

@ -1,21 +0,0 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -1,22 +0,0 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
'23c18046f52bef3eea034657bafda50f' => $vendorDir . '/symfony/polyfill-php81/bootstrap.php',
'6124b4c8570aa390c21fafd04a26c69f' => $vendorDir . '/myclabs/deep-copy/src/DeepCopy/deep_copy.php',
'3917c79c5052b270641b5a200963dbc2' => $vendorDir . '/kint-php/kint/init.php',
'db356362850385d08a5381de2638b5fd' => $vendorDir . '/mpdf/mpdf/src/functions.php',
'ec07570ca5a812141189b1fa81503674' => $vendorDir . '/phpunit/phpunit/src/Framework/Assert/Functions.php',
);

View File

@ -1,10 +0,0 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'org\\bovigo\\vfs\\' => array($vendorDir . '/mikey179/vfsstream/src/main/php'),
);

View File

@ -1,62 +0,0 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'setasign\\Fpdi\\' => array($vendorDir . '/setasign/fpdi/src'),
'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
'Symfony\\Polyfill\\Php81\\' => array($vendorDir . '/symfony/polyfill-php81'),
'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Symfony\\Contracts\\Service\\' => array($vendorDir . '/symfony/service-contracts'),
'Symfony\\Contracts\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher-contracts'),
'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
'Symfony\\Component\\Stopwatch\\' => array($vendorDir . '/symfony/stopwatch'),
'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
'React\\Stream\\' => array($vendorDir . '/react/stream/src'),
'React\\Socket\\' => array($vendorDir . '/react/socket/src'),
'React\\Promise\\' => array($vendorDir . '/react/promise/src'),
'React\\EventLoop\\' => array($vendorDir . '/react/event-loop/src'),
'React\\Dns\\' => array($vendorDir . '/react/dns/src'),
'React\\ChildProcess\\' => array($vendorDir . '/react/child-process/src'),
'React\\Cache\\' => array($vendorDir . '/react/cache/src'),
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src', $vendorDir . '/psr/http-factory/src'),
'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Predis\\' => array($vendorDir . '/predis/predis/src'),
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'),
'PhpCsFixer\\' => array($vendorDir . '/friendsofphp/php-cs-fixer/src'),
'Nexus\\CsConfig\\' => array($vendorDir . '/nexusphp/cs-config/src'),
'Mpdf\\PsrLogAwareTrait\\' => array($vendorDir . '/mpdf/psr-log-aware-trait/src'),
'Mpdf\\PsrHttpMessageShim\\' => array($vendorDir . '/mpdf/psr-http-message-shim/src'),
'Mpdf\\' => array($vendorDir . '/mpdf/mpdf/src'),
'Matrix\\' => array($vendorDir . '/markbaker/matrix/classes/src'),
'Laminas\\Escaper\\' => array($vendorDir . '/laminas/laminas-escaper/src'),
'Kint\\' => array($vendorDir . '/kint-php/kint/src'),
'Fidry\\CpuCoreCounter\\' => array($vendorDir . '/fidry/cpu-core-counter/src'),
'Faker\\' => array($vendorDir . '/fakerphp/faker/src/Faker'),
'Evenement\\' => array($vendorDir . '/evenement/evenement/src'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
'Composer\\Pcre\\' => array($vendorDir . '/composer/pcre/src'),
'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'),
'CodeIgniter\\CodingStandard\\' => array($vendorDir . '/codeigniter/coding-standard/src'),
'CodeIgniter\\' => array($baseDir . '/system'),
'Clue\\React\\NDJson\\' => array($vendorDir . '/clue/ndjson-react/src'),
);

View File

@ -1,50 +0,0 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitb6668d4a545a8f860d35d17ef0fdd011
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInitb6668d4a545a8f860d35d17ef0fdd011', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInitb6668d4a545a8f860d35d17ef0fdd011', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInitb6668d4a545a8f860d35d17ef0fdd011::getInitializer($loader));
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInitb6668d4a545a8f860d35d17ef0fdd011::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,761 +0,0 @@
<?php return array(
'root' => array(
'name' => 'codeigniter4/framework',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'dea6b204d35302eab4f6049ea7307d19804ef2ba',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'clue/ndjson-react' => array(
'pretty_version' => 'v1.3.0',
'version' => '1.3.0.0',
'reference' => '392dc165fce93b5bb5c637b67e59619223c931b0',
'type' => 'library',
'install_path' => __DIR__ . '/../clue/ndjson-react',
'aliases' => array(),
'dev_requirement' => true,
),
'codeigniter/coding-standard' => array(
'pretty_version' => 'v1.8.1',
'version' => '1.8.1.0',
'reference' => '2c16682b4a3754bc6694fef1056f686f32298ee3',
'type' => 'library',
'install_path' => __DIR__ . '/../codeigniter/coding-standard',
'aliases' => array(),
'dev_requirement' => true,
),
'codeigniter4/framework' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => 'dea6b204d35302eab4f6049ea7307d19804ef2ba',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'composer/pcre' => array(
'pretty_version' => '3.3.0',
'version' => '3.3.0.0',
'reference' => '1637e067347a0c40bbb1e3cd786b20dcab556a81',
'type' => 'library',
'install_path' => __DIR__ . '/./pcre',
'aliases' => array(),
'dev_requirement' => true,
),
'composer/semver' => array(
'pretty_version' => '3.4.2',
'version' => '3.4.2.0',
'reference' => 'c51258e759afdb17f1fd1fe83bc12baaef6309d6',
'type' => 'library',
'install_path' => __DIR__ . '/./semver',
'aliases' => array(),
'dev_requirement' => true,
),
'composer/xdebug-handler' => array(
'pretty_version' => '3.0.5',
'version' => '3.0.5.0',
'reference' => '6c1925561632e83d60a44492e0b344cf48ab85ef',
'type' => 'library',
'install_path' => __DIR__ . '/./xdebug-handler',
'aliases' => array(),
'dev_requirement' => true,
),
'evenement/evenement' => array(
'pretty_version' => 'v3.0.2',
'version' => '3.0.2.0',
'reference' => '0a16b0d71ab13284339abb99d9d2bd813640efbc',
'type' => 'library',
'install_path' => __DIR__ . '/../evenement/evenement',
'aliases' => array(),
'dev_requirement' => true,
),
'fakerphp/faker' => array(
'pretty_version' => 'v1.23.1',
'version' => '1.23.1.0',
'reference' => 'bfb4fe148adbf78eff521199619b93a52ae3554b',
'type' => 'library',
'install_path' => __DIR__ . '/../fakerphp/faker',
'aliases' => array(),
'dev_requirement' => true,
),
'fidry/cpu-core-counter' => array(
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'reference' => 'f92996c4d5c1a696a6a970e20f7c4216200fcc42',
'type' => 'library',
'install_path' => __DIR__ . '/../fidry/cpu-core-counter',
'aliases' => array(),
'dev_requirement' => true,
),
'friendsofphp/php-cs-fixer' => array(
'pretty_version' => 'v3.62.0',
'version' => '3.62.0.0',
'reference' => '627692f794d35c43483f34b01d94740df2a73507',
'type' => 'application',
'install_path' => __DIR__ . '/../friendsofphp/php-cs-fixer',
'aliases' => array(),
'dev_requirement' => true,
),
'kint-php/kint' => array(
'pretty_version' => '5.1.1',
'version' => '5.1.1.0',
'reference' => '8c5ec370c3382ceae0b88e91f9bbb00e6bb4f93b',
'type' => 'library',
'install_path' => __DIR__ . '/../kint-php/kint',
'aliases' => array(),
'dev_requirement' => true,
),
'laminas/laminas-escaper' => array(
'pretty_version' => '2.13.0',
'version' => '2.13.0.0',
'reference' => 'af459883f4018d0f8a0c69c7a209daef3bf973ba',
'type' => 'library',
'install_path' => __DIR__ . '/../laminas/laminas-escaper',
'aliases' => array(),
'dev_requirement' => false,
),
'maennchen/zipstream-php' => array(
'pretty_version' => '3.1.0',
'version' => '3.1.0.0',
'reference' => 'b8174494eda667f7d13876b4a7bfef0f62a7c0d1',
'type' => 'library',
'install_path' => __DIR__ . '/../maennchen/zipstream-php',
'aliases' => array(),
'dev_requirement' => false,
),
'markbaker/complex' => array(
'pretty_version' => '3.0.2',
'version' => '3.0.2.0',
'reference' => '95c56caa1cf5c766ad6d65b6344b807c1e8405b9',
'type' => 'library',
'install_path' => __DIR__ . '/../markbaker/complex',
'aliases' => array(),
'dev_requirement' => false,
),
'markbaker/matrix' => array(
'pretty_version' => '3.0.1',
'version' => '3.0.1.0',
'reference' => '728434227fe21be27ff6d86621a1b13107a2562c',
'type' => 'library',
'install_path' => __DIR__ . '/../markbaker/matrix',
'aliases' => array(),
'dev_requirement' => false,
),
'mikey179/vfsstream' => array(
'pretty_version' => 'v1.6.11',
'version' => '1.6.11.0',
'reference' => '17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f',
'type' => 'library',
'install_path' => __DIR__ . '/../mikey179/vfsstream',
'aliases' => array(),
'dev_requirement' => true,
),
'mpdf/mpdf' => array(
'pretty_version' => 'v8.2.4',
'version' => '8.2.4.0',
'reference' => '9e3ff91606fed11cd58a130eabaaf60e56fdda88',
'type' => 'library',
'install_path' => __DIR__ . '/../mpdf/mpdf',
'aliases' => array(),
'dev_requirement' => false,
),
'mpdf/psr-http-message-shim' => array(
'pretty_version' => 'v2.0.1',
'version' => '2.0.1.0',
'reference' => 'f25a0153d645e234f9db42e5433b16d9b113920f',
'type' => 'library',
'install_path' => __DIR__ . '/../mpdf/psr-http-message-shim',
'aliases' => array(),
'dev_requirement' => false,
),
'mpdf/psr-log-aware-trait' => array(
'pretty_version' => 'v3.0.0',
'version' => '3.0.0.0',
'reference' => 'a633da6065e946cc491e1c962850344bb0bf3e78',
'type' => 'library',
'install_path' => __DIR__ . '/../mpdf/psr-log-aware-trait',
'aliases' => array(),
'dev_requirement' => false,
),
'myclabs/deep-copy' => array(
'pretty_version' => '1.12.0',
'version' => '1.12.0.0',
'reference' => '3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c',
'type' => 'library',
'install_path' => __DIR__ . '/../myclabs/deep-copy',
'aliases' => array(),
'dev_requirement' => false,
),
'nexusphp/cs-config' => array(
'pretty_version' => 'v3.24.0',
'version' => '3.24.0.0',
'reference' => 'fd0fdb458cbf42ba636a2ed218530b335421f33f',
'type' => 'library',
'install_path' => __DIR__ . '/../nexusphp/cs-config',
'aliases' => array(),
'dev_requirement' => true,
),
'nikic/php-parser' => array(
'pretty_version' => 'v5.1.0',
'version' => '5.1.0.0',
'reference' => '683130c2ff8c2739f4822ff7ac5c873ec529abd1',
'type' => 'library',
'install_path' => __DIR__ . '/../nikic/php-parser',
'aliases' => array(),
'dev_requirement' => true,
),
'paragonie/random_compat' => array(
'pretty_version' => 'v9.99.100',
'version' => '9.99.100.0',
'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a',
'type' => 'library',
'install_path' => __DIR__ . '/../paragonie/random_compat',
'aliases' => array(),
'dev_requirement' => false,
),
'phar-io/manifest' => array(
'pretty_version' => '2.0.4',
'version' => '2.0.4.0',
'reference' => '54750ef60c58e43759730615a392c31c80e23176',
'type' => 'library',
'install_path' => __DIR__ . '/../phar-io/manifest',
'aliases' => array(),
'dev_requirement' => true,
),
'phar-io/version' => array(
'pretty_version' => '3.2.1',
'version' => '3.2.1.0',
'reference' => '4f7fd7836c6f332bb2933569e566a0d6c4cbed74',
'type' => 'library',
'install_path' => __DIR__ . '/../phar-io/version',
'aliases' => array(),
'dev_requirement' => true,
),
'phpoffice/phpspreadsheet' => array(
'pretty_version' => '2.2.2',
'version' => '2.2.2.0',
'reference' => 'ffbcee68069b073bff07a71eb321dcd9f2763513',
'type' => 'library',
'install_path' => __DIR__ . '/../phpoffice/phpspreadsheet',
'aliases' => array(),
'dev_requirement' => false,
),
'phpunit/php-code-coverage' => array(
'pretty_version' => '10.1.15',
'version' => '10.1.15.0',
'reference' => '5da8b1728acd1e6ffdf2ff32ffbdfd04307f26ae',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-code-coverage',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/php-file-iterator' => array(
'pretty_version' => '4.1.0',
'version' => '4.1.0.0',
'reference' => 'a95037b6d9e608ba092da1b23931e537cadc3c3c',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-file-iterator',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/php-invoker' => array(
'pretty_version' => '4.0.0',
'version' => '4.0.0.0',
'reference' => 'f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-invoker',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/php-text-template' => array(
'pretty_version' => '3.0.1',
'version' => '3.0.1.0',
'reference' => '0c7b06ff49e3d5072f057eb1fa59258bf287a748',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-text-template',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/php-timer' => array(
'pretty_version' => '6.0.0',
'version' => '6.0.0.0',
'reference' => 'e2a2d67966e740530f4a3343fe2e030ffdc1161d',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/php-timer',
'aliases' => array(),
'dev_requirement' => true,
),
'phpunit/phpunit' => array(
'pretty_version' => '10.5.30',
'version' => '10.5.30.0',
'reference' => 'b15524febac0153876b4ba9aab3326c2ee94c897',
'type' => 'library',
'install_path' => __DIR__ . '/../phpunit/phpunit',
'aliases' => array(),
'dev_requirement' => true,
),
'predis/predis' => array(
'pretty_version' => 'v2.2.2',
'version' => '2.2.2.0',
'reference' => 'b1d3255ed9ad4d7254f9f9bba386c99f4bb983d1',
'type' => 'library',
'install_path' => __DIR__ . '/../predis/predis',
'aliases' => array(),
'dev_requirement' => true,
),
'psr/container' => array(
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => 'c71ecc56dfe541dbd90c5360474fbc405f8d5963',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/container',
'aliases' => array(),
'dev_requirement' => true,
),
'psr/event-dispatcher' => array(
'pretty_version' => '1.0.0',
'version' => '1.0.0.0',
'reference' => 'dbefd12671e8a14ec7f180cab83036ed26714bb0',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/event-dispatcher',
'aliases' => array(),
'dev_requirement' => true,
),
'psr/event-dispatcher-implementation' => array(
'dev_requirement' => true,
'provided' => array(
0 => '1.0',
),
),
'psr/http-client' => array(
'pretty_version' => '1.0.3',
'version' => '1.0.3.0',
'reference' => 'bb5906edc1c324c9a05aa0873d40117941e5fa90',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-client',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/http-factory' => array(
'pretty_version' => '1.1.0',
'version' => '1.1.0.0',
'reference' => '2b4765fddfe3b508ac62f829e852b1501d3f6e8a',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-factory',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/http-message' => array(
'pretty_version' => '2.0',
'version' => '2.0.0.0',
'reference' => '402d35bcb92c70c026d1a6a9883f06b2ead23d71',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/http-message',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/log' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => 'fe5ea303b0887d5caefd3d431c3e61ad47037001',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/log',
'aliases' => array(),
'dev_requirement' => false,
),
'psr/log-implementation' => array(
'dev_requirement' => true,
'provided' => array(
0 => '1.0|2.0|3.0',
),
),
'psr/simple-cache' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => '764e0b3939f5ca87cb904f570ef9be2d78a07865',
'type' => 'library',
'install_path' => __DIR__ . '/../psr/simple-cache',
'aliases' => array(),
'dev_requirement' => false,
),
'react/cache' => array(
'pretty_version' => 'v1.2.0',
'version' => '1.2.0.0',
'reference' => 'd47c472b64aa5608225f47965a484b75c7817d5b',
'type' => 'library',
'install_path' => __DIR__ . '/../react/cache',
'aliases' => array(),
'dev_requirement' => true,
),
'react/child-process' => array(
'pretty_version' => 'v0.6.5',
'version' => '0.6.5.0',
'reference' => 'e71eb1aa55f057c7a4a0d08d06b0b0a484bead43',
'type' => 'library',
'install_path' => __DIR__ . '/../react/child-process',
'aliases' => array(),
'dev_requirement' => true,
),
'react/dns' => array(
'pretty_version' => 'v1.13.0',
'version' => '1.13.0.0',
'reference' => 'eb8ae001b5a455665c89c1df97f6fb682f8fb0f5',
'type' => 'library',
'install_path' => __DIR__ . '/../react/dns',
'aliases' => array(),
'dev_requirement' => true,
),
'react/event-loop' => array(
'pretty_version' => 'v1.5.0',
'version' => '1.5.0.0',
'reference' => 'bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354',
'type' => 'library',
'install_path' => __DIR__ . '/../react/event-loop',
'aliases' => array(),
'dev_requirement' => true,
),
'react/promise' => array(
'pretty_version' => 'v3.2.0',
'version' => '3.2.0.0',
'reference' => '8a164643313c71354582dc850b42b33fa12a4b63',
'type' => 'library',
'install_path' => __DIR__ . '/../react/promise',
'aliases' => array(),
'dev_requirement' => true,
),
'react/socket' => array(
'pretty_version' => 'v1.16.0',
'version' => '1.16.0.0',
'reference' => '23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1',
'type' => 'library',
'install_path' => __DIR__ . '/../react/socket',
'aliases' => array(),
'dev_requirement' => true,
),
'react/stream' => array(
'pretty_version' => 'v1.4.0',
'version' => '1.4.0.0',
'reference' => '1e5b0acb8fe55143b5b426817155190eb6f5b18d',
'type' => 'library',
'install_path' => __DIR__ . '/../react/stream',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/cli-parser' => array(
'pretty_version' => '2.0.1',
'version' => '2.0.1.0',
'reference' => 'c34583b87e7b7a8055bf6c450c2c77ce32a24084',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/cli-parser',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/code-unit' => array(
'pretty_version' => '2.0.0',
'version' => '2.0.0.0',
'reference' => 'a81fee9eef0b7a76af11d121767abc44c104e503',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/code-unit',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/code-unit-reverse-lookup' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => '5e3a687f7d8ae33fb362c5c0743794bbb2420a1d',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/code-unit-reverse-lookup',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/comparator' => array(
'pretty_version' => '5.0.2',
'version' => '5.0.2.0',
'reference' => '2d3e04c3b4c1e84a5e7382221ad8883c8fbc4f53',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/comparator',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/complexity' => array(
'pretty_version' => '3.2.0',
'version' => '3.2.0.0',
'reference' => '68ff824baeae169ec9f2137158ee529584553799',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/complexity',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/diff' => array(
'pretty_version' => '5.1.1',
'version' => '5.1.1.0',
'reference' => 'c41e007b4b62af48218231d6c2275e4c9b975b2e',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/diff',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/environment' => array(
'pretty_version' => '6.1.0',
'version' => '6.1.0.0',
'reference' => '8074dbcd93529b357029f5cc5058fd3e43666984',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/environment',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/exporter' => array(
'pretty_version' => '5.1.2',
'version' => '5.1.2.0',
'reference' => '955288482d97c19a372d3f31006ab3f37da47adf',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/exporter',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/global-state' => array(
'pretty_version' => '6.0.2',
'version' => '6.0.2.0',
'reference' => '987bafff24ecc4c9ac418cab1145b96dd6e9cbd9',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/global-state',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/lines-of-code' => array(
'pretty_version' => '2.0.2',
'version' => '2.0.2.0',
'reference' => '856e7f6a75a84e339195d48c556f23be2ebf75d0',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/lines-of-code',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/object-enumerator' => array(
'pretty_version' => '5.0.0',
'version' => '5.0.0.0',
'reference' => '202d0e344a580d7f7d04b3fafce6933e59dae906',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/object-enumerator',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/object-reflector' => array(
'pretty_version' => '3.0.0',
'version' => '3.0.0.0',
'reference' => '24ed13d98130f0e7122df55d06c5c4942a577957',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/object-reflector',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/recursion-context' => array(
'pretty_version' => '5.0.0',
'version' => '5.0.0.0',
'reference' => '05909fb5bc7df4c52992396d0116aed689f93712',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/recursion-context',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/type' => array(
'pretty_version' => '4.0.0',
'version' => '4.0.0.0',
'reference' => '462699a16464c3944eefc02ebdd77882bd3925bf',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/type',
'aliases' => array(),
'dev_requirement' => true,
),
'sebastian/version' => array(
'pretty_version' => '4.0.1',
'version' => '4.0.1.0',
'reference' => 'c51fa83a5d8f43f1402e3f32a005e6262244ef17',
'type' => 'library',
'install_path' => __DIR__ . '/../sebastian/version',
'aliases' => array(),
'dev_requirement' => true,
),
'setasign/fpdi' => array(
'pretty_version' => 'v2.6.0',
'version' => '2.6.0.0',
'reference' => 'a6db878129ec6c7e141316ee71872923e7f1b7ad',
'type' => 'library',
'install_path' => __DIR__ . '/../setasign/fpdi',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/console' => array(
'pretty_version' => 'v7.1.3',
'version' => '7.1.3.0',
'reference' => 'cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/console',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/deprecation-contracts' => array(
'pretty_version' => 'v3.5.0',
'version' => '3.5.0.0',
'reference' => '0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/event-dispatcher' => array(
'pretty_version' => 'v7.1.1',
'version' => '7.1.1.0',
'reference' => '9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/event-dispatcher-contracts' => array(
'pretty_version' => 'v3.5.0',
'version' => '3.5.0.0',
'reference' => '8f93aec25d41b72493c6ddff14e916177c9efc50',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/event-dispatcher-contracts',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/event-dispatcher-implementation' => array(
'dev_requirement' => true,
'provided' => array(
0 => '2.0|3.0',
),
),
'symfony/filesystem' => array(
'pretty_version' => 'v7.1.2',
'version' => '7.1.2.0',
'reference' => '92a91985250c251de9b947a14bb2c9390b1a562c',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/filesystem',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/finder' => array(
'pretty_version' => 'v7.1.3',
'version' => '7.1.3.0',
'reference' => '717c6329886f32dc65e27461f80f2a465412fdca',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/finder',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/options-resolver' => array(
'pretty_version' => 'v7.1.1',
'version' => '7.1.1.0',
'reference' => '47aa818121ed3950acd2b58d1d37d08a94f9bf55',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/options-resolver',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => '0424dff1c58f028c451efff2045f5d92410bd540',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-intl-grapheme' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => '64647a7c30b2283f5d49b874d84a18fc22054b7a',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-intl-normalizer' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => 'a95281b0be0d9ab48050ebd988b967875cdb9fdb',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => 'fd22ab50000ef01661e2a31d850ebaa297f8e03c',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-php80' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => '77fa7995ac1b21ab60769b7323d600a991a90433',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php80',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/polyfill-php81' => array(
'pretty_version' => 'v1.30.0',
'version' => '1.30.0.0',
'reference' => '3fb075789fb91f9ad9af537c4012d523085bd5af',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-php81',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/process' => array(
'pretty_version' => 'v7.1.3',
'version' => '7.1.3.0',
'reference' => '7f2f542c668ad6c313dc4a5e9c3321f733197eca',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/process',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/service-contracts' => array(
'pretty_version' => 'v3.5.0',
'version' => '3.5.0.0',
'reference' => 'bd1d9e59a81d8fa4acdcea3f617c581f7475a80f',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/service-contracts',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/stopwatch' => array(
'pretty_version' => 'v7.1.1',
'version' => '7.1.1.0',
'reference' => '5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/stopwatch',
'aliases' => array(),
'dev_requirement' => true,
),
'symfony/string' => array(
'pretty_version' => 'v7.1.3',
'version' => '7.1.3.0',
'reference' => 'ea272a882be7f20cad58d5d78c215001617b7f07',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/string',
'aliases' => array(),
'dev_requirement' => true,
),
'theseer/tokenizer' => array(
'pretty_version' => '1.2.3',
'version' => '1.2.3.0',
'reference' => '737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2',
'type' => 'library',
'install_path' => __DIR__ . '/../theseer/tokenizer',
'aliases' => array(),
'dev_requirement' => true,
),
),
);

View File

@ -1,19 +0,0 @@
Copyright (C) 2021 Composer
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,189 +0,0 @@
composer/pcre
=============
PCRE wrapping library that offers type-safe `preg_*` replacements.
This library gives you a way to ensure `preg_*` functions do not fail silently, returning
unexpected `null`s that may not be handled.
As of 3.0 this library enforces [`PREG_UNMATCHED_AS_NULL`](#preg_unmatched_as_null) usage
for all matching and replaceCallback functions, [read more below](#preg_unmatched_as_null)
to understand the implications.
It thus makes it easier to work with static analysis tools like PHPStan or Psalm as it
simplifies and reduces the possible return values from all the `preg_*` functions which
are quite packed with edge cases. As of v2.2.0 / v3.2.0 the library also comes with a
[PHPStan extension](#phpstan-extension) for parsing regular expressions and giving you even better output types.
This library is a thin wrapper around `preg_*` functions with [some limitations](#restrictions--limitations).
If you are looking for a richer API to handle regular expressions have a look at
[rawr/t-regx](https://packagist.org/packages/rawr/t-regx) instead.
[![Continuous Integration](https://github.com/composer/pcre/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/composer/pcre/actions)
Installation
------------
Install the latest version with:
```bash
$ composer require composer/pcre
```
Requirements
------------
* PHP 7.4.0 is required for 3.x versions
* PHP 7.2.0 is required for 2.x versions
* PHP 5.3.2 is required for 1.x versions
Basic usage
-----------
Instead of:
```php
if (preg_match('{fo+}', $string, $matches)) { ... }
if (preg_match('{fo+}', $string, $matches, PREG_OFFSET_CAPTURE)) { ... }
if (preg_match_all('{fo+}', $string, $matches)) { ... }
$newString = preg_replace('{fo+}', 'bar', $string);
$newString = preg_replace_callback('{fo+}', function ($match) { return strtoupper($match[0]); }, $string);
$newString = preg_replace_callback_array(['{fo+}' => fn ($match) => strtoupper($match[0])], $string);
$filtered = preg_grep('{[a-z]}', $elements);
$array = preg_split('{[a-z]+}', $string);
```
You can now call these on the `Preg` class:
```php
use Composer\Pcre\Preg;
if (Preg::match('{fo+}', $string, $matches)) { ... }
if (Preg::matchWithOffsets('{fo+}', $string, $matches)) { ... }
if (Preg::matchAll('{fo+}', $string, $matches)) { ... }
$newString = Preg::replace('{fo+}', 'bar', $string);
$newString = Preg::replaceCallback('{fo+}', function ($match) { return strtoupper($match[0]); }, $string);
$newString = Preg::replaceCallbackArray(['{fo+}' => fn ($match) => strtoupper($match[0])], $string);
$filtered = Preg::grep('{[a-z]}', $elements);
$array = Preg::split('{[a-z]+}', $string);
```
The main difference is if anything fails to match/replace/.., it will throw a `Composer\Pcre\PcreException`
instead of returning `null` (or false in some cases), so you can now use the return values safely relying on
the fact that they can only be strings (for replace), ints (for match) or arrays (for grep/split).
Additionally the `Preg` class provides match methods that return `bool` rather than `int`, for stricter type safety
when the number of pattern matches is not useful:
```php
use Composer\Pcre\Preg;
if (Preg::isMatch('{fo+}', $string, $matches)) // bool
if (Preg::isMatchAll('{fo+}', $string, $matches)) // bool
```
Finally the `Preg` class provides a few `*StrictGroups` method variants that ensure match groups
are always present and thus non-nullable, making it easier to write type-safe code:
```php
use Composer\Pcre\Preg;
// $matches is guaranteed to be an array of strings, if a subpattern does not match and produces a null it will throw
if (Preg::matchStrictGroups('{fo+}', $string, $matches))
if (Preg::matchAllStrictGroups('{fo+}', $string, $matches))
```
**Note:** This is generally safe to use as long as you do not have optional subpatterns (i.e. `(something)?`
or `(something)*` or branches with a `|` that result in some groups not being matched at all).
A subpattern that can match an empty string like `(.*)` is **not** optional, it will be present as an
empty string in the matches. A non-matching subpattern, even if optional like `(?:foo)?` will anyway not be present in
matches so it is also not a problem to use these with `*StrictGroups` methods.
If you would prefer a slightly more verbose usage, replacing by-ref arguments by result objects, you can use the `Regex` class:
```php
use Composer\Pcre\Regex;
// this is useful when you are just interested in knowing if something matched
// as it returns a bool instead of int(1/0) for match
$bool = Regex::isMatch('{fo+}', $string);
$result = Regex::match('{fo+}', $string);
if ($result->matched) { something($result->matches); }
$result = Regex::matchWithOffsets('{fo+}', $string);
if ($result->matched) { something($result->matches); }
$result = Regex::matchAll('{fo+}', $string);
if ($result->matched && $result->count > 3) { something($result->matches); }
$newString = Regex::replace('{fo+}', 'bar', $string)->result;
$newString = Regex::replaceCallback('{fo+}', function ($match) { return strtoupper($match[0]); }, $string)->result;
$newString = Regex::replaceCallbackArray(['{fo+}' => fn ($match) => strtoupper($match[0])], $string)->result;
```
Note that `preg_grep` and `preg_split` are only callable via the `Preg` class as they do not have
complex return types warranting a specific result object.
See the [MatchResult](src/MatchResult.php), [MatchWithOffsetsResult](src/MatchWithOffsetsResult.php), [MatchAllResult](src/MatchAllResult.php),
[MatchAllWithOffsetsResult](src/MatchAllWithOffsetsResult.php), and [ReplaceResult](src/ReplaceResult.php) class sources for more details.
Restrictions / Limitations
--------------------------
Due to type safety requirements a few restrictions are in place.
- matching using `PREG_OFFSET_CAPTURE` is made available via `matchWithOffsets` and `matchAllWithOffsets`.
You cannot pass the flag to `match`/`matchAll`.
- `Preg::split` will also reject `PREG_SPLIT_OFFSET_CAPTURE` and you should use `splitWithOffsets`
instead.
- `matchAll` rejects `PREG_SET_ORDER` as it also changes the shape of the returned matches. There
is no alternative provided as you can fairly easily code around it.
- `preg_filter` is not supported as it has a rather crazy API, most likely you should rather
use `Preg::grep` in combination with some loop and `Preg::replace`.
- `replace`, `replaceCallback` and `replaceCallbackArray` do not support an array `$subject`,
only simple strings.
- As of 2.0, the library always uses `PREG_UNMATCHED_AS_NULL` for matching, which offers [much
saner/more predictable results](#preg_unmatched_as_null). As of 3.0 the flag is also set for
`replaceCallback` and `replaceCallbackArray`.
#### PREG_UNMATCHED_AS_NULL
As of 2.0, this library always uses PREG_UNMATCHED_AS_NULL for all `match*` and `isMatch*`
functions. As of 3.0 it is also done for `replaceCallback` and `replaceCallbackArray`.
This means your matches will always contain all matching groups, either as null if unmatched
or as string if it matched.
The advantages in clarity and predictability are clearer if you compare the two outputs of
running this with and without PREG_UNMATCHED_AS_NULL in $flags:
```php
preg_match('/(a)(b)*(c)(d)*/', 'ac', $matches, $flags);
```
| no flag | PREG_UNMATCHED_AS_NULL |
| --- | --- |
| array (size=4) | array (size=5) |
| 0 => string 'ac' (length=2) | 0 => string 'ac' (length=2) |
| 1 => string 'a' (length=1) | 1 => string 'a' (length=1) |
| 2 => string '' (length=0) | 2 => null |
| 3 => string 'c' (length=1) | 3 => string 'c' (length=1) |
| | 4 => null |
| group 2 (any unmatched group preceding one that matched) is set to `''`. You cannot tell if it matched an empty string or did not match at all | group 2 is `null` when unmatched and a string if it matched, easy to check for |
| group 4 (any optional group without a matching one following) is missing altogether. So you have to check with `isset()`, but really you want `isset($m[4]) && $m[4] !== ''` for safety unless you are very careful to check that a non-optional group follows it | group 4 is always set, and null in this case as there was no match, easy to check for with `$m[4] !== null` |
PHPStan Extension
-----------------
To use the PHPStan extension if you do not use `phpstan/extension-installer` you can include `vendor/composer/pcre/extension.neon` in your PHPStan config.
The extension provides much better type information for $matches as well as regex validation where possible.
License
-------
composer/pcre is licensed under the MIT License, see the LICENSE file for details.

View File

@ -1,54 +0,0 @@
{
"name": "composer/pcre",
"description": "PCRE wrapping library that offers type-safe preg_* replacements.",
"type": "library",
"license": "MIT",
"keywords": [
"pcre",
"regex",
"preg",
"regular expression"
],
"authors": [
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
}
],
"require": {
"php": "^7.4 || ^8.0"
},
"require-dev": {
"phpunit/phpunit": "^8 || ^9",
"phpstan/phpstan": "^1.11.10",
"phpstan/phpstan-strict-rules": "^1.1"
},
"conflict": {
"phpstan/phpstan": "<1.11.10"
},
"autoload": {
"psr-4": {
"Composer\\Pcre\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Composer\\Pcre\\": "tests"
}
},
"extra": {
"branch-alias": {
"dev-main": "3.x-dev"
},
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"scripts": {
"test": "@php vendor/bin/phpunit",
"phpstan": "@php phpstan analyse"
}
}

View File

@ -1,46 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class MatchAllResult
{
/**
* An array of match group => list of matched strings
*
* @readonly
* @var array<int|string, list<string|null>>
*/
public $matches;
/**
* @readonly
* @var 0|positive-int
*/
public $count;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
* @param array<int|string, list<string|null>> $matches
*/
public function __construct(int $count, array $matches)
{
$this->matches = $matches;
$this->matched = (bool) $count;
$this->count = $count;
}
}

View File

@ -1,46 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class MatchAllStrictGroupsResult
{
/**
* An array of match group => list of matched strings
*
* @readonly
* @var array<int|string, list<string>>
*/
public $matches;
/**
* @readonly
* @var 0|positive-int
*/
public $count;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
* @param array<list<string>> $matches
*/
public function __construct(int $count, array $matches)
{
$this->matches = $matches;
$this->matched = (bool) $count;
$this->count = $count;
}
}

View File

@ -1,48 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class MatchAllWithOffsetsResult
{
/**
* An array of match group => list of matches, every match being a pair of string matched + offset in bytes (or -1 if no match)
*
* @readonly
* @var array<int|string, list<array{string|null, int}>>
* @phpstan-var array<int|string, list<array{string|null, int<-1, max>}>>
*/
public $matches;
/**
* @readonly
* @var 0|positive-int
*/
public $count;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
* @param array<int|string, list<array{string|null, int}>> $matches
* @phpstan-param array<int|string, list<array{string|null, int<-1, max>}>> $matches
*/
public function __construct(int $count, array $matches)
{
$this->matches = $matches;
$this->matched = (bool) $count;
$this->count = $count;
}
}

View File

@ -1,39 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class MatchResult
{
/**
* An array of match group => string matched
*
* @readonly
* @var array<int|string, string|null>
*/
public $matches;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
* @param array<string|null> $matches
*/
public function __construct(int $count, array $matches)
{
$this->matches = $matches;
$this->matched = (bool) $count;
}
}

View File

@ -1,39 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class MatchStrictGroupsResult
{
/**
* An array of match group => string matched
*
* @readonly
* @var array<int|string, string>
*/
public $matches;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
* @param array<string> $matches
*/
public function __construct(int $count, array $matches)
{
$this->matches = $matches;
$this->matched = (bool) $count;
}
}

View File

@ -1,41 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class MatchWithOffsetsResult
{
/**
* An array of match group => pair of string matched + offset in bytes (or -1 if no match)
*
* @readonly
* @var array<int|string, array{string|null, int}>
* @phpstan-var array<int|string, array{string|null, int<-1, max>}>
*/
public $matches;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
* @param array<array{string|null, int}> $matches
* @phpstan-param array<int|string, array{string|null, int<-1, max>}> $matches
*/
public function __construct(int $count, array $matches)
{
$this->matches = $matches;
$this->matched = (bool) $count;
}
}

View File

@ -1,60 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
class PcreException extends \RuntimeException
{
/**
* @param string $function
* @param string|string[] $pattern
* @return self
*/
public static function fromFunction($function, $pattern)
{
$code = preg_last_error();
if (is_array($pattern)) {
$pattern = implode(', ', $pattern);
}
return new PcreException($function.'(): failed executing "'.$pattern.'": '.self::pcreLastErrorMessage($code), $code);
}
/**
* @param int $code
* @return string
*/
private static function pcreLastErrorMessage($code)
{
if (function_exists('preg_last_error_msg')) {
return preg_last_error_msg();
}
// older php versions did not set the code properly in all cases
if (PHP_VERSION_ID < 70201 && $code === 0) {
return 'UNDEFINED_ERROR';
}
$constants = get_defined_constants(true);
if (!isset($constants['pcre'])) {
return 'UNDEFINED_ERROR';
}
foreach ($constants['pcre'] as $const => $val) {
if ($val === $code && substr($const, -6) === '_ERROR') {
return $const;
}
}
return 'UNDEFINED_ERROR';
}
}

View File

@ -1,430 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
class Preg
{
/** @internal */
public const ARRAY_MSG = '$subject as an array is not supported. You can use \'foreach\' instead.';
/** @internal */
public const INVALID_TYPE_MSG = '$subject must be a string, %s given.';
/**
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @return 0|1
*
* @param-out array<int|string, string|null> $matches
*/
public static function match(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
{
self::checkOffsetCapture($flags, 'matchWithOffsets');
$result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
if ($result === false) {
throw PcreException::fromFunction('preg_match', $pattern);
}
return $result;
}
/**
* Variant of `match()` which outputs non-null matches (or throws)
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @return 0|1
* @throws UnexpectedNullMatchException
*
* @param-out array<int|string, string> $matches
*/
public static function matchStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
{
$result = self::match($pattern, $subject, $matchesInternal, $flags, $offset);
$matches = self::enforceNonNullMatches($pattern, $matchesInternal, 'match');
return $result;
}
/**
* Runs preg_match with PREG_OFFSET_CAPTURE
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_OFFSET_CAPTURE are always set, no other flags are supported
* @return 0|1
*
* @param-out array<int|string, array{string|null, int<-1, max>}> $matches
*/
public static function matchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
{
$result = preg_match($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
if ($result === false) {
throw PcreException::fromFunction('preg_match', $pattern);
}
return $result;
}
/**
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @return 0|positive-int
*
* @param-out array<int|string, list<string|null>> $matches
*/
public static function matchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
{
self::checkOffsetCapture($flags, 'matchAllWithOffsets');
self::checkSetOrder($flags);
$result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL, $offset);
if (!is_int($result)) { // PHP < 8 may return null, 8+ returns int|false
throw PcreException::fromFunction('preg_match_all', $pattern);
}
return $result;
}
/**
* Variant of `match()` which outputs non-null matches (or throws)
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @return 0|positive-int
* @throws UnexpectedNullMatchException
*
* @param-out array<int|string, list<string>> $matches
*/
public static function matchAllStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): int
{
$result = self::matchAll($pattern, $subject, $matchesInternal, $flags, $offset);
$matches = self::enforceNonNullMatchAll($pattern, $matchesInternal, 'matchAll');
return $result;
}
/**
* Runs preg_match_all with PREG_OFFSET_CAPTURE
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported
* @return 0|positive-int
*
* @param-out array<int|string, list<array{string|null, int<-1, max>}>> $matches
*/
public static function matchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): int
{
self::checkSetOrder($flags);
$result = preg_match_all($pattern, $subject, $matches, $flags | PREG_UNMATCHED_AS_NULL | PREG_OFFSET_CAPTURE, $offset);
if (!is_int($result)) { // PHP < 8 may return null, 8+ returns int|false
throw PcreException::fromFunction('preg_match_all', $pattern);
}
return $result;
}
/**
* @param string|string[] $pattern
* @param string|string[] $replacement
* @param string $subject
* @param int $count Set by method
*
* @param-out int<0, max> $count
*/
public static function replace($pattern, $replacement, $subject, int $limit = -1, ?int &$count = null): string
{
if (!is_scalar($subject)) {
if (is_array($subject)) {
throw new \InvalidArgumentException(static::ARRAY_MSG);
}
throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
}
$result = preg_replace($pattern, $replacement, $subject, $limit, $count);
if ($result === null) {
throw PcreException::fromFunction('preg_replace', $pattern);
}
return $result;
}
/**
* @param string|string[] $pattern
* @param ($flags is PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string|null, int<-1, max>}>): string) : callable(array<int|string, string|null>): string) $replacement
* @param string $subject
* @param int $count Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
*
* @param-out int<0, max> $count
*/
public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, ?int &$count = null, int $flags = 0): string
{
if (!is_scalar($subject)) {
if (is_array($subject)) {
throw new \InvalidArgumentException(static::ARRAY_MSG);
}
throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
}
$result = preg_replace_callback($pattern, $replacement, $subject, $limit, $count, $flags | PREG_UNMATCHED_AS_NULL);
if ($result === null) {
throw PcreException::fromFunction('preg_replace_callback', $pattern);
}
return $result;
}
/**
* Variant of `replaceCallback()` which outputs non-null matches (or throws)
*
* @param string $pattern
* @param ($flags is PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string, int<0, max>}>): string) : callable(array<int|string, string>): string) $replacement
* @param string $subject
* @param int $count Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
*
* @param-out int<0, max> $count
*/
public static function replaceCallbackStrictGroups(string $pattern, callable $replacement, $subject, int $limit = -1, ?int &$count = null, int $flags = 0): string
{
return self::replaceCallback($pattern, function (array $matches) use ($pattern, $replacement) {
return $replacement(self::enforceNonNullMatches($pattern, $matches, 'replaceCallback'));
}, $subject, $limit, $count, $flags);
}
/**
* @param ($flags is PREG_OFFSET_CAPTURE ? (array<string, callable(array<int|string, array{string|null, int<-1, max>}>): string>) : array<string, callable(array<int|string, string|null>): string>) $pattern
* @param string $subject
* @param int $count Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
*
* @param-out int<0, max> $count
*/
public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, ?int &$count = null, int $flags = 0): string
{
if (!is_scalar($subject)) {
if (is_array($subject)) {
throw new \InvalidArgumentException(static::ARRAY_MSG);
}
throw new \TypeError(sprintf(static::INVALID_TYPE_MSG, gettype($subject)));
}
$result = preg_replace_callback_array($pattern, $subject, $limit, $count, $flags | PREG_UNMATCHED_AS_NULL);
if ($result === null) {
$pattern = array_keys($pattern);
throw PcreException::fromFunction('preg_replace_callback_array', $pattern);
}
return $result;
}
/**
* @param int-mask<PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_OFFSET_CAPTURE> $flags PREG_SPLIT_NO_EMPTY or PREG_SPLIT_DELIM_CAPTURE
* @return list<string>
*/
public static function split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
{
if (($flags & PREG_SPLIT_OFFSET_CAPTURE) !== 0) {
throw new \InvalidArgumentException('PREG_SPLIT_OFFSET_CAPTURE is not supported as it changes the type of $matches, use splitWithOffsets() instead');
}
$result = preg_split($pattern, $subject, $limit, $flags);
if ($result === false) {
throw PcreException::fromFunction('preg_split', $pattern);
}
return $result;
}
/**
* @param int-mask<PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_OFFSET_CAPTURE> $flags PREG_SPLIT_NO_EMPTY or PREG_SPLIT_DELIM_CAPTURE, PREG_SPLIT_OFFSET_CAPTURE is always set
* @return list<array{string, int}>
* @phpstan-return list<array{string, int<0, max>}>
*/
public static function splitWithOffsets(string $pattern, string $subject, int $limit = -1, int $flags = 0): array
{
$result = preg_split($pattern, $subject, $limit, $flags | PREG_SPLIT_OFFSET_CAPTURE);
if ($result === false) {
throw PcreException::fromFunction('preg_split', $pattern);
}
return $result;
}
/**
* @template T of string|\Stringable
* @param string $pattern
* @param array<T> $array
* @param int-mask<PREG_GREP_INVERT> $flags PREG_GREP_INVERT
* @return array<T>
*/
public static function grep(string $pattern, array $array, int $flags = 0): array
{
$result = preg_grep($pattern, $array, $flags);
if ($result === false) {
throw PcreException::fromFunction('preg_grep', $pattern);
}
return $result;
}
/**
* Variant of match() which returns a bool instead of int
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*
* @param-out array<int|string, string|null> $matches
*/
public static function isMatch(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
{
return (bool) static::match($pattern, $subject, $matches, $flags, $offset);
}
/**
* Variant of `isMatch()` which outputs non-null matches (or throws)
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @throws UnexpectedNullMatchException
*
* @param-out array<int|string, string> $matches
*/
public static function isMatchStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
{
return (bool) self::matchStrictGroups($pattern, $subject, $matches, $flags, $offset);
}
/**
* Variant of matchAll() which returns a bool instead of int
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*
* @param-out array<int|string, list<string|null>> $matches
*/
public static function isMatchAll(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
{
return (bool) static::matchAll($pattern, $subject, $matches, $flags, $offset);
}
/**
* Variant of `isMatchAll()` which outputs non-null matches (or throws)
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*
* @param-out array<int|string, list<string>> $matches
*/
public static function isMatchAllStrictGroups(string $pattern, string $subject, ?array &$matches = null, int $flags = 0, int $offset = 0): bool
{
return (bool) self::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset);
}
/**
* Variant of matchWithOffsets() which returns a bool instead of int
*
* Runs preg_match with PREG_OFFSET_CAPTURE
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*
* @param-out array<int|string, array{string|null, int<-1, max>}> $matches
*/
public static function isMatchWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
{
return (bool) static::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
}
/**
* Variant of matchAllWithOffsets() which returns a bool instead of int
*
* Runs preg_match_all with PREG_OFFSET_CAPTURE
*
* @param non-empty-string $pattern
* @param array<mixed> $matches Set by method
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*
* @param-out array<int|string, list<array{string|null, int<-1, max>}>> $matches
*/
public static function isMatchAllWithOffsets(string $pattern, string $subject, ?array &$matches, int $flags = 0, int $offset = 0): bool
{
return (bool) static::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
}
private static function checkOffsetCapture(int $flags, string $useFunctionName): void
{
if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the type of $matches, use ' . $useFunctionName . '() instead');
}
}
private static function checkSetOrder(int $flags): void
{
if (($flags & PREG_SET_ORDER) !== 0) {
throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the type of $matches');
}
}
/**
* @param array<int|string, string|null|array{string|null, int}> $matches
* @return array<int|string, string>
* @throws UnexpectedNullMatchException
*/
private static function enforceNonNullMatches(string $pattern, array $matches, string $variantMethod)
{
foreach ($matches as $group => $match) {
if (is_string($match) || (is_array($match) && is_string($match[0]))) {
continue;
}
throw new UnexpectedNullMatchException('Pattern "'.$pattern.'" had an unexpected unmatched group "'.$group.'", make sure the pattern always matches or use '.$variantMethod.'() instead.');
}
/** @var array<string> */
return $matches;
}
/**
* @param array<int|string, list<string|null>> $matches
* @return array<int|string, list<string>>
* @throws UnexpectedNullMatchException
*/
private static function enforceNonNullMatchAll(string $pattern, array $matches, string $variantMethod)
{
foreach ($matches as $group => $groupMatches) {
foreach ($groupMatches as $match) {
if (null === $match) {
throw new UnexpectedNullMatchException('Pattern "'.$pattern.'" had an unexpected unmatched group "'.$group.'", make sure the pattern always matches or use '.$variantMethod.'() instead.');
}
}
}
/** @var array<int|string, list<string>> */
return $matches;
}
}

View File

@ -1,176 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
class Regex
{
/**
* @param non-empty-string $pattern
*/
public static function isMatch(string $pattern, string $subject, int $offset = 0): bool
{
return (bool) Preg::match($pattern, $subject, $matches, 0, $offset);
}
/**
* @param non-empty-string $pattern
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*/
public static function match(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchResult
{
self::checkOffsetCapture($flags, 'matchWithOffsets');
$count = Preg::match($pattern, $subject, $matches, $flags, $offset);
return new MatchResult($count, $matches);
}
/**
* Variant of `match()` which returns non-null matches (or throws)
*
* @param non-empty-string $pattern
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @throws UnexpectedNullMatchException
*/
public static function matchStrictGroups(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchStrictGroupsResult
{
// @phpstan-ignore composerPcre.maybeUnsafeStrictGroups
$count = Preg::matchStrictGroups($pattern, $subject, $matches, $flags, $offset);
return new MatchStrictGroupsResult($count, $matches);
}
/**
* Runs preg_match with PREG_OFFSET_CAPTURE
*
* @param non-empty-string $pattern
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported
*/
public static function matchWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchWithOffsetsResult
{
$count = Preg::matchWithOffsets($pattern, $subject, $matches, $flags, $offset);
return new MatchWithOffsetsResult($count, $matches);
}
/**
* @param non-empty-string $pattern
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
*/
public static function matchAll(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllResult
{
self::checkOffsetCapture($flags, 'matchAllWithOffsets');
self::checkSetOrder($flags);
$count = Preg::matchAll($pattern, $subject, $matches, $flags, $offset);
return new MatchAllResult($count, $matches);
}
/**
* Variant of `matchAll()` which returns non-null matches (or throws)
*
* @param non-empty-string $pattern
* @param int-mask<PREG_UNMATCHED_AS_NULL> $flags PREG_UNMATCHED_AS_NULL is always set, no other flags are supported
* @throws UnexpectedNullMatchException
*/
public static function matchAllStrictGroups(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllStrictGroupsResult
{
self::checkOffsetCapture($flags, 'matchAllWithOffsets');
self::checkSetOrder($flags);
// @phpstan-ignore composerPcre.maybeUnsafeStrictGroups
$count = Preg::matchAllStrictGroups($pattern, $subject, $matches, $flags, $offset);
return new MatchAllStrictGroupsResult($count, $matches);
}
/**
* Runs preg_match_all with PREG_OFFSET_CAPTURE
*
* @param non-empty-string $pattern
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_UNMATCHED_AS_NULL and PREG_MATCH_OFFSET are always set, no other flags are supported
*/
public static function matchAllWithOffsets(string $pattern, string $subject, int $flags = 0, int $offset = 0): MatchAllWithOffsetsResult
{
self::checkSetOrder($flags);
$count = Preg::matchAllWithOffsets($pattern, $subject, $matches, $flags, $offset);
return new MatchAllWithOffsetsResult($count, $matches);
}
/**
* @param string|string[] $pattern
* @param string|string[] $replacement
* @param string $subject
*/
public static function replace($pattern, $replacement, $subject, int $limit = -1): ReplaceResult
{
$result = Preg::replace($pattern, $replacement, $subject, $limit, $count);
return new ReplaceResult($count, $result);
}
/**
* @param string|string[] $pattern
* @param ($flags is PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string|null, int<-1, max>}>): string) : callable(array<int|string, string|null>): string) $replacement
* @param string $subject
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
*/
public static function replaceCallback($pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0): ReplaceResult
{
$result = Preg::replaceCallback($pattern, $replacement, $subject, $limit, $count, $flags);
return new ReplaceResult($count, $result);
}
/**
* Variant of `replaceCallback()` which outputs non-null matches (or throws)
*
* @param string $pattern
* @param ($flags is PREG_OFFSET_CAPTURE ? (callable(array<int|string, array{string, int<0, max>}>): string) : callable(array<int|string, string>): string) $replacement
* @param string $subject
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
*/
public static function replaceCallbackStrictGroups($pattern, callable $replacement, $subject, int $limit = -1, int $flags = 0): ReplaceResult
{
$result = Preg::replaceCallbackStrictGroups($pattern, $replacement, $subject, $limit, $count, $flags);
return new ReplaceResult($count, $result);
}
/**
* @param ($flags is PREG_OFFSET_CAPTURE ? (array<string, callable(array<int|string, array{string|null, int<-1, max>}>): string>) : array<string, callable(array<int|string, string|null>): string>) $pattern
* @param string $subject
* @param int-mask<PREG_UNMATCHED_AS_NULL|PREG_OFFSET_CAPTURE> $flags PREG_OFFSET_CAPTURE is supported, PREG_UNMATCHED_AS_NULL is always set
*/
public static function replaceCallbackArray(array $pattern, $subject, int $limit = -1, int $flags = 0): ReplaceResult
{
$result = Preg::replaceCallbackArray($pattern, $subject, $limit, $count, $flags);
return new ReplaceResult($count, $result);
}
private static function checkOffsetCapture(int $flags, string $useFunctionName): void
{
if (($flags & PREG_OFFSET_CAPTURE) !== 0) {
throw new \InvalidArgumentException('PREG_OFFSET_CAPTURE is not supported as it changes the return type, use '.$useFunctionName.'() instead');
}
}
private static function checkSetOrder(int $flags): void
{
if (($flags & PREG_SET_ORDER) !== 0) {
throw new \InvalidArgumentException('PREG_SET_ORDER is not supported as it changes the return type');
}
}
}

View File

@ -1,43 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
final class ReplaceResult
{
/**
* @readonly
* @var string
*/
public $result;
/**
* @readonly
* @var 0|positive-int
*/
public $count;
/**
* @readonly
* @var bool
*/
public $matched;
/**
* @param 0|positive-int $count
*/
public function __construct(int $count, string $result)
{
$this->count = $count;
$this->matched = (bool) $count;
$this->result = $result;
}
}

View File

@ -1,20 +0,0 @@
<?php
/*
* This file is part of composer/pcre.
*
* (c) Composer <https://github.com/composer>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Composer\Pcre;
class UnexpectedNullMatchException extends PcreException
{
public static function fromFunction($function, $pattern)
{
throw new \LogicException('fromFunction should not be called on '.self::class.', use '.PcreException::class);
}
}

View File

@ -1,30 +0,0 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 80100)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 8.1.0". You are running ' . PHP_VERSION . '.';
}
if (PHP_INT_SIZE !== 8) {
$issues[] = 'Your Composer dependencies require a 64-bit build of PHP.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

View File

@ -1,224 +0,0 @@
# Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
### [3.4.2] 2024-07-12
* Fixed PHP 5.3 syntax error
### [3.4.1] 2024-07-12
* Fixed normalizeStability's return type to enforce valid stabilities
### [3.4.0] 2023-08-31
* Support larger major version numbers (#149)
### [3.3.2] 2022-04-01
* Fixed handling of non-string values (#134)
### [3.3.1] 2022-03-16
* Fixed possible cache key clash in the CompilingMatcher memoization (#132)
### [3.3.0] 2022-03-15
* Improved performance of CompilingMatcher by memoizing more (#131)
* Added CompilingMatcher::clear to clear all memoization caches
### [3.2.9] 2022-02-04
* Revert #129 (Fixed MultiConstraint with MatchAllConstraint) which caused regressions
### [3.2.8] 2022-02-04
* Updates to latest phpstan / CI by @Seldaek in https://github.com/composer/semver/pull/130
* Fixed MultiConstraint with MatchAllConstraint by @Toflar in https://github.com/composer/semver/pull/129
### [3.2.7] 2022-01-04
* Fixed: typo in type definition of Intervals class causing issues with Psalm scanning vendors
### [3.2.6] 2021-10-25
* Fixed: type improvements to parseStability
### [3.2.5] 2021-05-24
* Fixed: issue comparing disjunctive MultiConstraints to conjunctive ones (#127)
* Fixed: added complete type information using phpstan annotations
### [3.2.4] 2020-11-13
* Fixed: code clean-up
### [3.2.3] 2020-11-12
* Fixed: constraints in the form of `X || Y, >=Y.1` and other such complex constructs were in some cases being optimized into a more restrictive constraint
### [3.2.2] 2020-10-14
* Fixed: internal code cleanups
### [3.2.1] 2020-09-27
* Fixed: accidental validation of broken constraints combining ^/~ and wildcards, and -dev suffix allowing weird cases
* Fixed: normalization of beta0 and such which was dropping the 0
### [3.2.0] 2020-09-09
* Added: support for `x || @dev`, not very useful but seen in the wild and failed to validate with 1.5.2/1.6.0
* Added: support for `foobar-dev` being equal to `dev-foobar`, dev-foobar is the official way to write it but we need to support the other for BC and convenience
### [3.1.0] 2020-09-08
* Added: support for constraints like `^2.x-dev` and `~2.x-dev`, not very useful but seen in the wild and failed to validate with 3.0.1
* Fixed: invalid aliases will no longer throw, unless explicitly validated by Composer in the root package
### [3.0.1] 2020-09-08
* Fixed: handling of some invalid -dev versions which were seen as valid
### [3.0.0] 2020-05-26
* Break: Renamed `EmptyConstraint`, replace it with `MatchAllConstraint`
* Break: Unlikely to affect anyone but strictly speaking a breaking change, `*.*` and such variants will not match all `dev-*` versions anymore, only `*` does
* Break: ConstraintInterface is now considered internal/private and not meant to be implemented by third parties anymore
* Added `Intervals` class to check if a constraint is a subsets of another one, and allow compacting complex MultiConstraints into simpler ones
* Added `CompilingMatcher` class to speed up constraint matching against simple Constraint instances
* Added `MatchAllConstraint` and `MatchNoneConstraint` which match everything and nothing
* Added more advanced optimization of contiguous constraints inside MultiConstraint
* Added tentative support for PHP 8
* Fixed ConstraintInterface::matches to be commutative in all cases
### [2.0.0] 2020-04-21
* Break: `dev-master`, `dev-trunk` and `dev-default` now normalize to `dev-master`, `dev-trunk` and `dev-default` instead of `9999999-dev` in 1.x
* Break: Removed the deprecated `AbstractConstraint`
* Added `getUpperBound` and `getLowerBound` to ConstraintInterface. They return `Composer\Semver\Constraint\Bound` instances
* Added `MultiConstraint::create` to create the most-optimal form of ConstraintInterface from an array of constraint strings
### [1.7.2] 2020-12-03
* Fixed: Allow installing on php 8
### [1.7.1] 2020-09-27
* Fixed: accidental validation of broken constraints combining ^/~ and wildcards, and -dev suffix allowing weird cases
* Fixed: normalization of beta0 and such which was dropping the 0
### [1.7.0] 2020-09-09
* Added: support for `x || @dev`, not very useful but seen in the wild and failed to validate with 1.5.2/1.6.0
* Added: support for `foobar-dev` being equal to `dev-foobar`, dev-foobar is the official way to write it but we need to support the other for BC and convenience
### [1.6.0] 2020-09-08
* Added: support for constraints like `^2.x-dev` and `~2.x-dev`, not very useful but seen in the wild and failed to validate with 1.5.2
* Fixed: invalid aliases will no longer throw, unless explicitly validated by Composer in the root package
### [1.5.2] 2020-09-08
* Fixed: handling of some invalid -dev versions which were seen as valid
* Fixed: some doctypes
### [1.5.1] 2020-01-13
* Fixed: Parsing of aliased version was not validating the alias to be a valid version
### [1.5.0] 2019-03-19
* Added: some support for date versions (e.g. 201903) in `~` operator
* Fixed: support for stabilities in `~` operator was inconsistent
### [1.4.2] 2016-08-30
* Fixed: collapsing of complex constraints lead to buggy constraints
### [1.4.1] 2016-06-02
* Changed: branch-like requirements no longer strip build metadata - [composer/semver#38](https://github.com/composer/semver/pull/38).
### [1.4.0] 2016-03-30
* Added: getters on MultiConstraint - [composer/semver#35](https://github.com/composer/semver/pull/35).
### [1.3.0] 2016-02-25
* Fixed: stability parsing - [composer/composer#1234](https://github.com/composer/composer/issues/4889).
* Changed: collapse contiguous constraints when possible.
### [1.2.0] 2015-11-10
* Changed: allow multiple numerical identifiers in 'pre-release' version part.
* Changed: add more 'v' prefix support.
### [1.1.0] 2015-11-03
* Changed: dropped redundant `test` namespace.
* Changed: minor adjustment in datetime parsing normalization.
* Changed: `ConstraintInterface` relaxed, setPrettyString is not required anymore.
* Changed: `AbstractConstraint` marked deprecated, will be removed in 2.0.
* Changed: `Constraint` is now extensible.
### [1.0.0] 2015-09-21
* Break: `VersionConstraint` renamed to `Constraint`.
* Break: `SpecificConstraint` renamed to `AbstractConstraint`.
* Break: `LinkConstraintInterface` renamed to `ConstraintInterface`.
* Break: `VersionParser::parseNameVersionPairs` was removed.
* Changed: `VersionParser::parseConstraints` allows (but ignores) build metadata now.
* Changed: `VersionParser::parseConstraints` allows (but ignores) prefixing numeric versions with a 'v' now.
* Changed: Fixed namespace(s) of test files.
* Changed: `Comparator::compare` no longer throws `InvalidArgumentException`.
* Changed: `Constraint` now throws `InvalidArgumentException`.
### [0.1.0] 2015-07-23
* Added: `Composer\Semver\Comparator`, various methods to compare versions.
* Added: various documents such as README.md, LICENSE, etc.
* Added: configuration files for Git, Travis, php-cs-fixer, phpunit.
* Break: the following namespaces were renamed:
- Namespace: `Composer\Package\Version` -> `Composer\Semver`
- Namespace: `Composer\Package\LinkConstraint` -> `Composer\Semver\Constraint`
- Namespace: `Composer\Test\Package\Version` -> `Composer\Test\Semver`
- Namespace: `Composer\Test\Package\LinkConstraint` -> `Composer\Test\Semver\Constraint`
* Changed: code style using php-cs-fixer.
[3.4.2]: https://github.com/composer/semver/compare/3.4.1...3.4.2
[3.4.1]: https://github.com/composer/semver/compare/3.4.0...3.4.1
[3.4.0]: https://github.com/composer/semver/compare/3.3.2...3.4.0
[3.3.2]: https://github.com/composer/semver/compare/3.3.1...3.3.2
[3.3.1]: https://github.com/composer/semver/compare/3.3.0...3.3.1
[3.3.0]: https://github.com/composer/semver/compare/3.2.9...3.3.0
[3.2.9]: https://github.com/composer/semver/compare/3.2.8...3.2.9
[3.2.8]: https://github.com/composer/semver/compare/3.2.7...3.2.8
[3.2.7]: https://github.com/composer/semver/compare/3.2.6...3.2.7
[3.2.6]: https://github.com/composer/semver/compare/3.2.5...3.2.6
[3.2.5]: https://github.com/composer/semver/compare/3.2.4...3.2.5
[3.2.4]: https://github.com/composer/semver/compare/3.2.3...3.2.4
[3.2.3]: https://github.com/composer/semver/compare/3.2.2...3.2.3
[3.2.2]: https://github.com/composer/semver/compare/3.2.1...3.2.2
[3.2.1]: https://github.com/composer/semver/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/composer/semver/compare/3.1.0...3.2.0
[3.1.0]: https://github.com/composer/semver/compare/3.0.1...3.1.0
[3.0.1]: https://github.com/composer/semver/compare/3.0.0...3.0.1
[3.0.0]: https://github.com/composer/semver/compare/2.0.0...3.0.0
[2.0.0]: https://github.com/composer/semver/compare/1.5.1...2.0.0
[1.7.2]: https://github.com/composer/semver/compare/1.7.1...1.7.2
[1.7.1]: https://github.com/composer/semver/compare/1.7.0...1.7.1
[1.7.0]: https://github.com/composer/semver/compare/1.6.0...1.7.0
[1.6.0]: https://github.com/composer/semver/compare/1.5.2...1.6.0
[1.5.2]: https://github.com/composer/semver/compare/1.5.1...1.5.2
[1.5.1]: https://github.com/composer/semver/compare/1.5.0...1.5.1
[1.5.0]: https://github.com/composer/semver/compare/1.4.2...1.5.0
[1.4.2]: https://github.com/composer/semver/compare/1.4.1...1.4.2
[1.4.1]: https://github.com/composer/semver/compare/1.4.0...1.4.1
[1.4.0]: https://github.com/composer/semver/compare/1.3.0...1.4.0
[1.3.0]: https://github.com/composer/semver/compare/1.2.0...1.3.0
[1.2.0]: https://github.com/composer/semver/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/composer/semver/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/composer/semver/compare/0.1.0...1.0.0
[0.1.0]: https://github.com/composer/semver/compare/5e0b9a4da...0.1.0

Some files were not shown because too many files have changed in this diff Show More