Ejemplo n.º 1
0
function getCustomerSalesGraph($id)
{
    $sales = getCustomerSales($id);
    return json_encode(array(width => 800, height => 400, padding => array(top => 10, left => 100, bottom => 20, right => 10), data => array(array(name => "table", values => $sales)), scales => array(array(name => "x", type => "ordinal", range => "width", domain => array(data => "table", field => "data.saleid")), array(name => "y", range => "height", domain => array(data => "table", field => "data.total"))), axes => array(array(type => "x", scale => "x"), array(type => "y", scale => "y")), marks => array(array(type => "rect", from => array(data => "table"), properties => array(enter => array(x => array(scale => "x", field => "data.saleid"), width => array(scale => "x", band => true, offset => -1), y => array(scale => "y", field => "data.total"), y2 => array(scale => "y", value => 0)), update => array(fill => array(value => "#156ba1")), hover => array(fill => array(value => "#1b88ce")))))));
}
Ejemplo n.º 2
0
<?php

// initialize
include_once '../../../common/init.php';
if (!isLoggedInCustomer()) {
    redirect("pages/customer/auth/login.php");
} else {
    include_once $BASE_PATH . 'database/sales.php';
    $purchases = getCustomerSales($_SESSION['customer']['id']);
    $smarty->assign('purchases', $purchases);
    $smarty->display("customer/history/list_purchases.tpl");
}