示例#1
0
            }
            ?>
	</tbody>
	</table>
</div>

<div id="orderLine_placeHolder" class="col-50 col-m-100 topLine">
	
</div>

<?php 
        } else {
            if ($type == "s") {
                echo '<link href="css/supplier.css" rel="stylesheet" type="text/css" />' . '<script src="js/supplier.js"> </script>' . "<link rel='stylesheet' type='text/css' href='jquery_ui/dataTable/jquery.dataTables.min.css'/>" . "<script src='jquery_ui/dataTable/jquery.dataTables.min.js'></script>" . "<script src='jquery_ui/chart/jquery.canvasjs.min.js'></script>";
                include_once "Brain/Product.php";
                $genderChart = getSalesSummaryByGender($typeID);
                $ourProduct = getProductsBySupplier($typeID);
                $TABLE_FORMAT = <<<_TABLE
<table class="display" id="ourProductList">
<thead><tr><th>Photo</th><th>No</th><th>Name</th><th>Price</th><th>QTY</th><th>Cat</th></tr></thead>
<tbody>%s</tbody>
</table>
_TABLE;
                $TABLE_ROW_FORMAT = <<<_TABLEROW
<tr><td><img src='product_image/%s'/></td><td>%s</td><td>%s</td><td>%5.2f</td><td>%d</td><td>%s</td>
_TABLEROW;
                $selectionBox = "<select id='selectcat' name='cat' onchange='getCatChart(6,\"{$typeID}\")'>";
                $category = getAllCategories();
                while ($row = $category->fetch_assoc()) {
                    $selectionBox .= "<option value='" . $row[catNo] . "'>" . $row[catName] . "</option>";
                }
示例#2
0
function getSalesSummaryByGender($suppNo, $isMale = null)
{
    //if distNo not set --> get all district and return an array
    // $districts[distNo] --> result
    if (!isset($isMale)) {
        $genderChart["M"] = getSalesSummaryByGender($suppNo, true, "Sold", "DESC");
        $genderChart["F"] = getSalesSummaryByGender($suppNo, false, "Sold", "DESC");
        return $genderChart;
    }
    $custGender = 'F';
    if ($isMale) {
        $custGender = 'M';
    }
    $query = "SELECT Customer." . custGender . ", District." . distNo . ", District." . distName . ", OrderLine." . prodNo . ", Product." . prodName . ", Product." . prodPhoto . ", Product." . catNo . ", Category." . catName . ", SUM(OrderLine." . qty . ") AS Sold " . "FROM OrderLine " . "JOIN CustOrder ON OrderLine." . ordNo . " = CustOrder." . ordNo . " " . "JOIN Product ON Product." . prodNo . " = OrderLine." . prodNo . " " . "JOIN Category ON Product." . catNo . " = Category." . catNo . " " . "JOIN District ON CustOrder." . distNo . " = District." . distNo . " " . "JOIN Customer ON Customer." . custNo . " = CustOrder." . custNo . " " . "WHERE Product." . suppNo . " = '{$suppNo}' " . "AND Customer." . custGender . " = '{$custGender}' " . "AND " . isDeleted . " = 0 " . "GROUP BY Product." . prodNo . " " . DB::genOrderByStr(func_get_args(), func_num_args(), 2);
    return DB::query($query);
}
示例#3
0
<?php

include_once "../Brain/functions.php";
include_once "../Brain/Product.php";
$requestCode = $_POST["requestCode"];
$suppNo = $_POST[suppNo];
$array["title"]["text"] = $_POST['title'];
$array["animationEnabled"] = "true";
$array["data"][0]["type"] = "column";
switch ($requestCode) {
    case 1:
        $chart = getSalesSummaryByGender($suppNo);
        $chart = $chart["M"];
        break;
    case 2:
        $chart = getSalesSummaryByGender($suppNo);
        $chart = $chart["F"];
        break;
    case 3:
        $chart = getSalesSummaryByDistrict($suppNo, "DST01");
        break;
    case 4:
        $chart = getSalesSummaryByDistrict($suppNo, "DST02");
        break;
    case 5:
        $chart = getSalesSummaryByDistrict($suppNo, "DST03");
        break;
    case 6:
        if (isset($_POST[catNo])) {
            $chart = getSalesSummaryByCat($suppNo, $_POST[catNo]);
            break;