diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 374be11e..addcf7a6 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -342,19 +342,24 @@ class cashbook extends BaseController function addIncomeExpense() { + $bankdate = $this->input->post('bankdate'); $bankid = $this->input->post('bakid'); + $remaindebitamount=$this->input->post('remaindebitamount'); + $remaincreditamount=$this->input->post('remaincreditamount'); $amount = $this->input->post('bankamount'); $amounttype = $this->input->post('type'); $totalbankamount = $this->input->post('totalbankamount'); - $alreadypaid=$this->input->post('alreadypaid'); + $alreadypaid=$this->input->post('alreadydebitpaid'); $directamount = $this->input->post('totalamount'); $debitamount=$this->input->post('debitamount'); $alreadycreditpaid=$this->input->post('alreadycreditpaid'); $bankorcash=$this->input->post('borc'); $total=$directamount+$alreadypaid; $ctotal=$directamount+$alreadycreditpaid; + $updateBalancetocleared= $remaindebitamount-$directamount; + $updatecbalancetocleared= $remaincreditamount-$directamount; if($amounttype==CREDIT) { $type=RECEIPT; @@ -366,8 +371,7 @@ class cashbook extends BaseController $bankamounttype=DEBIT; } - $alreadypaid=$this->input->post('alreadypaid'); - //$total=$debitamount+$alreadypaid; + $accounttype = $this->input->post('myradio'); @@ -481,14 +485,14 @@ class cashbook extends BaseController //$clearbalance=$totalbankamount- if($amounttype=='CREDIT') { - $cashbookstatus1= array('cclearbalance'=>$ctotal,'cstatus'=>$statu,'IsActive'=>$isactive); + $cashbookstatus1= array('cclearbalance'=>$ctotal,'cbalancetocleared'=>$updatecbalancetocleared,'cstatus'=>$statu,'IsActive'=>$isactive); //print_r($cashbookstatus1); //die(); $res1 = $this->cashbook_model->cashcreditupdate($cashbookstatus1,$bankid); } 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); } @@ -1249,7 +1253,14 @@ class cashbook extends BaseController if($check == 1) { //echo $arec; + if($totalpaidamount>0) + { $clearedblnce=($totalpaidamount+$arec); + } + else + { + $clearedblnce=($arec-(-$totalpaidamount)); + } $balancetoreceived =($bankcreditamount-$totalpaidamount); $check =1; } diff --git a/application/views/bankcashnew.php b/application/views/bankcashnew.php index 428dfbd9..2d96d972 100644 --- a/application/views/bankcashnew.php +++ b/application/views/bankcashnew.php @@ -209,10 +209,12 @@ else $('#bakid').val(bid); //alert(bid+'ighhhhhhhhhhhhh'); var bamd=bankiddebit[1]; + $('#remaindebitamount').val(bamd); var alreadypaid=localStorage.getItem('paidedamount'); + var narration=localStorage.getItem('narr'); //alert(alreadypaid+'aap'); - $('#alreadypaid').val(alreadypaid); + $('#alreadydebitpaid').val(alreadypaid); var banktotaldebit=localStorage.getItem('debitamount'); $('#totalbankamount').val(banktotaldebit); document.getElementById("bankid").innerHTML=bid; @@ -239,6 +241,7 @@ else var bidc=bankidcredit[0]; $('#bakid').val(bidc); var bamc=bankidcredit[1]; + $('#remaincreditamount').val(bamc); var narration=localStorage.getItem('narr'); var totcredit=localStorage.getItem('totcredit'); $('#totalbankamount').val(totcredit); @@ -506,8 +509,10 @@ else + + - + diff --git a/application/views/bankinvoice.php b/application/views/bankinvoice.php index 5ae32c8a..10b96bf5 100644 --- a/application/views/bankinvoice.php +++ b/application/views/bankinvoice.php @@ -383,7 +383,7 @@ if(x==true) //alert(invid+'iv'); - var invoicevalue = i+'-'+invid+'-'+invoicereceived; + var invoicevalue = i+','+invid+','+invoicereceived; tempinvoice.push(invoicevalue); @@ -402,7 +402,7 @@ else var Payment= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val()); var Inid = document.getElementById ('invoice_id'+i ).innerText - var invoicevalue = i+'-'+Inid+'-'+Payment; + var invoicevalue = i+','+Inid+','+Payment; //alert(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 negative=0; - if(amount<0) - { - negative=1; - alert("Invalid Amount") - $('#invoicereceived'+i).val(''); - } + var x = document.getElementById('checkboxcheckbox'+i).checked; - if(x==true && negative == 0) + if(x==true ) { 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 sa=res2[2]; @@ -525,14 +519,14 @@ function GetAmount(i) if(res3 == invid){ - tempinvoice[index] = i+'-'+invid+'-'+amount; + tempinvoice[index] = i+','+invid+','+amount; } else if( as == invid){ -tempinvoice[index] = i+'-'+invid+'-'+amount; +tempinvoice[index] = i+','+invid+','+amount; } }); calculategrandtotal(); @@ -546,8 +540,8 @@ function calculategrandtotal(){ $.each(tempinvoice, function( index, value ) { - - var res2 = value.split('-'); + + var res2 = value.split(','); var a=res2.length; @@ -567,7 +561,15 @@ function calculategrandtotal(){ var sum = 0; for (var i = 0; i < tempTotal.length; i++) { - + // alert(tempTotal); + // if(tempTotal < 0) + // { + // alert('minusvalue'); + // } + // else + // { + // alert('plus'); + // } sum += tempTotal[i]; } @@ -589,7 +591,7 @@ function Save() { var arrval = tempinvoice[i-1]; - var number = arrval.split('-'); + var number = arrval.split(','); number = number[0]; //alert('rowcount'+i+'selectedcheckboxnumber'+number+'tempinvoice'+arrval); @@ -612,8 +614,7 @@ function Save() var invoicereceived=$('#invoicereceived'+number).val(); //var payment = parseFloat(invoiceamount); - if(parseFloat(totalvalue)<=parseFloat(bankdebitamount)) - { + $.ajax( { @@ -623,19 +624,14 @@ function Save() success:function(data) { if(data) - { + { //alert('Saved Successfully'); window.location.href ="Bankingstatement"; } } }); - } - else{ - - alert('You are payment exceeding'); - location.reload(); - } + // j=j+1; } } diff --git a/application/views/bankstatement.php b/application/views/bankstatement.php index b4419a9c..bc0304dc 100644 --- a/application/views/bankstatement.php +++ b/application/views/bankstatement.php @@ -307,7 +307,7 @@ $Bankname = $t->Bankname; { ?> - Debit) - ($t->Clearbalance);?> + Debit) - $clearbalance;?>