supplierdetails code

This commit is contained in:
venbatechnologies@gmail.com 2017-07-18 19:35:03 +05:30
parent d9251b77bf
commit c06311ba1a
4 changed files with 244 additions and 242 deletions

View File

@ -14,26 +14,26 @@ class supplier extends BaseController
/** /**
* This is default constructor of the class * This is default constructor of the class
*/ */
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->load->model('supplier_model'); $this->load->model('supplier_model');
$this->load->library('form_validation'); $this->load->library('form_validation');
$this->load->library('pagination'); $this->load->library('pagination');
$this->load->library('Excel'); $this->load->library('Excel');
$this->isLoggedIn(); $this->isLoggedIn();
} }
/** /**
* This function used to load the first screen of the user * This function used to load the first screen of the user
*/ */
public function index() public function index()
{ {
$this->global['pageTitle'] = 'Siddharth : Supplier'; $this->global['pageTitle'] = 'Siddharth : Supplier';
$this->loadViews("supplierListing", $this->global, NULL , NULL); $this->loadViews("supplierListing", $this->global, NULL , NULL);
} }
/** /**
* This function is used to load the Supplier list * This function is used to load the Supplier list
*/ */
function supplierListing() function supplierListing()
@ -48,7 +48,7 @@ class supplier extends BaseController
$this->loadViews("supplierListing", $this->global, $data, NULL); $this->loadViews("supplierListing", $this->global, $data, NULL);
} }
/** /**
* This function is used to load the add new supplier */ * This function is used to load the add new supplier */
function addsupplier() function addsupplier()
{ {
@ -61,58 +61,60 @@ 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 * This function is used to check whether PAN already exist or not
*/ */
function CheckPAN() function CheckPAN()
{ {
$id = $this->input->post('id');
$id = $this->input->post('id');
$query = $this->supplier_model->checkPAN($id );
$query = $this->supplier_model->checkPAN($id );
$query = $query[0]['PAN'];
$query = $query[0]['PAN'];
print_r($query);
print_r($query);
}
/* To Check the Pan Number is exists in the database or not for the selected Supplier */ }
function checkPanValidateSupplier() { /* 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'); $SupplierID = $this->input->post('SupplierID');
// echo 'Sup'. $SupplierID ; $PanNo = $this->input->post('panno');
$query = $this->supplier_model->checkPAN($PanNo,$SupplierID); // echo 'Sup'. $SupplierID ;
if (count($query)> 0) $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; $this->form_validation->set_message('checkPanValidateSupplier', 'The Entered PAN Number is already exists in the Database.');
} return false;
else }
{ else
return true; {
} return true;
} }
}
/* To Check the Pan Number is exists in the database or not */
function checkPanValidate() /* To Check the Pan Number is exists in the database or not */
{ function checkPanValidate()
{
$PanNo = $this->input->post('panno'); // alert('validation pan');
$query = $this->supplier_model->checkPAN($PanNo); $PanNo = $this->input->post('panno');
if (count($query)> 0)
{ $query = $this->supplier_model->checkPAN($PanNo);
$this->form_validation->set_message('checkPanValidate', 'The Entered PAN Number is already exists in the Database.'); if (count($query)> 0)
return false; {
} $this->form_validation->set_message('checkPanValidate', 'The Entered PAN Number is already exists in the Database.');
else return false;
{ }
return true; 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
*/ */
function addNewsupplier() 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('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('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('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) if($this->form_validation->run() == FALSE)
{ {
@ -134,14 +136,14 @@ class supplier extends BaseController
} }
else else
{ {
$SupplierName = $this->input->post('SupplierName'); $SupplierName = $this->input->post('SupplierName');
$Address = $this->input->post('Address'); $Address = $this->input->post('Address');
$ContactNumber = $this->input->post('ContactNumber'); $ContactNumber = $this->input->post('ContactNumber');
$AlternateContactNumber = $this->input->post('AlternateContactNumber'); $AlternateContactNumber = $this->input->post('AlternateContactNumber');
$EmailAddress = $this->input->post('emailid'); $EmailAddress = $this->input->post('emailid');
$Exiseregistration = $this->input->post('Exciseregistration'); $Exiseregistration = $this->input->post('Exciseregistration');
$TIN = $this->input->post('TIN'); $TIN = $this->input->post('TIN');
$PAN = $this->input->post('panno'); $PAN = strtoupper($this->input->post('panno'));
$GSTNo = $this->input->post('GSTNo'); $GSTNo = $this->input->post('GSTNo');
$GSTRange = $this->input->post('GSTRange'); $GSTRange = $this->input->post('GSTRange');
$CollectrateAddress = $this->input->post('CollectrateAddress'); $CollectrateAddress = $this->input->post('CollectrateAddress');
@ -149,18 +151,18 @@ class supplier extends BaseController
$PaymentTerms = $this->input->post('PaymentTerms'); $PaymentTerms = $this->input->post('PaymentTerms');
$Payment = $this->input->post('Payment'); $Payment = $this->input->post('Payment');
$PayableAT = $this->input->post('PayableAT'); $PayableAT = $this->input->post('PayableAT');
$CSTNo = $this->input->post('CSTNo'); $CSTNo = $this->input->post('CSTNo');
$CSTDt = $this->input->post('dateofCST'); $CSTDt = $this->input->post('dateofCST');
if($CSTDt != '') if($CSTDt != '')
{ {
$CSTDate = $this->getDateformat($CSTDt); $CSTDate = $this->getDateformat($CSTDt);
} }
else else
{ {
$CSTDate = null; $CSTDate = null;
} }
$EMSNo = $this->input->post('EMSNo'); $EMSNo = $this->input->post('EMSNo');
$TSNo = $this->input->post('TSNo'); $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); $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) if($result > 0)
{ {
redirect('supplierListing','refresh'); redirect('supplierListing','refresh');
echo "<script>alert('New Supplier Created successfully!');</script>"; echo "<script>alert('New Supplier Created successfully!');</script>";
} }
else else
{ {
redirect('supplierListing','refresh'); redirect('supplierListing','refresh');
echo "<script>alert('Supplier Record Not Created!');</script>"; echo "<script>alert('Supplier Record Not Created!');</script>";
} }
} }
} }
function getDateformat($Val) function getDateformat($Val)
{ {
$date = new DateTime($Val); $date = new DateTime($Val);
$retDate = $date->format('Y-m-d H:i:s'); $retDate = $date->format('Y-m-d H:i:s');
return $retDate; return $retDate;
} }
/** /**
* This function is used to edit the Supplier information * This function is used to edit the Supplier information
*/ */
function editsupplier() 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('SupplierName','Supplier Name','trim|required');
$this->form_validation->set_rules('Address','Address','trim|required|'); $this->form_validation->set_rules('Address','Address','trim|required|');
$supplierID = $this->input->post('SupplierID'); $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('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('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('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('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) if($this->form_validation->run() == FALSE)
@ -238,7 +240,7 @@ class supplier extends BaseController
$EmailAddress = $this->input->post('emailid'); $EmailAddress = $this->input->post('emailid');
$Exiseregistration = $this->input->post('Exciseregistration'); $Exiseregistration = $this->input->post('Exciseregistration');
$TIN = $this->input->post('TIN'); $TIN = $this->input->post('TIN');
$PAN = $this->input->post('panno'); $PAN = strtoupper($this->input->post('panno'));
$GSTNo = $this->input->post('GSTNo'); $GSTNo = $this->input->post('GSTNo');
$GSTRange = $this->input->post('GSTRange'); $GSTRange = $this->input->post('GSTRange');
$CollectrateAddress = $this->input->post('CollectrateAddress'); $CollectrateAddress = $this->input->post('CollectrateAddress');
@ -246,29 +248,29 @@ class supplier extends BaseController
$PaymentTerms = $this->input->post('PaymentTerms'); $PaymentTerms = $this->input->post('PaymentTerms');
$Payment = $this->input->post('Payment'); $Payment = $this->input->post('Payment');
//$PayableAT = $this->input->post('PayableAT'); //$PayableAT = $this->input->post('PayableAT');
$UpdatedBy = $this->session->userdata ( 'userId' ); $UpdatedBy = $this->session->userdata ( 'userId' );
$chked = $this->input->post('isactive'); $chked = $this->input->post('isactive');
if( $chked != '') if( $chked != '')
{ {
$IsActive = '1'; $IsActive = '1';
} }
else else
{ {
$IsActive = '0'; $IsActive = '0';
} }
$CSTNo = $this->input->post('CSTNo'); $CSTNo = $this->input->post('CSTNo');
$CSTDt = $this->input->post('dateofCST'); $CSTDt = $this->input->post('dateofCST');
if($CSTDt != '') if($CSTDt != '')
{ {
$CSTDate = $this->getDateformat($CSTDt); $CSTDate = $this->getDateformat($CSTDt);
} }
else else
{ {
$CSTDate = null; $CSTDate = null;
} }
$EMSNo = $this->input->post('EMSNo'); $EMSNo = $this->input->post('EMSNo');
$TSNo = $this->input->post('TSNo'); $TSNo = $this->input->post('TSNo');
@ -283,60 +285,59 @@ class supplier extends BaseController
$rawmaterial =$this->input->post('rawmaterial'); $rawmaterial =$this->input->post('rawmaterial');
$maintanance = $this->input->post('maintanance'); $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); $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); //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); //print_r($supplier);die();
//die();
$result = $this->supplier_model->UpdateSupplier($supplier, $supplierID); $result = $this->supplier_model->UpdateSupplier($supplier, $supplierID);
if($result == True) if($result == True)
{ {
redirect('supplierListing','refresh'); redirect('supplierListing','refresh');
echo "<script>alert('Supplier updated successfully!');</script>"; echo "<script>alert('Supplier updated successfully!');</script>";
} }
else else
{ {
redirect('supplierListing','refresh'); redirect('supplierListing','refresh');
echo "<script>alert('Supplier Record Not updated!');</script>"; echo "<script>alert('Supplier Record Not updated!');</script>";
} }
} }
} }
function viewsupplier($SID = '') function viewsupplier($SID = '')
{ {
$Payment = ''; $Payment = '';
if($SID == '') if($SID == '')
{ {
$supplierID = $_GET['SID']; $supplierID = $_GET['SID'];
$Payment = $_GET['Payment']; $Payment = $_GET['Payment'];
} }
else else
{ {
$supplierID = $SID; $supplierID = $SID;
} }
$data['supplier'] = $this->supplier_model->getSupplierInfo($supplierID); $data['supplier'] = $this->supplier_model->getSupplierInfo($supplierID);
$data['payment'] = $this->supplier_model->getpayment($Payment ); $data['payment'] = $this->supplier_model->getpayment($Payment );
$this->global['pageTitle'] = 'Siddharth : Edit Supplier'; $this->global['pageTitle'] = 'Siddharth : Edit Supplier';
$this->loadViews("editSupplier", $this->global,$data, NULL); $this->loadViews("editSupplier", $this->global,$data, NULL);
} }
/** this function can be use for excel report **/ /** this function can be use for excel report **/
function export_supplierdetails(){ function export_supplierdetails(){
$this->load->library('excel'); $this->load->library('excel');
$this->excel->setActiveSheetIndex(0); $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('A1', 'SupplierID');
$this->excel->getActiveSheet()->setCellValue('B1', 'SupplierName'); $this->excel->getActiveSheet()->setCellValue('B1', 'SupplierName');
$this->excel->getActiveSheet()->setCellValue('C1', 'Address'); $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('B1')->getFont()->setBold(true);
$this->excel->getActiveSheet()->getStyle('C1')->getFont()->setSize(12); $this->excel->getActiveSheet()->getStyle('C1')->getFont()->setSize(12);
$this->excel->getActiveSheet()->getStyle('C1')->getFont()->setBold(true); $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('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('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('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('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('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('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('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('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('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('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('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('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('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('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('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('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('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); $this->excel->getActiveSheet()->getStyle('U1')->getFont()->setBold(true);
@ -412,28 +413,28 @@ class supplier extends BaseController
$i = 2; $i = 2;
$s = 1; $s = 1;
foreach ($exportData as $data) { foreach ($exportData as $data) {
$this->excel->getActiveSheet()->setCellValue('A' . $i,$data['SupplierID']); $this->excel->getActiveSheet()->setCellValue('A' . $i,$data['SupplierID']);
$this->excel->getActiveSheet()->setCellValue('B' . $i,$data['SupplierName']); $this->excel->getActiveSheet()->setCellValue('B' . $i,$data['SupplierName']);
$this->excel->getActiveSheet()->setCellValue('C' . $i,$data['Address']); $this->excel->getActiveSheet()->setCellValue('C' . $i,$data['Address']);
$this->excel->getActiveSheet()->setCellValue('D' . $i,$data['ContactNumber']); $this->excel->getActiveSheet()->setCellValue('D' . $i,$data['ContactNumber']);
$this->excel->getActiveSheet()->setCellValue('E' . $i,$data['AlternateContactNumber']); $this->excel->getActiveSheet()->setCellValue('E' . $i,$data['AlternateContactNumber']);
$this->excel->getActiveSheet()->setCellValue('F' . $i,$data['EmailAddress']); $this->excel->getActiveSheet()->setCellValue('F' . $i,$data['EmailAddress']);
$this->excel->getActiveSheet()->setCellValue('G' . $i,$data['Exiseregistration']); $this->excel->getActiveSheet()->setCellValue('G' . $i,$data['Exiseregistration']);
$this->excel->getActiveSheet()->setCellValue('H' . $i,$data['TIN']); $this->excel->getActiveSheet()->setCellValue('H' . $i,$data['TIN']);
$this->excel->getActiveSheet()->setCellValue('I' . $i,$data['PAN']); $this->excel->getActiveSheet()->setCellValue('I' . $i,$data['PAN']);
$this->excel->getActiveSheet()->setCellValue('J' . $i,$data['CSTNO']); $this->excel->getActiveSheet()->setCellValue('J' . $i,$data['CSTNO']);
$this->excel->getActiveSheet()->setCellValue('K' . $i,$data['CSTDate']); $this->excel->getActiveSheet()->setCellValue('K' . $i,$data['CSTDate']);
$this->excel->getActiveSheet()->setCellValue('L' . $i,$data['GSTNO']); $this->excel->getActiveSheet()->setCellValue('L' . $i,$data['GSTNO']);
$this->excel->getActiveSheet()->setCellValue('M' . $i,$data['GSTRange']); $this->excel->getActiveSheet()->setCellValue('M' . $i,$data['GSTRange']);
$this->excel->getActiveSheet()->setCellValue('N' . $i,$data['CollectrateAddress']); $this->excel->getActiveSheet()->setCellValue('N' . $i,$data['CollectrateAddress']);
$this->excel->getActiveSheet()->setCellValue('O' . $i,$data['UANumber']); $this->excel->getActiveSheet()->setCellValue('O' . $i,$data['UANumber']);
$this->excel->getActiveSheet()->setCellValue('P' . $i,$data['PaymentTerms']); $this->excel->getActiveSheet()->setCellValue('P' . $i,$data['PaymentTerms']);
$this->excel->getActiveSheet()->setCellValue('Q' . $i,$data['PaymentDays']); $this->excel->getActiveSheet()->setCellValue('Q' . $i,$data['PaymentDays']);
$this->excel->getActiveSheet()->setCellValue('R' . $i,$data['PayableAT']); $this->excel->getActiveSheet()->setCellValue('R' . $i,$data['PayableAT']);
$this->excel->getActiveSheet()->setCellValue('S' . $i,$data['firstname']); $this->excel->getActiveSheet()->setCellValue('S' . $i,$data['firstname']);
$this->excel->getActiveSheet()->setCellValue('T' . $i,$data['Update_by']); $this->excel->getActiveSheet()->setCellValue('T' . $i,$data['Update_by']);
$this->excel->getActiveSheet()->setCellValue('U' . $i,$data['IsActive']); $this->excel->getActiveSheet()->setCellValue('U' . $i,$data['IsActive']);
$i++; $i++;
$s++; $s++;
@ -451,8 +452,8 @@ class supplier extends BaseController
} }
function pageNotFound() function pageNotFound()
{ {
$this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found'; $this->global['pageTitle'] = 'Siddharth : 404 - Page Not Found';

View File

@ -3,7 +3,7 @@
class supplier_model extends CI_Model class supplier_model extends CI_Model
{ {
/** /**
* This function is used to get the user listing count * This function is used to get the user listing count
* @param string $searchText : This is optional search text * @param string $searchText : This is optional search text
* @param number $page : This is pagination offset * @param number $page : This is pagination offset
@ -20,7 +20,7 @@ class supplier_model extends CI_Model
$result = $query->result(); $result = $query->result();
return $result; return $result;
} }
/** /**
* This function used to get user information by id * This function used to get user information by id
* @param number $userId : This is user id * @param number $userId : This is user id
* @return array $result : This is user information * @return array $result : This is user information
@ -29,14 +29,14 @@ class supplier_model extends CI_Model
function getpayment($Configvalue = '') function getpayment($Configvalue = '')
{ {
$ConfigID = 'C009'; $ConfigID = 'C009';
$this->db->select('ConfigValue'); $this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails'); $this->db->from('T_ConfigDetails');
$this->db->where('Config_id ',$ConfigID ); $this->db->where('Config_id ',$ConfigID );
if ($Configvalue!= '') if ($Configvalue!= '')
{ {
$this->db->where('ConfigValue !=',$Configvalue ); $this->db->where('ConfigValue !=',$Configvalue );
} }
$query = $this->db->get(); $query = $this->db->get();
return $query->result(); return $query->result();
@ -45,24 +45,24 @@ class supplier_model extends CI_Model
function checkPAN($PAN,$SID = '') function checkPAN($PAN,$SID = '')
{ {
$this->db->select('PAN'); $this->db->select('PAN');
$this->db->from('T_SupplierDetailsN'); $this->db->from('T_SupplierDetailsN');
$this->db->where('PAN',$PAN); $this->db->where('PAN',$PAN);
if ($SID != '') if ($SID != '')
{ {
$this->db->where('SupplierID !=',$SID); $this->db->where('SupplierID !=',$SID);
} }
$query = $this->db->get(); $query = $this->db->get();
//print_r($this->db->last_query()); //print_r($this->db->last_query());
if ($query->num_rows > 0) { if ($query->num_rows > 0) {
//echo $result->num_rows; //echo $result->num_rows;
return $query->result_array(); return $query->result_array();
} }
} }
function addNewsupplier($supplier) function addNewsupplier($supplier)
{ {
@ -70,13 +70,13 @@ function addNewsupplier($supplier)
$this->db->insert('T_SupplierDetailsN', $supplier); $this->db->insert('T_SupplierDetailsN', $supplier);
$SID = $this->db->affected_rows(); $SID = $this->db->affected_rows();
if($SID>0) // if($SID>0)
{ // {
$subQuery = 'select max(SupplierID) as suppid from T_SupplierDetailsN'; // $subQuery = 'select max(SupplierID) as suppid from T_SupplierDetailsN';
$query = $this->db->query($subQuery); // $query = $this->db->query($subQuery);
return $query->result(); // return $query->result();
} // }
//return $SID; return $SID;
} }
@ -85,7 +85,7 @@ function addNewsupplier($supplier)
* @param number $userId : This is user id * @param number $userId : This is user id
* @return array $result : This is user information * @return array $result : This is user information
*/ */
function getSupplierInfo($supplierID='') function getSupplierInfo($supplierID='')
{ {
$this->db->select('*'); $this->db->select('*');
$this->db->from('T_SupplierDetailsN'); $this->db->from('T_SupplierDetailsN');
@ -94,8 +94,8 @@ function addNewsupplier($supplier)
// print_r($this->db->last_query()); // print_r($this->db->last_query());
return $query->result(); return $query->result();
} }
/* This function to get the Supplier Address on respective Supplier ID */ /* This function to get the Supplier Address on respective Supplier ID */
function GetSupplierAddress($supplierID) function GetSupplierAddress($supplierID)
{ {
$this->db->select('Address'); $this->db->select('Address');
$this->db->from('T_SupplierDetailsN'); $this->db->from('T_SupplierDetailsN');
@ -103,7 +103,7 @@ function addNewsupplier($supplier)
$query = $this->db->get(); $query = $this->db->get();
return $query->result_array(); return $query->result_array();
} }
function UpdateSupplier($supplier, $supplierID) function UpdateSupplier($supplier, $supplierID)
{ {
$this->db->where('SupplierID', $supplierID); $this->db->where('SupplierID', $supplierID);
$this->db->update('T_SupplierDetailsN', $supplier); $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->where('SupplierID', $supplierID);
$this->db->update('T_SupplierDetailsN', $supplier); $this->db->update('T_SupplierDetailsN', $supplier);
@ -134,22 +134,22 @@ function addNewsupplier($supplier)
} }
function export_excel(){ function export_excel(){
$this->db->select('det.SupplierID,SupplierName,det.Address,det.ContactNumber,det.AlternateContactNumber,det.EmailAddress,det.Exiseregistration,det.TIN, $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'); 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('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('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('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('T_Employee_Details as emp1', 'emp1.empid=tbl1.empid','left');
return $this->db->get('T_SupplierDetailsN as det')->result_array(); return $this->db->get('T_SupplierDetailsN as det')->result_array();
} }
/*SUPPLIER */ /*SUPPLIER */
/*SUPPLIER TYPE */ /*SUPPLIER TYPE */
} }
?> ?>

View File

@ -286,7 +286,7 @@ $(function() {
<div class="col-md-12" style="padding:0px;"> <div class="col-md-12" style="padding:0px;">
<div class="col-md-3 pad"> <div class="col-md-3 pad">
<span for="PAN">PAN</span> <span class="badge">*</span> <span for="PAN">PAN</span> <span class="badge">*</span>
<input type="text" id="panno" maxlength="10" pattern="(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]).{1,}" style="text-transform:uppercase;" name="panno" onchange="validatePAN();" requried class="form-control" title="Please Enter 5 Character and 4 digit numbers and 1 Character format"> <input type="text" id="panno" maxlength="10" pattern="(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]).{1,}" name="panno" onchange="validatePAN();" requried class="form-control" title="Please Enter 5 Character and 4 digit numbers and 1 Character format (Character should be in caps)">
</div> </div>
<div class="col-md-3 pad"> <div class="col-md-3 pad">
<span for="TIN">TIN</span><span class="badge">*</span> <span for="TIN">TIN</span><span class="badge">*</span>

View File

@ -148,7 +148,7 @@ if(!empty($supplier))
//PAN Validate //PAN Validate
function validatePAN() { 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(); var PAN = $('#panno').val();
@ -220,7 +220,8 @@ function getValidAlternateNumber()
} }
function validateEmail() { 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(); var email = $('#emailid').val();
@ -327,7 +328,7 @@ function onlyAlphabets(evt) {
<span for="SupplierID">Supplier ID</span> <span for="SupplierID">Supplier ID</span>
<input type="text" name="SupplierID" id="SupplierID" class="form-control" readonly value="<?php echo $SupplierID;?>"> <input type="text" name="SupplierID" id="SupplierID" class="form-control" readonly value="<?php echo $SupplierID;?>">
</div> </div>
<div class="col-md-4 pad"> <div class="col-md-3 pad">
<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 value="<?php echo $SupplierName;?>"> <input type="text" name="SupplierName" onkeypress="return onlyAlphabets(event);" maxlength="100" id="supplierName" class="form-control" required value="<?php echo $SupplierName;?>">
@ -338,7 +339,7 @@ function onlyAlphabets(evt) {
<input type="text" name="ContactNumber" onchange="return getContactNumberValidation();" onkeypress="return event.charCode >= 48 && event.charCode <= 57" id="ContactNumber" required pattern="(.){10,10}" maxlength="10" class="form-control" value="<?php echo $ContactNumber;?>" title="Please Enter 10 digit Number"> <input type="text" name="ContactNumber" onchange="return getContactNumberValidation();" onkeypress="return event.charCode >= 48 && event.charCode <= 57" id="ContactNumber" required pattern="(.){10,10}" maxlength="10" class="form-control" value="<?php echo $ContactNumber;?>" title="Please Enter 10 digit Number">
</div> </div>
<div class="col-md-2 pad"> <div class="col-md-3 pad">
<span for="AlternateContactNumber">Alternate Contact Number</span> <span for="AlternateContactNumber">Alternate Contact Number</span>
<input type="text" name="AlternateContactNumber" onchange="return getValidAlternateNumber();" onkeypress="return event.charCode >= 48 && event.charCode <= 57" id="AlternateContactNumber" pattern="(.){10,10}" maxlength="10" class="form-control" value="<?php echo $AlternateContactNumber;?>" title="Please Enter 10 digit Number"> <input type="text" name="AlternateContactNumber" onchange="return getValidAlternateNumber();" onkeypress="return event.charCode >= 48 && event.charCode <= 57" id="AlternateContactNumber" pattern="(.){10,10}" maxlength="10" class="form-control" value="<?php echo $AlternateContactNumber;?>" title="Please Enter 10 digit Number">
</div> </div>
@ -373,7 +374,7 @@ function onlyAlphabets(evt) {
<div class="col-md-3 pad"> <div class="col-md-3 pad">
<span for="PAN">PAN</span> <span class="badge">*</span> <span for="PAN">PAN</span> <span class="badge">*</span>
<input type="text" id="panno" maxlength="10" name="panno" required pattern="(?=.*[A-Z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Z]).{1,}" onchange="validatePAN();" class="form-control" value="<?php echo $PAN;?>" style="text-transform:uppercase;" title="Please Enter 5 Character and 4 digit numbers and 1 Character format"> <input type="text" id="panno" maxlength="10" name="panno" required pattern="(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]}).{1,}" 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)">
</div> </div>
<div class="col-md-3 pad"> <div class="col-md-3 pad">
<span for="TIN">TIN</span><span class="badge">*</span> <span for="TIN">TIN</span><span class="badge">*</span>
@ -441,7 +442,7 @@ function onlyAlphabets(evt) {
<legend>Bank Details</legend> <legend>Bank Details</legend>
<!-- Text input--> <!-- Text input-->
<div class="col-md-12">
<div class="col-md-3"><span>Account Number</span> <div class="col-md-3"><span>Account Number</span>
<input type="text" id="accno" maxlength="20" name="accno" value="<?php echo $accno;?>" class="form-control"> <input type="text" id="accno" maxlength="20" name="accno" value="<?php echo $accno;?>" class="form-control">
</div> </div>
@ -454,7 +455,7 @@ function onlyAlphabets(evt) {
<div class="col-md-3"><span>Bank Address</span> <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" > <input type="text" id="bankaddress" name="bankaddress" value="<?php echo $bankaddress;?>" class="form-control" maxlength="200" >
</div> </div>
</div>
<!-- Text input--> <!-- Text input-->
<legend>Payment Details</legend> <legend>Payment Details</legend>