bankstatement bugs

This commit is contained in:
gayathri1990 2018-07-18 18:26:57 +05:30
parent 271b049d97
commit 526a6acbb2
4 changed files with 49 additions and 34 deletions

View File

@ -342,19 +342,24 @@ class cashbook extends BaseController
function addIncomeExpense() function addIncomeExpense()
{ {
$bankdate = $this->input->post('bankdate'); $bankdate = $this->input->post('bankdate');
$bankid = $this->input->post('bakid'); $bankid = $this->input->post('bakid');
$remaindebitamount=$this->input->post('remaindebitamount');
$remaincreditamount=$this->input->post('remaincreditamount');
$amount = $this->input->post('bankamount'); $amount = $this->input->post('bankamount');
$amounttype = $this->input->post('type'); $amounttype = $this->input->post('type');
$totalbankamount = $this->input->post('totalbankamount'); $totalbankamount = $this->input->post('totalbankamount');
$alreadypaid=$this->input->post('alreadypaid'); $alreadypaid=$this->input->post('alreadydebitpaid');
$directamount = $this->input->post('totalamount'); $directamount = $this->input->post('totalamount');
$debitamount=$this->input->post('debitamount'); $debitamount=$this->input->post('debitamount');
$alreadycreditpaid=$this->input->post('alreadycreditpaid'); $alreadycreditpaid=$this->input->post('alreadycreditpaid');
$bankorcash=$this->input->post('borc'); $bankorcash=$this->input->post('borc');
$total=$directamount+$alreadypaid; $total=$directamount+$alreadypaid;
$ctotal=$directamount+$alreadycreditpaid; $ctotal=$directamount+$alreadycreditpaid;
$updateBalancetocleared= $remaindebitamount-$directamount;
$updatecbalancetocleared= $remaincreditamount-$directamount;
if($amounttype==CREDIT) if($amounttype==CREDIT)
{ {
$type=RECEIPT; $type=RECEIPT;
@ -366,8 +371,7 @@ class cashbook extends BaseController
$bankamounttype=DEBIT; $bankamounttype=DEBIT;
} }
$alreadypaid=$this->input->post('alreadypaid');
//$total=$debitamount+$alreadypaid;
$accounttype = $this->input->post('myradio'); $accounttype = $this->input->post('myradio');
@ -481,14 +485,14 @@ class cashbook extends BaseController
//$clearbalance=$totalbankamount- //$clearbalance=$totalbankamount-
if($amounttype=='CREDIT') if($amounttype=='CREDIT')
{ {
$cashbookstatus1= array('cclearbalance'=>$ctotal,'cstatus'=>$statu,'IsActive'=>$isactive); $cashbookstatus1= array('cclearbalance'=>$ctotal,'cbalancetocleared'=>$updatecbalancetocleared,'cstatus'=>$statu,'IsActive'=>$isactive);
//print_r($cashbookstatus1); //print_r($cashbookstatus1);
//die(); //die();
$res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid);
} }
else else
{ {
$cashbookstatus = array('Clearbalance'=>$total,'Status'=>$statu1,'IsActive'=>$isactive); $cashbookstatus = array('Clearbalance'=>$total,'Balancetocleared'=>$updateBalancetocleared,'Status'=>$statu1,'IsActive'=>$isactive);
$res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid);
} }
@ -1249,7 +1253,14 @@ class cashbook extends BaseController
if($check == 1) if($check == 1)
{ {
//echo $arec; //echo $arec;
if($totalpaidamount>0)
{
$clearedblnce=($totalpaidamount+$arec); $clearedblnce=($totalpaidamount+$arec);
}
else
{
$clearedblnce=($arec-(-$totalpaidamount));
}
$balancetoreceived =($bankcreditamount-$totalpaidamount); $balancetoreceived =($bankcreditamount-$totalpaidamount);
$check =1; $check =1;
} }

View File

