so im kinda new in codeigniter and web developing in general but is it possible to count Sub Total and Tax, automatically input that value into somekind of input box in codeigniter?
for example :
- i have model that join some column and show the data into a table
table model.php
public function getPurchaseOrder()
{
$query =$this->db->query('SELECT dkmno, kodeprod,kodebarang_op,qty_op,unit_op,price,catatan FROM order_product JOIN barang_dkm ON order_product.kodebarang_op = barang_dkm.kodebarang');
return $query->result_array();
}
table view.php
<table class="table table-fixed table-bordered table-hover" style="width:100%;" id="tebal">
<thead>
<tr>
<th scope="col">DKM No </th>
<th scope="col">Kode Produksi </th>
<th scope="col">Kode Barang </th>
<th scope="col">Deskripsi </th>
<th scope="col">Jumlah/Quantity </th>
<th scope="col">Unit </th>
<th scope="col">Unit Price </th>
<th scope="col">Sub Total </th>
</tr>
</thead>
<tbody>
<?php foreach ($dataTabel as $kiki) : ?>
<tr class="table-row">
<td><?php echo $kiki["dkmno"]; ?></td>
<td><?php echo $kiki["kodeprod"]; ?></td>
<td><?php echo $kiki["kodebarang_op"]; ?></td>
<td><?php echo $kiki["catatan"]; ?></td>
<td><?php echo $kiki["qty_op"]; ?></td>
<td><?php echo $kiki["unit_op"]; ?></td>
<td><?php echo $kiki["price"]; ?></td>
<td class="calc"><?php $a=$kiki["qty_op"]*$kiki["price"]; echo $a ?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
and i want to count sub total from the table above and show the answer in a textbox or inputbox
subtotal, discount, and tax code if you want to know
<div class="row mt-5">
<div class="col-sm" id="kontol">
<div class="form-group">
<div class="row">
<div class="col-sm-3">
<label for="SubTotal" class="control-label">Sub Total : </label>
</div>
<div class="col-sm-9">
<input type="number" id="subTotal" name="SubTotal" value="" style="text-align: right;" class="form-control" disabled>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-3">
<label for="Discount" class="label-control" id="Discount">Discount : </label>
</div>
<div class="col-lg-3">
<div class="input-group">
<input type="number" name="Discount" class="form-control" id="inputDiscount" value="" min="0" max="100" onchange="calculatedSubTotal()"><span class="input-group-addon">%</span>
</div>
</div>
<div class="col-lg-6">
<input type="number" name="SubTotalDiscount" value="" style="text-align: right;" class="form-control" id="subTotalDiscount" disabled>
</div>
</div>
</div>
<div class="form-group">
<div class="row">
<div class="col-lg-3">
<label for="Tax" class="label-control">Tax : </label>
</div>
<div class="col-lg-3">
<div class="input-group">
<input type="number" name="Tax" value="" min="0" max="100" class="form-control" id="inputTax" onchange="calculatedSubTotal()"><span class="input-group-addon">%</span>
</div>
</div>
<div class="col-lg-6">
<input type="number" name="SubTotalTax" style="text-align: right;" class="form-control" id="subTotalTax" value="" disabled>
</div>
</div>
</div>
i have try to look at people who ask the same question but i still need somekind a detail how the model.php, controller.php, view.php, script.js work, if you need more details here's the link the ui that i already made : https://i.stack.imgur.com/OCAXK.png