示例#1
0
文件: index.php 项目: phpsmith/IS4C
    }
}
$store = FormLib::get('store', 0);
$dates = array($dstr . ' 00:00:00', $dstr . ' 23:59:59');
$store_dates = array($dstr . ' 00:00:00', $dstr . ' 23:59:59', $store);
if ($excel === false) {
    echo "<br /><a href=index.php?date={$repDate}&excel=yes>Click here for Excel version</a>";
}
echo '<br>Report run ' . $today . ' for ' . $repDate . "<br />";
echo 'Store: ' . $storeInfo['names'][$store] . '<br />';
$dlog = DTransactionsModel::selectDlog($dstr);
$OP_DB = $FANNIE_SERVER_DBMS == 'MSSQL' ? $FANNIE_OP_DB . '.dbo.' : $FANNIE_OP_DB . '.';
$TRANS = $FANNIE_SERVER_DBMS == 'MSSQL' ? $FANNIE_TRANS_DB . '.dbo.' : $FANNIE_TRANS_DB . '.';
$tenderQ = $dbc->prepare_statement("SELECT \nCASE WHEN d.trans_subtype IN ('CC','AX') then 'Credit Card' ELSE t.TenderName END as TenderName,\n-sum(d.total) as total, COUNT(d.total)\nFROM {$dlog} as d ,{$OP_DB}tenders as t \nWHERE d.tdate BETWEEN ? AND ?\nAND d.trans_status <>'X'  \nAND d.trans_subtype = t.TenderCode\nand d.total <> 0\nAND " . DTrans::isStoreID($store, 'd') . "\nGROUP BY CASE WHEN d.trans_subtype IN ('CC','AX') then 'Credit Card' ELSE t.TenderName END");
$tenderR = $dbc->exec_statement($tenderQ, $store_dates);
$tenders = WfcLib::getTenders();
$mad = array(0.0, 0);
while ($row = $dbc->fetch_row($tenderR)) {
    if (isset($tenders[$row[0]])) {
        $tenders[$row[0]][1] = $row[1];
        $tenders[$row[0]][2] = $row[2];
    } elseif ($row[0] == "MAD Coupon") {
        $mad[0] = $row[1];
        $mad[1] = $row[2];
    }
}
echo "<br /><b>Tenders</b>";
echo WfcLib::tablify($tenders, array(1, 0, 2, 3), array("Account", "Type", "Amount", "Count"), array(WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY, WfcLib::ALIGN_RIGHT), 2);
if ($store != 50) {
    /*
    $stamp = strtotime($dstr);