Esempio n. 1
0
    $smarty->assign('totalqty', $totalqty);
    $smarty->assign('totalrevenue', $totalrevenue);
    $smarty->assign('content', $smarty->fetch('salesitem.tpl'));
} elseif (isset($_GET['action']) && $_GET['action'] == 'customer') {
    $page = 0;
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    }
    $offset = 10;
    if ($_POST) {
        $data = $_POST;
    } else {
        $data['from'] = date("Y-m-d");
        $data['to'] = date("Y-m-d");
    }
    $customerrevenue = $report->getCustomer($data, $page, $offset);
    $totalrevenue = 0;
    $totalorders = 0;
    if (count($customerrevenue)) {
        foreach ($customerrevenue as $val) {
            $totalrevenue = $totalrevenue + $val['total'];
            $totalorders = $totalorders + $val['orders'];
        }
    }
    $smarty->assign('from', date('M d, Y', strtotime($data['from'])));
    $smarty->assign('to', date('M d, Y', strtotime($data['to'])));
    $smarty->assign('customers', $customerrevenue);
    $smarty->assign('totalrevenue', $totalrevenue);
    $smarty->assign('totalorders', $totalorders);
    $smarty->assign('content', $smarty->fetch('customerreport.tpl'));
} else {