bankstatement

This commit is contained in:
gayathri1990 2018-04-16 17:46:48 +05:30
parent 2370166d7a
commit 8c92964ced
6 changed files with 85 additions and 57 deletions

View File

@ -313,9 +313,10 @@ class cashbook extends BaseController
{
$stat='OPEN';
}
$creditbalance=$totalbankamount-$totalamount;
$creditbalance=$totalbankamount-$ctotal;
//echo $creditbalance;
if($creditbalance=='0')
//die();
if($creditbalance==0)
{
$statu='CLOSE';
@ -328,6 +329,8 @@ class cashbook extends BaseController
if($amounttype=='CREDIT')
{
$cashbookstatus1= array('cclearbalance'=>$ctotal,'cstatus'=>$statu);
//print_r($cashbookstatus1);
//die();
$res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid);
}
else
@ -707,13 +710,12 @@ class cashbook extends BaseController
{
if ($this->input->post('btn_submit'))
{
$SupplierName = $this->input->post('SupplierName');
$Supplierid = $this->input->post('SupplierName');
$fdate = $this->input->post('from_date');
$tdate = $this->input->post('to_date');
//$data['cash'] = $_GET['sid'];
//$data['bankid'] = $_GET['d'];
$data['bankdepit'] = $this->cashbook_model->debitbankstatemet($SupplierName,$fdate,$tdate);
$data['bankdepit'] = $this->cashbook_model->debitbankstatemet($Supplierid,$fdate,$tdate);
}
$data['getsupplier'] = $this->cashbook_model->getsupplier();
@ -764,7 +766,7 @@ class cashbook extends BaseController
$tdate = $this->input->post('to_date');
$bankid= $_GET['d'];
$data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid);
$data['mappingiv'] = $this->cashbook_model->creditinvoicelist($SupplierName,$fdate,$tdate,$bankid);
$data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid);
$data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid);
$data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid);
$data['supplier'] = $this->cashbook_model->getsupplier();
@ -804,7 +806,11 @@ class cashbook extends BaseController
$check = $this->input->post('check');
$rw = $this->input->post('rw');
$this->global['pageTitle'] = 'Siddharth : Cashbook Listing';
$date = $this->input->post('date');
$date = $this->input->post('podate');
$date = date_create($date);//,'Y-m-d');
$date = date_format($date,'Y-m-d');
//echo $date;
$pono = $this->input->post('pono');
$sname = $this->input->post('sname');
$tot = $this->input->post('tot');
@ -987,9 +993,9 @@ class cashbook extends BaseController
$updateamount=($totalpaidamount+$eRec);
$invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$totalpaidamount,'bankid'=>$bankid);
$invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid);
$invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid);
$invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid);
// //print_r ($invoicedata);
// //die();
@ -1005,7 +1011,7 @@ class cashbook extends BaseController
else
{
//echo "update";
$result3 = $this->cashbook_model->invoiceupdate1($invoicedata,$invid);
$result3 = $this->cashbook_model->invoiceupdate1($invoicedata1,$invid);
}
if($balancetoreceived1==0)

View File

