473,465 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to calculate tax in html table?

4 New Member
I have the following table:

Expand|Select|Wrap|Line Numbers
  1.       0 -  40 000    0%       0
  2.  40 001 -  80 000   27%       0
  3.  80 001 - 200 000   32%  10 800
  4. 200 001 - 750 000   34%  49 200
  5. 750 001 -           37% 236 200
Assuming my Taxable Salary is 155 123.00 p.a, How do I calculate my tax payable with java script.(IF/Match). I all ready have written the table in html to sum all the income and deductions which gives me 155 123.00.

Thank you
May 22 '12 #1
7 1975
Rabbit
12,516 Recognized Expert Moderator MVP
What code do you have so far?
May 22 '12 #2
williamje
4 New Member
In Javascript!!! Hope I am right. Quite new to this stuff!!!


Expand|Select|Wrap|Line Numbers
  1. html>
  2. <head>
  3. <title>MONTHLY TAX</title>
  4. <style>
  5.      body {
  6.      font-size : sans-serif ;
  7.      }
  8.      #summation {
  9.      font-size : 18px ;
  10.      font-weight : bold ;
  11.      color : black ;
  12.      }
  13.      .txt {
  14.      background-color : gold ;
  15.      font-weight : bold ;
  16.      text-align : right ;
  17.      }
  18. </style>
  19. <script type="text/javascript"><!--
  20. function updatesum () {
  21. document.form.sum.value= (document.form.sum1.value -0) +
  22. (document.form.sum2.value -0) +
  23. (document.form.sum3.value -0) +
  24. (document.form.sum4.value -0) +
  25. (document.form.sum5.value -0) +
  26. (document.form.sum6.value -0) -
  27. (document.form.sum7.value -0) ;
  28. }
  29. function multiply () {
  30. var ans= (document.form.sum.value) * (document.form.twelve.value)
  31. document.form.answer.value=ans;
  32. }
  33. //--></script>
  34. </head>
  35. <body>
  36. <form name="form">
  37. <table width="335" bgcolor="black">
  38.    <caption align="left">
  39.    <b>NAMIBIA PERSONAL INCOME TAX RATES</b>
  40.    </caption>
  41.    <tr bgcolor="#EDC112">
  42.       <td align="right">0</td>
  43.       <td align="right">40 000</td>
  44.       <td align="right">0%</td>
  45.       <td align="right">0</td>
  46.    </tr>
  47.    <tr bgcolor="#EDC112">
  48.       <td align="right">40 001</td>
  49.       <td align="right">80 000</td>
  50.       <td align="right">27%</td>
  51.       <td align="right">0</td>
  52.    </tr>
  53.    <tr bgcolor="#EDC112">
  54.       <td align="right">80 001</td>
  55.       <td align="right">200 000</td>
  56.       <td align="right">32%</td>
  57.       <td align="right">10 800</td>
  58.    </tr>
  59.    <tr bgcolor="#EDC112">
  60.       <td align="right">200 001</td>
  61.       <td align="right">750 000</td>
  62.       <td align="right">34%</td>
  63.       <td align="right">49 200</td>
  64.    </tr>
  65.    <tr bgcolor="#EDC112">
  66.       <td align="right">750 001</td>
  67.       <td>&nbsp;</td>
  68.       <td align="right">37%</td>
  69.       <td align="right">236 200</td>
  70.    </tr>
  71.    <tr bgcolor="#EDC112">
  72.       <td><b><u>Monthly Tax</u></b></td>
  73.       <td>&nbsp;</td>
  74.       <td>&nbsp;</td>
  75.       <td>&nbsp;</td>
  76.    </tr>
  77.    <tr bgcolor="#EDC112">
  78.       <td>Basic Pay</td>
  79.       <td dir="rtl"><input name="sum1" id="sum1" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  80.       <td>&nbsp;</td>
  81.       <td>&nbsp;</td>
  82.    </tr>
  83.    <tr bgcolor="#EDC112">
  84.       <td>Bonus</td>
  85.       <td dir="rtl"><input name="sum2" id="sum2" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  86.       <td>&nbsp;</td>
  87.       <td>&nbsp;</td>
  88.    </tr>
  89.    <tr bgcolor="#EDC112">
  90.       <td>Overtime</td>
  91.       <td dir="rtl"><input name="sum3" id="sum3" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  92.       <td>&nbsp;</td>
  93.       <td>&nbsp;</td>
  94.    </tr>
  95.    <tr bgcolor="#EDC112">
  96.       <td>Standby</td>
  97.       <td dir="rtl"><input name="sum4" id="sum4" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  98.       <td>&nbsp;</td>
  99.       <td>&nbsp;</td>
  100.    </tr>
  101.    <tr bgcolor="#EDC112">
  102.       <td>2/3 Housing All</td>
  103.       <td dir="rtl"><input name="sum5" id="sum5" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  104.       <td>&nbsp;</td>
  105.       <td>&nbsp;</td>
  106.    </tr>
  107.    <tr bgcolor="#EDC112">
  108.       <td>Other Income</td>
  109.       <td dir="rtl"><input name="sum6" id="sum6" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  110.       <td>&nbsp;</td>
  111.       <td>&nbsp;</td>
  112.    </tr>
  113.    <tr bgcolor="red">
  114.       <td bgcolor="red">Less:Pension</td>
  115.       <td dir="rtl"><input name="sum7" id="sum7" type="text" size="12" maxlength="12" onchange="updatesum()"></td>
  116.       <td>&nbsp;</td>
  117.       <td>&nbsp;</td>
  118.    </tr>
  119.    <tr bgcolor="#EDC112">
  120.       <td><b>Taxable Salary</b></td>
  121.       <td dir="rtl"><input name="sum" id="sum" type="text" size="14" maxlength="14" readonly="true" disabled="disabled"></td>
  122.       <td></td></td>
  123.       <td></td></td>
  124.    </tr>
  125.    <tr bgcolor="#EDC112">
  126.       <td><input name="twelve" id="twelve" type="button" disabled="true" value="12"></td>
  127.       <td dir="rtl"><input name="answer" id="answer" type="text" size="14" maxlength="14"></td>
  128.       <td></td>
  129.       <td><input name="now" id="now" type="button" value="answer" onclick="multiply()" maxlength="14" size="14"></td>
  130.    </tr>
  131.    <tr bgcolor="#EDC112">
  132.       <td></td>
  133.       <td>&nbsp;</td>
  134.       <td>&nbsp;</td>
  135.       <td>&nbsp;</td>
  136.    </tr>
  137.    <tr bgcolor="#EDC112">
  138.       <td><b>Tax Payable</b></td>
  139.       <td dir="rtl"><input name="Tax Payable" id="Tax Payable" type="text" size="12" maxlength="12" readonly="true"></td>
  140.       <td></td>
  141.       <td></td>
  142.    </tr>
  143.    <tr bgcolor="#EDC112">
  144.       <td>1</td>
  145.       <td>&nbsp;</td>
  146.       <td>&nbsp;</td>
  147.       <td>&nbsp;</td>
  148.    </tr>
  149.    <tr bgcolor="#EDC112">
  150.       <td>2</td>
  151.       <td>&nbsp;</td>
  152.       <td>&nbsp;</td>
  153.       <td>&nbsp;</td>
  154.    </tr>
  155.    <tr bgcolor="#EDC112">
  156.       <td>3</td>
  157.       <td>&nbsp;</td>
  158.       <td>&nbsp;</td>
  159.       <td>&nbsp;</td>
  160.    </tr>
  161.    <tr bgcolor="#EDC112">
  162.       <td>4</td>
  163.       <td>&nbsp;</td>
  164.       <td>&nbsp;</td>
  165.       <td>&nbsp;</td>
  166.    </tr>
  167.    <tr bgcolor="#EDC112">
  168.       <td>5</td>
  169.       <td>&nbsp;</td>
  170.       <td>&nbsp;</td>
  171.       <td>&nbsp;</td>
  172.    </tr>
  173.    <tr bgcolor="#EDC112">
  174.       <td>6</td>
  175.       <td>&nbsp;</td>
  176.       <td>&nbsp;</td>
  177.       <td>&nbsp;</td>
  178.    </tr>
  179.    <tr bgcolor="#EDC112">
  180.       <td>&nbsp;</td>
  181.       <td>&nbsp;</td>
  182.       <td>&nbsp;</td>
  183.       <td>&nbsp;</td>
  184.    </tr>
  185.    <tr bgcolor="#EDC112">
  186.       <td>&nbsp;</td>
  187.       <td>&nbsp;</td>
  188.       <td>&nbsp;</td>
  189.       <td>&nbsp;</td>
  190.    </tr>
  191.    <tr bgcolor="#EDC112">
  192.       <td>&nbsp;</td>
  193.       <td>&nbsp;</td>
  194.       <td>&nbsp;</td>
  195.       <td>&nbsp;</td></td>
  196.    </tr>
  197. </table>
  198. <form/>
  199. </body>
  200. </html>
