diff --git a/application/views/bankinvoice.php b/application/views/bankinvoice.php index dd29225e..9fb0ece0 100644 --- a/application/views/bankinvoice.php +++ b/application/views/bankinvoice.php @@ -171,7 +171,8 @@ foreach($financialyear as $item) if(!empty($bankinvoicedata)){ foreach($bankinvoicedata as $t) - { + { + //print_r($bankinvoicedata); $status=$t->Paymentstatus; $balancetopay=$t->Balancetopay; if($status !='ST057') @@ -309,7 +310,9 @@ function GetPayment(i) { var x = document.getElementById('checkboxcheckbox'+i).checked; + var amount= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val()) +//alert(amount); var negative=0; if(amount<0) { @@ -326,6 +329,7 @@ if(x==true) $('#Rowid').val(row); var date= document.getElementById ( "invoicedate"+i ).innerText; var invid =document.getElementById ( "invoice_id"+i ).innerText; + //alert(invid); var cusname =document.getElementById ("client_name"+i ).innerText; var invoiceamount =document.getElementById ("invoice_paid"+i ).innerText; var invoicereceived=document.getElementById ("invoice_balance"+i ).innerText; @@ -377,13 +381,16 @@ if(x==true) } } - + //alert(invid+'iv'); + var invoicevalue = i+'-'+invid+'-'+invoicereceived; + tempinvoice.push(invoicevalue); calculategrandtotal(); intex = parseInt(intex)+1; + } @@ -396,8 +403,12 @@ 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; + //alert(invoicevalue); + var a = tempinvoice.indexOf(invoicevalue); var b = tempTotal.indexOf(Payment); + //alert(a); + //alert(b); if(a!=-1) { @@ -488,6 +499,7 @@ function GetAmount(i) $('#hideinvoiceamount'+cid).val(invoiceamount); $('#hideinvoicerecd'+cid).val(amount); var totalvalue=$('#addvalue').val(); + //alert(totalvalue); var bid=$('#bankid').val(); } else @@ -501,23 +513,55 @@ function GetAmount(i) $.each(tempinvoice, function( index, value ) { - var res2 = value.split('-'); - if(res2[1] == invid){ + + + var res2= value.split('-') + + var as=res2[1]; + var sa=res2[2]; + var concat=as.concat(sa); + var res3 = concat.replace('2018','2018-'); + + + if(res3 == invid){ tempinvoice[index] = i+'-'+invid+'-'+amount; + } + + else if( as == invid){ + + +tempinvoice[index] = i+'-'+invid+'-'+amount; +} }); calculategrandtotal(); } } + + function calculategrandtotal(){ $.each(tempinvoice, function( index, value ) { - var res2 = value.split('-'); + + var res2 = value.split('-'); + + var a=res2.length; + + + if(res2.length==3){ + tempTotal[index]=parseFloat(res2[2]); + + } + else{ + + + tempTotal[index]=parseFloat(res2[3]); + } }); //console.log(tempTotal); var sum = 0;