title: how to calculate gst value
body: <p>I have sales transaction in my project, I want to calculate total amount with and without <code>gst</code>.
  <a href="https://i.stack.imgur.com/nmBqh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nmBqh.png" alt="enter image description here"></a></p>
  
  <p>I keep a <code>textbox</code> to enter the <code>gst</code> value if we want we enter the <code>gst</code> value for the particular product while auto calculated when key ups if we don't want to include the total amount to be calculated automatically.</p>
  
  <p><strong>JavaScript:</strong></p>
  
  <pre><code>$(document).ready(function() {
    $('#gst').keyup(function(ev) {
      var reeta = price * qty;
      var tot_price = (reeta * gst / 100) + reeta ;
      var divobj = document.getElementById('tot_amount');
      divobj.value = tot_price;
    });
  });
  </code></pre>
  
  <p><strong>PHP:</strong></p>
  
  <pre><code>&lt;tr&gt;
    &lt;td&gt;
      &lt;?php echo ++$counter; ?&gt;
    &lt;/td&gt;
    &lt;td class="record"&gt;
      &lt;?php echo $row['prod_name'];?&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;input class="w3-input w3-border" name="pages" id="qty" type="text" readonly value="&lt;?php echo $row['qty'];?"&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;input class="w3-input w3-border" name="pages" id="price" type="text" readonly value="&lt;?php echo number_format($row['price'], 2);?&gt;"&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;input class="w3-input w3-border" name="pages" id="gst" type="text"&gt;&lt;br&gt;&lt;br&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;input class="w3-input w3-border" name="tot_amount" readonly id="tot_amount" type="text" &gt;&lt;br&gt;&lt;br&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Thus I need to calculate <code>gst</code> based on the rate entered <code>gstrate</code> field. Can anyone give me a hand? Most of the formulas calculate <code>gst</code> amount and add it to subtotal but I have no chance to do that.</p>