";
$no = 1;
foreach ($record->result_array() as $row) {
$sub_total = (($row['harga_jual'] - $row['diskon']) * $row['jumlah']);
echo "
$row[nama_produk] |
" . rupiah($row['harga_jual'] - $row['diskon']) . " |
$row[jumlah] |
" . ($row['berat'] * $row['jumlah']) . " Gram |
Rp " . rupiah($sub_total) . " |
";
$no++;
}
// Calculate discount if total is greater than or equal to Rp 500,000
$discount = 0;
if ($total['total'] >= 500000) {
$discount = 0.1 * $total['total'];
}
$final_total = $total['total'] - $discount;
echo "
Berat (" . terbilang($total['total_berat']) . " Gram) |
$total[total_berat] Gram |
Ongkos Kirim (" . terbilang($total['ongkir']) . " Rupiah) |
Rp " . rupiah($total['ongkir']) . " |
Total (" . terbilang($total['total']) . " Rupiah) |
Rp " . rupiah($total['total']) . " |
Discount (" . terbilang($discount) . " Rupiah) |
Rp " . rupiah($discount) . " |
Total after Discount (" . terbilang($final_total) . " Rupiah) |
Rp " . rupiah($final_total) . " |
Subtotal (" . terbilang($final_total + $total['ongkir']) . " Rupiah) |
Rp " . rupiah($final_total + $total['ongkir']) . " |