May 23 '12 #3
Rabbit
12,516 Recognized Expert Moderator MVP
Please use code tags when posting code.

And is it working?
May 23 '12 #4
williamje
4 New Member
Yes Rabbit,it is working. Where can I mail you the html page?
May 24 '12 #5
Rabbit
12,516 Recognized Expert Moderator MVP
Well, if it's working, I don't need to see the page.
May 24 '12 #6
williamje
4 New Member
Hi Rabbit,

Did you fully understand my question? I am missing the final part in my table,i.e." How will I match the 155 123.00(Taxable Salary) in the table to calculate the Tax Payable? with reference to the Table"
May 24 '12 #7
Rabbit
12,516 Recognized Expert Moderator MVP
Whether or not I understood your question is moot. You said it was working. Meaning you were able to resolve your own question. However, it seems that you mean what you have so far runs fine but your code is not working because it's not producing the results you want.

I will have to look at this tomorrow when I get more time.
May 24 '12 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: alex | last post by:
Hi, I am looking for a way to populate an HTML table from an external local text file which looks like this: DATE/TIME LAT. LON. DEPTH. ML....
5
by: ted | last post by:
Hello, I have a HTML table in my XSL that basically handles the layout of the whole page. I'm using xsl:include to split up the XSL into separate files. Is there a trick or technique to put...
10
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
0
by: demon | last post by:
if i give you a htmltable object , how can i calculate the table's height in browser?
4
by: Sebastiano | last post by:
I have written a simple page with a 1x1 HTML table. I have set the two property height and width of the table to 100%. I have named this page test.htm and I try to see it using my IIS 5.0 (in...
4
by: KatB | last post by:
Hi, in order to format my web page, I'm starting to use Flow layout so using html tables to space out controls, etc. When using grid layout, the following worked when it was just a datagrid. I...
1
by: Al Wilkerson | last post by:
Hey, I have a Web Form with a drop down list, textbox, and search button. When click the search button an SQL server database is queried fordata. Once I have the data in a dataset I use the...
6
by: McKirahan | last post by:
I an using ASP to read a database table and generate an HTML table which is save via FSO with a file extension of .xls which opens up in MS-Excel. I am inserting several lines of text into a cell...
2
by: Geary | last post by:
I am porting my first traditional app to a web-based app using VS2005 and ASP.NET 2.0. I have a page that will replace a data entry form. To have complete control of layout, I want to use a table...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.