make a change to index.php file to calculate the discount amount and discount percent

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

make a change to index.php file to calculate the discount amount and discount percent

Post by answerhappygod »

make a change to index.php file to calculate the discount amountand discount percent
<?php
$customer_type = filter_input(INPUT_POST, 'type');$invoice_subtotal = filter_input(INPUT_POST, 'subtotal');
if ($customer_type == 'R') {if ($invoice_subtotal < 100) {$discount_percent = .0;} else if ($invoice_subtotal >= 100 && $invoice_subtotal< 250) {$discount_percent = .1;} else if ($invoice_subtotal >= 250) {$discount_percent = .25;}} else if ($customer_type == 'C') {if ($invoice_subtotal < 250) {$discount_percent = .2;} else {$discount_percent = .3;}} else {$discount_percent = .0;}
$discount_amount = $invoice_subtotal * $discount_percent;$invoice_total = $invoice_subtotal - $discount_amount;
$percent = number_format(($discount_percent * 100));$discount = number_format($discount_amount, 2);$total = number_format($invoice_total, 2);
include 'invoice_total.php';
?>
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply