Esempio n. 1
0
$id = $_SESSION['adminid'];
$order = new order();
$report = new report();
if (isset($_GET['action']) && $_GET['action'] == 'financial') {
    $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");
    }
    $orders = $report->getFinancial($data, $page, $offset);
    $totalwithtax = 0;
    $totalwithouttax = 0;
    $totaltax = 0;
    $totalship = 0;
    $totaldisc = 0;
    if (count($orders)) {
        foreach ($orders as $val) {
            if ($val['status'] == 'paid') {
                $totalwithtax = $totalwithtax + $val['grandtotal'];
                $totalwithouttax = $totalwithouttax + $val['grandtotal'] - $val['tax'];
                $totaltax = $totaltax + $val['tax'];
                $totalship = $totalship + $val['shipping'];
                // $totaldisc = $totaldisc + $val['discount'];
            }
        }