PHP:
if(isset($id)):
$order_items_qry = $conn->query("SELECT o.*,i.name, i.size FROM `order_items` o inner join item_list i on o.item_id = i.id where o.`po_id` = '$id' ");
echo $conn->error;
while($row = $order_items_qry->fetch_assoc()):
?>
<tr class="po-item" data-id="">
<td class="align-middle p-1 text-center">
<button class="btn btn-sm btn-danger py-0" type="button" onclick="rem_item($(this))"><i class="fa fa-times"></i></button>
</td>
<td class="align-middle p-0 text-center">
<input type="number" class="text-center w-100 border-0" step="any" name="qty[]" value="<?php echo $row['quantity'] ?>"/>
</td>
<td class="align-middle p-1">
<input type="text" class="text-center w-100 border-0" name="unit[]" value="<?php echo $row['unit'] ?>"/>
</td>
<td class="align-middle p-1">
<input type="text" class="text-center w-100 border-0" name="specs[]" value="<?php echo $row['specs'] ?>"/>
</td>
<td class="align-middle p-1">
<input type="hidden" name="item_id[]" value="<?php echo $row['item_id'] ?>">
<input type="text" class="text-center w-100 border-0 item_id" value="<?php echo $row['name'] ?>" required/></td>
<td class="align-middle text-center p-1 item-size"><?php echo $row['size'] ?></td>
<td class="align-middle p-1">
<input type="number" step="any" class="text-center w-100 border-0" name="unit_price[]" value="<?php echo ($row['unit_price']) ?>"/></td>
<td class="align-middle p-1 text-left total-price"><?php echo number_format($row['quantity'] * $row['unit_price']) ?></td>
</tr>
<?php endwhile;endif; ?>
</tbody>
<tfoot>
<tr class="bg-lightblue">
<tr>
<th class="p-1 text-right" colspan="6"><span><button class="btn btn btn-sm btn-flat btn-primary py-0 mx-1" type="button" id="add_row">Add Row</button></span> PO Amount</th>
<th class="p-1 text-right" colspan="">$</th>
<th class="p-1 text-left" id="sub_total">0</th>
</tr>
<tr>
<th class="p-1 text-right" colspan="6">Advance Payment (%)
<th class="p-1 text-right" colspan="">$</th>
//* This the text to be filled by the percentage from supplier_list
<input type="number" step="any" name="discount_percentage" class="border-light text-right" value="<?php echo isset($discount_percentage) ? $discount_percentage : 0 ?>">
</th>
<th class="p-1"><input type="text" class="w-100 border-0 text-left" readonly value="<?php echo isset($discount_amount) ? $discount_amount : 0 ?>" name="discount_amount"></th>
</tr>
<tr>
<th class="p-1 text-right" colspan="6">Total:</th>
<th class="p-1 text-right" colspan="">$</th>
<th class="p-1 text-left" id="total">0</th>
</tr>
</tr>
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.