示例#1
0
文件: index.php 项目: phpsmith/IS4C
$taxSumQ = $dbc->prepare_statement("SELECT  -1*sum(total) as tax_collected\nFROM {$dlog} as d \nWHERE d.tdate BETWEEN ? AND ?\nAND (d.upc = 'tax')\nAND " . DTrans::isStoreID($store, 'd') . "\nGROUP BY d.upc");
$taxSumR = $dbc->exec_statement($taxSumQ, $store_dates);
echo "<br /><b><u>Actual Tax Collected</u></b><br />";
echo sprintf("%.2f<br />", array_pop($dbc->fetch_row($taxSumR)));
$transQ = $dbc->prepare_statement("select q.trans_num,sum(q.quantity) as items,transaction_type, sum(q.total) from\n    (\n    select trans_num,card_no,quantity,total,\n        m.memdesc as transaction_type\n    from {$dlog} as d\n    left join custdata as c on d.card_no = c.cardno\n    left join memTypeID as m on c.memtype = m.memTypeID\n    WHERE d.tdate BETWEEN ? AND ?\n    AND trans_type in ('I','D')\n    and upc <> 'RRR'\n    and c.personNum=1\n    AND " . DTrans::isStoreID($store, 'd') . "\n    ) as q \n    group by q.trans_num,q.transaction_type");
$transR = $dbc->exec_statement($transQ, $store_dates);
$transinfo = array("Member" => array(0, 0.0, 0.0, 0.0, 0.0), "Non Member" => array(0, 0.0, 0.0, 0.0, 0.0), "Staff Member" => array(0, 0.0, 0.0, 0.0, 0.0), "Staff NonMem" => array(0, 0.0, 0.0, 0.0, 0.0));
while ($row = $dbc->fetch_array($transR)) {
    if (!isset($transinfo[$row[2]])) {
        continue;
    }
    $transinfo[$row[2]][0] += 1;
    $transinfo[$row[2]][1] += $row[1];
    $transinfo[$row[2]][3] += $row[3];
}
$tSum = 0;
$tItems = 0;
$tDollars = 0;
foreach (array_keys($transinfo) as $k) {
    $transinfo[$k][2] = round($transinfo[$k][1] / $transinfo[$k][0], 2);
    $transinfo[$k][4] = round($transinfo[$k][3] / $transinfo[$k][0], 2);
    $tSum += $transinfo[$k][0];
    $tItems += $transinfo[$k][1];
    $tDollars += $transinfo[$k][3];
}
$transinfo["Totals"] = array($tSum, $tItems, round($tItems / $tSum, 2), $tDollars, round($tDollars / $tSum, 2));
echo "<br /><b>Transaction information</b>";
echo WfcLib::tablify($transinfo, array(0, 1, 2, 3, 4, 5), array("Type", "Transactions", "Items", "Average items/transaction", "\$", "\$/transaction"), array(WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY));
?>
</body></html>
示例#2
0
td.left {
    padding-right: 4em;
    text-align: left;
}
td.right {
    padding-left: 4em;
    text-align: right;
}
td.center {
    padding-left: 2em;
    padding-right: 2em;
    text-align: center;
}
</style>
</head>
<BODY BGCOLOR = 'ffffff' ><font size=2> 
<?php 
}
if ($excel === false) {
    echo "<br /><a href=stockOverdueReport.php?excel=yes>Click here for Excel version</a>";
}
$balanceQ = "SELECT s.memnum,s.payments,s.enddate,b.balance,\n        c.lastname,c.firstname,m.street,\n        m.city,m.state,m.zip\n        FROM equity_live_balance as s left join\n        custdata as c on s.memnum=c.cardno left join\n        ar_live_balance as b on s.memnum=b.card_no\n        left join meminfo as m on s.memnum=m.card_no\n        WHERE c.personnum = 1 and c.type <> 'TERM'\n        and s.payments < 100 and\n        " . $sql->datediff('s.enddate', $sql->now()) . " < -60\n        order by s.memnum";
$balanceR = $sql->query($balanceQ);
$balances = array();
while ($row = $sql->fetch_row($balanceR)) {
    $temp = explode(" ", $row[2]);
    $datestr = $temp[0];
    $balances["{$row['0']}"] = array($row[4] . ", " . $row[5], str_replace("\n", " ", $row[6]), $row[7], $row[8], $row[9], $row[1], $datestr, $row[3]);
}
echo WfcLib::tablify($balances, array(0, 1, 2, 3, 4, 5, 6, 7, 8), array("Account", "Name", "Address", "City", "State", "Zip", "Current Stock Balance", "Stock due date", "Current AR Balance"), array(WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY));