diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php index b0bf2c9d..143fe018 100755 --- a/application/controllers/supplier.php +++ b/application/controllers/supplier.php @@ -14,26 +14,26 @@ class supplier extends BaseController /** * This is default constructor of the class */ - public function __construct() + public function __construct() { parent::__construct(); $this->load->model('supplier_model'); - $this->load->library('form_validation'); - $this->load->library('pagination'); - $this->load->library('Excel'); + $this->load->library('form_validation'); + $this->load->library('pagination'); + $this->load->library('Excel'); $this->isLoggedIn(); } - /** + /** * This function used to load the first screen of the user */ - public function index() + public function index() { $this->global['pageTitle'] = 'Siddharth : Supplier'; $this->loadViews("supplierListing", $this->global, NULL , NULL); } - - /** + + /** * This function is used to load the Supplier list */ function supplierListing() @@ -48,7 +48,7 @@ class supplier extends BaseController $this->loadViews("supplierListing", $this->global, $data, NULL); } - /** + /** * This function is used to load the add new supplier */ function addsupplier() { @@ -61,58 +61,60 @@ 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->input->post('id'); - - $query = $this->supplier_model->checkPAN($id ); - - $query = $query[0]['PAN']; - - print_r($query); - - } - /* To Check the Pan Number is exists in the database or not for the selected Supplier */ - function checkPanValidateSupplier() { - - $SupplierID = $this->input->post('SupplierID'); - $PanNo = $this->input->post('panno'); - // echo 'Sup'. $SupplierID ; - $query = $this->supplier_model->checkPAN($PanNo,$SupplierID); - if (count($query)> 0) - { - $this->form_validation->set_message('checkPanValidateSupplier', 'The Entered PAN Number is already exists in the Database.'); - return false; - } - else - { - return true; - } - } - - /* To Check the Pan Number is exists in the database or not */ - function checkPanValidate() - { - - $PanNo = $this->input->post('panno'); - - $query = $this->supplier_model->checkPAN($PanNo); - if (count($query)> 0) - { - $this->form_validation->set_message('checkPanValidate', 'The Entered PAN Number is already exists in the Database.'); - return false; - } - else - { - return true; - } - } - - /** + + function CheckPAN() + { + + $id = $this->input->post('id'); + + $query = $this->supplier_model->checkPAN($id ); + + $query = $query[0]['PAN']; + + print_r($query); + + } + /* To Check the Pan Number is exists in the database or not for the selected Supplier */ + function checkPanValidateSupplier() { + + $SupplierID = $this->input->post('SupplierID'); + $PanNo = $this->input->post('panno'); + // echo 'Sup'. $SupplierID ; + $query = $this->supplier_model->checkPAN($PanNo,$SupplierID); + if (count($query)> 0) + { + $this->form_validation->set_message('checkPanValidateSupplier', 'The Entered PAN Number is already exists in the Database.'); + return false; + } + else + { + return true; + } + } + + /* To Check the Pan Number is exists in the database or not */ + function checkPanValidate() + { + // alert('validation pan'); + + $PanNo = $this->input->post('panno'); + + $query = $this->supplier_model->checkPAN($PanNo); + if (count($query)> 0) + { + $this->form_validation->set_message('checkPanValidate', 'The Entered PAN Number is already exists in the Database.'); + return false; + } + else + { + return true; + } + } + + /** * This function is used to add new Supplier to the system */ function addNewsupplier() @@ -125,8 +127,8 @@ class supplier extends BaseController $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|numeric|max_length[10]'); $this->form_validation->set_rules('emailid','emailid', 'valid_email|max_length[128]|required'); $this->form_validation->set_rules('TIN','TIN','trim|required|max_length[11]'); - $this->form_validation->set_rules('panno', 'panno', 'trim|required|max_length[10]|callback_checkPanValidate'); - + $this->form_validation->set_rules('panno', 'panno', 'trim|required|max_length[10]|callback_checkPanValidate'); + if($this->form_validation->run() == FALSE) { @@ -134,14 +136,14 @@ class supplier extends BaseController } else { - $SupplierName = $this->input->post('SupplierName'); + $SupplierName = $this->input->post('SupplierName'); $Address = $this->input->post('Address'); $ContactNumber = $this->input->post('ContactNumber'); $AlternateContactNumber = $this->input->post('AlternateContactNumber'); $EmailAddress = $this->input->post('emailid'); $Exiseregistration = $this->input->post('Exciseregistration'); $TIN = $this->input->post('TIN'); - $PAN = $this->input->post('panno'); + $PAN = strtoupper($this->input->post('panno')); $GSTNo = $this->input->post('GSTNo'); $GSTRange = $this->input->post('GSTRange'); $CollectrateAddress = $this->input->post('CollectrateAddress'); @@ -149,18 +151,18 @@ class supplier extends BaseController $PaymentTerms = $this->input->post('PaymentTerms'); $Payment = $this->input->post('Payment'); $PayableAT = $this->input->post('PayableAT'); - $CSTNo = $this->input->post('CSTNo'); - - $CSTDt = $this->input->post('dateofCST'); - - if($CSTDt != '') - { - $CSTDate = $this->getDateformat($CSTDt); - } - else - { - $CSTDate = null; - } + $CSTNo = $this->input->post('CSTNo'); + + $CSTDt = $this->input->post('dateofCST'); + + if($CSTDt != '') + { + $CSTDate = $this->getDateformat($CSTDt); + } + else + { + $CSTDate = null; + } $EMSNo = $this->input->post('EMSNo'); $TSNo = $this->input->post('TSNo'); @@ -182,31 +184,31 @@ class supplier extends BaseController $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'Exiseregistration'=>$Exiseregistration,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'PayableAT'=>$PayableAT,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'Cert_EMS'=>$EMSNo, 'Cert_TS'=>$TSNo, 'Cert_IMS'=>$IMSNo, 'Cert_ISO'=>$ISONo, 'Cert_OSHAS'=>$OSHASNo, 'BankAcNumber'=>$accno, 'IFSCCode'=>$ifsc, 'BranchName'=>$branchname, 'BankAddress'=>$bankaddress,'Createdby'=>$Createdby,'IsService'=>$service,'IsMaintanance'=>$maintenance,'IsRawMaterial'=>$rawmaterial); - $result = $this->supplier_model->addNewsupplier($supplier); + $result = $this->supplier_model->addNewsupplier($supplier); if($result > 0) { - redirect('supplierListing','refresh'); - echo ""; + redirect('supplierListing','refresh'); + echo ""; } - + else { - redirect('supplierListing','refresh'); - echo ""; + redirect('supplierListing','refresh'); + echo ""; } } } - - function getDateformat($Val) - { - $date = new DateTime($Val); - $retDate = $date->format('Y-m-d H:i:s'); - return $retDate; - } - /** + + function getDateformat($Val) + { + $date = new DateTime($Val); + $retDate = $date->format('Y-m-d H:i:s'); + return $retDate; + } + /** * This function is used to edit the Supplier information */ function editsupplier() @@ -214,14 +216,14 @@ class supplier extends BaseController $this->form_validation->set_rules('SupplierName','Supplier Name','trim|required'); $this->form_validation->set_rules('Address','Address','trim|required|'); $supplierID = $this->input->post('SupplierID'); - //echo 'supID' . $supplierID ; + //echo 'supID' . $supplierID ; $this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|numeric|max_length[10]'); $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|numeric|max_length[10]'); $this->form_validation->set_rules('emailid','emailid','valid_email|max_length[128]|required'); $this->form_validation->set_rules('TIN','TIN','trim|required|max_length[11]'); - - $this->form_validation->set_rules('panno', 'panno', 'trim|required|max_length[10]|callback_checkPanValidateSupplier'); + + $this->form_validation->set_rules('panno', 'panno', 'trim|required|max_length[10]|callback_checkPanValidateSupplier'); if($this->form_validation->run() == FALSE) @@ -238,7 +240,7 @@ class supplier extends BaseController $EmailAddress = $this->input->post('emailid'); $Exiseregistration = $this->input->post('Exciseregistration'); $TIN = $this->input->post('TIN'); - $PAN = $this->input->post('panno'); + $PAN = strtoupper($this->input->post('panno')); $GSTNo = $this->input->post('GSTNo'); $GSTRange = $this->input->post('GSTRange'); $CollectrateAddress = $this->input->post('CollectrateAddress'); @@ -246,29 +248,29 @@ class supplier extends BaseController $PaymentTerms = $this->input->post('PaymentTerms'); $Payment = $this->input->post('Payment'); //$PayableAT = $this->input->post('PayableAT'); - $UpdatedBy = $this->session->userdata ( 'userId' ); - $chked = $this->input->post('isactive'); - - if( $chked != '') - { - $IsActive = '1'; - } - else - { - $IsActive = '0'; - } - - $CSTNo = $this->input->post('CSTNo'); - $CSTDt = $this->input->post('dateofCST'); - - if($CSTDt != '') - { - $CSTDate = $this->getDateformat($CSTDt); - } - else - { - $CSTDate = null; - } + $UpdatedBy = $this->session->userdata ( 'userId' ); + $chked = $this->input->post('isactive'); + + if( $chked != '') + { + $IsActive = '1'; + } + else + { + $IsActive = '0'; + } + + $CSTNo = $this->input->post('CSTNo'); + $CSTDt = $this->input->post('dateofCST'); + + if($CSTDt != '') + { + $CSTDate = $this->getDateformat($CSTDt); + } + else + { + $CSTDate = null; + } $EMSNo = $this->input->post('EMSNo'); $TSNo = $this->input->post('TSNo'); @@ -283,60 +285,59 @@ class supplier extends BaseController $rawmaterial =$this->input->post('rawmaterial'); $maintanance = $this->input->post('maintanance'); - $supplier = array(); + $supplier = array(); $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'Exiseregistration'=>$Exiseregistration,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$Payment,'CSTNo'=>$CSTNo,'CSTDate'=>$CSTDate,'Cert_EMS'=>$EMSNo, 'Cert_TS'=>$TSNo, 'Cert_IMS'=>$IMSNo, 'Cert_ISO'=>$ISONo, 'Cert_OSHAS'=>$OSHASNo, 'BankAcNumber'=>$accno, 'IFSCCode'=>$ifsc, 'BranchName'=>$branchname, 'BankAddress'=>$bankaddress,'UpdatedBy'=>$UpdatedBy,'IsActive'=>$IsActive,'IsService'=>$service,'IsMaintanance'=>$maintanance,'IsRawMaterial'=>$rawmaterial); //SupplierID, SupplierName, Address, ContactNumber, AlternateContactNumber, EmailAddress, Exiseregistration, TIN, PAN, CSTNO, CSTDate, GSTNO, GSTRange, CollectrateAddress, UANumber, PaymentTerms, PaymentDays, PayableAT, Cert_EMS, Cert_TS, Cert_IMS, Cert_ISO, Cert_OSHAS, BankAcNumber, IFSCCode, BranchName, BankAddress, Createdby, UpdatedBy, Updatedon, CreatedOn, IsActive); - print_r($supplier); - //die(); + //print_r($supplier);die(); $result = $this->supplier_model->UpdateSupplier($supplier, $supplierID); - + if($result == True) { - redirect('supplierListing','refresh'); - echo ""; + redirect('supplierListing','refresh'); + echo ""; } - + else { redirect('supplierListing','refresh'); - echo ""; + echo ""; } } } - - function viewsupplier($SID = '') + + function viewsupplier($SID = '') { - $Payment = ''; - if($SID == '') - { - $supplierID = $_GET['SID']; - $Payment = $_GET['Payment']; - } - else - { - - $supplierID = $SID; - } + $Payment = ''; + if($SID == '') + { + $supplierID = $_GET['SID']; + $Payment = $_GET['Payment']; + } + else + { + + $supplierID = $SID; + } $data['supplier'] = $this->supplier_model->getSupplierInfo($supplierID); $data['payment'] = $this->supplier_model->getpayment($Payment ); $this->global['pageTitle'] = 'Siddharth : Edit Supplier'; - + $this->loadViews("editSupplier", $this->global,$data, NULL); - } + } - /** this function can be use for excel report **/ - - function export_supplierdetails(){ - - - $this->load->library('excel'); + /** this function can be use for excel report **/ + + function export_supplierdetails(){ + + + $this->load->library('excel'); $this->excel->setActiveSheetIndex(0); - $this->excel->getActiveSheet()->setTitle('supplier details'); + $this->excel->getActiveSheet()->setTitle('supplier details'); $this->excel->getActiveSheet()->setCellValue('A1', 'SupplierID'); $this->excel->getActiveSheet()->setCellValue('B1', 'SupplierName'); $this->excel->getActiveSheet()->setCellValue('C1', 'Address'); @@ -368,41 +369,41 @@ class supplier extends BaseController $this->excel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); $this->excel->getActiveSheet()->getStyle('C1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('C1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('D1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('D1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('D1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('E1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('E1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('E1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('F1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('F1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('F1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('G1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('G1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('G1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('H1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('H1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('H1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('I1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('I1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('I1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('J1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('J1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('J1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('K1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('K1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('K1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('L1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('L1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('L1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('M1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('M1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('M1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('N1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('N1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('N1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('O1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('O1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('O1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('P1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('P1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('P1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('Q1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('Q1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('Q1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('R1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('R1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('R1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('S1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('S1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('S1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('T1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('T1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('T1')->getFont()->setBold(true); - $this->excel->getActiveSheet()->getStyle('U1')->getFont()->setSize(12); + $this->excel->getActiveSheet()->getStyle('U1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('U1')->getFont()->setBold(true); @@ -412,28 +413,28 @@ class supplier extends BaseController $i = 2; $s = 1; foreach ($exportData as $data) { - - $this->excel->getActiveSheet()->setCellValue('A' . $i,$data['SupplierID']); - $this->excel->getActiveSheet()->setCellValue('B' . $i,$data['SupplierName']); - $this->excel->getActiveSheet()->setCellValue('C' . $i,$data['Address']); - $this->excel->getActiveSheet()->setCellValue('D' . $i,$data['ContactNumber']); - $this->excel->getActiveSheet()->setCellValue('E' . $i,$data['AlternateContactNumber']); - $this->excel->getActiveSheet()->setCellValue('F' . $i,$data['EmailAddress']); - $this->excel->getActiveSheet()->setCellValue('G' . $i,$data['Exiseregistration']); - $this->excel->getActiveSheet()->setCellValue('H' . $i,$data['TIN']); - $this->excel->getActiveSheet()->setCellValue('I' . $i,$data['PAN']); - $this->excel->getActiveSheet()->setCellValue('J' . $i,$data['CSTNO']); - $this->excel->getActiveSheet()->setCellValue('K' . $i,$data['CSTDate']); - $this->excel->getActiveSheet()->setCellValue('L' . $i,$data['GSTNO']); - $this->excel->getActiveSheet()->setCellValue('M' . $i,$data['GSTRange']); - $this->excel->getActiveSheet()->setCellValue('N' . $i,$data['CollectrateAddress']); - $this->excel->getActiveSheet()->setCellValue('O' . $i,$data['UANumber']); - $this->excel->getActiveSheet()->setCellValue('P' . $i,$data['PaymentTerms']); - $this->excel->getActiveSheet()->setCellValue('Q' . $i,$data['PaymentDays']); - $this->excel->getActiveSheet()->setCellValue('R' . $i,$data['PayableAT']); - $this->excel->getActiveSheet()->setCellValue('S' . $i,$data['firstname']); - $this->excel->getActiveSheet()->setCellValue('T' . $i,$data['Update_by']); - $this->excel->getActiveSheet()->setCellValue('U' . $i,$data['IsActive']); + + $this->excel->getActiveSheet()->setCellValue('A' . $i,$data['SupplierID']); + $this->excel->getActiveSheet()->setCellValue('B' . $i,$data['SupplierName']); + $this->excel->getActiveSheet()->setCellValue('C' . $i,$data['Address']); + $this->excel->getActiveSheet()->setCellValue('D' . $i,$data['ContactNumber']); + $this->excel->getActiveSheet()->setCellValue('E' . $i,$data['AlternateContactNumber']); + $this->excel->getActiveSheet()->setCellValue('F' . $i,$data['EmailAddress']); + $this->excel->getActiveSheet()->setCellValue('G' . $i,$data['Exiseregistration']); + $this->excel->getActiveSheet()->setCellValue('H' . $i,$data['TIN']); + $this->excel->getActiveSheet()->setCellValue('I' . $i,$data['PAN']); + $this->excel->getActiveSheet()->setCellValue('J' . $i,$data['CSTNO']); + $this->excel->getActiveSheet()->setCellValue('K' . $i,$data['CSTDate']); + $this->excel->getActiveSheet()->setCellValue('L' . $i,$data['GSTNO']); + $this->excel->getActiveSheet()->setCellValue('M' . $i,$data['GSTRange']); + $this->excel->getActiveSheet()->setCellValue('N' . $i,$data['CollectrateAddress']); + $this->excel->getActiveSheet()->setCellValue('O' . $i,$data['UANumber']); + $this->excel->getActiveSheet()->setCellValue('P' . $i,$data['PaymentTerms']); + $this->excel->getActiveSheet()->setCellValue('Q' . $i,$data['PaymentDays']); + $this->excel->getActiveSheet()->setCellValue('R' . $i,$data['PayableAT']); + $this->excel->getActiveSheet()->setCellValue('S' . $i,$data['firstname']); + $this->excel->getActiveSheet()->setCellValue('T' . $i,$data['Update_by']); + $this->excel->getActiveSheet()->setCellValue('U' . $i,$data['IsActive']); $i++; $s++; @@ -451,8 +452,8 @@ class supplier extends BaseController } - - + + function pageNotFound() { $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found'; diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php index 96219051..f389d323 100755 --- a/application/models/supplier_model.php +++ b/application/models/supplier_model.php @@ -3,7 +3,7 @@ class supplier_model extends CI_Model { - /** + /** * This function is used to get the user listing count * @param string $searchText : This is optional search text * @param number $page : This is pagination offset @@ -20,7 +20,7 @@ class supplier_model extends CI_Model $result = $query->result(); return $result; } - /** + /** * This function used to get user information by id * @param number $userId : This is user id * @return array $result : This is user information @@ -29,14 +29,14 @@ class supplier_model extends CI_Model function getpayment($Configvalue = '') { - $ConfigID = 'C009'; + $ConfigID = 'C009'; $this->db->select('ConfigValue'); $this->db->from('T_ConfigDetails'); - $this->db->where('Config_id ',$ConfigID ); - if ($Configvalue!= '') - { - $this->db->where('ConfigValue !=',$Configvalue ); - } + $this->db->where('Config_id ',$ConfigID ); + if ($Configvalue!= '') + { + $this->db->where('ConfigValue !=',$Configvalue ); + } $query = $this->db->get(); return $query->result(); @@ -45,24 +45,24 @@ class supplier_model extends CI_Model function checkPAN($PAN,$SID = '') { - $this->db->select('PAN'); + $this->db->select('PAN'); $this->db->from('T_SupplierDetailsN'); - $this->db->where('PAN',$PAN); - if ($SID != '') - { - $this->db->where('SupplierID !=',$SID); - } - $query = $this->db->get(); - //print_r($this->db->last_query()); + $this->db->where('PAN',$PAN); + if ($SID != '') + { + $this->db->where('SupplierID !=',$SID); + } + $query = $this->db->get(); + //print_r($this->db->last_query()); if ($query->num_rows > 0) { - //echo $result->num_rows; + //echo $result->num_rows; return $query->result_array(); - } - + } + } - - + + function addNewsupplier($supplier) { @@ -70,13 +70,13 @@ function addNewsupplier($supplier) $this->db->insert('T_SupplierDetailsN', $supplier); $SID = $this->db->affected_rows(); - if($SID>0) - { - $subQuery = 'select max(SupplierID) as suppid from T_SupplierDetailsN'; - $query = $this->db->query($subQuery); - return $query->result(); - } - //return $SID; + // if($SID>0) + // { + // $subQuery = 'select max(SupplierID) as suppid from T_SupplierDetailsN'; + // $query = $this->db->query($subQuery); + // return $query->result(); + // } + return $SID; } @@ -85,7 +85,7 @@ function addNewsupplier($supplier) * @param number $userId : This is user id * @return array $result : This is user information */ - function getSupplierInfo($supplierID='') + function getSupplierInfo($supplierID='') { $this->db->select('*'); $this->db->from('T_SupplierDetailsN'); @@ -94,8 +94,8 @@ function addNewsupplier($supplier) // print_r($this->db->last_query()); return $query->result(); } - /* This function to get the Supplier Address on respective Supplier ID */ - function GetSupplierAddress($supplierID) + /* This function to get the Supplier Address on respective Supplier ID */ + function GetSupplierAddress($supplierID) { $this->db->select('Address'); $this->db->from('T_SupplierDetailsN'); @@ -103,7 +103,7 @@ function addNewsupplier($supplier) $query = $this->db->get(); return $query->result_array(); } - function UpdateSupplier($supplier, $supplierID) + function UpdateSupplier($supplier, $supplierID) { $this->db->where('SupplierID', $supplierID); $this->db->update('T_SupplierDetailsN', $supplier); @@ -116,8 +116,8 @@ function addNewsupplier($supplier) - - function viewsupplier($supplier, $supplierID) + + function viewsupplier($supplier, $supplierID) { $this->db->where('SupplierID', $supplierID); $this->db->update('T_SupplierDetailsN', $supplier); @@ -134,22 +134,22 @@ function addNewsupplier($supplier) } - function export_excel(){ - - $this->db->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN, + function export_excel(){ + + $this->db->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN, det.PAN,det.CSTNO,det.CSTDate,det.GSTNO,det.GSTRange,det.CollectrateAddress,det.UANumber,det.PaymentTerms,det.PaymentDays,det.PayableAT,emp.firstname ,emp1.firstname as Update_by,,det.IsActive'); - $this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left'); - $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left'); - $this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left'); - $this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left'); + $this->db->join('tbl_users as tbl',' det.createdby = tbl.userid','left'); + $this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left'); + $this->db->join('tbl_users as tbl1',' det.UpdatedBy = tbl1.userid','left'); + $this->db->join('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left'); return $this->db->get('T_SupplierDetailsN as det')->result_array(); - } + } /*SUPPLIER */ /*SUPPLIER TYPE */ - - + + - - } + + } ?> \ No newline at end of file diff --git a/application/views/addsupplier.php b/application/views/addsupplier.php index 32f4a58d..21bc2e2a 100755 --- a/application/views/addsupplier.php +++ b/application/views/addsupplier.php @@ -286,7 +286,7 @@ $(function() {
PAN * - +
TIN* diff --git a/application/views/editSupplier.php b/application/views/editSupplier.php index 3b0db906..005ac0de 100755 --- a/application/views/editSupplier.php +++ b/application/views/editSupplier.php @@ -148,7 +148,7 @@ if(!empty($supplier)) //PAN Validate function validatePAN() { - var reg = /(?=.*[A-Z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Z]).{1,}$/; + var reg = /(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]).{1,}$/; var PAN = $('#panno').val(); @@ -220,7 +220,8 @@ function getValidAlternateNumber() } function validateEmail() { - //var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; + + var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; var email = $('#emailid').val(); @@ -327,7 +328,7 @@ function onlyAlphabets(evt) { Supplier ID
-
+
Supplier Name* @@ -338,7 +339,7 @@ function onlyAlphabets(evt) {
-
+
Alternate Contact Number
@@ -373,7 +374,7 @@ function onlyAlphabets(evt) {
PAN * - +
TIN* @@ -441,7 +442,7 @@ function onlyAlphabets(evt) { Bank Details -
+
Account Number
@@ -454,7 +455,7 @@ function onlyAlphabets(evt) {
Bank Address
-
+ Payment Details