diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php
index dfa1453c..04808b9d 100755
--- a/application/controllers/cashbook.php
+++ b/application/controllers/cashbook.php
@@ -159,6 +159,8 @@ class cashbook extends BaseController
$data['bankdetails']=$this->employeedetails_model->getBankDetails();
//$this->global['pageTitle'] = 'Siddharth : Cash Book: Add New Income Expense ';
$this->global['pageTitle'] = 'Siddharth : Bank Report - File Upload';
+ $data['bankbalance'] = $this->cashbook_model->getbalancedetails();
+ $data['clearbalance'] = $this->cashbook_model->clearedbalance();
$this->loadViews("bankingfile", $this->global, $data , NULL);
}
function bankfileupload()
@@ -170,6 +172,8 @@ class cashbook extends BaseController
{
//echo "FILE AVAILABLE";
$config['file_name'] = $_FILES['userfile']['name'];
+ $myFIle = $config['file_name'];
+
$config['upload_path'] = 'uploads/banking/';
$path = $config['upload_path'];
//$filename = $config['file_name'];
@@ -177,6 +181,10 @@ class cashbook extends BaseController
//echo $document;
$fs = $this->uploadFile1();
$document = $path.$fs;
+ $created_by = $this->session->userdata('userId');
+
+ $openingbalance=0;
+ $closingbalance=0;
$inputFileName = $_FILES['userfile']['tmp_name'];
require_once APPPATH .'third_party/PHPExcel/IOFactory.php';
$objTpl = PHPExcel_IOFactory::load($inputFileName);
@@ -193,9 +201,18 @@ class cashbook extends BaseController
$fileupload= array('Bankname'=>$bank,'document'=>$document);
$res = $this->cashbook_model->bankfile($fileupload);
- for($x=22;$x<=$highestRow4;$x++){
+ for($x=21;$x<=$highestRow4;$x++){
+ if($x == 21){
+ $openingbalance=$sheet->getCell('H'.$x)->getValue();
+
+ }
+ if($x == $highestRow4){
+
+ $closingbalance=$sheet->getCell('H'.$highestRow4)->getValue();
+
+ }
@@ -246,6 +263,9 @@ class cashbook extends BaseController
$res = $this->cashbook_model->bankfiledata($filedataupload);
}
+ $balance= array('filename'=>$config['file_name'],'created_by'=>$created_by,'openingbalance'=>$openingbalance,'closingbalance'=>$closingbalance);
+ $bal = $this->cashbook_model->balance($balance);
+
if( $res == 1 ){
echo "";
@@ -534,7 +554,9 @@ class cashbook extends BaseController
$this->global['pageTitle'] = 'Siddharth : Cashbook Details';
$this->loadViews("cashbooklisting", $this->global, NULL , NULL);
- }
+ }
+
+
public function cashbookList()
{
@@ -549,8 +571,28 @@ class cashbook extends BaseController
$this->loadViews("cashbooklisting", $this->global, $data, NULL);
+ }
+
+
+ //advance list
+ public function AdvanceList()
+ {
+
+
+ $this->load->model('cashbook_model');
+ // $data['dropdownvalues1'] = $this->cashbook_model->getAccounTypes1();
+ // print_r($data['dropdownvalues1']);
+ // die();
+ $data['list'] = $this->cashbook_model->Selectadvance();
+// print_r($data);
+// die();
+ $this->global['pageTitle'] = 'Siddharth : Advance Listing';
+
+ $this->loadViews("Advancelisting", $this->global, $data, NULL);
+
}
+
public function cashbookdtl()
{
diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php
index 769d97cd..14c1580e 100755
--- a/application/models/cashbook_model.php
+++ b/application/models/cashbook_model.php
@@ -84,7 +84,30 @@ class cashbook_model extends CI_Model
$result = $query->result();
return $result;
- }
+ }
+
+
+ function Selectadvance($i="")
+ {
+ // echo $i;
+ $this->db->select('T_SupplierDetailsN.SupplierName,t_accountcode.name,cashtype,T_Employee_Details.FirstName,T_Employee_Details.LastName,t_income_expense.*');
+ $this->db->from('t_income_expense');
+ $this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code','left');
+ $this->db->join('tbl_users','t_income_expense.Created_By=tbl_users.userId','left');
+ $this->db->join('T_Employee_Details','tbl_users.EmpID=T_Employee_Details.EmpID','left');
+ $this->db->join('T_SupplierDetailsN','T_SupplierDetailsN.SupplierID=t_income_expense.Supplier_id' );
+ $this->db->order_by("date","desc");
+ $this->db->where('t_accountcode.code','ADV003');
+ if(!empty($i))
+ {
+ $this->db->where('t_income_expense.id',$i);
+
+ }
+ $r = $this->db->get();
+ return $r->result();
+ }
+
+
function viewdepartment($sid='')
{
$sql="SELECT ie.*,br.*,br.ID,ie.totalbankamount,ac.name,ie.id,date_format(ie.date,'%d-%m-%Y')as date FROM t_income_expense ie
@@ -147,6 +170,21 @@ class cashbook_model extends CI_Model
}
}
+function balance($balance){
+
+
+ $this ->db->insert('T_bankbalance',$balance);
+}
+
+function getbalancedetails()
+{
+
+$subquery="SELECT openingbalance,closingbalance FROM T_bankbalance WHERE balance_keyid in (SELECT MAX(balance_keyid) FROM T_bankbalance)";
+$query = $this->db->query($subquery);
+return $query->result();
+
+}
+
function report_finyear(){
@@ -199,6 +237,19 @@ function bankstatement($fdate,$tdate,$fa,$aa){
+}
+function clearedbalance(){
+
+ $sql = 'SELECT SUM(cbalancetocleared) as credit,SUM(Balancetocleared) as debit FROM T_bankreport';
+ // $sql = 'SELECT SUM(Clearbalance) - SUM(CClearbalance) as creditdebit FROM T_bankreport';
+
+// $row = mysql_fetch_array($sql);
+// $sum = $row['total'];
+$query = $this->db->query($sql);
+ return $query->result();
+// print_r($sum);
+// die();
+
}
function debitbankstatemet($Supplierid,$fdate,$tdate)
diff --git a/application/views/Advancelisting.php b/application/views/Advancelisting.php
new file mode 100644
index 00000000..d51cd629
--- /dev/null
+++ b/application/views/Advancelisting.php
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | Account Type |
+ DATE |
+ Account Name |
+ Supplier Name |
+ Cash Type |
+ Amount |
+ Details |
+ Action |
+
+
+
+
+
+
+
+ | id.'">'.$l->type.'';?> |
+ date),'d-m-Y');?> |
+ name;?> |
+ SupplierName;?> |
+
+ cashtype;?> |
+ total;?> |
+ description;?> |
+
+ type; ?>." Details ">
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/views/bankcashnew.php b/application/views/bankcashnew.php
index d63ad0c9..fe9ce6f1 100644
--- a/application/views/bankcashnew.php
+++ b/application/views/bankcashnew.php
@@ -38,11 +38,11 @@ $('#gst').click(function(){
$('#towhom').text('Received From:');
- $("#Date").datepicker({
- //minDate : new Date(year-SIAStartYear,1,1),
- maxDate :'now',
- dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
-});
+// $("#Date").datepicker({
+// //minDate : new Date(year-SIAStartYear,1,1),
+// maxDate :'now',
+// dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
+// });
});
@@ -192,7 +192,9 @@ else
var bankiddebit=localStorage.getItem('bankiddebit');
var bankidcredit=localStorage.getItem('bankidcredit');
+ var cashdate=localStorage.getItem('cbdate');
$('#batype').val(atype);
+ $('#Date').val(cashdate);
$('#borc').val('Bank');
//alert(alreadyreceived+'arrr');
var bankiddebit = bankiddebit.split(',');
@@ -323,7 +325,7 @@ else
diff --git a/application/views/bankingfile.php b/application/views/bankingfile.php
index ca481d55..20ea82a9 100644
--- a/application/views/bankingfile.php
+++ b/application/views/bankingfile.php
@@ -1,4 +1,34 @@
+openingbalance;
+ $closingbalance = $t->closingbalance;
+
+
+ }}
+
+ ?>
+
+ creditdebit;
+ $credit = $b->credit;
+ $debit = $b->debit;
+ //
+
+
+ }}
+
+ ?>