Table ticket pricing

This commit is contained in:
Chris Smith
2019-03-04 14:55:31 -06:00
parent be36a874fd
commit 011beb9b34
4 changed files with 29 additions and 3 deletions

View File

@@ -49,16 +49,38 @@ function shoppingCartLineItem($name, $price, $description = '')
<h6 class="my-0">' . $name . '</h6>
<small class="text-muted">' . $description . '</small>
</div>
<span class="text-muted">' . '$' . number_format(($price/100), 2) . '</span>
<span class="text-muted">' . '$' . number_format(($price / 100), 2) . '</span>
</li>';
}
}
/**
* Calculate table ticket price and event tickets based on quantity
*
* @param $qty integer Quantity of event tickets purchased
* @param $price integer Price of event tickets
* @param $tablePrice integer Price of table
* @return array
*/
function eventPricing($qty)
{
$tableQty = 0;
$eventQty = 0;
// If pricing is 8 or more then we need to factor in table reservations
if ($qty > 7) {
$tableQty = (int) ($qty / 8);
$eventQty = $qty - ($tableQty * 8);
}
return [$tableQty, $eventQty];
}
function shoppingCartTotal($price)
{
echo '<li class="list-group-item d-flex justify-content-between">
<span>Total</span>
<strong>' . '$' . number_format(($price/100), 2) . '</strong>
<strong>' . '$' . number_format(($price / 100), 2) . '</strong>
</li>';
}