222 lines
7.7 KiB
PHP
Executable File
222 lines
7.7 KiB
PHP
Executable File
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
require APPPATH . '/libraries/BaseController.php';
|
|
|
|
/**
|
|
* Class : Employee (Employee Controller)
|
|
* User Class to control all user related operations.
|
|
* @author : Gandhimathi
|
|
* @version : 1.1
|
|
* @since : 07 Apr 2017
|
|
*/
|
|
class companycontroller extends BaseController
|
|
{
|
|
/**
|
|
* This is default constructor of the class
|
|
*/
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->load->model('companydetailsmodel');
|
|
$this->isLoggedIn();
|
|
}
|
|
/**
|
|
* This function used to load the first screen of the user
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->global['pageTitle'] = 'Siddharth : Company Details';
|
|
|
|
//$this->loadViews("companyadd", $this->global, NULL , NULL);
|
|
|
|
//$this->loadViews("Updatecompany", $this->global,NULL,NULL);
|
|
}
|
|
|
|
public function companyview()
|
|
{
|
|
$this->global['pageTitle'] = 'Siddharth : Company Details';
|
|
|
|
$data['userRecords'] = $this->companydetailsmodel->companylisting();
|
|
$data['payment'] = $this->companydetailsmodel->getpayment();
|
|
$data['filenames']=$this->companydetailsmodel->filelist();
|
|
//$data['filetype']=$this->companydetailsmodel->getfilename();
|
|
$this->loadViews("companyview", $this->global,$data, NULL);
|
|
}
|
|
|
|
function companyadd(){
|
|
|
|
$this->global['pageTitle'] = 'Siddharth : Company Details';
|
|
$this->loadViews("companyadd", $this->global, NULL);
|
|
}
|
|
|
|
|
|
function add()
|
|
{
|
|
$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 addfile()
|
|
{
|
|
$file = '';
|
|
//Check whether user upload picture
|
|
if(!empty($_FILES['images']['name']))
|
|
{
|
|
|
|
$config['upload_path'] = 'uploads/files/';
|
|
$config['allowed_types'] = 'docx|pdf|doc|png|jpg';
|
|
$config['file_name'] = $_FILES['images']['name'];
|
|
|
|
//Load upload library and initialize configuration
|
|
$this->load->library('upload',$config);
|
|
$this->upload->initialize($config);
|
|
|
|
if($this->upload->do_upload('images'))
|
|
{
|
|
$uploadData = $this->upload->data();
|
|
$file = $uploadData['file_name'];
|
|
}
|
|
else
|
|
{
|
|
$error = array('error' => $this->upload->display_errors());
|
|
$file = '';
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$file = '';
|
|
}
|
|
|
|
return $file ;
|
|
}
|
|
|
|
|
|
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 deletefile()
|
|
{
|
|
|
|
$ID = $this->input->post('id');
|
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
|
$updatedDate = $dt->format('Y-m-d H:i:s');
|
|
$userInfo = array('isDeleted'=>1);
|
|
$result = $this->companydetailsmodel->deletefile($ID, $userInfo);
|
|
echo 'Succssfully change the user status to InActive';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function UpdateCompany()
|
|
{
|
|
$data['payment'] = $this->companydetailsmodel->getpayment();
|
|
if($this->isAdmin() == TRUE)
|
|
{
|
|
$this->loadThis();
|
|
}
|
|
else
|
|
{
|
|
|
|
$Picture = $this->add();
|
|
$file =$this->addfile();
|
|
$CompID = $this->input->post('CompanyID');
|
|
$CompanyName = $this->input->post('CompanyName');
|
|
$Address = $this->input->post('Address');
|
|
$ContactNumber = $this->input->post('ContactNumber');
|
|
$AlternateContactNumber = $this->input->post('AlternateContactNumber');
|
|
$EmailAddress = $this->input->post('EmailAddress');
|
|
$Exiseregistration = $this->input->post('Exiseregistration1');
|
|
$TIN = $this->input->post('TIN');
|
|
$PAN = $this->input->post('PAN');
|
|
$GSTNO = $this->input->post('GSTNO');
|
|
$GSTRange = $this->input->post('GSTRange');
|
|
$CollectrateAddress = $this->input->post('CollectrateAddress');
|
|
$UANumber = $this->input->post('UANumber');
|
|
$Payment = $this->input->post('PaymentTerms');
|
|
$PaymentDays = $this->input->post('PaymentDays');
|
|
$PayableAT = $this->input->post('PayableAT');
|
|
$createdby = $this->session->userdata ( 'userId' );
|
|
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));
|
|
$createddt = $dt->format('Y-m-d H:i:s');
|
|
$UpdatedBY = $this->session->userdata ( 'Userid' );
|
|
//$companywebsite = $this->input->post('companywebsite');
|
|
$ceoname = $this->input->post('ceoname');
|
|
$mdname = $this->input->post('mdname');
|
|
$companystartedon = $this->input->post('companystartedon');
|
|
$partnerdetails = $this->input->post ('partnerdetails');
|
|
$ProfilePic = $this->input->post ('ProfilePic');
|
|
//$files = $this->input->post('files');
|
|
$filedescription1= $this->input->post('filedescription');
|
|
//$files = $this->input->post('filename');
|
|
$financialstart=$this->input->post('financialstart');
|
|
$financialend=$this->input->post('financialend');
|
|
$ID= $this->input->post('ID');
|
|
//$createdDate=$this->input->post('createdDate');
|
|
|
|
$Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'PaymentTerms'=>$Payment ,'PaymentDays'=>$PaymentDays ,'PayableAT'=>$PayableAT ,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend);
|
|
|
|
if(!empty($file))
|
|
{
|
|
$myfile = array('CompID'=>$CompID,'filename'=>$file,'ID'=>$ID,'filedescription'=>$filedescription1,'createdDate'=>$createddt);
|
|
//print_r($myfile);die();
|
|
$result2 = $this->companydetailsmodel->filedetails($myfile);
|
|
}
|
|
$result = $this->companydetailsmodel->Updatecompany($Company,$CompID);
|
|
|
|
if($result > 0)
|
|
{
|
|
|
|
// $this->session->set_flashdata('Success', $EmpId.'Employee Updated successfully!');
|
|
|
|
echo "<script>alert('You Have Successfully updated the company Record!');</script>";
|
|
redirect('companyview','refresh');
|
|
}
|
|
|
|
|
|
// redirect('employeeListing');
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|