Evidence-based, Multicultural Activities

 

Purchase Send Test

<?php
require("class_mindfull.php");
$purchase_management = new purchase_management;

// Begin Tax
if ($_POST["state"] != " ")
{
$_POST["adjusted_tax_rate"] = .07325;
}
elseif (!$_POST["adjusted_tax_rate"])
{
$_POST["adjusted_tax_rate"] = 0.00;
}
else
{
$_POST["adjusted_tax_rate"] = ($_POST["adjusted_tax_rate"]/100);
}
// End Tax

$prepaid_current = $_POST["prepaid"];
$product_list = $purchase_management->generate_product_list();
foreach($purchase_management->product_array as $product_key => $product_value)
{
$prechecked = $purchase_management->product_array[$product_key]["prefix"] . "add_item";
$prequantity = $purchase_management->product_array[$product_key]["prefix"] . "quantity";
$preshipping = $purchase_management->product_array[$product_key]["prefix"] . "shipping";
$presubtotal = $purchase_management->product_array[$product_key]["prefix"] . "subtotal";

if($_POST[$prequantity] > 0.1 AND $_POST[$prechecked] === "y")
{
$pretax = $purchase_management->product_array[$product_key]["prefix"] . "tax";
$prepptax = $purchase_management->product_array[$product_key]["prefix"] . "pptax";
$purchase_management->generate_tax_rate($_POST["adjusted_tax_rate"],$_POST["state"],$_POST["tax_exempt"],$pretax,$prepptax,$purchase_management->product_array[$product_key]["price"],$_POST[$prequantity]);
if (current_user_can(edit_posts))
{
$purchase_management->$preshipping = 0;
$purchase_management->shipping_total = 0;
if ($_POST[$prequantity] >= 5)
{
$purchase_management->call_bulk = 12345;
}
}
else
{
$purchase_management->$preshipping = $purchase_management->generate_shipping($preshipping,$_POST[$prequantity]);
}
$purchase_management->$presubtotal = round(($purchase_management->product_array[$product_key]["price"] * $_POST[$prequantity]), 2);
$purchase_management->subtotal = $purchase_management->subtotal + $purchase_management->$presubtotal;

// Begin Mixed Payments
if ($prepaid_current > 0)
{
$prepaid_deduction = round(($prepaid_current / $_POST[$prequantity]), 2);
if ($prepaid_deduction <= $purchase_management->product_array[$product_key]["price"])
{
$form_price = $purchase_management->product_array[$product_key]["price"] – $prepaid_deduction;
$prepaid_current = 0;
}
else
{
$form_price = 0;
$prepaid_current = $prepaid_current – $purchase_management->$presubtotal;
}
/*echo "Prepaid Deduction: " . $prepaid_deduction . "<br />
Form Price: " . $form_price . "<br />
Current Prepaid Amount: " . $prepaid_current . "<p />"; */
}
else
{
$form_price = $purchase_management->product_array[$product_key]["price"];
}
// End Mixed Payments

$purchase_management->form_output($purchase_management->product_array[$product_key]["item_name"],$purchase_management->product_array[$product_key]["item_number"],$form_price,$purchase_management->$prepptax,$_POST[$prequantity],$purchase_management->$preshipping,$purchase_management->item_counter);
}
else
{
$_POST[$prequantity] = "—";
}
$prequantity = "";
$pretax = "";
$prepptax = "";
$preshipping = "";
}

$purchase_management->order_total = round(($purchase_management->subtotal + $purchase_management->tax_var + $purchase_management->shipping_total), 2);

// Begin Output Variables
if(current_user_can(edit_posts))
{
$ship_var = "<strong>Not Applicable</strong>";
}

if ($purchase_management->call_bulk != 12345)
{
if($prepaid_current <= 0)
{
$proc_var = ‘<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but03.gif" name="submit" alt="Make payments with PayPal – it\’s fast, free and secure!" />’;
}
else
{
$proc_var = ‘<span style="font-weight:bold;color:#CC0000;text-align:justify;">The check or money order amount has exceeded the product subtotal. Please hit your browser back button and enter a new amount.</span>’;
}
}
else
{
$purchase_management->order_total = "—";
$proc_var = ‘<span style="font-weight:bold;color:#CC0000;text-align:justify;">Call (636)391-2629 for bulk purchases.</span>’;
}
// End Output Variables