@ -19,7 +19,7 @@ class cashbook_model extends CI_Model
}
function getAccounTypes1()
{
$this->db->select('name.type');
$this->db->select('name,type');
$r = $this->db->get('t_accountcode');
return $r->result();
@ -150,11 +150,12 @@ class cashbook_model extends CI_Model
}
function debitbankstatemet($SupplierName,$fdate,$tdate)
function debitbankstatemet($Supplierid,$fdate,$tdate)
{
$status='ST057';
//echo $tdate;
//die();
//$Supplierid;
$this->db->distinct();
$this->db->select('POM.PONO,POM.Paymentstatus,supp.SupplierName,
POM.TotalOrderValue,POM.ServiceDescription,BR.Balancetopay,BR.Amountpaid,
@ -170,10 +171,11 @@ class cashbook_model extends CI_Model
$this->db->where_in('POM.Status',[ST044,ST056]);
$this->db->where('POM.Paymentstatus !=','ST057');
//$this->db->or_where('POM.Status',ST056);
$this->db->where('supp.SupplierName',$SupplierName);
$this->db->or_where('POM.PODate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
$this->db->where('POM.PODate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
$this->db->or_where('supp.SupplierID',$Supplierid);
$this->db->group_by('POM.PONO');
$query = $this->db->get();
@ -191,8 +193,9 @@ class cashbook_model extends CI_Model
$this->db->join ('T_Bankinvoicereport BI','BI.invoiceno = iv.invoice_number','left');
$this->db->where('iv.invoice_status_id','2');
$this->db->where('iva.receivedstatus !=','ST065');
$this->db->where('ic.client_name',$Customer);
$this->db->or_where('iv.invoice_date_created BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
$this->db->where('iv.invoice_date_created BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"');
$this->db->or_where('ic.client_id',$Customer);
$this->db->group_by('iva.invoice_id');
//$this->db->where('inc.type','PAYMENT');
$query = $this->db->get();
@ -236,13 +239,13 @@ function debitpolist($bankid)
}
function creditinvoicelist($SupplierName,$fdate,$tdate,$bankid)
function creditinvoicelist($bankid)
{
$this->db->select('indate,invoiceno,customername,totinvoiceamount,bankid as id,
$this->db->select('indate,invoiceno,customername,totinvoiceamount,bankid,
balancetoreceived,amountreceived');
$this->db->from ('T_Bankinvoicereport');
$this->db->from ('T_Bankmappingiv');
$this->db->where('bankid',$bankid);
$this->db->group_by('invoiceno');
//$this->db->group_by('invoiceno');
$query = $this->db->get();
return $query->result();
@ -318,7 +321,7 @@ function newcashbook()
function debitlistpo($SupplierName,$fdate,$tdate,$pono)
{
$this->db->select('bmp.mid,bmp.PONO,bmp.Amountpaid,br.Narration');
$this->db->select('bmp.mid,bmp.PONO,bmp.Amountpaid,br.Narration');
$this->db->from ('T_Bankmappingpo as bmp');
$this->db->join('T_bankreport br','br.ID = bmp.mid');
@ -332,9 +335,8 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono)
function creditlistinv($invno)
{
$this->db->select('bmp.bankid,bmp.invoiceno,bmp.amountreceived,br.Narration');
$this->db->from ('T_Bankinvoicereport as bmp');
$this->db->join('T_bankreport br','br.ID = bmp.bankid');
$this->db->from ('T_Bankmappingiv as bmp');
$this->db->join('T_bankreport br','br.ID = bmp.bankid');
$this->db->where('invoiceno',$invno);
// $this->db->group_by('PONO');
$query = $this->db->get();
@ -344,7 +346,7 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono)
function getsupplier()
{
$this->db->select('SupplierName');
$this->db->select('SupplierName,SupplierID');
$this->db->from('T_SupplierDetailsN');
//$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code');
//$this->db->where('t_income_expense.id')
@ -354,7 +356,7 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono)
}
function getcustomer()
{
$this->db->select('client_name');
$this->db->select('client_name,client_id');
$this->db->from('ip_clients');
//$this->db->join('t_accountcode','t_income_expense.account_code=t_accountcode.code');
//$this->db->where('t_income_expense.id')
@ -376,12 +378,12 @@ function debitlistpo($SupplierName,$fdate,$tdate,$pono)
$r = $this->db->affected_rows();
return $r;
}
function invicedata($invoicedata)
{
$this->db->insert('T_Bankinvoicereport',$invoicedata);
$r = $this->db->affected_rows();
return $r;
}
// function invicedata($invoicedata)
// {
// $this->db->insert('T_Bankinvoicereport',$invoicedata);
// $r = $this->db->affected_rows();
// return $r;
// }
function mappingpo($podata)
{
$this->db->insert('T_Bankmappingpo',$podata);

View File

@ -118,7 +118,7 @@
{?>
<option value="<?php echo $gs->SupplierName;?>"><?php echo $gs->SupplierName ; ?></option>
<option value="<?php echo $gs->SupplierID;?>"><?php echo $gs->SupplierName ; ?></option>
<?php } endforeach; ?>
@ -189,7 +189,8 @@
$tvt=0.00;
if(!empty($bankdepit)){
foreach($bankdepit as $t)
{
{
//print_r($bankdepit);
$status=$t->Paymentstatus;
$balancetopay=$t->Balancetopay;
//print_r($$status);
@ -202,7 +203,7 @@
<td data-name="sell"><input type="checkbox" class="checkboxcheckbox" onchange="GetPayment(<?php echo $i ?>) "id="checkboxcheckbox<?php echo $i ?>" name="checkbox<?php echo $i ?>";></td>
<td align="left" id="date<?php echo $i ?>"><span><?php echo $t->PODate?></span></td>
<td align="left" id="date<?php echo $i ?>"><span><?php echo date_format(date_create($t->PODate),'d-m-Y');?></span></td>
<td align="left" id="pono<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $t->PONO;?>"><span><?php echo $t->PONO?></span></a></td>
<!--<td align="left"><a href="<?= base_url() ?>cashbook/bankreceipt?sid=<?php echo $t->PONO;?>"><span><?php echo $t->PONO?></span></a></td>-->
@ -278,7 +279,7 @@
<div class="col-md-12" id="tov1"></div>
<div class="col-md-12" id="qw1"></div>
<!--<input type="text" name="qw1" id="qw1">-->
@ -355,6 +356,7 @@ var intex=1;
var row=0;
var j=1;
var tott=0;
var total=0;
function GetPayment(i)
{
@ -363,13 +365,14 @@ function GetPayment(i)
var balanceamount=bankdebitamount-totalvalue;
var x = document.getElementById('checkboxcheckbox'+i).checked;
var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val())
var negative=0;
if(amount<0)
{
negative=1;
alert("Invalid Amount")
$('#invoicepaymet'+i).val('');
negative=1;
alert("Invalid Amount")
$('#invoicepaymet'+i).val('');
}
temp=intex;
@ -409,11 +412,12 @@ if(x==true)
var totalordervalue =document.getElementById ("tov"+i ).innerText;
//var advanceamount =document.getElementById ( "aa"+i ).innerText;
var invoicepayment =document.getElementById ( "qw"+i ).innerText;
$('#invoicepaymet'+i).val(invoicepayment);
//alert(invoicepayment+'ipa');
$('#invoicepaymet'+i).val(invoicepayment);
var RowCount= $('#Rowid').val();
//alert(RowCount);
//alert('advance' + advanceamount);
//alert(j+'j');
$('<input>').attr({
type:'hidden',
name:'date1'+j,
@ -458,7 +462,6 @@ if(x==true)
if(negative==1)
{
// alert()
for(o=1;o<j;o++)
{
@ -468,20 +471,27 @@ if(x==true)
}
intex = parseInt(intex)+1;
j=parseInt(j)+1;
var to=0;
//var to=0;
var to=0;
for(t=1;t<j;t++)
{
//var tt= $('#inv_amount'+t).val();
var tt=parseFloat( $('#qw1'+t).val() == '' ? '0.00' : $('#qw1'+t).val());
//alert(tt)
to = parseFloat(to) + parseFloat (tt);
//alert(to);
$('#addvalue').val(parseFloat(to).toFixed(2));
}
//alert(t+'loopt');
// var to=0;
// for(t=1;t<j;t++)
// {
// //var addedvalue= $('#qw1'+t).val();
// var tt=parseFloat( $('#qw1'+t).val() == '' ? '0.00' : $('#qw1'+t).val());
// to = parseFloat(to) + parseFloat(tt);
// $('#addvalue').val(parseFloat(to).toFixed(2));
// }
@ -530,7 +540,9 @@ else
//alert(ro);
$('#Rowid').val(ro);
//$('#addvalue').val('');
$('#invoicepaymet'+i).val('');
$('#date1'+i).val('');
$('#pono1'+i).val('');
@ -556,6 +568,7 @@ function isNumberKey(evt)
}
function GetAmount(i)
{
var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val())
//alert(amount);
var negative=0;
@ -566,7 +579,8 @@ function GetAmount(i)
$('#invoicepaymet'+i).val('');
}
var x = document.getElementById('checkboxcheckbox'+i).checked;
if(x==true && negative == 0)
{
//alert(x);
@ -636,6 +650,12 @@ function GetAmount(i)
}
// else
// {
// //document.getElementById('checkboxcheckbox'+i).checked = false;
// $('#invoicepaymet'+i).val('');
// $('#addvalue').val('');
// }
}
function Save()
@ -651,7 +671,6 @@ function Save()
rw= parseFloat(rw)+1;
check = parseFloat(check)+1;
var bankdebitamount=$('#debitamount').val();
//alert(bankdebitamount);
var bid=$('#bankid').val();
var date =$('#date1'+i).val();
@ -659,6 +678,7 @@ function Save()
var suppliername=$('#sn1'+i).val();
var totalordervalue=$('#tov1'+i).val();
var amountpaid=$('#qw1'+i).val();
//alert(amountpaid+'qw1');
var invoicepaymet=$('#invoicepaymet'+i).text();
// alert(invoicepaymet);
var totalvalue=$('#addvalue').val();
@ -672,7 +692,7 @@ function Save()
//alert('you have remainining'+balnceamount);
$.ajax(
{
data:{date:date,pono:pono,sname:suppliername,tot:totalordervalue,aa:amountpaid,ip:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
data:{podate:date,pono:pono,sname:suppliername,tot:totalordervalue,aa:amountpaid,ip:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
type:"POST",
url:"<?php echo base_url() ?>cashbook/receipt",
success:function(data)

View File

@ -119,7 +119,7 @@
{?>
<option value="<?php echo $gc->client_name;?>"><?php echo $gc->client_name ; ?></option>
<option value="<?php echo $gc->client_id;?>"><?php echo $gc->client_name ; ?></option>
<?php } endforeach; ?>
@ -205,7 +205,7 @@
<td data-name="sell"><input type="checkbox" onchange="GetPayment(<?php echo $i ?>) "id="checkboxcheckbox<?php echo $i ?>" name="checkbox<?php echo $i ?>";></td>
<td align="left" id="invoicedate<?php echo $i ?>"><span><?php echo $t->invoice_date_created?></span></td>
<td align="left" id="invoicedate<?php echo $i ?>"><span><?php echo date_format(date_create($t->invoice_date_created),'d-m-Y');?></span></td>
<td align="left" id="invoice_id<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingcredit?sid=<?php echo $t->invoice_number;?>"><span><?php echo $t->invoice_number?></span></td>
<td align="left" id="client_name<?php echo $i ?>"><span><?php echo $t->client_name?></span></td>
<td align="left" id="invoice_paid<?php echo $i ?>"><span><?php echo $t->invoice_total?></span></td>

View File

@ -200,8 +200,8 @@ if(!empty($debitmapping))
<td align="left" id="tov"><span><?php echo $ap->indate?></span></td>
<td align="left" id="invno"><a href="<?= base_url() ?>cashbook/mappingcredit?sid=<?php echo $ap->invoiceno;?>"><span><?php echo $ap->invoiceno?></span></a></td>
<td align="left" id="tov"><span><?php echo date_format(date_create($ap->indate),'d-m-Y');?></span></td>
<td align="left" id="invno"><?php echo $ap->invoiceno?></span></td>
<td align="left" id="aa"><span><?php echo $ap->customername?></span></td>
<td align="left" id="aa"><span><?php echo $ap->totinvoiceamount?></span></td>
<td align="left" id="aa"><span><?php echo $ap->balancetoreceived?></span></td>

View File

@ -209,7 +209,7 @@ if(!empty($mapping))
<td align="left" id="date"><span><?php echo $ap->Podate?></span></td>
<td align="left" id="date"><span><?php echo date_format(date_create($ap->Podate),'d-m-Y');?></span></td>
<td align="left" id="pono"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $ap->PONO;?>"><span><?php echo $ap->PONO?></span></a></td>
<!--<td align="left"><a href="<?= base_url() ?>cashbook/bankreceipt?sid=<?php echo $t->PONO;?>"><span><?php echo $t->PONO?></span></a></td>-->