diff --git a/application/controllers/companycontroller.php b/application/controllers/companycontroller.php
index 4aceb9fb..a6458f2d 100755
--- a/application/controllers/companycontroller.php
+++ b/application/controllers/companycontroller.php
@@ -37,9 +37,10 @@ class companycontroller extends BaseController
$this->global['pageTitle'] = 'Siddharth : Company Details';
$data['userRecords'] = $this->companydetailsmodel->companylisting();
- $data['payment'] = $this->companydetailsmodel->getpayment();
+ $data['payment'] = $this->companydetailsmodel->getPaymentTerms();
$data['filenames']=$this->companydetailsmodel->filelist();
//$data['filetype']=$this->companydetailsmodel->getfilename();
+ $data['filetype']=$this->companydetailsmodel->getfilename();
$this->loadViews("companyview", $this->global,$data, NULL);
}
@@ -80,6 +81,36 @@ class companycontroller extends BaseController
return $picture ;
}
+ function editimage($ModifyPictureName)
+ {
+ //$picture = $ModifyPictureName;
+ 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 = '';
@@ -146,34 +177,38 @@ class companycontroller extends BaseController
function UpdateCompany()
{
- $data['payment'] = $this->companydetailsmodel->getpayment();
+ //die();
+ // $data['payment'] = $this->companydetailsmodel->getpayment();
if($this->isAdmin() == TRUE)
{
$this->loadThis();
}
else
{
-
- // $Picture = $this->add();
- $PictureName = $this->input->post('Image');
- $ModifyPictureName = $this->input->post('ModifyImage');
+
+
+ $PictureName = $this->input->post('Image');
+ $ModifyPictureName = $this->input->post('ModifyImage');
if ($PictureName != '')
- {
+ { //echo 'Exists';
if(strlen($ModifyPictureName) == 0)
{
+ //echo 'Exists But Not replace';
$Picture = $PictureName;
}
else
{
- $Picture = $ModifyPictureName;
+ //echo 'Exists But Replace';
+ //$Picture = $this->editimage($ModifyPictureName);
+ $Picture = $this->add($ModifyPictureName);
}
}
else
{
- //echo 'Not Exists';
+ //echo 'Not Exists';
$Picture = $this->add();
- }
- $file =$this->addfile();
+ }
+ $file =$this->addfile();
$CompID = $this->input->post('CompanyID');
$CompanyName = $this->input->post('CompanyName');
$Address = $this->input->post('Address');
@@ -187,33 +222,42 @@ class companycontroller extends BaseController
$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');
+ $PaymentId = $this->input->post('paymentid');
+ //$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');
+ //$ceoname = $this->input->post('ceoname');
+ //$mdname = $this->input->post('mdname');
+ //$companystartedon = $this->input->post('companystartedon');
+ //$partnerdetails = $this->input->post ('partnerdetails');
+ $companywebsite = $this->input->post('companywebsite');
+ //$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');
+ //$financialstart=$this->input->post('financialstart');
+ //$financialend=$this->input->post('financialend');
+ $date = new DateTime($this->input->post('financialstart'));
+ $financialstart = $date->format('Y-m-d H:i:s');
+
+ $date2 = new DateTime($this->input->post('financialend'));
+ $financialend = $date2->format('Y-m-d H:i:s');
+
$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);
+ //$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);
+ $Company = array('CompID'=>$CompID,'CompanyName'=>$CompanyName,'Address'=>$Address,'ContactNumber'=>$ContactNumber,'AlternateContactNumber'=>$AlternateContactNumber,'EmailAddress'=>$EmailAddress,'TIN'=>$TIN,'PAN'=>$PAN,'GSTNO'=>$GSTNO,'GSTRange'=>$GSTRange,'UANumber'=>$UANumber,'Createdby'=>$createdby,'ProfilePic'=>$Picture,'Exiseregistration'=>$Exiseregistration,'CollectrateAddress'=>$CollectrateAddress,'FiscalYearStartOn'=>$financialstart,'FiscalYearEndsOn'=> $financialend,'paymentID'=>$PaymentId,'companyWebsite'=>$companywebsite);
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);
@@ -228,8 +272,7 @@ class companycontroller extends BaseController
}
- // redirect('employeeListing');
-
+ // redirect('companyview');
}
}
diff --git a/application/models/companydetailsmodel.php b/application/models/companydetailsmodel.php
index d04421c6..aead5c35 100755
--- a/application/models/companydetailsmodel.php
+++ b/application/models/companydetailsmodel.php
@@ -68,8 +68,9 @@ class companydetailsmodel extends CI_Model
// updated by //
function companylisting()
{
- $this->db->select('com.*,emp.firstname');
- $this->db->from('T_Company_Details com');
+ $this->db->select('com.*,emp.firstname,pmt.PaymentTerms');
+ $this->db->from('T_Company_Details com');
+ $this->db->join('T_PaymentTerms pmt','com.paymentID = pmt.PaymentID','left');
$this->db->join('tbl_users as tbl',' com.createdby = tbl.userid','left');
$this->db->join('T_Employee_Details as emp', 'emp.empid=tbl.empid','left');
$query = $this->db->get();
@@ -78,9 +79,29 @@ class companydetailsmodel extends CI_Model
}
// dropdown for payaple terms @ companydetails//
- function getpayment($Configvalue = '')
+ // function getpayment($Configvalue = '')
+ // {
+ // $ConfigID = 'C009';
+ // $this->db->select('ConfigValue');
+ // $this->db->from('T_ConfigDetails');
+ // $this->db->where('Config_ID ',$ConfigID );
+ // $query = $this->db->get();
+ // return $query->result();
+ // }
+ function getPaymentTerms()
{
- $ConfigID = 'C009';
+ $this->db->select('*');
+ $this->db->from('T_PaymentTerms');
+ $query = $this->db->get();
+ $result = $query->result();
+ return $result;
+ }
+
+
+ // dropdown for file description @ companydetails//
+ function getfilename($Configvalue = '')
+ {
+ $ConfigID = 'C025';
$this->db->select('ConfigValue');
$this->db->from('T_ConfigDetails');
$this->db->where('Config_ID ',$ConfigID );
@@ -89,18 +110,6 @@ class companydetailsmodel extends CI_Model
}
- // dropdown for file description @ companydetails//
- /*function getfilename($Configvalue = '')
- {
- $ConfigID = 'C021';
- $this->db->select('ConfigValue');
- $this->db->from('t_configdetails');
- $this->db->where('Config_ID ',$ConfigID );
- $query = $this->db->get();
- return $query->result();
- }*/
-
-
//display the name for createdby @companydetails//
diff --git a/application/views/companyview.php b/application/views/companyview.php
index 488c8bce..bf06838a 100755
--- a/application/views/companyview.php
+++ b/application/views/companyview.php
@@ -13,17 +13,18 @@ $GSTRange = '';
$CollectrateAddress = '';
$UANumber = '';
$PaymentTerms = '';
-$PaymentDays = '';
-$PayableAT = '';
+$PaymentId = '';
+//$PaymentDays = '';
+//$PayableAT = '';
$Createdby = '';
$CreatedDate = '';
$UpdatedBy = '';
$Updatedon = '';
$ProfilePic = '';
$companywebsite ='';
-$ceoname='';
-$companystartedon='';
-$partnerdetails='';
+//$ceoname='';
+//$companystartedon='';
+//$partnerdetails='';
$firstname = '';
//$files ='';
$financialyear='';
@@ -51,23 +52,48 @@ if(!empty($userRecords))
$CollectrateAddress = $uf->CollectrateAddress;
$UANumber = $uf->UANumber;
$PaymentTerms = $uf->PaymentTerms ;
- $PaymentDays = $uf->PaymentDays ;
- $PayableAT = $uf->PayableAT ;
+ $PaymentId = $uf->paymentID;
+ //$PaymentDays = $uf->PaymentDays ;
+ //$PayableAT = $uf->PayableAT ;
$Createdby = $uf->Createdby;
//$CreatedDate = $uf->CreatedDate;
$UpdatedBy = $uf->UpdatedBy;
$Updatedon = $uf->Updatedon;
$ProfilePic = $uf->ProfilePic;
+ $companywebsite = $uf->companyWebsite;
//$companywebsite = $uf->companywebsite;
//$ceoname = $uf->ceoname;
//$mdname = $uf->mdname;
//$companystartedon = $uf->companystartedon;
//$partnerdetails = $uf->partnerdetails;
$firstname = $uf->firstname;
- $financialstart= $uf->FiscalYearStartOn;
- $financialend= $uf->FiscalYearEndsOn;
+ //$financialstart= $uf->FiscalYearStartOn;
+ //$financialend= $uf->FiscalYearEndsOn;
//$files = $uf->files;
//$financialyear = $uf->financialyear;
+
+
+ $FStartDt = $uf->FiscalYearStartOn;
+ if($FStartDt != '' && $FStartDt != '0000-00-00 00:00:00' )
+ {
+ $FSdate = new DateTime($FStartDt);
+ $financialstart = $FSdate->format('d-m-Y');
+ }
+ else
+ {
+ $financialstart = "";
+ }
+
+ $FEndDt = $uf->FiscalYearEndsOn;
+ if($FEndDt != '' && $FEndDt != '0000-00-00 00:00:00' )
+ {
+ $FEdate = new DateTime($FEndDt);
+ $financialend = $FEdate ->format('d-m-Y');
+ }
+ else
+ {
+ $financialend = "";
+ }
}
@@ -87,7 +113,7 @@ if(!empty($filenames))
function readURL(input,num) {
if (num==0)
- {
+ {
if (input.files && input.files[0]) {
var reader = new FileReader();
@@ -96,14 +122,14 @@ function readURL(input,num) {
.attr('src', e.target.result)
.width(166)
.height(166);
- //alert(e.target.result);
+ //alert(e.target.result);
};
reader.readAsDataURL(input.files[0]);
- $('#ModifyImage').val(input.files[0]['name']);
+ $('#ModifyImage').val(input.files[0]['name']);
}
- }
- else
+ }
+ else
{
if (input.files && input.files[0]) {
var reader = new FileReader();
@@ -119,6 +145,34 @@ function readURL(input,num) {
}
}
}
+
+
+ function isNumberKey(evt){
+ var charCode = (evt.which) ? evt.which : evt.keyCode;
+ if (charCode != 46 && charCode != 45 &&charCode != 32 && charCode >= 33
+ && (charCode < 48 || charCode > 57))
+ return false;
+
+ return true;
+ }
+
+function onlyAlphabets(evt) {
+ var charCode;
+ if (window.event)
+ charCode = window.event.keyCode; //for IE
+ else
+ charCode = evt.which; //for firefox
+ if (charCode == 32) //for <space> symbol
+ return true;
+ if (charCode > 31 && charCode < 65) //for characters before 'A' in ASCII Table
+ return false;
+ if (charCode > 90 && charCode < 97) //for characters between 'Z' and 'a' in ASCII Table
+ return false;
+ if (charCode > 122) //for characters beyond 'z' in ASCII Table
+ return false;
+ return true;
+ }
+
function validateEmail() {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
@@ -137,8 +191,8 @@ function validateEmail() {
}
}
function validatePAN() {
- var reg = /(?=.*[A-Z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Z]).{1,}$/;
-
+ //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 = $('#PAN').val();
if(PAN != '')
@@ -156,7 +210,7 @@ function validatePAN() {
}
function validateGST() {
-var reg = /(?=.*[0-9]).{2}(?=.*[A-Z]).{5}(?=.*[0-9]).{4}(?=.*[A-Z]).{1}(?=.*[0-9]).{1}(?=.*[Z]).{1}(?=.*[0-9]).{1}$/;
+var reg = /(?=.*[0-9]).{2}(?=.*[A-Za-z]).{5}(?=.*[0-9]).{4}(?=.*[A-Za-z]).{1}(?=.*[0-9]).{1}(?=.*[Zz]).{1}(?=.*[A-Za-z0-9]).{1}$/;
//alert('gst');
var GST = $('#GSTNO').val();
@@ -164,7 +218,7 @@ var reg = /(?=.*[0-9]).{2}(?=.*[A-Z]).{5}(?=.*[0-9]).{4}(?=.*[A-Z]).{1}(?=.*[0-9
{
if (reg.test(GST) == false)
{
- alert('Please Enter Valid GST Number Format should be 22AAAAA1111S1Z1');
+ alert('Please Enter Valid GST Number Format should be 22AAAAA1111S1Z1 or 22AAAAA1111S1ZA ');
return (false);
}
else
@@ -180,25 +234,138 @@ var reg = /(?=.*[0-9]).{2}(?=.*[A-Z]).{5}(?=.*[0-9]).{4}(?=.*[A-Z]).{1}(?=.*[0-9
}
- var selDiv = "";
+ //var selDiv = "";
- document.addEventListener("DOMContentLoaded", init, false);
+ //document.addEventListener("DOMContentLoaded", init, false);
- function getMobileValidation()
- {
- var contactNumber = $('#ContactNumber').val().length;
- if(contactNumber < 10)
- {
- alert('Please Enter valid Contact Number');
- return false;
- }
- else
- {
- return true;
- }
+// function getMobileValidation()
+// {
+// var contactNumber = $('#ContactNumber').val().length;
+// if(contactNumber < 10)
+// {
+// alert('Please Enter valid Contact Number');
+// return false;
+// }
+// else
+// {
+// return true;
+// }
+// }
+
+function getMobileValidation(){
+ // alert('mobile number and telephone phone');
+
+ var contactNumber = $('#ContactNumber').val();
+ var telephone =/^[0-9]{3,5}\s[0-9]{6,8}$/.test(contactNumber);
+ var mobilephone = /^[0-9]{10}$/.test(contactNumber);
+
+ // alert('telephone:'+telephone);//alert('other telephone:'+regex);
+ // alert('mobilephone:'+mobilephone);//alert('input value:'+contactNumber);
+
+ if(contactNumber!=''){
+
+ if(telephone){
+ // alert(' telephone number'+contactNumber);
+ return true;
+ }
+ else if(mobilephone){
+ // alert('mobile number'+contactNumber);
+ return true;
+ }
+
+ else{
+ alert('Please Enter valid Contact Number ex: 044 12345678 , 0444 1234567,04444 123456 and 9876543210');//alert('need to change:'+contactNumber);
+ return false;
+ }
+ }
+ else{
+
+ alert(' Please enter correct format of contact number');
+ //alert('invalid'+contactNumber);
+ return false;
+ }
+ }
+function ValidateExno() {
+ var reg = /(?=.*[A-Za-z]).{5}(?=.*[0-9]).{4}(?=.*[A-Za-z]).{1}(?=.*[A-Za-z]).{2}(?=.*[0-9]).{3}$/;
+
+ var ECC = $('#ExiseRegistration1').val();
+
+ if(ECC != '')
+ {
+ if (reg.test(ECC) == false)
+ {
+ alert('Please Enter Valid Excise Control Code Number');
+ return (false);
+ }
+ else
+ {
+ return true;
+ }
+ }
+
}
+
+function ValidateAlternateContact(){
+ // alert('phone');
+
+ var AlternateContactNumber = $('#AlternateContactNumber').val();
+
+ var telephone =/^[0-9]{3,5}\s[0-9]{6,8}$/.test(AlternateContactNumber);
+ var mobilephone = /^[0-9]{10}$/.test(AlternateContactNumber);
+
+ // alert('chennai telephone:'+telephone);//alert('other telephone:'+regex);
+ // alert('mobilephone:'+mobilephone);//alert('input value:'+contactNumber);
+
+ if(AlternateContactNumber!=''){
+
+ if(telephone){
+ // alert(' telephone number chennai district successfully inserted'+AlternateContactNumber);
+ return true;
+ }
+ else if(mobilephone){
+ // alert('mobile number successfully inserted'+AlternateContactNumber);
+ return true;
+ }
+ else{
+ alert('Please Enter valid Contact Number ex: 044 12345678 , 0444 1234567,04444 123456 and 9876543210');//alert('need to change:'+contactNumber);
+ return false;
+ }
+ }
+ else{
+
+ alert('Please enter correct format of contact number');
+ //alert('invalid'+AlternateContactNumber);
+ return false;
+ }
+ }
+
+
+
+