diff --git a/application/controllers/Employeedetails.php b/application/controllers/Employeedetails.php
deleted file mode 100644
index b907f137..00000000
--- a/application/controllers/Employeedetails.php
+++ /dev/null
@@ -1,556 +0,0 @@
-load->model('employeedetails_model');
- $this->isLoggedIn();
- }
- /**
- * This function used to load the first screen of the user
- */
- public function index()
- {
- $this->global['pageTitle'] = 'Siddharth : Employee Details';
-
- $this->loadViews("employeeListing", $this->global, NULL , NULL);
- }
-
- /**
- * This function is used to load the Employee details
- */
- function employeeListing()
- {
- if($this->isAdmin() == TRUE)
- {
- $this->loadThis();
- }
- else
- {
-
- $this->load->model('Employeedetails_model');
-
- $searchText = $this->input->post('searchText');
- $data['searchText'] = $searchText;
-
- $this->load->library('pagination');
-
- $count = $this->Employeedetails_model->employeeListingCount($searchText);
-
-
- $returns = $this->paginationCompress ( "employeeListing/", $count[0]['Count'], 10 );
-
- $data['userRecords'] = $this->employeedetails_model->employeeListing($searchText, $returns["page"], $returns["segment"]);
-
- $this->global['pageTitle'] = 'Siddharth : Employee Listing';
-
- $this->loadViews("employeeListing", $this->global, $data, NULL);
- }
- }
- /*
- Validation for Gender status Dropdown
- */
- function Gender_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Gender_validate', 'Please Select Gender.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
-/*
- Validation for Martial status Dropdown
- */
- function Martial_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Martial_validate', 'Please Select Martial status.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
-/*
- Validation for BloodGroup Dropdown
- */
- function Blood_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Blood_validate', 'Please Select Blood Group.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
- /*
- Validation for Qualification Dropdown
- */
- function select_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('select_validate', 'Please Select Educational Qualification.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
-/*
- Validation for Department Dropdown
- */
- function Dep_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Dep_validate', 'Please Select Department.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
-/*
- Validation for Desigination Dropdown
- */
- function Des_validate($selectValue)
-{
- //echo 'select_validate method called';
- // 'none' is the first option and the text says something like "-Choose one-"
- if($selectValue == '-1')
- {
- $this->form_validation->set_message('Des_validate', 'Please Select Desigination.');
- return false;
- }
- else // user picked something
- {
- return true;
- }
-}
- /**
- * This function is used to save the new Employee form in the database
- */
-
- function AddNewEmployee()
- {
- if($this->isAdmin() == TRUE)
- {
- $this->loadThis();
- }
- else
- {
- $this->load->library('form_validation');
-
- $this->form_validation->set_rules('ContactNumber', 'ContactNumber', 'trim|required|min_length[10]|max_length[10]');
- $this->form_validation->set_rules('emailid', 'emailid', 'trim|required|valid_email');
- $this->form_validation->set_rules('gender', 'gender', 'callback_Gender_validate');
- $this->form_validation->set_rules('MartialStatus', 'MartialStatus', 'callback_Martial_validate');
-
- $this->form_validation->set_rules('bloodgroup', 'bloodgroup', 'callback_Blood_validate');
-
- $this->form_validation->set_rules('emergencycontactnumber', 'emergencycontactnumber', 'trim|required|min_length[10]|max_length[10]');
-
- $this->form_validation->set_rules('desigination', 'Desigination', 'callback_Des_validate');
- $this->form_validation->set_rules('departmentname', 'departmentname', 'callback_Dep_validate');
- $this->form_validation->set_rules('eduqualifaction', 'eduqualifaction', 'callback_select_validate');
- $this->form_validation->set_rules('referrercontno', 'referrercontno', 'trim|min_length[10]|max_length[10]');
- $this->form_validation->set_rules('aadharno', 'aadharno', 'trim|min_length[12]|max_length[12]');
- $this->form_validation->set_rules('panno', 'panno', 'trim|min_length[10]|max_length[10]');
- $this->form_validation->set_rules('passportno', 'passportno', 'trim|min_length[8]|max_length[8]');
- $this->form_validation->set_rules('accountno', 'accountno', 'trim|min_length[15]|max_length[15]');
-
-
- if($this->form_validation->run() == FALSE)
- {
- $this->addemployee();
- //echo 'Validate method called';
- }
- else
- {
- //echo 'Validate not method called';
- $Picture = $this->add();
-
- $FirstName = $this->input->post('FirstName');
- $LastName = $this->input->post('LastName');
- $FatherName = $this->input->post('FatherName');
- $DateofBirth = $this->input->post('DateofBirth');
- $ContactNumber = $this->input->post('ContactNumber');
- $EmailId = $this->input->post('emailid');
- $Gender = $this->input->post('gender');
- $MartialStatus = $this->input->post('MartialStatus');
- $BloodGroup = $this->input->post('bloodgroup');
- $CurrentAddress = $this->input->post('currentaddress');
- $permanentaddress = $this->input->post('permanentaddress');
- $emergencycontactname = $this->input->post('emergencycontactname');
- $emergencycontactnumber = $this->input->post('emergencycontactnumber');
- $desigination = $this->input->post('desigination');
- $departmentCode = $this->input->post('departmentname');
- $dateofjoining = $this->input->post('dateofjoining');
- $Previousexperience = $this->input->post('Previousexperience');
- $eduqualifaction = $this->input->post('eduqualifaction');
- $addqualification = $this->input->post('addqualification');
- $referredby = $this->input->post('referredby');
- $referrercontno = $this->input->post('referrercontno');
- $accountno = $this->input->post('accountno');
- $ifsccode = $this->input->post('ifsccode');
- $bankbranchname = $this->input->post('bankbranchname');
- $bankaddress = $this->input->post('bankaddress');
- $aadharno = $this->input->post('aadharno');
- $panno = $this->input->post('panno');
- $passportno = $this->input->post('passportno');
- $ValidTill = $this->input->post('ValidTill');
- $addinfo = $this->input->post('addinfo');
- $IsActive = '1';
- $createdby = $this->session->userdata ( 'userId' );
-
-
- $DOB = $this->getDateformat($DateofBirth);
- $DOJ = $this->getDateformat($dateofjoining);
- if($ValidTill != '')
- {
- $Valid = $this->getDateformat($ValidTill);
- }
- else
- {
- $Valid = null;
- }
-
- //echo $DOB;
- $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender,'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId,'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ,'PreviousYearsOfExp'=>$Previousexperience,'Designation'=>$desigination,'Departmentcode'=>$departmentCode,'PresentAddress'=>$CurrentAddress,'PermanentAddress'=>$permanentaddress,'EmergencyContactName'=>$emergencycontactname,'EmergencyContactNumber'=>$emergencycontactnumber,'Edu_Qualification'=>$eduqualifaction,'Additional_Qualification'=>$addqualification,'AadharNo'=>$aadharno,'PANNo'=>$panno,'BankAccountNo'=>$accountno,'IFSCCode'=>$ifsccode,'BankBranchName'=>$bankbranchname,'BankAddress'=>$bankaddress,'PassportNo'=>$passportno,'Passport_Valid_till'=>$Valid,'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'CreatedBy'=>$createdby);
-
- $this->load->model('Employeedetails_model');
- $result = $this->Employeedetails_model->addNewemployee($Employee);
-
- if($result > 0)
- {
- echo "";
- // $this->session->set_flashdata('Success', 'New Employee created successfully!');
- redirect('employeeListing','refresh');
- }
- else
- {
- echo "";
- $this->session->set_flashdata('Error', 'New Employee details not saved');
- redirect('employeeListing','refresh');
- }
-
- }
- }
- }
-
- function getDateformat($Val)
- {
- $date = new DateTime($Val);
- $retDate = $date->format('Y-m-d H:i:s');
- return $retDate;
- }
-
- /**
- * This function is used to load the add new Employee form with dropdown values */
- function addemployee()
- {
- if($this->isAdmin() == TRUE)
- {
- $this->loadThis();
- }
- else
- {
- $this->load->model('employeedetails_model');
- $GenderConfigID = 'C013';
- $MartialConfigID = 'C012';
- $QualificationConfigID = 'C014';
- $DesignationConfigID = 'C010';
- $BloodGroupConfigID = 'C011';
-
- $data['Gender'] = $this->employeedetails_model->getConfigValue($GenderConfigID);
- $data['Martial'] = $this->employeedetails_model->getConfigValue($MartialConfigID);
- $data['Qualification'] = $this->employeedetails_model->getConfigValue($QualificationConfigID);
- $data['Designation'] = $this->employeedetails_model->getConfigValue($DesignationConfigID);
- $data['BloodGroup'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID);
-
- $data['Department'] = $this->employeedetails_model->getDepartment();
- $this->global['pageTitle'] = 'Siddharth : Add New Employee';
- $this->loadViews("addemployee", $this->global, $data, NULL);
- }
- }
- /**
- * This function is used to check whether the Employee is existing in the database or not */
- function CheckEmail()
- {
- $id = $this->input->post('id');
- $this->load->model('employeedetails_model');
- $query = $this->employeedetails_model->checkMailExists($id );
-
- $query = $query[0]['EmailId'];
- print_r($query);
-
- }
- function pageNotFound()
- {
- $this->global['pageTitle'] = 'CodeInsect : 404 - Page Not Found';
-
- $this->loadViews("404", $this->global, NULL, NULL);
- }
-
- function add(){
-
-
- $picture = '';
- //Check whether user upload picture
- if(!empty($_FILES['photo']['name']))
- {
-
- $config['upload_path'] = 'uploads/images/';
- $config['allowed_types'] = 'jpg|jpeg|png|gif';
- $config['file_name'] = $_FILES['photo']['name'];
-
- //Load upload library and initialize configuration
- $this->load->library('upload',$config);
- $this->upload->initialize($config);
-
- if($this->upload->do_upload('photo'))
- {
- $uploadData = $this->upload->data();
- $picture = $uploadData['file_name'];
- }
- else
- {
- $error = array('error' => $this->upload->display_errors());
- $picture = '';
- }
- }
- else
- {
- $picture = '';
- }
-
- return $picture ;
- }
-
- function ViewEmployee($EmpNO='')
- {
- if($this->isAdmin() == TRUE)
- {
- $this->loadThis();
- }
- else
- {
- if($EmpNO == '')
- {
- $EmpID = $_GET['EmpID'];
- }
- else
- {
-
- $EmpID = $EmpNO; }
-
- $GenderConfigID = 'C013';
- $MartialConfigID = 'C012';
- $QualificationConfigID = 'C014';
- $DesignationConfigID = 'C010';
- $BloodGroupConfigID = 'C011';
- $this->load->model('employeedetails_model');
- $data['GenderList'] = $this->employeedetails_model->getConfigValue($GenderConfigID);
- $data['MartialList'] = $this->employeedetails_model->getConfigValue($MartialConfigID);
- $data['QualificationList'] = $this->employeedetails_model->getConfigValue($QualificationConfigID);
- $data['DesignationList'] = $this->employeedetails_model->getConfigValue($DesignationConfigID);
- $data['BloodGroupList'] = $this->employeedetails_model->getConfigValue($BloodGroupConfigID);
-
- $data['DepartmentList'] = $this->employeedetails_model->getDepartment();
- $data['EmpDetails'] = $this->employeedetails_model->viewemployee($EmpID);
- $this->global['pageTitle'] = 'Siddharth : View Employee';
-
- $this->loadViews("editEmployee", $this->global, $data, NULL);
-
- }
- }
- /* To Check the email exists in the database or not for the employee*/
- function checkMailEmp()
- {
- $Empid = $this->input->post('employeeid');
- $EmailId = $this->input->post('emailid');
-
- $this->load->model('employeedetails_model');
- $query = $this->employeedetails_model->checkMailExists($EmailId, $Empid);
- if (count($query)> 0)
- {
- $this->form_validation->set_message('checkMailEmp', 'The Entered Email id is exists in the Database.');
- return false;
- }
- else
- {
- return true;
- }
- }
- /* To Update the employee details*/
- function UpdateEmployee()
- {
- if($this->isAdmin() == TRUE)
- {
- $this->loadThis();
- }
- else
- {
- $EmpId = $this->input->post('employeeid');
- $this->load->library('form_validation');
-
- $this->form_validation->set_rules('ContactNumber', 'ContactNumber', 'trim|required|min_length[10]|max_length[10]');
- $this->form_validation->set_rules('emailid', 'emailid', 'trim|required|valid_email|callback_checkMailEmp');
- $this->form_validation->set_rules('gender', 'gender', 'callback_Gender_validate');
- $this->form_validation->set_rules('MartialStatus', 'MartialStatus', 'callback_Martial_validate');
-
- $this->form_validation->set_rules('bloodgroup', 'bloodgroup', 'callback_Blood_validate');
-
- $this->form_validation->set_rules('emergencycontactnumber', 'emergencycontactnumber', 'trim|required|min_length[10]|max_length[10]');
-
- $this->form_validation->set_rules('desigination', 'Desigination', 'callback_Des_validate');
- $this->form_validation->set_rules('departmentname', 'departmentname', 'callback_Dep_validate');
- $this->form_validation->set_rules('eduqualifaction', 'eduqualifaction', 'callback_select_validate');
- $this->form_validation->set_rules('referrercontno', 'referrercontno', 'trim|min_length[10]|max_length[10]');
- $this->form_validation->set_rules('aadharno', 'aadharno', 'trim|min_length[12]|max_length[12]');
- $this->form_validation->set_rules('panno', 'panno', 'trim|min_length[10]|max_length[10]');
- $this->form_validation->set_rules('passportno', 'passportno', 'trim|min_length[8]|max_length[8]');
- $this->form_validation->set_rules('accountno', 'accountno', 'trim|min_length[15]|max_length[15]');
-
- if($this->form_validation->run() == FALSE)
- {
- $this->ViewEmployee($EmpId);
-
- }
- else
- {
-
- $this->load->model('Employeedetails_model');
- $EmpId = $this->input->post('employeeid');
- $PictureName = $this->input->post('Image');
-
- if ($PictureName != '')
- {
- //echo 'Exists';
- $Picture = $PictureName;
- }
- else
- {
- //echo 'Not Exists';
- $Picture = $this->add();
- }
- //echo $Picture;
-
- $FirstName = $this->input->post('FirstName');
- $LastName = $this->input->post('LastName');
- $FatherName = $this->input->post('FatherName');
- $DateofBirth = $this->input->post('DateofBirth');
- $ContactNumber = $this->input->post('ContactNumber');
- $EmailId = $this->input->post('emailid');
- $Gender = $this->input->post('gender');
- $MartialStatus = $this->input->post('MartialStatus');
- $BloodGroup = $this->input->post('bloodgroup');
- $CurrentAddress = $this->input->post('currentaddress');
- $permanentaddress = $this->input->post('permanentaddress');
- $emergencycontactname = $this->input->post('emergencycontactname');
- $emergencycontactnumber = $this->input->post('emergencycontactnumber');
- $desigination = $this->input->post('desigination');
- $departmentCode = $this->input->post('departmentname');
- $dateofjoining = $this->input->post('dateofjoining');
- $Previousexperience = $this->input->post('Previousexperience');
- $eduqualifaction = $this->input->post('eduqualifaction');
- $addqualification = $this->input->post('addqualification');
- $referredby = $this->input->post('referredby');
- $referrercontno = $this->input->post('referrercontno');
- $accountno = $this->input->post('accountno');
- $ifsccode = $this->input->post('ifsccode');
- $bankbranchname = $this->input->post('bankbranchname');
- $bankaddress = $this->input->post('bankaddress');
- $aadharno = $this->input->post('aadharno');
- $panno = $this->input->post('panno');
- $passportno = $this->input->post('passportno');
- $ValidTill = $this->input->post('ValidTill');
- $addinfo = $this->input->post('addinfo');
-
- $chked = $this->input->post('isactive');
- // echo 'chkvalue'. $chked ;
- if( $chked != '')
- {
- $IsActive = '1';
- }
- else
- {
- $IsActive = '0';
- }
- // echo 'chkvalue'. $IsActive ;
- $UpdatedBY = $this->session->userdata ( 'userId' );
-
-
- $DOB = $this->getDateformat($DateofBirth);
- $DOJ = $this->getDateformat($dateofjoining);
- if($ValidTill != '')
- {
- $Valid = $this->getDateformat($ValidTill);
- }
- else
- {
- $Valid = null;
- }
-
- //echo $DOB;
- $Employee = array('FirstName'=>$FirstName, 'LastName'=>$LastName,'FatherName'=>$FatherName,'Gender'=>$Gender,'DateofBirth'=>$DOB,'ContactNumber'=>$ContactNumber,'EmailId'=>$EmailId,'BloodGroup'=>$BloodGroup,'MartialStatus'=>$MartialStatus,'DateofJoining'=>$DOJ,'PreviousYearsOfExp'=>$Previousexperience,'Designation'=>$desigination,'Departmentcode'=>$departmentCode,'PresentAddress'=>$CurrentAddress,'PermanentAddress'=>$permanentaddress,'EmergencyContactName'=>$emergencycontactname,'EmergencyContactNumber'=>$emergencycontactnumber,'Edu_Qualification'=>$eduqualifaction,'Additional_Qualification'=>$addqualification,'AadharNo'=>$aadharno,'PANNo'=>$panno,'BankAccountNo'=>$accountno,'IFSCCode'=>$ifsccode,'BankBranchName'=>$bankbranchname,'BankAddress'=>$bankaddress,'PassportNo'=>$passportno,'Passport_Valid_till'=>$Valid,'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'UpdatedBY'=>$UpdatedBY);
-
-
- $result = $this->Employeedetails_model->UpdateEmployee($Employee,$EmpId);
-
- if($result > 0)
- {
- echo "";
- // $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!');
- redirect('employeeListing','refresh');
- }
- else
- {
- echo "";
- $this->session->set_flashdata('Error', $EmpId.'Employee details not saved');
- redirect('employeeListing','refresh');
- }
-
- // redirect('employeeListing');
- }
- }
- }
-}
-
-?>
\ No newline at end of file
diff --git a/application/controllers/supplier.php b/application/controllers/supplier.php
index c3f4ee60..52bc5039 100644
--- a/application/controllers/supplier.php
+++ b/application/controllers/supplier.php
@@ -3,11 +3,11 @@
require APPPATH . '/libraries/BaseController.php';
/**
- * Class : purchaseorder (PurchaseorderController)
+ * Class : Supplier Controller (supplier)
* User Class to control all user related operations.
- * @author : VenbaMail Mali
+ * @author : Gandhimathi
* @version : 1.1
- * @since : 15 Feb 2016
+ * @since : 12 Apr 2017
*/
class supplier extends BaseController
{
@@ -18,6 +18,8 @@ class supplier extends BaseController
{
parent::__construct();
$this->load->model('supplier_model');
+ $this->load->library('form_validation');
+ $this->load->library('pagination');
$this->isLoggedIn();
}
/**
@@ -39,17 +41,16 @@ class supplier extends BaseController
$this->load->model('supplier_model');
$searchText = $this->input->post('searchText');
- $data['searchText'] = $searchText;
-
- $this->load->library('pagination');
+ $data['searchText'] = $searchText;
+
$count = $this->supplier_model->supplierListingCount($searchText);
- $returns = $this->paginationCompress ( "supplierListing/", $count, 5 );
+ $returns = $this->paginationCompress ( "supplierListing/", $count, 10 );
$data['userRecords'] = $this->supplier_model->supplierListing($searchText, $returns["page"], $returns["segment"]);
- $this->global['pageTitle'] = 'Siddharth : Supplier Listing';
+ $this->global['pageTitle'] = 'Siddharth Industries : Supplier Listing';
$this->loadViews("supplierListing", $this->global, $data, NULL);
@@ -58,7 +59,7 @@ class supplier extends BaseController
* This function is used to load the add new supplier */
function addsupplier()
{
- $this->load->model('supplier_model');
+
$data['payment'] = $this->supplier_model->getpayment();
//$data['users'] = $this->purchaseorder_model->getusers();
@@ -70,58 +71,72 @@ class supplier extends BaseController
/**
* This function is used to check whether PAN already exist or not
*/
-
-
function CheckPAN()
{
- $id = $this->input->post('id');
-
- $this->load->model('supplier_model');
+ $id = $this->input->post('id');
$query = $this->supplier_model->checkPAN($id );
-
- // $result = array_shift($result);
- $query = $query[0]['PAN'];
-
-
- print_r($query);
-
- //return $PAN;
+ $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;
+ }
+ }
/**
- * This function is used to add new user to the system
+ * This function is used to add new Supplier to the system
*/
function addNewsupplier()
{
- $this->load->library('form_validation');
-
- $SupplierID = $this->input->post('SupplierID');
-
+
$this->form_validation->set_rules('SupplierName','Supplier Name','trim|required');
$this->form_validation->set_rules('Address','Address','trim|required|');
- $this->form_validation->set_rules('ContactNumber','Contact Number','trim|required|numeric');
- $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim|required|numeric');
+ $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('EmailAddress','Email Address|valid_email|xss_clean|max_length[128]|required');
- $this->form_validation->set_rules('Exiseregistration','Exiseregistration','trim|required');
- $this->form_validation->set_rules('TIN','TIN','trim|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('PAN', 'PAN', 'trim|required');
- $this->form_validation->set_rules('GSTNo','GST No','trim|required');
- $this->form_validation->set_rules('GSTRange','GST Range','trim|required');
- $this->form_validation->set_rules('CollectrateAddress','CollectrateAddress','trim|required');
- $this->form_validation->set_rules('UANumber','UANumber','trim|required');
- $this->form_validation->set_rules('PaymentTerms','PaymentTerms','trim|required');
- $this->form_validation->set_rules('PaymentDays','PaymentTerms','trim|required');
- $this->form_validation->set_rules('PayableAT','PayableAT','trim|required');
-
if($this->form_validation->run() == FALSE)
{
@@ -129,166 +144,134 @@ class supplier extends BaseController
}
else
{
- $SupplierName = ucwords(strtolower($this->input->post('SupplierName')));
- $Address = $this->input->post('Address');
-
+ $SupplierName = $this->input->post('SupplierName');
+ $Address = $this->input->post('Address');
$ContactNumber = $this->input->post('ContactNumber');
$AlternateContactNumber = $this->input->post('AlternateContactNumber');
- $EmailAddress = $this->input->post('EmailAddress');
- $Exiseregistration = $this->input->post('Exiseregistration');
+ $EmailAddress = $this->input->post('emailid');
+ $Exiseregistration = $this->input->post('Exciseregistration');
$TIN = $this->input->post('TIN');
- $PAN = $this->input->post('PAN');
+ $PAN = $this->input->post('panno');
$GSTNo = $this->input->post('GSTNo');
$GSTRange = $this->input->post('GSTRange');
$CollectrateAddress = $this->input->post('CollectrateAddress');
$UANumber = $this->input->post('UANumber');
$PaymentTerms = $this->input->post('PaymentTerms');
- $PaymentDays = $this->input->post('PaymentDays');
+ $Payment = $this->input->post('Payment');
$PayableAT = $this->input->post('PayableAT');
- $Createdby = $this->input->post('Createdby');
+ $Createdby = $this->session->userdata ( 'userId' );
+ $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,'Createdby'=>$Createdby);
-
- $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'=>$PaymentDays,'PayableAT'=>$PayableAT,'Createdby'=>$Createdby,'createdDate'=>date('Y-m-d H:i:sa'));
-
- $this->load->model('supplier_model');
- $result = $this->supplier_model->addNewsupplier($supplier);
- echo $supplier;
+ $result = $this->supplier_model->addNewsupplier($supplier);
+
if($result > 0)
{
- $this->session->set_flashdata('success', 'New Supplier created successfully');
+ // redirect('supplierListing','refresh');
+ echo "";
}
else
{
- $this->session->set_flashdata('error', 'Supplier Not Create');
+ // redirect('supplierListing','refresh');
+ echo "";
}
-
- redirect('supplierListing');
}
- }
- /**
- * This function is used load user edit information
- * @param number $userId : Optional : This is user id
- */
- function editOldsupplier($supplierID = NULL)
- {
-
-
-
- //$data['SupplierName'] = $this->purchaseorder_model->getSupplierName();
- $data['supplier'] = $this->supplier_model->getUserInfo($supplierID);
- $data['payment'] = $this->supplier_model->getpayment();
- $this->global['pageTitle'] = 'Siddharth : Edit Supplier';
-
- $this->loadViews("editOldsupplier", $this->global,$data, NULL);
-
}
/**
- * This function is used to edit the user information
+ * This function is used to edit the Supplier information
*/
function editsupplier()
- {
-
-
-
-
-
-
- $this->load->library('form_validation');
-
- $supplierID = $this->input->post('supplierID');
-
- $this->form_validation->set_rules('SupplierName','Supplier Name','trim');
+ {
+ $this->form_validation->set_rules('SupplierName','Supplier Name','trim|required');
$this->form_validation->set_rules('Address','Address','trim|required|');
- $this->form_validation->set_rules('ContactNumber','Contact Number','trim||numeric');
- $this->form_validation->set_rules('AlternateContactNumber','Alternate Contact Number','trim||numeric');
- $this->form_validation->set_rules('EmailAddress','Email Address|valid_email|xss_clean|max_length[128]');
- $this->form_validation->set_rules('Exiseregistration','Exiseregistration','trim|required');
- $this->form_validation->set_rules('TIN','TIN','trim|required');
- $this->form_validation->set_rules('PAN','PAN','required');
- $this->form_validation->set_rules('GSTNo','GST No','trim|required');
- $this->form_validation->set_rules('GSTRange','GST Range','trim|required');
- $this->form_validation->set_rules('CollectrateAddress','CollectrateAddress','trim|required');
- $this->form_validation->set_rules('UANumber','UANumber','trim|required');
- $this->form_validation->set_rules('PaymentTerms','PaymentTerms','trim|required');
- $this->form_validation->set_rules('PaymentDays','PaymentTerms','trim|required');
- $this->form_validation->set_rules('PayableAT','PaymentTerms','trim|required');
+ $supplierID = $this->input->post('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('EmailAddress','Email Address|valid_email|xss_clean|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');
+
if($this->form_validation->run() == FALSE)
{
- $this->editsupplier($supplierID);
+ $this->viewsupplier($supplierID);
}
else
{
- $supplierID = $this->input->post('SupplierID');
- $SupplierName = ucwords(strtolower($this->input->post('SupplierName')));
- $Address = $this->input->post('Address');
+
+ $SupplierName = $this->input->post('SupplierName');
+ $Address = $this->input->post('Address');
$ContactNumber = $this->input->post('ContactNumber');
$AlternateContactNumber = $this->input->post('AlternateContactNumber');
- $EmailAddress = $this->input->post('EmailAddress');
- $Exiseregistration = $this->input->post('Exiseregistration');
+ $EmailAddress = $this->input->post('emailid');
+ $Exiseregistration = $this->input->post('Exciseregistration');
$TIN = $this->input->post('TIN');
- $PAN = $this->input->post('PAN');
+ $PAN = $this->input->post('panno');
$GSTNo = $this->input->post('GSTNo');
$GSTRange = $this->input->post('GSTRange');
$CollectrateAddress = $this->input->post('CollectrateAddress');
$UANumber = $this->input->post('UANumber');
$PaymentTerms = $this->input->post('PaymentTerms');
- $PaymentDays = $this->input->post('PaymentDays');
+ $Payment = $this->input->post('Payment');
$PayableAT = $this->input->post('PayableAT');
- $UpdatedBy = $this->input->post('UpdatedBy');
- $Createdby = $this->input->post('Createdby');
+ $UpdatedBy = $this->session->userdata ( 'userId' );
+ $chked = $this->input->post('isactive');
+ // echo 'chkvalue'. $chked ;
+ if( $chked != '')
+ {
+ $IsActive = '1';
+ }
+ else
+ {
+ $IsActive = '0';
+ }
+ $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,'PayableAT'=>$PayableAT,'UpdatedBy'=>$UpdatedBy,'IsActive'=>$IsActive);
-
- $supplier = array();
-
-
-
- if(empty($ContactNumber))
+ $result = $this->supplier_model->UpdateSupplier($supplier, $supplierID);
+
+ if($result == True)
{
- $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'Exiseregistration'=>$Exiseregistration,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$PaymentDays,'PayableAT'=>$PayableAT,'UpdatedBy'=>$UpdatedBy,'Createdby'=>$Createdby,'createdDate'=>date('Y-m-d H:i:sa'));
+ redirect('supplierListing','refresh');
+ echo "";
}
- else{
- $supplier = array('SupplierName'=>$SupplierName, 'Address'=>$Address, 'ContactNumber'=>$ContactNumber, 'AlternateContactNumber'=> $AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'Exiseregistration'=>$Exiseregistration,'PAN'=>$PAN,'GSTNo'=>$GSTNo,'GSTRange'=>$GSTRange,'CollectrateAddress'=>$CollectrateAddress,'UANumber'=>$UANumber,'PaymentTerms'=>$PaymentTerms,'PaymentDays'=>$PaymentDays,'PayableAT'=>$PayableAT,'UpdatedBy'=>$UpdatedBy,'Createdby'=>$Createdby,'createdDate'=>date('Y-m-d H:i:sa'));
- }
-
- $result = $this->supplier_model->editsupplier($supplier, $supplierID);
-
- echo $PaymentDays;
- if($result == true)
- {
- $this->session->set_flashdata('success', 'supplier updated successfully');
- }
else
{
- $this->session->set_flashdata('error', 'supplier updation failed');
+ redirect('supplierListing','refresh');
+ echo "";
}
-
- redirect('supplierListing');
}
}
- function viewsupplier($supplierID = NULL)
- {
-
-
+ function viewsupplier($SID = '')
+ {
+ $Payment = '';
+ if($SID == '')
+ {
+ $supplierID = $_GET['SID'];
+ $Payment = $_GET['Payment'];
+ }
+ else
+ {
+
+ $supplierID = $SID;
+ }
-
- //$data['SupplierName'] = $this->purchaseorder_model->getSupplierName();
- $data['supplier'] = $this->supplier_model->getuserInfo($supplierID);
-
- $this->global['pageTitle'] = 'Siddharth : view Supplier';
-
- $this->loadViews("viewsupplier", $this->global,$data, NULL);
-
- }
-
-
-
+
+ $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);
+ }
function pageNotFound()
{
diff --git a/application/models/Employeedetails_model.php b/application/models/Employeedetails_model.php
deleted file mode 100644
index e40e0b60..00000000
--- a/application/models/Employeedetails_model.php
+++ /dev/null
@@ -1,191 +0,0 @@
-db->select('count(*) as Count');
- $this->db->from('T_Employee_Details Emp');
- //$likeCriteria = '';
- $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
- if(!empty($searchText)) {
- $likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%'
- OR Emp.FirstName LIKE '%".$searchText."%'
- OR Emp.LastName LIKE '%".$searchText."%'
- OR Emp.ContactNumber LIKE '%".$searchText."%'
- OR Emp.EmailId LIKE '%".$searchText."%'
- OR Emp.Designation LIKE '%".$searchText."%'
- OR Dep.DepartmentName LIKE '%".$searchText."%'
-
- )";
-
- $this->db->where($likeCriteria);
- }
-
-
- // print_r( $this->db->last_query());
-
- $query = $this->db->get();
- // print_r( $this->db->last_query());
- return $query->result_array();
- }
-
-
- /**
- * 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
- * @param number $segment : This is pagination limit
- * @return array $result : This is result
- */
- function employeeListing($searchText = '', $page, $segment)
- {
- $this->db->select(' Emp.*,Dep.DepartmentName as DepartmentName');
- $this->db->from('T_Employee_Details Emp');
-
- $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
- if(!empty($searchText)) {
- $likeCriteria = "(Emp.EmpID LIKE '%".$searchText."%'
- OR Emp.FirstName LIKE '%".$searchText."%'
- OR Emp.LastName LIKE '%".$searchText."%'
- OR Emp.ContactNumber LIKE '%".$searchText."%'
- OR Emp.EmailId LIKE '%".$searchText."%'
- OR Emp.Designation LIKE '%".$searchText."%'
- OR Dep.DepartmentName LIKE '%".$searchText."%'
- )";
- $this->db->where($likeCriteria);
- }
-
-
- $this->db->order_by("Emp.EmpID", "asc");
- $this->db->limit($page, $segment);
- $query = $this->db->get();
- //print_r( $this->db->last_query());
- $result = $query->result();
- return $result;
- }
-
-
- function getUserRoles()
- {
- $this->db->select('roleId, role');
- $this->db->from('tbl_roles');
- $this->db->where('roleId !=', 1);
- $query = $this->db->get();
-
- return $query->result();
- }
-
- /**
- * This function is used to get the Config value from configuration table
- * @return array $result : This is result of the query
- */
- function getConfigValue(string $ConfigID )
- {
-
- $this->db->select('ConfigValue');
- $this->db->from('T_ConfigDetails');
- $this->db->where('Config_id ',$ConfigID );
- $query = $this->db->get();
-
- return $query->result();
- }
-
- /* *//**
- * This function is used to get the Department details from T_DepartmentDetails
- * @return array $result : This is result of the query
- */
- function getDepartment()
- {
- $this->db->select('DEPCode, DepartmentName');
- $this->db->from('T_DepartmentDetails');
- $this->db->where('IsActive =', 1);
- $query = $this->db->get();
-
- return $query->result();
- }
- /**
- * This function used to get user information by id
- * @param number $userId : This is user id
- * @return array $result : This is user information
- */
-
-function addNewemployee($Employee)
- {
-
- $this->db->insert('T_Employee_Details', $Employee);
-
- $EmpID = $this->db->affected_rows();
-
- return $EmpID;
- }
-
-
- function UpdateEmployee($Emp, $EmpID)
- {
- //echo $EmpID;
- $this->db->where('EmpID', $EmpID);
- $this->db->update('T_Employee_Details', $Emp);
- return TRUE;
- }
-
-
- function viewemployee( $EmpID)
- {
- $this->db->select('Emp.*,Dep.DepartmentName as DepartmentName');
- $this->db->from('T_Employee_Details AS Emp');
- $this->db->join('T_DepartmentDetails Dep', 'Emp.Departmentcode = Dep.DEPCode','left');
- $this->db->where('Emp.EmpID', $EmpID);
- $query = $this->db->get();
-
- $result = $query->result();
-
- // print_r($this->db->last_query());
- return $result;
- }
-
- /* This function to get the Employee department on respective Employee */
- function GetEmployeeDepartment($EmployeeID)
- {
- $this->db->select('DepartmentName');
- $this->db->from('T_EmployeeDetails');
- $this->db->where($EmployeeID);
- $query = $this->db->get();
- return $query->result_array();
- }
-
- function checkMailExists($email='',$Empid='')
- {
- $this->db->select('EmailId');
- $this->db->from('T_Employee_Details');
- $this->db->where('EmailId',$email);
- if ($Empid != '')
- {
- $this->db->where('EmpID !=',$Empid);
- }
- $query = $this->db->get();
- //print_r($this->db->last_query());
- if ($query->num_rows > 0) {
- return $query->result_array();
- }
- }
-
- function checkPhotoExists($Pic)
- {
- $this->db->select('ProfilePic');
- $this->db->from('T_Employee_Details');
- $this->db->where($Pic);
-
- $query = $this->db->get();
- // print_r($this->db->last_query());
- if ($query->num_rows > 0) {
- return $query->result_array();
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/application/models/supplier_model.php b/application/models/supplier_model.php
index 1169b89a..7959c839 100644
--- a/application/models/supplier_model.php
+++ b/application/models/supplier_model.php
@@ -86,48 +86,52 @@ class supplier_model extends CI_Model
*/
- function getpayment()
+ function getpayment($Configvalue = '')
{
$ConfigID = 'C009';
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_id ',$ConfigID );
+ if ($Configvalue!= '')
+ {
+ $this->db->where('ConfigValue !=',$Configvalue );
+ }
$query = $this->db->get();
return $query->result();
}
- function checkPAN($PAN)
+ function checkPAN($PAN,$SID = '')
{
$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());
if ($query->num_rows > 0) {
//echo $result->num_rows;
return $query->result_array();
- }
-
+ }
- //return $query->result();
- }
+ }
function addNewsupplier($supplier)
{
- $this->db->trans_start();
+
$this->db->insert('T_SupplierDetailsN', $supplier);
-
- $PO_id = $this->db->insert_id();
-
- $this->db->trans_complete();
-
- return $PO_id;
+
+ $SID = $this->db->affected_rows();
+
+ return $SID;
+
}
/**
@@ -135,12 +139,10 @@ function addNewsupplier($supplier)
* @param number $userId : This is user id
* @return array $result : This is user information
*/
- function getuserInfo($supplierID)
+ function getSupplierInfo($supplierID='')
{
- $this->db->select('SupplierID, SupplierName,Address,ContactNumber,AlternateContactNumber,Exiseregistration,EmailAddress,TIN,PAN,,GSTNO,GSTRange,CollectrateAddress,UANumber,PaymentTerms,PaymentDays,PayableAT,Createdby,UpdatedBy');
- $this->db->from('T_SupplierDetailsN');
- //$this->db->where('isDeleted', 0);
- //$this->db->where('roleId !=', 1);
+ $this->db->select('*');
+ $this->db->from('T_SupplierDetailsN');
$this->db->where('SupplierID', $supplierID);
$query = $this->db->get();
@@ -155,7 +157,7 @@ function addNewsupplier($supplier)
$query = $this->db->get();
return $query->result_array();
}
- function editsupplier($supplier, $supplierID)
+ function UpdateSupplier($supplier, $supplierID)
{
$this->db->where('SupplierID', $supplierID);
$this->db->update('T_SupplierDetailsN', $supplier);