Bank Upload Issues Fixes : ps

This commit is contained in:
Sanjeev 2021-06-22 14:43:17 +05:30
parent b1b5e6521a
commit 0d28edf401
3 changed files with 40 additions and 19 deletions

View File

@ -48,7 +48,7 @@
$active_group = 'default'; $active_group = 'default';
$active_record = TRUE; $active_record = TRUE;
$db['default']['hostname'] = 'sidharthindustries.com'; $db['default']['hostname'] = '35.213.153.5';
// $db['default']['username'] = 'kasiram9_prod'; // $db['default']['username'] = 'kasiram9_prod';
// $db['default']['password'] = 'sia!1234'; // $db['default']['password'] = 'sia!1234';
// $db['default']['database'] = 'kasiram9_SIAPROD'; // $db['default']['database'] = 'kasiram9_SIAPROD';

View File

@ -227,21 +227,26 @@ class cashbook extends BaseController
} }
function bankfileupload() function bankfileupload()
{ {
$document = null; //document => default NULL
$document = null;
// fs => File Name default 0
$fs = 0; $fs = 0;
if(!empty($_FILES['userfile']['name'])) if(!empty($_FILES['userfile']['name']))
{ {
//echo "FILE AVAILABLE"; //echo "FILE AVAILABLE";
$config['file_name'] = $_FILES['userfile']['name']; $config['file_name'] = $_FILES['userfile']['name']; // This Also FileName with format.
$myFIle = $config['file_name']; $myFIle = $config['file_name']; // This Also FileName with format.
// xls File destination folder Given Below.
$config['upload_path'] = 'uploads/banking/'; $config['upload_path'] = 'uploads/banking/';
$path = $config['upload_path']; $path = $config['upload_path'];
//$filename = $config['file_name']; //Destionation Path => uploads/banking.
$filename = $config['file_name'];// This Also FileName with format.
$document = $path.$filename; $document = $path.$filename;
//echo $document;
$fs = $this->uploadFile1(); $fs = $this->uploadFile1();
// $this->function_alert($fs);
// echo "uploadFile1()".$fs;die();
$document = $path.$fs; $document = $path.$fs;
$created_by = $this->session->userdata('userId'); $created_by = $this->session->userdata('userId');
@ -335,11 +340,12 @@ class cashbook extends BaseController
// $IsActive=0; // $IsActive=0;
$filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,'Status'=>$Status,'cstatus'=>$cstatus); $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,'Status'=>$Status,'cstatus'=>$cstatus);
// print_r($filedataupload);
$res = $this->cashbook_model->bankfiledata($filedataupload); $res = $this->cashbook_model->bankfiledata($filedataupload);
// echo "response ".$res;
} }
// die();
$balance= array('filename'=>$config['file_name'],'created_by'=>$created_by,'openingbalance'=>$openingbalance,'closingbalance'=>$closingbalance); $balance= array('filename'=>$config['file_name'],'created_by'=>$created_by,'openingbalance'=>$openingbalance,'closingbalance'=>$closingbalance);
$bal = $this->cashbook_model->balance($balance); $bal = $this->cashbook_model->balance($balance);
@ -349,7 +355,7 @@ class cashbook extends BaseController
} }
else else
{ {
echo "<script>alert('Saved unsuccessfully!');window.location.href='Bankingstatement';</script>"; echo "<script>alert('Saved unsuccessfully!');window.location.href='Bankingstatement';</script>";
} }
} }
} }
@ -598,14 +604,16 @@ class cashbook extends BaseController
function uploadFile1() function uploadFile1()
{ {
//echo "INSIDE UPLOAFD"; // echo "I am Here INSIDE UPLOAD";
// die();
//$this->load->library('upload') //$this->load->library('upload')
$pathinfo = pathinfo($_FILES['userfile']['name']); $pathinfo = pathinfo($_FILES['userfile']['name']);
$config['upload_path'] = 'uploads/banking/'; $config['upload_path'] = 'uploads/banking/';
$config['allowed_types'] = 'png|jpg|jpeg|xlsx'; // $config['allowed_types'] = 'png|jpg|jpeg|xlsx';
$config['allowed_types'] = 'xlsx|csv|xls';
$config['file_name'] = $_FILES['userfile']['name']; $config['file_name'] = $_FILES['userfile']['name'];
// $config['overwrite'] = true; $config['overwrite'] = true;
//Load upload library and initialize configuration //Load upload library and initialize configuration
$this->load->library('upload',$config); $this->load->library('upload',$config);
@ -2345,4 +2353,7 @@ $amountInWords = "Rupees " . $result ." Paise ". $points." Only";
} }
} }
function function_alert($msg) {
echo "<script type='text/javascript'>alert('$msg');</script>";
}
?> ?>

View File

@ -255,7 +255,7 @@ function finyear(){
{ {
$this->db->select('reportdate,Narration,Balance'); $this->db->select('reportdate,Narration,Balance,ID,IsActive');
$this->db->from('T_bankreport'); $this->db->from('T_bankreport');
$this->db->where('reportdate',$filedataupload['reportdate']); $this->db->where('reportdate',$filedataupload['reportdate']);
$this->db->where('Narration',$filedataupload['Narration']); $this->db->where('Narration',$filedataupload['Narration']);
@ -263,12 +263,22 @@ function finyear(){
$query = $this->db->get(); $query = $this->db->get();
if ($query->num_rows() > 0){ if ($query->num_rows() > 0){
return true; $data = array_shift($query->result_array());
// return true;
// echo "Data Available so Update Functionality";
// echo($data['ID']);
// echo"<br>";
$this->db->where('ID',$data['ID']);
// $this->db->where('IsActive',NULL);
$this->db->update('T_bankreport',$filedataupload);
$r = $this->db->affected_rows();
// print_r($this->db->last_query());
return $r;
} }
else{ else{
// echo "Data not Available so insert";
$this->db->insert('T_bankreport', $filedataupload); $this->db->insert('T_bankreport', $filedataupload);
$r = $this->db->affected_rows(); $r = $this->db->affected_rows();
//print_r($this->db->last_query()); //print_r($this->db->last_query());
return $r; return $r;
} }