?>
<form action="https://www.paypal.com/cgi-bin/webscr" name="form_purchase" method="post">
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="business" value="dredmonds@sbcglobal.net" />
<?php echo $purchase_management->final_item_form; ?>
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="address_override" value="1" />
<input type="hidden" name="notify_url" value="http://mindfullgames.com/test_ipn.php" />
<input type="hidden" name="return" value="http://mindfullgames.com/purchase/thank_you/" />
<input type="hidden" name="cancel_return" value="http://mindfullgames.com/" />
<input type="hidden" name="first_name" value="<?php echo $_POST["first_name"] ?>" size="35" />
<input type="hidden" name="last_name" value="<?php echo $_POST["last_name"] ?>" size="35" />
<input type="hidden" name="address1" value="<?php echo $_POST["address1"] ?>" size="35" />
<input type="hidden" name="address2" value="<?php echo $_POST["address2"] ?>" size="35" />
<input type="hidden" name="city" value="<?php echo $_POST["city"] ?>" size="35" />
<input type="hidden" name="state" value="<?php echo $_POST["state"] ?>" size="35" />
<input type="hidden" name="zip" value="<?php echo $_POST["zip"] ?>" size="20" />
<input type="hidden" name="custom" value="<?php echo $_POST["tax_exempt_number"] ?>" />
<table width="550" cellpadding="0" cellspacing="0">
<tr>
<td><table width="280" bgcolor="#cccccc" style="border:1px solid #000000;">
<tr>
<td width="120"> First Name: </td>
<td><?php echo $_POST["first_name"] ?></td>
</tr>
<tr>
<td> Last Name: </td>
<td><?php echo $_POST["last_name"] ?></td>
</tr>
<tr>
<td> Address 1: </td>
<td><?php echo $_POST["address1"] ?></td>
</tr>
<tr>
<td> Address 2: </td>
<td><?php echo $_POST["address2"] ?></td>
</tr>
<tr>
<td> City: </td>
<td><?php echo $_POST["city"] ?></td>
</tr>
<tr>

<td> State: </td>
<td><?php echo $_POST["state"] ?></td>
</tr>
<tr>
<td> Zip Code: </td>
<td><?php echo $_POST["zip"] ?></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td> Quantity: </td>
<td>
<?php
foreach($purchase_management->product_array as $product_key => $product_value)
{
if (!current_user_can(edit_posts) AND $purchase_management->product_array[$product_key]["posonly"] == "y")
{
echo "";
}
else
{
$display_quantity_prefix = $purchase_management->product_array[$product_key]["prefix"] . "quantity";
?>
<?php echo $purchase_management->product_array[$product_key]["item_name"] ?>: <?php echo $_POST[$display_quantity_prefix]; ?><br />
<?php
}
}
?>
</td>
</tr>
<tr>
<td style="text-align:left;">Shipping / Handling Total: </td>
<td>$ <?php echo $purchase_management->shipping_total; ?></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td> Tax Amount: </td>
<td>$ <?php echo $purchase_management->tax_var; ?></td>
</tr>
<tr>
<td> Tax Exempt: </td>
<td valign="middle" style="text-align:middle;"><?php echo $_POST["tax_exempt_number"] ?></td>
</tr>
<tr>
<td colspan="2"><hr /></td>
</tr>
<tr>
<td> Prepaid Amount: </td>
<td valign="middle" style="text-align:middle;">$ <?php echo $_POST["prepaid"]; ?></td>
</tr>
<tr>
<td> Paypal Amount: </td>
<td valign="middle" style="text-align:middle;">$ <?php echo $purchase_management->order_total – $_POST["prepaid"]; ?></td>
</tr>
<tr>
<td> Order Total: </td>
<td valign="middle" style="text-align:middle;">$ <?php echo $purchase_management->order_total; ?></td>
</tr>
<tr>
<td colspan="2" align="right"><?php echo $proc_var; ?></td>
</tr>
</table></td>
<td valign="top" width="300" style="padding:0px 0px 0px 20px; text-align:justify"><p>Your order details are to the left. To continue with your order, please press the Paypal button at the bottom of the form.</p>
<p>You will be taken t a secure location at Paypal where you can use your own Paypal account or VISA, MASTERCARD, AMEX, or DISCOVER credit cards to safely purchase our products.</p></td>
</tr>
</table>
</form>