Jump to content

round total...


techker

Recommended Posts

Hey guys i have tried a few combinations with no luck...

 

i have a tax cal for my invoice form but i need to round out the total not to have 1.23445

 

 

i have tried

 

 
 document.formname.Total.value = formname.Total.value.round (text1+text2+text3+text4+text5)* 0.14975 + (text1+text2+text3+text4+text5);
 
 document.formname.Total.value = Total.round (text1+text2+text3+text4+text5)* 0.14975 + (text1+text2+text3+text4+text5);
 
 
...
 
any clue how?
 
Link to comment
https://forums.phpfreaks.com/topic/284205-round-total/
Share on other sites

So i have an invoice and it calculates tax.works fine but i need to round the decimals.so i don't get 12.1234$

 

i have this

 

function calculate(){ 
 
 if(isNaN(document.formname.f1.value) || document.formname.f1.value==""){ 
 var text1 = 0; 
 }else{ 
 var text1 = parseInt(document.formname.f1.value); 
 } 
 
 if(isNaN(document.formname.f2.value) || document.formname.f2.value==""){ 
 var text2 = 0; 
 }else{ 
 var text2 = parseFloat(document.formname.f2.value); 
 } 
 
  if(isNaN(document.formname.f3.value) || document.formname.f3.value==""){ 
 var text3 = 0; 
 }else{ 
 var text3 = parseFloat(document.formname.f3.value); 
 } 
 
  if(isNaN(document.formname.f4.value) || document.formname.f4.value==""){ 
 var text4 = 0; 
 }else{ 
 var text4 = parseFloat(document.formname.f4.value); 
 } 
 
  if(isNaN(document.formname.f5.value) || document.formname.f5.value==""){ 
 var text5 = 0; 
 }else{ 
 var text5 = parseFloat(document.formname.f5.value); 
 } 
 
 
 
 document.formname.Total.value = (text1+text2+text3+text4+text5)* 0.14975 + (text1+text2+text3+text4+text5);
Link to comment
https://forums.phpfreaks.com/topic/284205-round-total/#findComment-1459764
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.