コード例 #1
0
ファイル: orders.php プロジェクト: Hernior/20152
function getOrders($companyID)
{
    global $conn;
    if ($stmtOrders = $conn->prepare("SELECT o.`orde_id`, o.`Users_user_id`, o.`orde_price`, o.`orde_status`, o.`orde_stars`, o.`orde_address`, ohp.`Products_prod_id`, p.`prod_description`, p.`prod_price`, u.`user_name` FROM orders o, orders_has_products ohp, products p, users u WHERE o.`Companies_comp_id`=? AND ohp.`Orders_orde_id`=o.`orde_id` AND p.`prod_id`=ohp.`Products_prod_id` AND u.`user_id`=o.`Users_user_id` ORDER BY o.`orde_id` DESC")) {
        $stmtOrders->bind_param("i", $companyID);
        $stmtOrders->execute();
        $stmtOrders->bind_result($orderID, $orderUserID, $orderPrice, $orderStatus, $orderStars, $orderAddress, $productID, $productDescription, $productPrice, $userName);
        $stmtOrders->store_result();
        while ($stmtOrders->fetch()) {
            $statusClass = getStatusClass($orderStatus);
            $orderStatus = getStatus($orderStatus);
            $orderStars = getStars($orderStars);
            echo "<tr class=\"{$statusClass}\">\n\n            <td>{$orderID}</td>\n\n            <td class=\"text-center\">{$userName}</td>\n\n            <td>{$productDescription}</td>\n\n            <td class=\"text-center\">" . $orderPrice / $productPrice . "</td>\n\n            <td class=\"text-right\">R\$ " . number_format($orderPrice, 2, ',', ' ') . "</td>\n\n            <td class=\"text-center\">{$orderStatus}</td>\n\n            <td class=\"text-center\">{$orderStars}</td>\n\n            <td>{$orderAddress}</td>\n\n            <td class=\"text-center\"><a class=\"btn btn-primary btn-xs\" href=\"../../controllers/sendOrder.php?order={$orderID}\" role=\"button\" data-toggle=\"modal\" data-target=\"#order\">Enviar</a></td>\n\n            </tr>";
        }
    } else {
        echo "Falha na conexão: " . $conn->error;
    }
}
コード例 #2
0
ファイル: orders.php プロジェクト: Hernior/20152
function getOrders($userID)
{
    global $conn;
    if ($stmtOrders = $conn->prepare("SELECT o.`orde_id`, o.`Companies_comp_id`, o.`orde_price`, o.`orde_status`, o.`orde_stars`, o.`orde_address`, ohp.`Products_prod_id`, p.`prod_description`, p.`prod_price`, c.`comp_name` FROM orders o, orders_has_products ohp, products p, companies c WHERE o.`Users_user_id`=? AND ohp.`Orders_orde_id`=o.`orde_id` AND p.`prod_id`=ohp.`Products_prod_id` AND c.`comp_id`=o.`Companies_comp_id` ORDER BY o.`orde_id` DESC")) {
        $stmtOrders->bind_param("i", $userID);
        $stmtOrders->execute();
        $stmtOrders->bind_result($orderID, $orderCompanyID, $orderPrice, $orderStatus, $orderStars, $orderAddress, $productID, $productDescription, $productPrice, $compName);
        $stmtOrders->store_result();
        while ($stmtOrders->fetch()) {
            $showReceiveOption = $orderStatus;
            $statusClass = getStatusClass($orderStatus);
            $orderStatus = getStatus($orderStatus);
            $orderStars = getStars($orderStars);
            echo "<tr class=\"{$statusClass}\">\n\n            <td>{$compName}</td>\n\n            <td class=\"text-center\">{$orderID}</td>\n\n            <td>{$productDescription}</td>\n\n            <td class=\"text-center\">" . $orderPrice / $productPrice . "</td>\n\n            <td class=\"text-right\">R\$ " . number_format($orderPrice, 2, ',', ' ') . "</td>\n\n            <td class=\"text-center\">{$orderStatus}</td>\n\n            <td class=\"text-center\">{$orderStars}</td>\n\n            <td>{$orderAddress}</td>\n";
            echo getOption($showReceiveOption, $orderID);
            echo "</tr>";
        }
    } else {
        echo "Falha na conexão: " . $conn->error;
    }
}