Mohon bantuannya mas? Bagaimana cara menghitung total bayar, vat , dan total order dari kode berikut ini: Mohon bantuannya sudah buntu ni (ini cuplikan kodenya):
</table>
<br>
<table border="0" align="center">
<div align="center" style="text-decoration:underline "><strong>Spesifikasi Project:</strong></div>
<tr>
<td width="500"><b>Material</b></td>
<td width="20"><b>Qty</b></td>
<td width="20"><b>Harga (Rp)</b></td>
<td width="20"><b>Total (Rp)</b></td>
</tr>
<script>
function hitung() {
var jumlah01 = document.getElementsByName("jumlah01")[0].value;
var harga01 = document.getElementsByName("harga01")[0].value;
var total01 = parseInt(harga01) * parseInt(jumlah01);
document.getElementsByName("total01")[0].value = total01;
}
function hitung02() {
var jumlah02 = document.getElementsByName("jumlah02")[0].value;
var harga02 = document.getElementsByName("harga02")[0].value;
var total02 = parseInt(harga02) * parseInt(jumlah02);
document.getElementsByName("total02")[0].value = total02;
}
function hitung03() {
var jumlah03 = document.getElementsByName("jumlah03")[0].value;
var harga03 = document.getElementsByName("harga03")[0].value;
var total03 = parseInt(harga03) * parseInt(jumlah03);
document.getElementsByName("total03")[0].value = total03;
}
function hitung04() {
var jumlah04 = document.getElementsByName("jumlah04")[0].value;
var harga04= document.getElementsByName("harga04")[0].value;
var total04 = parseInt(harga04) * parseInt(jumlah04);
document.getElementsByName("total04")[0].value = total04;
}
function hitung05() {
var jumlah05 = document.getElementsByName("jumlah05")[0].value;
var harga05 = document.getElementsByName("harga05")[0].value;
var total05 = parseInt(harga05) * parseInt(jumlah05);
document.getElementsByName("total05")[0].value = total05;
}
function hitung06() {
var jumlah06 = document.getElementsByName("jumlah06")[0].value;
var harga06 = document.getElementsByName("harga06")[0].value;
var total06 = parseInt(harga06) * parseInt(jumlah06);
document.getElementsByName("total06")[0].value = total06;
}
function hitung07() {
var jumlah07 = document.getElementsByName("jumlah07")[0].value;
var harga07 = document.getElementsByName("harga07")[0].value;
var total07 = parseInt(harga07) * parseInt(jumlah07);
document.getElementsByName("total07")[0].value = total07;
}
function hitung08() {
var jumlah08 = document.getElementsByName("jumlah08")[0].value;
var harga08 = document.getElementsByName("harga08")[0].value;
var total08 = parseInt(harga08) * parseInt(jumlah08);
document.getElementsByName("total08")[0].value = total08;
}
function hitung09() {
var jumlah09 = document.getElementsByName("jumlah09")[0].value;
var harga09 = document.getElementsByName("harga09")[0].value;
var total09 = parseInt(harga09) * parseInt(jumlah09);
document.getElementsByName("total09")[0].value = total09;
}
function hitung10() {
var jumlah10 = document.getElementsByName("jumlah10")[0].value;
var harga10 = document.getElementsByName("harga10")[0].value;
var total10 = parseInt(harga10) * parseInt(jumlah10);
document.getElementsByName("total10")[0].value = total10;
}
function hitung11() {
var jumlah11 = document.getElementsByName("jumlah11")[0].value;
var harga11 = document.getElementsByName("harga11")[0].value;
var total11 = parseInt(harga11) * parseInt(jumlah11);
document.getElementsByName("total11")[0].value = total11;
}
function hitung12() {
var jumlah12 = document.getElementsByName("jumlah12")[0].value;
var harga12 = document.getElementsByName("harga12")[0].value;
var total12 = parseInt(harga12) * parseInt(jumlah12);
document.getElementsByName("total12")[0].value = total12;
}
function hitung13() {
var jumlah13 = document.getElementsByName("jumlah13")[0].value;
var harga13= document.getElementsByName("harga13")[0].value;
var total13 = parseInt(harga13) * parseInt(jumlah13);
document.getElementsByName("total13")[0].value = total13;
}
function hitung14() {
var jumlah14 = document.getElementsByName("jumlah14")[0].value;
var harga14 = document.getElementsByName("harga14")[0].value;
var total14 = parseInt(harga14) * parseInt(jumlah14);
document.getElementsByName("total14")[0].value = total14;
}
function hitung15() {
var jumlah15 = document.getElementsByName("jumlah15")[0].value;
var harga15 = document.getElementsByName("harga15")[0].value;
var total15 = parseInt(harga15) * parseInt(jumlah15);
document.getElementsByName("total15")[0].value = total15;
}
</script>
<tr>
<td><input type=text name='material01' size='80'></td>
<td><input type=text name='jumlah01' size='10' value="0" onKeyUp='hitung()'></td>
<td><input type=text name='harga01' size='20' value="0" onKeyUp='hitung()'></td>
<td><input type=text name='total01' size='20' value="0" readonly="total01" ></td>
</tr>
<tr>
<td><input type=text name='material02' size='80'></td>
<td><input type=text name='jumlah02' size='10' value="0" onKeyUp='hitung02()'></td>
<td><input type=text name='harga02' size='20' value="0" onKeyUp='hitung02()'></td>
<td><input type=text name='total02' size='20' value="0" readonly="total02"></td>
</tr>
<tr>
<td><input type=text name='material03' size='80'></td>
<td><input type=text name='jumlah03' size='10' value="0" onKeyUp='hitung03()'></td>
<td><input type=text name='harga03' size='20' value="0" onKeyUp='hitung03()'></td>
<td><input type=text name='total03' size='20' value="0" readonly="total03"></td>
</tr>
<tr>
<td><input type=text name='material04' size='80'></td>
<td><input type=text name='jumlah04' size='10' value="0" onKeyUp='hitung04()'></td>
<td><input type=text name='harga04' size='20' value="0" onKeyUp='hitung04()'></td>
<td><input type=text name='total04' size='20' value="0" readonly="total04"></td>
</tr>
<tr>
<td><input type=text name='material05' size='80'></td>
<td><input type=text name='jumlah05' size='10' value="0" onKeyUp='hitung05()'></td>
<td><input type=text name='harga05' size='20' value="0" onKeyUp='hitung05()'></td>
<td><input type=text name='total05' size='20' value="0" readonly="total05"></td>
</tr>
<tr>
<td><input type=text name='material06' size='80'></td>
<td><input type=text name='jumlah06' size='10' value="0" onKeyUp='hitung06()'></td>
<td><input type=text name='harga06' size='20' value="0" onKeyUp='hitung06()'></td>
<td><input type=text name='total06' size='20' value="0" readonly="total06"></td>
</tr>
<tr>
<td><input type=text name='material07' size='80'></td>
<td><input type=text name='jumlah07' size='10' value="0" onKeyUp='hitung07()'></td>
<td><input type=text name='harga07' size='20' value="0" onKeyUp='hitung07()'></td>
<td><input type=text name='total07' size='20' value="0" readonly="total07"></td>
</tr>
<tr>
<td><input type=text name='material08' size='80'></td>
<td><input type=text name='jumlah08' size='10' value="0" onKeyUp='hitung08()'></td>
<td><input type=text name='harga08' size='20' value="0" onKeyUp='hitung08()'></td>
<td><input type=text name='total08' size='20' value="0" readonly="total08"></td>
</tr>
<tr>
<td><input type=text name='material09' size='80'></td>
<td><input type=text name='jumlah09' size='10' value="0" onKeyUp='hitung09()'></td>
<td><input type=text name='harga09' size='20' value="0" onKeyUp='hitung09()'></td>
<td><input type=text name='total09' size='20' value="0" readonly="total09"></td>
</tr>
<tr>
<td><input type=text name='material10' size='80'></td>
<td><input type=text name='jumlah10' size='10' value="0" onKeyUp='hitung10()'></td>
<td><input type=text name='harga10' size='20' value="0" onKeyUp='hitung10()'></td>
<td><input type=text name='total10' size='20' value="0" readonly="total10"></td>
</tr>
<tr>
<td><input type=text name='material11' size='80'></td>
<td><input type=text name='jumlah11' size='10' value="0" onKeyUp='hitung11()'></td>
<td><input type=text name='harga11' size='20' value="0" onKeyUp='hitung11()'></td>
<td><input type=text name='total11' size='20' value="0" readonly="total11"></td>
</tr>
<tr>
<td><input type=text name='material12' size='80'></td>
<td><input type=text name='jumlah12' size='10' value="0" onKeyUp='hitung12()'></td>
<td><input type=text name='harga12' size='20' value="0" onKeyUp='hitung12()'></td>
<td><input type=text name='total12' size='20' value="0" readonly="total12"></td>
</tr>
<tr>
<td><input type=text name='material13' size='80'></td>
<td><input type=text name='jumlah13' size='10' value="0" onKeyUp='hitung13()'></td>
<td><input type=text name='harga13' size='20' value="0" onKeyUp='hitung13()'></td>
<td><input type=text name='total13' size='20' value="0" readonly="total13"></td>
</tr>
<tr>
<td><input type=text name='material14' size='80'></td>
<td><input type=text name='jumlah14' size='10' value="0" onKeyUp='hitung14()'></td>
<td><input type=text name='harga14' size='20' value="0" onKeyUp='hitung14()'></td>
<td><input type=text name='total14' size='20' value="0" readonly="total14"></td>
</tr>
<tr>
<td><input type=text name='material15' size='80'></td>
<td><input type=text name='jumlah15' size='10' value="0" onKeyUp='hitung15()'></td>
<td><input type=text name='harga15' size='20' value="0" onKeyUp='hitung15()'></td>
<td><input type=text name='total15' size='20' value="0" readonly="total15"></td>
</tr>
</table>
<br>
<?php
$sql="select * from project";
$tot1=$_POST['total01'];
$tot2=$_POST['total02'];
$grand= $tot1 + $tot2;
$totalorder = $grand;
?>
<table border='0' align='right'>
<tr><td>TOTAL Order (Rp)</td> <td> <input type=text name='total_order' size='25' value='<?php echo $totalorder; ?>' readonly="total_order"></td></tr>
<tr><td>Vat 10% (Rp)</td> <td> <input type=text name='vat' size='25' value="0" readonly="vat"></td></tr>
<tr><td><b>TOTAL BAYAR (Rp)</b></td> <td> <input type=text name='total_bayar' size='25' value="0" readonly="total_bayar"></td></tr>
<tr> <td></td> <td align="right"> <input type="reset" value="Batal"/> <input type="submit" value="Simpan"/></td></tr>
</table>
<table border='0' align='left'>
<b>Staff yang bertugas:</b><br><br>
<tr><td>Nama Staff </td> <td> <input type=text name='staff' size='25' value="<?php echo '' . $_SESSION['ID'] . '';?>" readonly="staff"></td></tr>
<tr><td width='100'> Hari / Tanggal </td> <td width='150'> <input type=text name='tanggal' size='25' value="<?php echo date('D, j-F-Y '); ?>" readonly="tanggal"></td></tr>
<tr><td width='100'> Jam</td> <td width='150'> <input type=text name='jam' size='25' value="<?php include('jam.php'); ?>" readonly="jam"></td></tr>
</table>