changes in bank statement upload anddeleted login id not allow

This commit is contained in:
gandhimathi 2018-04-28 13:35:36 +05:30
parent 38bc25667d
commit 2530d3e017
5 changed files with 92 additions and 36 deletions

View File

@ -161,35 +161,74 @@ class cashbook extends BaseController
$inputFileName = $_FILES['userfile']['tmp_name'];
require_once APPPATH .'third_party/PHPExcel/IOFactory.php';
$objTpl = PHPExcel_IOFactory::load($inputFileName);
$sheet = $objTpl->getActiveSheet(0) ;//->toArray(null, NULL, True, True);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$sheet = $objTpl->getActiveSheet();//->toArray(null, true,true,true);
$bank = $this->input->post('bankbranchname');
$fileupload= array('Bankname'=>$bank,'document'=>$document);
$res = $this->cashbook_model->bankfile($fileupload);
for($x=2;$x<=$highestRow;$x++){
$date = date('Y-m-d', PHPExcel_Shared_Date::ExcelToPHP( $sheet->getCell('A'.$x)->getValue()));
//echo $val; die();
$valuedate = date('Y-m-d', PHPExcel_Shared_Date::ExcelToPHP( $sheet->getCell('B'.$x)->getValue()));
//PHPExcel_Shared_Date::ExcelToPHP($valuedate);
//echo date('Y-m-d',strtotime($valuedate));die;
$chqno = $sheet->getCell('C'.$x)->getValue();
$narration = $sheet->getCell('D'.$x)->getValue();
$cod =$sheet->getCell('E'.$x)->getValue();
$debit =$sheet->getCell('F'.$x)->getValue();
$credit=$sheet->getCell('G'.$x)->getValue();
$balance=$sheet->getCell('H'.$x)->getValue();
$filedataupload= array('reportdate'=>$date,'valuedate'=>$valuedate,'chequeNo'=>$chqno,'Narration'=>$narration,'Cod'=>$cod,'Debit'=>$debit,'Credit'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,);
//print_r($filedataupload);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$highestRow4=$highestRow-4;
$bank = $this->input->post('bankbranchname');
$fileupload= array('Bankname'=>$bank,'document'=>$document);
$res = $this->cashbook_model->bankfile($fileupload);
for($x=22;$x<=$highestRow4;$x++){
$t=$sheet->getCell('A'.$x)->getValue();
$dat= str_replace('/','-',$t);
if (empty($dat))
{
$Date1 = NULL;
}
else
{
$Date1 = strtotime( $dat);
$Date1 = date("Y-m-d ", $Date1);
}
$s=$sheet->getCell('B'.$x)->getValue();
$dat1= str_replace('/','-',$s);
if (empty($dat1))
{
$Date2 = NULL;
}
else
{
$Date2 = date('Y-m-d',strtotime($dat1));
}
$chqno = $sheet->getCell('C'.$x)->getValue();
$narration = $sheet->getCell('D'.$x)->getValue();
$cod =$sheet->getCell('E'.$x)->getValue();
$debit =$sheet->getCell('F'.$x)->getValue();
$credit=$sheet->getCell('G'.$x)->getValue();
$balance=$sheet->getCell('H'.$x)->getValue();
$filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'Balance'=>$balance,'Bankname'=>$bank);
$res = $this->cashbook_model->bankfiledata($filedataupload);
}
if( $res == 1 ){
if( $res == 1 ){
echo "<script>alert('Saved Successfully!');window.location.href='Bankingstatement';</script>";
}
else
@ -198,7 +237,8 @@ class cashbook extends BaseController
}
}
}
function addIncomeExpense()
{
@ -439,7 +479,7 @@ class cashbook extends BaseController
{
$error = array('error' => $this->upload->display_errors());
$uploadfilename = '';
print_r($error);
// print_r($error);
return 0;
}

View File

@ -125,13 +125,27 @@ class cashbook_model extends CI_Model
return $r;
}
function bankfiledata($filedataupload)
{
$this->db->insert('T_bankreport', $filedataupload);
{
$this->db->select('reportdate,Narration,Balance');
$this->db->from('T_bankreport');
$this->db->where('reportdate',$filedataupload['reportdate']);
$this->db->where('Narration',$filedataupload['Narration']);
$this->db->where('Balance',$filedataupload['Balance']);
$query = $this->db->get();
if ($query->num_rows() > 0){
return true;
}
else{
$this->db->insert('T_bankreport', $filedataupload);
$r = $this->db->affected_rows();
//print_r($this->db->last_query());
return $r;
}
}
function bankstatement($fdate,$tdate){

View File

@ -15,9 +15,11 @@ class Login_model extends CI_Model
$this->db->join('tbl_roles as Roles','Roles.roleId = BaseTbl.roleId');
$this->db->join('T_Employee_Details as Emp','BaseTbl.EmpID = Emp.EmpID');
$this->db->join('T_DepartmentDetails as DEPT','Emp.Departmentcode = DEPT.DEPCode');
$this->db->where('BaseTbl.email', $email);
$this->db->or_where('Emp.ContactNumber', $email);
$this->db->where('BaseTbl.isDeleted', 0);
$this->db->where('BaseTbl.isDeleted !=',1);
$this->db->where('BaseTbl.email', $email);
$this->db->or_where('Emp.ContactNumber', $email);
$this->db->where('BaseTbl.isDeleted !=',1);
$query = $this->db->get();

View File

@ -48,7 +48,7 @@
</div>
<div class="col-md-3">
<label>Select option:</label></br>
<label>Nature of Maintenance:</label></br>
<input type="radio" id="radiobtn1" name="radiobtn" value="0" checked>Maintenance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown
</div>

View File

@ -100,7 +100,7 @@ if(!empty($MaintEdit))
</div>
<div class="col-md-3">
<label>Select option:</label></br>
<label>Nature of Maintenance:</label></br>
<input type="radio" id="radiobtn1" name="radiobtn" value="0" >Maintenance &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="radio" id="radiobtn2" name="radiobtn" value="1" >Breakdown
</div>