Hi,
We have a script that does simple mathematical calculations (addition) which we use to provide our clients with an instant quote for my services. I am trying to expand that script to do an additional task -- (A+B+C) x D . Our current script only does (A+B+C). I can't get it to work, here is how it looks:
Link to the page: http://medprogress.net/mail/mail_customize.php (note: website is still under heavy constructions)
The form aspect in question is where customers input "Number of Mail pieces" and I would like that to be the "D" in my (A+B+C) x D equation.
PHP calculations script:
// TURN ON ERROR PRINTING IF NEEDED
ini_set ('display_errors', 1);
error_reporting (E_ALL);
// SET VARIABLES FOR QUOTE NUMBER GENERATION
$time = time();
$qn = rand(1, 99);
$quote_num = $time . ' ' . $qn;
// CALCULATE PACKAGE PRICE AND SELECTION
If ( !empty($package) ) {
switch ($package) {
case "Internal":
$package_price = 0;
break;
case "External":
$package_price = 0;
break;
}
} Else {
$package = "";
$package_price = 0;
}
// CALCULATE ADD-ONS
If ( !empty($addon1) ) {
$addon1_price = 0.14;
} Else {
$addon1_price = 0;
$addon1 = "";
}
If ( !empty($addon2) ) {
$addon2_price = 0.10;
} Else {
$addon2_price = 0;
$addon2 = "";
}
If ( !empty($addon3) ) {
$addon3_price = 0.13;
} Else {
$addon3_price = 0;
$addon3 = "";
}
If ( !empty($addon4) ) {
$addon4_price = .30;
} Else {
$addon4_price = 0;
$addon4 = "";
}
// CALCULATE MAINTENANCE COSTS
If ( !empty($maintenance) ) {
switch ($maintenance) {
case "Postcard":
$maintenance_price = 1.00;
break;
case "Newsletter":
$maintenance_price = 1.10;
break;
}
} Else {
$maintenance = "";
$maintenance_price = 0;
}
$amount = $package_price + $maintenance_price + $addon1_price + $addon2_price + $addon3_price + $addon4_price * 10000; (This is were i'm stuck)
$total = $package_price + $maintenance_price + $addon1_price + $addon2_price + $addon3_price + $addon4_price;
If ($total > 0) {
$select = "yes";
} Else {
$select = "no";
}
$downpayment = $total / 2;
$total = number_format ($total, 2);
$downpayment = number_format ($downpayment, 2);
$eitems = "";
$items = "";