From c9c5002f5479b87212d9e270a7117ec56c3e81eb Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 30 Jul 2024 05:37:23 +0000 Subject: [PATCH] FIX_Live Supplier validation GST and PAN REMOVED --- app/Config/Routes.php | 2 - app/Controllers/Supplier.php | 62 +------------------- app/Models/Supplier_model.php | 35 ------------ app/Views/addSupplier.php | 104 +--------------------------------- app/Views/editSupplier.php | 74 ------------------------ 5 files changed, 3 insertions(+), 274 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 4a422bd5..1971a74a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -46,8 +46,6 @@ $routes->get('viewsupplier','Supplier::viewsupplier');// load edit supplier page $routes->post('editsupplier', 'Supplier::updatesupplierdetails'); //save supplier details $routes->post('addNewsupplier', 'Supplier::savesupplierdetails'); // update supplier details $routes->post('supplierExist','Supplier::checksupplier'); -$routes->post('supplierGSTExist','Supplier::checkGST'); -$routes->post('supplierPANExist','Supplier::checkPAN'); $routes->get('exportsupplier','Supplier::exportsupplier'); // export supplier details $routes->post('deletesupplier','Supplier::deletesupplier'); diff --git a/app/Controllers/Supplier.php b/app/Controllers/Supplier.php index e37f717a..f5eeffa3 100644 --- a/app/Controllers/Supplier.php +++ b/app/Controllers/Supplier.php @@ -67,55 +67,6 @@ class Supplier extends BaseController $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 ""; - // 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 @@ -150,16 +101,7 @@ class Supplier extends BaseController '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 = [ 'SupplierName' => [ 'required' => 'Please enter a supplier name.' @@ -200,7 +142,7 @@ class Supplier extends BaseController $EmailAddress = $this->request->getPost('emailid'); $PAN = (is_string($PAN)) ? strtoupper($PAN) : null ; $GSTNo = (is_string($GSTNo)) ? strtoupper($GSTNo) : null ; - $MSMENo = $this->request->getPost('MSME'); + $MSME = $this->request->getPost('MSME'); $accno = $this->request->getPost('accno'); $ifsc = $this->request->getPost('ifsc'); $branchname = $this->request->getPost('branchname'); @@ -212,7 +154,7 @@ class Supplier extends BaseController $maintenance = $this->request->getPost('maintanance'); $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'); $file2 = $this->request->getFile('Cert_GST'); diff --git a/app/Models/Supplier_model.php b/app/Models/Supplier_model.php index 41fcf03d..45807251 100644 --- a/app/Models/Supplier_model.php +++ b/app/Models/Supplier_model.php @@ -57,41 +57,6 @@ class Supplier_model extends Model 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) { diff --git a/app/Views/addSupplier.php b/app/Views/addSupplier.php index 82cf2049..16ece59d 100644 --- a/app/Views/addSupplier.php +++ b/app/Views/addSupplier.php @@ -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() { //$("#Payment").select2(); @@ -261,7 +240,7 @@
Supplier Name* - +
Contact Number* @@ -465,93 +444,12 @@ return false; } - // if(!validateGST()) - // { - // $('#GSTNo').focus(); - // return false; - // } - if (!validateEmail()) { $('#emailid').focus(); return false; } } - //Call to ajax existing PAN - $('#panno').change(function() { - - var id = $('#panno').val(); - if (id != '') { - $.ajax({ - data: {id: id}, - type: "POST", - url: "", - 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 = ''; // 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: "", - 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 = ''; // 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() { var suppliername = $('#supplierName').val(); var supplier = suppliername.replace(/ /g, ''); diff --git a/app/Views/editSupplier.php b/app/Views/editSupplier.php index cf6f5ed2..1d7b1b48 100644 --- a/app/Views/editSupplier.php +++ b/app/Views/editSupplier.php @@ -505,80 +505,6 @@ if (!empty($supplier)) { } //Call to ajax existing PAN - $('#panno').change(function() { - -var id = $('#panno').val(); -if (id != '') { - $.ajax({ - data: {id: id}, - type: "POST", - url: "", - 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: "", - 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 = ''; // 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() { var suppliername = $('#supplierName').val(); var supplier = suppliername.replace(/ /g, '');