function getItems($oid) { global $SETTINGS; $order = dbGetOrder($oid); $items = dbGetItems($oid); $packages = dbGetPackages(); $pieces = dbGetPieces(); $retarray = array(); foreach ($items as $item) { $row = array(); $row["PKID"] = $item["PKID"]; $row["Quantity"] = $item["Quantity"]; $row["Name"] = findPackageName($item["PKID"], $packages); $row["Personality"] = $item["Personality"]; if ($item["Personality"]) { $row["Personality"] = findPieceName($item["Personality"], $pieces); } $row["Price"] = findPackagePrice($item["PKID"], $packages); $retarray[] = $row; } // add the charity chapr marketing kit if needed if ($order["Charity"]) { $row = array(); $row["PKID"] = $SETTINGS["CharityKitPKID"]; $row["Quantity"] = 1; $row["Name"] = findPackageName($row["PKID"], $packages); $row["Personality"] = null; $retarray[] = $row; } return $retarray; }
function showOrderOrder($order, $page_id, $oid, $edit, $showEditButton) { global $SETTINGS; $retval = ""; $retval .= "<tr><th style=\"text-align:center\">QTY</th>"; $retval .= "<th>Item</th>"; $retval .= "<th>Personality</th>"; $retval .= "<th style=\"text-align:right\">Price</th></tr>"; $items = dbGetItems($oid); $packages = dbGetPackages(); $pieces = dbGetPieces(); $total = 0; $totalItems = 0; foreach ($items as $item) { $qty = $item["Quantity"]; $retval .= "<tr><td style=\"text-align:center\"><strong>" . $qty . "</strong></td>"; $retval .= "<td><strong>" . findPackageName($item["PKID"], $packages) . "</strong></td>"; $retval .= "<td><strong>" . findPieceName($item["Personality"], $pieces) . "</strong></td>"; $price = findPackagePrice($item["PKID"], $packages) * $qty; $retval .= "<td style=\"text-align:right\"><strong>" . number_format($price, 2) . "</strong></td>"; $total += $price; $totalItems += $qty; } $totalTotal = $total; $retval .= "</tr>\n"; $retval .= "<tr class=\"total\"><td></td><td></td>" . "<td style=\"text-align:right;\">ITEMS TOTAL</td>" . "<td style=\"text-align:right\">\$ <strong>" . number_format($total, 2) . "</strong></td></tr>\n"; // note that the shipping calculation is very simple here - // and should really be based upon some kind of "weight" or something // Note, by-the-way, that this doesn't SET the shipping in the data record // that is only "locked in" when the order is invoiced. $shipping = $order["ShippingFee"]; if ($shipping === null) { $shipping = $totalItems * $SETTINGS["ShippingPerChapR"]; } $retval .= "<tr><td></td><td></td><td style=\"text-align:right;\">Shipping"; if ($order["ShippingFee"] == null) { $retval .= " (default)"; } $retval .= "</td><td style=\"text-align:right\"><strong>" . number_format($shipping, 2) . "</strong></td></tr>\n"; $totalTotal += $shipping; if ($order["IsExpedited"]) { // expedite is much like shipping, although it is just a static figure // it is "locked in" when the order is invoiced. $expedite = $order["ExpediteFee"]; if ($expedite === null) { $expedite = $SETTINGS["ExpediteFeeDefault"]; } $retval .= "<tr><td></td><td></td><td style=\"text-align:right;\">Expedite Fee"; if ($order["ExpediteFee"] == null) { $retval .= " (default)"; } $retval .= "</td><td style=\"text-align:right\"><strong>" . number_format($expedite, 2) . "</strong></td></tr>\n"; $totalTotal += $expedite; } if ($order["Discount"]) { // discounts only show up if they exist $discount = $order["Discount"]; $retval .= "<tr><td></td><td></td><td style=\"text-align:right;\">Discount"; $retval .= "</td><td style=\"text-align:right\"><strong>-" . number_format($discount, 2) . "</strong></td></tr>\n"; $totalTotal -= $discount; } $retval .= "<tr><td></td><td></td><td style=\"text-align:right;\"><strong>TOTAL</strong></td><td style=\"text-align:right\">\$ <strong>" . number_format($totalTotal, 2) . "</strong></td></tr>\n"; $retval .= "<tr><td> </td></tr>"; $retval .= "<tr><td style=\"vertical-align:top;text-align:right;\">Notes:</td>\n"; $retval .= "<td colspan=3><strong>" . htmlNotesFormat($order["CustomerONotes"]) . "</strong></td></tr>\n"; $retval .= "<tr><td style=\"vertical-align:top;text-align:right;\">Admin Notes:</td>\n"; $retval .= "<td colspan=3><strong>" . htmlNotesFormat($order["AdminONotes"]) . "</strong></td></tr>\n"; $retval .= "<tr><td> </td></tr>"; $retval .= "<tr><td colspan=\"4\" style=\"text-align:right\">"; if ($showEditButton) { $retval .= "<a href=\"{$edit}&OID={$oid}\">Edit</a>"; } else { $retval .= "<em>Payment requested, editing not allowed</em>"; } $retval .= "</td></tr>"; return $retval; }
function getItems($oid) { $items = dbGetItems($oid); $packages = dbGetPackages(); $pieces = dbGetPieces(); $retarray = array(); foreach ($items as $item) { $row = array(); $row["Quantity"] = $item["Quantity"]; $row["Name"] = findPackageName($item["PKID"], $packages); $row["Personality"] = findPieceName($item["Personality"], $pieces); $row["Price"] = findPackagePrice($item["PKID"], $packages); $retarray[] = $row; } return $retarray; }