@ -209,10 +209,12 @@ else
$('#bakid').val(bid); $('#bakid').val(bid);
//alert(bid+'ighhhhhhhhhhhhh'); //alert(bid+'ighhhhhhhhhhhhh');
var bamd=bankiddebit[1]; var bamd=bankiddebit[1];
$('#remaindebitamount').val(bamd);
var alreadypaid=localStorage.getItem('paidedamount'); var alreadypaid=localStorage.getItem('paidedamount');
var narration=localStorage.getItem('narr'); var narration=localStorage.getItem('narr');
//alert(alreadypaid+'aap'); //alert(alreadypaid+'aap');
$('#alreadypaid').val(alreadypaid); $('#alreadydebitpaid').val(alreadypaid);
var banktotaldebit=localStorage.getItem('debitamount'); var banktotaldebit=localStorage.getItem('debitamount');
$('#totalbankamount').val(banktotaldebit); $('#totalbankamount').val(banktotaldebit);
document.getElementById("bankid").innerHTML=bid; document.getElementById("bankid").innerHTML=bid;
@ -239,6 +241,7 @@ else
var bidc=bankidcredit[0]; var bidc=bankidcredit[0];
$('#bakid').val(bidc); $('#bakid').val(bidc);
var bamc=bankidcredit[1]; var bamc=bankidcredit[1];
$('#remaincreditamount').val(bamc);
var narration=localStorage.getItem('narr'); var narration=localStorage.getItem('narr');
var totcredit=localStorage.getItem('totcredit'); var totcredit=localStorage.getItem('totcredit');
$('#totalbankamount').val(totcredit); $('#totalbankamount').val(totcredit);
@ -506,8 +509,10 @@ else
<input type="hidden" id="bakid" name="bakid"> <input type="hidden" id="bakid" name="bakid">
<input type="hidden" id="remaindebitamount" name="remaindebitamount">
<input type="hidden" id="remaincreditamount" name="remaincreditamount">
<input type="hidden" id="batype" name="type"> <input type="hidden" id="batype" name="type">
<input type="hidden" id="alreadypaid" name="alreadypaid"> <input type="hidden" id="alreadydebitpaid" name="alreadydebitpaid">
<input type="hidden" id="alreadycreditpaid" name="alreadycreditpaid"> <input type="hidden" id="alreadycreditpaid" name="alreadycreditpaid">
<input type="hidden" id="totalbankamount" name="totalbankamount"> <input type="hidden" id="totalbankamount" name="totalbankamount">
<input type="hidden" id="borc" name="borc"> <input type="hidden" id="borc" name="borc">

View File

