I want column 5 to get the sum of "TxToplamNet" id inputs.
I would like to write the value of the column number 4 with the value of column 5 and write to the input of "Total Kdv" id.
I get a Cannot read property 'getElementsByTagName'
error.
function Hesapla(Satir) {
var Tablo;
var SatirId;
var Miktar;
var Fiyat;
var KdvOrani;
var Tutar;
var ToplamSatir;
var ToplamNet;
var ToplamKdv;
Tablo = document.getElementById("FaturaDetay");
SatirId = Satir.parentNode.parentNode.rowIndex;
Miktar = parseFloat(Tablo.rows[SatirId].cells[1].getElementsByTagName("input")[0].value);
Fiyat = parseFloat(Tablo.rows[SatirId].cells[3].getElementsByTagName("input")[0].value);
Tutar = Miktar * Fiyat;
Tablo.rows[SatirId].cells[5].getElementsByTagName("input")[0].value = Tutar.toString();
try {
for (var i = 1; i < Tablo.rows.length; i++) {
ToplamNet += parseFloat(Tablo.rows[i].cells[5].getElementsByTagName("input")[0].value);
KdvOrani = parseFloat(Tablo.rows[i].cells[4].getElementsByTagName("input")[0].value);
ToplamSatir = parseFloat(Tablo.rows[i].cells[5].getElementsByTagName("input")[0].value);
ToplamKdv += ToplamSatir / 100 * KdvOrani;
}
} catch (Hata) {
alert(Hata.message)
}
document.getElementById("TxToplamNet").value = ToplamNet;
document.getElementById("TxToplamKdv").value = ToplamKdv;
document.getElementById("TxToplamGenel").value = ToplamNet + ToplamKdv;
}
<tbody>
<tr>
<td>
<input id="StokAd" class="form-control form-control-sm text-left">
</td>
<td>
<input id="Miktar" class="form-control form-control-sm text-right" value="0">
</td>
<td>
<input id="Birim" class="form-control form-control-sm text-left">
</td>
<td>
<input id="Fiyat" class="form-control form-control-sm text-right" onkeyup="Hesapla(this)" value="0">
</td>
<td>
<input id="Kdv" class="form-control form-control-sm text-center" value="18">
</td>
<td>
<input id="Tutar" class="form-control form-control-sm text-right" value="0" readonly>
</td>
<td>
<a class="btn btn-sm btn-outline-danger" onclick="SatirSil(this)">X</a>
</td>
</tr>
</tbody>
Comments
Post a Comment