FIX_Live Supplier validation GST and PAN REMOVED
This commit is contained in:
parent
cbd918370a
commit
c9c5002f54
@ -46,8 +46,6 @@ $routes->get('viewsupplier','Supplier::viewsupplier');// load edit supplier page
|
|||||||
$routes->post('editsupplier', 'Supplier::updatesupplierdetails'); //save supplier details
|
$routes->post('editsupplier', 'Supplier::updatesupplierdetails'); //save supplier details
|
||||||
$routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supplier details
|
$routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supplier details
|
||||||
$routes->post('supplierExist','Supplier::checksupplier');
|
$routes->post('supplierExist','Supplier::checksupplier');
|
||||||
$routes->post('supplierGSTExist','Supplier::checkGST');
|
|
||||||
$routes->post('supplierPANExist','Supplier::checkPAN');
|
|
||||||
$routes->get('exportsupplier','Supplier::exportsupplier'); // export supplier details
|
$routes->get('exportsupplier','Supplier::exportsupplier'); // export supplier details
|
||||||
$routes->post('deletesupplier','Supplier::deletesupplier');
|
$routes->post('deletesupplier','Supplier::deletesupplier');
|
||||||
|
|
||||||
|
|||||||
@ -67,55 +67,6 @@ class Supplier extends BaseController
|
|||||||
|
|
||||||
$this->loadViews("addSupplier", $this->global, $data, NULL);
|
$this->loadViews("addSupplier", $this->global, $data, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* This function is used to check whether PAN already exist or not
|
|
||||||
*/
|
|
||||||
function CheckPAN()
|
|
||||||
{
|
|
||||||
$id = $this->request->getPost('id');
|
|
||||||
$query = $this->supplier_model->checkPAN($id);
|
|
||||||
$response = ($query !== null && !empty($query)) ? $query[0]['PAN'] : null;
|
|
||||||
return $this->response->setJSON($response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* To Check the Pan Number is exists in the database or not */
|
|
||||||
public function checkPanValidate($PanNo)
|
|
||||||
{
|
|
||||||
$query = $this->supplier_model->checkPAN($PanNo);
|
|
||||||
if (count($query) > 0) {
|
|
||||||
|
|
||||||
return 'The Entered PAN Number is already exists in the Database.';
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkGST()
|
|
||||||
{
|
|
||||||
$id = $this->request->getPost('id');
|
|
||||||
$query = $this->supplier_model->checkGST($id);
|
|
||||||
$response = ($query !== null && !empty($query)) ? $query[0]['GSTNO'] : null;
|
|
||||||
return $this->response->setJSON($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* To Check the GST Number is exists in the database or not */
|
|
||||||
public function checkGstValidate($GstNo)
|
|
||||||
{
|
|
||||||
$query = $this->supplier_model->checkGST($GstNo);
|
|
||||||
if (count($query) > 0) {
|
|
||||||
// $this->validator->setMessage('checkGstValidate', 'The Entered GST Number is already exists in the Database.');
|
|
||||||
// echo "<script>alert('The Entered GST Number is already exists in the Database.');</script>";
|
|
||||||
// return false;
|
|
||||||
return 'The Entered GST Number already exists in the Database.';
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function is used to add new Supplier to the system
|
* This function is used to add new Supplier to the system
|
||||||
@ -150,16 +101,7 @@ class Supplier extends BaseController
|
|||||||
'rules' => 'valid_email|max_length[128]|required'
|
'rules' => 'valid_email|max_length[128]|required'
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
// $rules['panno'] = ($PAN=='') ? ['label' => 'panno','rules' => 'trim|max_length[10]']
|
|
||||||
// : ['label' => 'panno','rules' => 'trim|max_length[10]|checkPanValidate['.$PAN.']'];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $rules['GSTNo'] = ($GSTNo=='') ? ['label' => 'GSTNo','rules' => 'trim|max_length[15]']
|
|
||||||
// : ['label' => 'GSTNo', 'rules' => 'trim|max_length[15]|checkGstValidate[' . $GSTNo . ']'];
|
|
||||||
|
|
||||||
|
|
||||||
$messages = [
|
$messages = [
|
||||||
'SupplierName' => [
|
'SupplierName' => [
|
||||||
'required' => 'Please enter a supplier name.'
|
'required' => 'Please enter a supplier name.'
|
||||||
@ -200,7 +142,7 @@ class Supplier extends BaseController
|
|||||||
$EmailAddress = $this->request->getPost('emailid');
|
$EmailAddress = $this->request->getPost('emailid');
|
||||||
$PAN = (is_string($PAN)) ? strtoupper($PAN) : null ;
|
$PAN = (is_string($PAN)) ? strtoupper($PAN) : null ;
|
||||||
$GSTNo = (is_string($GSTNo)) ? strtoupper($GSTNo) : null ;
|
$GSTNo = (is_string($GSTNo)) ? strtoupper($GSTNo) : null ;
|
||||||
$MSMENo = $this->request->getPost('MSME');
|
$MSME = $this->request->getPost('MSME');
|
||||||
$accno = $this->request->getPost('accno');
|
$accno = $this->request->getPost('accno');
|
||||||
$ifsc = $this->request->getPost('ifsc');
|
$ifsc = $this->request->getPost('ifsc');
|
||||||
$branchname = $this->request->getPost('branchname');
|
$branchname = $this->request->getPost('branchname');
|
||||||
@ -212,7 +154,7 @@ class Supplier extends BaseController
|
|||||||
$maintenance = $this->request->getPost('maintanance');
|
$maintenance = $this->request->getPost('maintanance');
|
||||||
$PaymentId = $this->request->getPost('paymentid');
|
$PaymentId = $this->request->getPost('paymentid');
|
||||||
|
|
||||||
$supplier = array('SupplierName' => $SupplierName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'PAN' => $PAN, 'GSTNo' => $GSTNo, 'PaymentID' => $PaymentId, 'Cert_MSME' => $MSMENo, 'BankAcNumber' => $accno, 'IFSCCode' => $ifsc, 'BranchName' => $branchname, 'BankAddress' => $bankaddress, 'Createdby' => $Createdby, 'IsService' => $service, 'IsMaintanance' => $maintenance, 'IsRawMaterial' => $rawmaterial); //,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT);
|
$supplier = array('SupplierName' => $SupplierName, 'Address' => $Address, 'ContactNumber' => $ContactNumber, 'AlternateContactNumber' => $AlternateContactNumber, 'EmailAddress' => $EmailAddress, 'PAN' => $PAN, 'GSTNo' => $GSTNo, 'PaymentID' => $PaymentId, 'MSME' => $MSME, 'BankAcNumber' => $accno, 'IFSCCode' => $ifsc, 'BranchName' => $branchname, 'BankAddress' => $bankaddress, 'Createdby' => $Createdby, 'IsService' => $service, 'IsMaintanance' => $maintenance, 'IsRawMaterial' => $rawmaterial); //,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT);
|
||||||
|
|
||||||
$file1 = $this->request->getFile('Cert_MSME');
|
$file1 = $this->request->getFile('Cert_MSME');
|
||||||
$file2 = $this->request->getFile('Cert_GST');
|
$file2 = $this->request->getFile('Cert_GST');
|
||||||
|
|||||||
@ -57,41 +57,6 @@ class Supplier_model extends Model
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPAN($PAN, $SID = '')
|
|
||||||
{
|
|
||||||
|
|
||||||
$builder = $this->db->table('t_supplierdetailsn')
|
|
||||||
->select('PAN')->where('PAN', $PAN);
|
|
||||||
if ($SID != '') {
|
|
||||||
$builder->where('SupplierID !=', $SID);
|
|
||||||
}
|
|
||||||
$query = $builder->get();
|
|
||||||
|
|
||||||
if ($query->getNumRows() > 0) {
|
|
||||||
//echo $result->getNumRows();
|
|
||||||
return $query->getResultArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function checkGST($GST, $SID = null)
|
|
||||||
{
|
|
||||||
$builder = $this->db->table('t_supplierdetailsn')->select('GSTNO')
|
|
||||||
->where('GSTNO', $GST);
|
|
||||||
|
|
||||||
if ($SID !== null) {
|
|
||||||
$builder->where('SupplierID !=', $SID);
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = $builder->get();
|
|
||||||
|
|
||||||
if ($query->getNumRows() > 0) {
|
|
||||||
return $query->getResultArray();
|
|
||||||
} else {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function addNewsupplier($supplier)
|
function addNewsupplier($supplier)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -175,27 +175,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function onlyAlphabets(evt) {
|
|
||||||
var charCode;
|
|
||||||
if (window.event)
|
|
||||||
charCode = window.event.keyCode; //for IE
|
|
||||||
else
|
|
||||||
charCode = evt.which; //for firefox
|
|
||||||
if (charCode == 32) //for <space> symbol
|
|
||||||
return true;
|
|
||||||
if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
|
|
||||||
return false;
|
|
||||||
if (charCode > 122) //for characters beyond 'z' in ASCII Table
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
//$("#Payment").select2();
|
//$("#Payment").select2();
|
||||||
@ -261,7 +240,7 @@
|
|||||||
|
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<span for="SupplierName">Supplier Name</span><span class="badge">*</span>
|
<span for="SupplierName">Supplier Name</span><span class="badge">*</span>
|
||||||
<input type="text" name="SupplierName" onkeypress="return onlyAlphabets(event);" maxlength="100" id="supplierName" class="form-control" required>
|
<input type="text" name="SupplierName" maxlength="100" id="supplierName" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<span for="ContactNumber">Contact Number</span><span class="badge">*</span>
|
<span for="ContactNumber">Contact Number</span><span class="badge">*</span>
|
||||||
@ -465,93 +444,12 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!validateGST())
|
|
||||||
// {
|
|
||||||
// $('#GSTNo').focus();
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (!validateEmail()) {
|
if (!validateEmail()) {
|
||||||
$('#emailid').focus();
|
$('#emailid').focus();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//Call to ajax existing PAN
|
|
||||||
$('#panno').change(function() {
|
|
||||||
|
|
||||||
var id = $('#panno').val();
|
|
||||||
if (id != '') {
|
|
||||||
$.ajax({
|
|
||||||
data: {id: id},
|
|
||||||
type: "POST",
|
|
||||||
url: "<?= base_url() . 'supplierPANExist' ?>",
|
|
||||||
success: function(data) {
|
|
||||||
if(data){
|
|
||||||
var answer = confirm(data + " supplier details already exist in the database. Do you want to change the supplier details?");
|
|
||||||
if (answer) {
|
|
||||||
$('#panno').val('');
|
|
||||||
$('#panno').focus();
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
alert('Please edit the supplier details in the Edit screen and change the supplier status to Active');
|
|
||||||
window.location = '<?= site_url('supplierlisting') ?>'; // Use site_url() to generate the correct URL for redirection
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
alert('Error occurred while checking PAN number.');
|
|
||||||
$('#panno').val('');
|
|
||||||
$('#panno').focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert('Please enter the PAN Number');
|
|
||||||
$('#panno').focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#GSTNo').change(function() {
|
|
||||||
|
|
||||||
var id = $('#GSTNo').val();
|
|
||||||
if (id != '') {
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "<?= base_url() . 'supplierGSTExist' ?>",
|
|
||||||
data: { id: id },
|
|
||||||
success: function(data) {
|
|
||||||
if (data) {
|
|
||||||
var answer = confirm(data + " " + " supplier details is already exists in the database.Do you want to change the SUPPLIER details?")
|
|
||||||
if (answer) {
|
|
||||||
$('#GSTNo').val('');
|
|
||||||
$('#GSTNo').focus();
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
alert('Please edit the supplier details in the Edit screen and change the supplier status to Active');
|
|
||||||
window.location = '<?= site_url('supplierlisting') ?>'; // Use site_url() to generate the correct URL for redirection
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
alert('Error occurred while checking GST number.');
|
|
||||||
$('#GSTNo').val(''); // Clear GSTNo field
|
|
||||||
$('#GSTNo').focus(); // Focus on GSTNo field
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert('Please enter the GST Number');
|
|
||||||
$('#GSTNo').focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('#supplierName').change(function() {
|
$('#supplierName').change(function() {
|
||||||
var suppliername = $('#supplierName').val();
|
var suppliername = $('#supplierName').val();
|
||||||
var supplier = suppliername.replace(/ /g, '');
|
var supplier = suppliername.replace(/ /g, '');
|
||||||
|
|||||||
@ -505,80 +505,6 @@ if (!empty($supplier)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Call to ajax existing PAN
|
//Call to ajax existing PAN
|
||||||
$('#panno').change(function() {
|
|
||||||
|
|
||||||
var id = $('#panno').val();
|
|
||||||
if (id != '') {
|
|
||||||
$.ajax({
|
|
||||||
data: {id: id},
|
|
||||||
type: "POST",
|
|
||||||
url: "<?= base_url() . 'supplierPANExist' ?>",
|
|
||||||
success: function(data) {
|
|
||||||
if(data){
|
|
||||||
var answer = confirm(data + " supplier details already exist in the database. Do you want to change the supplier details?");
|
|
||||||
if (answer)
|
|
||||||
{
|
|
||||||
$('#panno').val('');
|
|
||||||
$('#panno').focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
alert('Please edit the supplier details in the Edit screen and change the supplier status to Active');
|
|
||||||
window.location = 'supplierlisting';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
// alert("error");
|
|
||||||
console.log("an error occur supplierPANExist")
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert('Please enter the PAN Number');
|
|
||||||
$('#panno').focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#GSTNo').change(function() {
|
|
||||||
|
|
||||||
var id = $('#GSTNo').val();
|
|
||||||
if (id != '') {
|
|
||||||
$.ajax({
|
|
||||||
type: "POST",
|
|
||||||
url: "<?= base_url() . 'supplierGSTExist' ?>",
|
|
||||||
data: { id: id },
|
|
||||||
success: function(data) {
|
|
||||||
if (data) {
|
|
||||||
var answer = confirm(data + " " + " supplier details is already exists in the database.Do you want to change the SUPPLIER details?")
|
|
||||||
if (answer) {
|
|
||||||
$('#GSTNo').val('');
|
|
||||||
$('#GSTNo').focus();
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
alert('Please edit the supplier details in the Edit screen and change the supplier status to Active');
|
|
||||||
window.location = '<?= site_url('supplierlisting') ?>'; // Use site_url() to generate the correct URL for redirection
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
alert('Error occurred while checking GST number.');
|
|
||||||
$('#GSTNo').val(''); // Clear GSTNo field
|
|
||||||
$('#GSTNo').focus(); // Focus on GSTNo field
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alert('Please enter the GST Number');
|
|
||||||
$('#GSTNo').focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#supplierName').change(function() {
|
$('#supplierName').change(function() {
|
||||||
var suppliername = $('#supplierName').val();
|
var suppliername = $('#supplierName').val();
|
||||||
var supplier = suppliername.replace(/ /g, '');
|
var supplier = suppliername.replace(/ /g, '');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user