コード例 #1
0
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>&nbsp;</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>&nbsp;</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;
}
コード例 #2
0
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;
}
コード例 #3
0
function itemsArea($pdf, $area, $oid, $order, $customer, $items, $mapping, $pieces)
{
    $string = "<table width=\"100%\">\n";
    $string .= "<tr><td colspan=\"3\" align=\"center\"><strong>Shipment Items</strong></td></tr>\n";
    $string .= "<tr><td width=\"10%\" style=\"border-bottom:1px solid #888888; text-align:center;\"><strong>QTY</strong></td>";
    $string .= "<td style=\"border-bottom:1px solid #888888;\" width=\"50%\"><strong>Item</strong></td>";
    $string .= "<td style=\"border-bottom:1px solid #888888;\" ><strong>Notes</strong> <em><font size=\"-2\">(include ChapR number(s) if applicable)</font></em></td></tr>\n";
    $string .= "<tr><td>&nbsp;</td></tr>\n";
    foreach ($items as $item) {
        $string .= "<tr>";
        $string .= "<td align=\"center\"><strong><font size=\"+4\">" . $item["Quantity"] . " x</font></strong></td>";
        $string .= "<td><strong><font size=\"+1\">" . $item["Name"] . "</font></strong>";
        $string .= "<UL>";
        if ($item["Personality"]) {
            $string .= "<LI><font size=\"-1\">" . $item["Personality"] . "</font></LI>";
        }
        // now get all of the pieces in the package
        foreach ($mapping as $map) {
            if ($map["PKID"] == $item["PKID"]) {
                $string .= "<LI><font size=\"-1\">" . findPieceName($map["PID"], $pieces) . "</font></LI>\n";
            }
        }
        $string .= "</UL></td>";
        $string .= "<td></td>";
        $string .= "</tr>";
        $string .= "<tr><td>&nbsp;</td></tr>";
        // extra spacing
    }
    $string .= "</table>";
    $pdf->SetFont('helvetica', '', 10, '', true);
    $pdf->SetFillColor(255, 255, 255);
    $pdf->SetTextColor(0, 0, 0);
    areaWriteHTMLCell($pdf, $area, "{$string}", 0, 0, true);
}
コード例 #4
0
function main($oid, $pdflink)
{
    // a packing list has all of the standard stuff on it, including
    // the order number, customer, address, but no price information.
    // it combines multiple items into one NUMBERED item along with the
    // stuff that should go into it.  It also includes a field for
    // notes that then need to be transcribed to shipping.
    $order = dbGetOrder($oid);
    $items = getItems($oid);
    $mapping = dbGetPVP();
    $pieces = dbGetPieces();
    if (!$order) {
        echo "Can't find order {$oid}\n";
        return;
    }
    $customer = dbGetCustomer($order["CID"]);
    if (!$customer) {
        echo "Can't find customer for order {$oid}\n";
        return;
    }
    echo "<div align=\"right\"><font size=\"-2\"><a href=\"{$pdflink}?oid={$oid}\">PDF Version</a></font></div>\n";
    // the whole thing is one big table
    echo "<table class=\"packinglist\">\n";
    // first, the header with "Order: XXX"
    echo "<tr><td class=\"ordertitle\" colspan=\"3\">";
    if ($order["IsExpedited"]) {
        echo standardIcon("expedite") . "&nbsp;&nbsp;";
    }
    if ($order["Charity"]) {
        echo standardIcon("charity") . "&nbsp;&nbsp;";
    }
    echo "Order: <strong>{$oid}</strong>";
    if ($order["Charity"]) {
        echo "&nbsp;&nbsp;" . standardIcon("charity");
    }
    if ($order["IsExpedited"]) {
        echo "&nbsp;&nbsp;" . standardIcon("expedite");
    }
    echo "</td></tr>\n";
    // now paint the "To:" and "Status"
    echo "<tr><td width=\"50%\">\n";
    echo "<table><tr><td class=\"title\" colspan=\"2\"><strong>Customer</strong></td></tr>\n";
    echo htmlCustomerAddress($customer);
    echo "</table></td>\n";
    echo "<td width=\"50%\">\n";
    echo "<table><tr><td class=\"title\" colspan=\"3\"><strong>Status</strong></td></tr>\n";
    //     echo("<tr><td>");
    echo htmlOrderStatus($order);
    //     echo("</td></tr>");
    echo "<tr><td class=\"title\" colspan=\"3\"><strong>Order Notes</strong></td></tr>\n";
    echo "<tr><td colspan=\"3\">" . htmlNotesFormat($order["CustomerONotes"]) . "</td></tr>\n";
    echo "<tr><td colspan=\"3\"><em>" . htmlNotesFormat($order["AdminONotes"]) . "</em></td></tr>\n";
    echo "</table></td>\n";
    echo "</tr>\n";
    // the middle part of the packing list is the actual list of items and components
    echo "<tr><td colspan=2>\n";
    echo "<table class=\"packingItems\">\n";
    echo "<tr><td class=\"title\" colspan=\"3\"><strong>Shipment Items</strong></td></tr>\n";
    echo "<tr><td style=\"border-bottom:1px solid; text-align:center;\"><strong>Count</strong></td>";
    echo "<td style=\"border-bottom:1px solid;\" width=\"50%\"><strong>Item</strong></td>";
    echo "<td style=\"border-bottom:1px solid;\" ><strong>Notes</strong> <em><font size=-1>(include ChapR number(s) if applicable)</font></em></td</tr>\n";
    echo "<tr><td>&nbsp;</td></tr>\n";
    foreach ($items as $item) {
        echo "<tr>";
        echo "<td class=\"qty\">" . $item["Quantity"] . " x</td>";
        echo "<td><p class=\"itemtitle\">" . $item["Name"] . "</p>";
        echo "<UL>";
        if ($item["Personality"]) {
            echo "<LI>" . $item["Personality"] . "</LI>";
        }
        // now get all of the pieces in the package
        foreach ($mapping as $map) {
            if ($map["PKID"] == $item["PKID"]) {
                echo "<LI>" . findPieceName($map["PID"], $pieces) . "</LI>\n";
            }
        }
        echo "</UL></td>";
        echo "<td></td>";
        echo "</tr>";
    }
    echo "</table></td></tr>\n";
    // the bottom part of the packing list is the shipment note section
    echo "<tr><td colspan=2>\n";
    echo "<table class=\"packingShipping\">\n";
    echo "<tr><td class=\"title\" colspan=\"6\"><strong>Shipment Details</strong></td></tr>\n";
    echo "<tr>";
    echo "<td class=\"fieldName\">Date Shipped: </td><td class=\"field\"></td>\n";
    echo "<td class=\"fieldName\">Carrier: </td><td class=\"field\"></td>\n";
    echo "<td class=\"fieldName\">Tracking #: </td><td class=\"field\"></td>\n";
    echo "</tr>";
    echo "</table></td></tr>\n";
    echo "</table>\n";
}