
<tr>
    <td><input type="number" id="srno" name="srno" class="form-control" style="width: 50px;"> </td>
    <td><input type="text"  style="width: 100px;" value="{{ $data->item ?? '' }}" class="form-control"> </td>
    <td><input type="number"  name="grosswtgms"  value="{{ $data->grosswtgms ?? '' }}" class="form-control"></td>
    <td><input type="number" class="purity_input form-control" name="Purity" style="width: 80px;" > </td>
    <td><input type="number"  name="netgoldwtgms"   value="{{ $data->netgoldwtgms ?? '' }}" class="form-control"> </td>
    <td><input type="number"  name="diamondwtcts"  value="{{ $data->diamondwtcts ?? '' }}" class="form-control"> </td>
    <td><input type="number"  name="colorstonewtcts"  value="{{ $data->colorstonewtcts ?? '' }}" class="form-control"> </td>
    <td><input type="number"   name="totalamount"  value="{{ $data->totalamount ?? '' }}" class="form-control"> </td>
    <td><input type="number"   name="kwdamount"  value="{{ $data->kwdamount ?? '' }}" class="form-control"> </td>
</tr>
<script>



$(document).ready(function () {
   $('input[name="grosswtgmstotal"]').val(calcSum());
       $('input[name="grosswtgms"]').change(function () { 
         $('input[name="grosswtgmstotal"]').val(calcSum());
       });
       function calcSum() {
            var tamount = 0;
            $('input[name="grosswtgms"]').each(function() {
                tamount += parseFloat(($(this).val() ? $(this).val() : 0));
            });
  return tamount;
}
});


$(document).ready(function () {
   $('input[name="netgoldwtgmstotal"]').val(calcSum());
       $('input[name="netgoldwtgms"]').change(function () { 
         $('input[name="netgoldwtgmstotal"]').val(calcSum());
       });
       function calcSum() {
            var tamount = 0;
            $('input[name="netgoldwtgms"]').each(function() {
                tamount += parseFloat(($(this).val() ? $(this).val() : 0));
            });
  return tamount;
}
});

$(document).ready(function () {
   $('input[name="diamondwtctstotal"]').val(calcSum());
       $('input[name="diamondwtcts"]').change(function () { 
         $('input[name="diamondwtctstotal"]').val(calcSum());
       });
       function calcSum() {
            var tamount = 0;
            $('input[name="diamondwtcts"]').each(function() {
                tamount += parseFloat(($(this).val() ? $(this).val() : 0));
            });
  return tamount;
}
});


$(document).ready(function () {
   $('input[name="colorstonewtctstotal"]').val(calcSum());
       $('input[name="colorstonewtcts"]').change(function () { 
         $('input[name="colorstonewtctstotal"]').val(calcSum());
       });
       function calcSum() {
            var tamount = 0;
            $('input[name="colorstonewtcts"]').each(function() {
                tamount += parseFloat(($(this).val() ? $(this).val() : 0));
            });
  return tamount;
}
});



$(document).ready(function () {
   $('input[name="totalamounttotal"]').val(calcSum());
       $('input[name="totalamount"]').change(function () { 
         $('input[name="totalamounttotal"]').val(calcSum());
       });
       function calcSum() {
            var tamount = 0;
            $('input[name="totalamount"]').each(function() {
                tamount += parseFloat(($(this).val() ? $(this).val() : 0));
            });
  return tamount;
}
});

$(document).ready(function () {
   $('input[name="kwdamounttotal"]').val(calcSum());
       $('input[name="kwdamount"]').change(function () { 
         $('input[name="kwdamounttotal"]').val(calcSum());
       });
       function calcSum() {
            var tamount = 0;
            $('input[name="kwdamount"]').each(function() {
                tamount += parseFloat(($(this).val() ? $(this).val() : 0));
            });
  return tamount;
}
});

function numberRows() {
      $('input[name ="srno"]').each(function(i) {
            $(this).val(i + 1);
      });
		}
numberRows();


</script>