@ -383,7 +383,7 @@ if(x==true)
//alert(invid+'iv'); //alert(invid+'iv');
var invoicevalue = i+'-'+invid+'-'+invoicereceived; var invoicevalue = i+','+invid+','+invoicereceived;
tempinvoice.push(invoicevalue); tempinvoice.push(invoicevalue);
@ -402,7 +402,7 @@ else
var Payment= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val()); var Payment= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val());
var Inid = document.getElementById ('invoice_id'+i ).innerText var Inid = document.getElementById ('invoice_id'+i ).innerText
var invoicevalue = i+'-'+Inid+'-'+Payment; var invoicevalue = i+','+Inid+','+Payment;
//alert(invoicevalue); //alert(invoicevalue);
var a = tempinvoice.indexOf(invoicevalue); var a = tempinvoice.indexOf(invoicevalue);
@ -459,15 +459,9 @@ function GetAmount(i)
var amount= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val()); var amount= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val());
var negative=0;
if(amount<0)
{
negative=1;
alert("Invalid Amount")
$('#invoicereceived'+i).val('');
}
var x = document.getElementById('checkboxcheckbox'+i).checked; var x = document.getElementById('checkboxcheckbox'+i).checked;
if(x==true && negative == 0) if(x==true )
{ {
var date= document.getElementById ( "invoicedate"+i ).innerText; var date= document.getElementById ( "invoicedate"+i ).innerText;
@ -515,7 +509,7 @@ function GetAmount(i)
{ {
var res2= value.split('-') var res2= value.split(',')
var as=res2[1]; var as=res2[1];
var sa=res2[2]; var sa=res2[2];
@ -525,14 +519,14 @@ function GetAmount(i)
if(res3 == invid){ if(res3 == invid){
tempinvoice[index] = i+'-'+invid+'-'+amount; tempinvoice[index] = i+','+invid+','+amount;
} }
else if( as == invid){ else if( as == invid){
tempinvoice[index] = i+'-'+invid+'-'+amount; tempinvoice[index] = i+','+invid+','+amount;
} }
}); });
calculategrandtotal(); calculategrandtotal();
@ -546,8 +540,8 @@ function calculategrandtotal(){
$.each(tempinvoice, function( index, value ) $.each(tempinvoice, function( index, value )
{ {
var res2 = value.split('-'); var res2 = value.split(',');
var a=res2.length; var a=res2.length;
@ -567,7 +561,15 @@ function calculategrandtotal(){
var sum = 0; var sum = 0;
for (var i = 0; i < tempTotal.length; i++) { for (var i = 0; i < tempTotal.length; i++) {
// alert(tempTotal);
// if(tempTotal < 0)
// {
// alert('minusvalue');
// }
// else
// {
// alert('plus');
// }
sum += tempTotal[i]; sum += tempTotal[i];
} }
@ -589,7 +591,7 @@ function Save()
{ {
var arrval = tempinvoice[i-1]; var arrval = tempinvoice[i-1];
var number = arrval.split('-'); var number = arrval.split(',');
number = number[0]; number = number[0];
//alert('rowcount'+i+'selectedcheckboxnumber'+number+'tempinvoice'+arrval); //alert('rowcount'+i+'selectedcheckboxnumber'+number+'tempinvoice'+arrval);
@ -612,8 +614,7 @@ function Save()
var invoicereceived=$('#invoicereceived'+number).val(); var invoicereceived=$('#invoicereceived'+number).val();
//var payment = parseFloat(invoiceamount); //var payment = parseFloat(invoiceamount);
if(parseFloat(totalvalue)<=parseFloat(bankdebitamount))
{
$.ajax( $.ajax(
{ {
@ -623,19 +624,14 @@ function Save()
success:function(data) success:function(data)
{ {
if(data) if(data)
{ {
//alert('Saved Successfully'); //alert('Saved Successfully');
window.location.href ="Bankingstatement"; window.location.href ="Bankingstatement";
} }
} }
}); });
}
else{
alert('You are payment exceeding');
location.reload();
}
// j=j+1; // j=j+1;
} }
} }

View File

@ -307,7 +307,7 @@ $Bankname = $t->Bankname;
{ {
?> ?>
<td align="left" id="btc<?php echo $i ?>"><span><?php echo ($t->Debit) - ($t->Clearbalance);?></span></td> <td align="left" id="btc<?php echo $i ?>"><span><?php echo ($t->Debit) - $clearbalance;?></span></td>
<?php <?php
} }
else else
@ -630,6 +630,8 @@ if (x==true)
var date=$('#date'+i).text(); var date=$('#date'+i).text();
var debit=$('#debit'+i).text(); var debit=$('#debit'+i).text();
var alreadypaid=$('#totalpaid'+i).text(); var alreadypaid=$('#totalpaid'+i).text();
var credit=$('#credit1'+i).text(); var credit=$('#credit1'+i).text();
localStorage.setItem('totcredit', credit); localStorage.setItem('totcredit', credit);
@ -638,6 +640,7 @@ if (x==true)
localStorage.setItem('narr',narration); localStorage.setItem('narr',narration);
var alreadycredit=$('#credit2'+i).text(); var alreadycredit=$('#credit2'+i).text();
localStorage.setItem('alreadyreceived',alreadycredit); localStorage.setItem('alreadyreceived',alreadycredit);
localStorage.setItem('paidedamount',alreadypaid); localStorage.setItem('paidedamount',alreadypaid);
var RowCount= $('#Rowid').val(); var RowCount= $('#Rowid').val();