invoce total value wrong
This commit is contained in:
parent
f5f6f5ff06
commit
0534828956
@ -171,7 +171,8 @@ foreach($financialyear as $item)
|
|||||||
if(!empty($bankinvoicedata)){
|
if(!empty($bankinvoicedata)){
|
||||||
foreach($bankinvoicedata as $t)
|
foreach($bankinvoicedata as $t)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
//print_r($bankinvoicedata);
|
||||||
$status=$t->Paymentstatus;
|
$status=$t->Paymentstatus;
|
||||||
$balancetopay=$t->Balancetopay;
|
$balancetopay=$t->Balancetopay;
|
||||||
if($status !='ST057')
|
if($status !='ST057')
|
||||||
@ -309,7 +310,9 @@ function GetPayment(i)
|
|||||||
{
|
{
|
||||||
var x = document.getElementById('checkboxcheckbox'+i).checked;
|
var x = document.getElementById('checkboxcheckbox'+i).checked;
|
||||||
|
|
||||||
|
|
||||||
var amount= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val())
|
var amount= parseFloat( $('#invoicereceived'+i).val() == '' ? '0.00' : $('#invoicereceived'+i).val())
|
||||||
|
//alert(amount);
|
||||||
var negative=0;
|
var negative=0;
|
||||||
if(amount<0)
|
if(amount<0)
|
||||||
{
|
{
|
||||||
@ -326,6 +329,7 @@ if(x==true)
|
|||||||
$('#Rowid').val(row);
|
$('#Rowid').val(row);
|
||||||
var date= document.getElementById ( "invoicedate"+i ).innerText;
|
var date= document.getElementById ( "invoicedate"+i ).innerText;
|
||||||
var invid =document.getElementById ( "invoice_id"+i ).innerText;
|
var invid =document.getElementById ( "invoice_id"+i ).innerText;
|
||||||
|
//alert(invid);
|
||||||
var cusname =document.getElementById ("client_name"+i ).innerText;
|
var cusname =document.getElementById ("client_name"+i ).innerText;
|
||||||
var invoiceamount =document.getElementById ("invoice_paid"+i ).innerText;
|
var invoiceamount =document.getElementById ("invoice_paid"+i ).innerText;
|
||||||
var invoicereceived=document.getElementById ("invoice_balance"+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;
|
var invoicevalue = i+'-'+invid+'-'+invoicereceived;
|
||||||
|
|
||||||
tempinvoice.push(invoicevalue);
|
tempinvoice.push(invoicevalue);
|
||||||
|
|
||||||
calculategrandtotal();
|
calculategrandtotal();
|
||||||
|
|
||||||
intex = parseInt(intex)+1;
|
intex = parseInt(intex)+1;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -396,8 +403,12 @@ 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);
|
||||||
|
|
||||||
var a = tempinvoice.indexOf(invoicevalue);
|
var a = tempinvoice.indexOf(invoicevalue);
|
||||||
var b = tempTotal.indexOf(Payment);
|
var b = tempTotal.indexOf(Payment);
|
||||||
|
//alert(a);
|
||||||
|
//alert(b);
|
||||||
|
|
||||||
if(a!=-1)
|
if(a!=-1)
|
||||||
{
|
{
|
||||||
@ -488,6 +499,7 @@ function GetAmount(i)
|
|||||||
$('#hideinvoiceamount'+cid).val(invoiceamount);
|
$('#hideinvoiceamount'+cid).val(invoiceamount);
|
||||||
$('#hideinvoicerecd'+cid).val(amount);
|
$('#hideinvoicerecd'+cid).val(amount);
|
||||||
var totalvalue=$('#addvalue').val();
|
var totalvalue=$('#addvalue').val();
|
||||||
|
//alert(totalvalue);
|
||||||
var bid=$('#bankid').val();
|
var bid=$('#bankid').val();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -501,23 +513,55 @@ function GetAmount(i)
|
|||||||
|
|
||||||
$.each(tempinvoice, function( index, value )
|
$.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;
|
tempinvoice[index] = i+'-'+invid+'-'+amount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if( as == invid){
|
||||||
|
|
||||||
|
|
||||||
|
tempinvoice[index] = i+'-'+invid+'-'+amount;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
calculategrandtotal();
|
calculategrandtotal();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function calculategrandtotal(){
|
function calculategrandtotal(){
|
||||||
|
|
||||||
$.each(tempinvoice, function( index, value )
|
$.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]);
|
tempTotal[index]=parseFloat(res2[2]);
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
|
||||||
|
tempTotal[index]=parseFloat(res2[3]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//console.log(tempTotal);
|
//console.log(tempTotal);
|
||||||
var sum = 0;
|
var sum = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user