JSFiddle - React, Tailwind, and code Playground
by Rohan Kumar
HTML
<form id="monthRevenue" action="../macro/$proj/cgi/DB_monthRevenue.cgi" method="post" enctype="multipart/form-data">
<input type="radio" value="excise" name="excOrSer" id="excise" />excise duty
<input type="radio" value="service" name="excOrSer" id="service" />service tax
<div id="returns" style="height: 90%;width: 100%;overflow: auto"></div>
</form>
JavaScript
$(document).ready(function () {
$(document).on('keyup',"input[name*='bed'][class='amount']", function () {
var sum = 0;
//iterate through each textboxes and add the values
$("input[name*='bed'][class='amount']").each(function () {
//add only if the value is number
if (!isNaN(this.value) && this.value.length != 0) {
sum += parseFloat(this.value);
}
});
$("input[name='totalBEDamount']").val(sum.toFixed(2));
});
});
// below code is for table creation
var exciseInputFields = {
'Cenvat Register A BED - 120040': '120040bed',
'Service tax BED - 120310': '120310bed',
'Cenvat Register C BED - 120150': '120150bed',
'Cenvat Register A ADC - BED - 120064': '120064bed',
'Cenvat Register C ADC -BED - 120144': '120144bed',
'PLA BED - 120000': '120000bed',
'TOTAL - BED': 'totalBED',
'PLA NCCD - 120006': 120006,
'CENVAT NCCD - 120070': 120070,
'TOTAL - NCCD': 'totalNCCD',
'PLA EDN CESS - 120243': 120243,
'Cenvat Register A EDN Cess - 120244': 120244,
'Cenvat Register C EDN Cess - 120245': 120245,
'Service tax EDN Cess - 120311 ': 120311,
'EDN CESS TOTAL': 'totalEDNe',
'PLA S & H EDN CESS - 120496': 120496,
'Cenvat Register A S & H EDN Cess -120493': 120493,
'Cenvat Register C S & H EDN Cess - 120494': 120494,
'Service tax S & H EDN Cess - 120495': 120495,
'S & H EDN CESS TOTAL': 'totalShEDNe',
'PLA AUTOMOBILE CESS - 120005': 120005,
'CENVAT ADC - 120064': 120064,
'GRAND TOTAL': 'Etotal'
};
var serviceInputFields = {
'Cenvat Register A - S. Tax': 'aSTax',
'Service Tax - S. Tax': 'sTax',
'Cenvat Register C BED - S. Tax': 'cBED',
'Cenvat Register A ADC - S. Tax': 'aADC',
...