cashbook and bank statement

This commit is contained in:
gandhimathi 2018-05-29 11:40:03 +05:30
parent 6f3ca32389
commit 938bc623ae
7 changed files with 318 additions and 9 deletions

View File

@ -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 "<script>alert('Saved Successfully!');window.location.href='Bankingstatement';</script>";
@ -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()
{

View File

@ -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)

View File

@ -0,0 +1,103 @@
<?php
// print_r($list);
// ?>
<!-- <CENTER><strong><h3 class="box-title">Siddharth Industries - Receipt and Payment List</h3></strong></CENTER> -->
<div class="content-wrapper">
<section class="content">
<div class="box">
<div class="box-header">
<CENTER><strong><h3 class="box-title">Siddharth Industries - Advance List</h3></strong></CENTER>
<!-- <div align="right" style="padding-right:10px">
<a href="addNewIncomeExpense" class="btn btn-primary" align="right"style="padding-right:10px" >Add New</a>
</div> -->
</div>
<table id="inexlist" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
<div align="right" style="padding-right:10px">
<div id="content" > </div>
<div class="modal fade" role="dialog">
<thead style="background-color:#ddf">
<tr>
<th>Account Type</th>
<th>DATE</th>
<th>Account Name</th>
<th>Supplier Name</th>
<th>Cash Type</th>
<th>Amount</th>
<th>Details</th>
<th>Action</th>
</tr>
</thead>
<tbody id="inexlistbody">
<?php if(!empty($list))
{
$base = base_url();
foreach($list as $l)
{
?>
<tr>
<td><?php echo '<a href="'.$base.'cashbook/incomeExpenseList/'.$l->id.'">'.$l->type.'</a>';?></td>
<td style="text-align:right;"><?php echo date_format(date_create($l->date),'d-m-Y');?></td>
<td><?php echo $l->name;?></td>
<td><?php echo $l->SupplierName;?></td>
<td><?php echo $l->cashtype;?></td>
<td style="text-align:right;"><?php echo $l->total;?></td>
<td><?php echo $l->description;?></td>
<td>
<a href="<?php echo base_url(); ?>cashbook/editcashbook?sid=<?php echo $l->id;?>"><i class="fa fa-pencil" data-toggle="tooltip" data-placement="left" title="Click here to view/Edit the ".<?php echo $l->type; ?>." Details "></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<br>
</div>
</div>
</div>
</div> </section>
</div>
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
<script>
$(function () {
$('#inexlist').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"aaSorting": [[ 0, "desc" ]],
"ordering": true,
"columnDefs" : [{"targets":1, "type":"date-eu"}],
"info": true,
"autoWidth": true
});
});
</script>

View File

@ -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
<div class="col-md-3">
<div class="form-group">
<b><span for="PODescription">Date:</span></b><span style="color:red">*</span></br></br>
<input type="text" class="form-control required" id="Date" name="Date" ><!--value="<?php echo $cb->cdate?>-->
<input type="text" class="form-control required" id="Date" readonly name="Date" ><!--value="<?php echo $cb->cdate?>-->
</div>
</div>

View File

@ -1,4 +1,34 @@
<?php
$openingbalance =0;
$closingbalance=0;
if(!empty($bankbalance)){
foreach($bankbalance as $t)
{
$openingbalance = $t->openingbalance;
$closingbalance = $t->closingbalance;
}}
?>
<?php
if(!empty($clearbalance)){
foreach($clearbalance as $b)
// print_r($t);die();
{
// $creditdebit= $b->creditdebit;
$credit = $b->credit;
$debit = $b->debit;
//
}}
?>
<script>
function readURL(input) {
$('#FileName').val(input.files[0].name);
@ -42,6 +72,68 @@ function checkYearMonthAsEmpty()
</h1>
</section>
<br><br>
<div class="col-md-4" >
<div class="info-box" style="min-height: 105px;">
<span class="info-box-icon bg-red" style="height: 105px;padding:25px;"><i class="fa fa-inr"></i></span>
<div class="info-box-content">
<span class="info-box-text"style="color:#dd4b39;"><strong>Opening Balance</strong></span>
<span class="info-box-number"style="color:black;"><?php echo $openingbalance;?></span>
</div>
<!-- /.info-box-content -->
</div>
</a>
<!-- /.info-box -->
</div>
<div class="col-md-4">
<div class="info-box" style="min-height: 105px;">
<span class="info-box-icon bg-red" style="height: 105px;padding:25px;"><i class="fa fa-inr"></i></span>
<div class="info-box-content">
<span class="info-box-text"style="color:#dd4b39;"><strong>Closing Balance</strong></span>
<span class="info-box-number"style="color:black;"><?php echo $closingbalance;?></span>
</div>
<!-- /.info-box-content -->
</div>
</a>
<!-- /.info-box -->
</div>
<div class="col-md-4">
<div class="info-box" style="min-height: 105px;">
<span class="info-box-icon bg-red" style="height: 105px;padding:25px;"><i class="fa fa-inr"></i></span>
<div class="info-box-content">
<!-- <span class="info-box-text"style="color:#dd4b39;"><strong>Cleared Balance</strong></span>
<span class="info-box-number"style="color:black;"><?php echo $creditdebit;?></span> -->
<span class="info-box-text"style="color:#dd4b39;"><strong> Balance To Clear[Credit]</strong></span>
<span class="info-box-number"style="color:black;"><?php echo $credit;?></span>
<span class="info-box-text"style="color:#dd4b39;"><strong> Balance To Clear[Debit]</strong></span>
<span class="info-box-number"style="color:black;"><?php echo $debit;?></span>
</div>
<!-- /.info-box-content -->
</div>
</a>
<!-- /.info-box -->
</div>
<section class="content">
<div class="row">
<div class="col-md-8 col-md-offset-2" style="border:2px dotted;padding:2%;">

View File

@ -180,6 +180,7 @@ $finyear = $item->financial_year;
<th style="text-align:right;"> Cleard Balance (&#8377;)</th>
<th style="text-align:right;"> Balance to Clear (&#8377;)</th>
<th>Status</th>
<th>balance</th>
</tr>
</thead>
@ -265,6 +266,8 @@ $finyear = $item->financial_year;
<td><?php echo $t->cstatus;?></td>
<td><?php echo $t->Balance;?></td>
@ -583,6 +586,8 @@ if (x==true)
localStorage.setItem('test',avalue);
localStorage.setItem('debitamount',debit);
localStorage.setItem('bankidcredit',tempcredit);
localStorage.setItem('cbdate',date);
window.location.href="Bankcash";
// alert(tcpaid+'tc');

View File

@ -1263,6 +1263,13 @@ else{
<span>Receipt and Payment</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>cashbook/AdvanceList">
<i class="fa fa-vcard"></i> <span>Advance</span>
</a>
</li>
<li>
</ul>
</li>
@ -1357,6 +1364,13 @@ else{
<span>Receipt and Payment</span>
</a>
</li>
<li>
<a href="<?php echo base_url(); ?>cashbook/AdvanceList">
<i class="fa fa-vcard"></i> <span>Advance</span>
</a>
</li>
<li>