Exemplo n.º 1
0
}
echo "<br /><b>Returns</b>";
echo WfcLib::tablify($returns, array(0, 1), array("pCode", "Sales"), array(WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY), 1);
// idea here is to get everything to the right of the
// RIGHT MOST space, hence the reverse
$voidTransQ = $dbc->prepare_statement("SELECT RIGHT(description," . $dbc->locate("' '", "REVERSE(description)") . "-1),\n           trans_num,-1*total from\n           {$TRANS}voidTransHistory \n        WHERE tdate BETWEEN ? AND ?");
$voidTransR = $dbc->exec_statement($voidTransQ, $dates);
$voids = array();
while ($row = $dbc->fetch_row($voidTransR)) {
    $voids["{$row['0']}"] = array($row[1], $row[2]);
}
echo "<br /><b>Voids</b>";
echo WfcLib::tablify($voids, array(0, 1, 2), array("Original", "Void", "Total"), array(WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY), 2);
$otherQ = $dbc->prepare_statement("SELECT d.department,t.dept_name, -1*sum(total) as total \nFROM {$dlog} as d left join departments as t ON d.department = t.dept_no\nWHERE d.tdate BETWEEN ? AND ?\nAND d.department > 300 AND \n(d.register_no <> 20 or d.department = 703)\nand d.department <> 610\nand d.department not between 500 and 599\nAND " . DTrans::isStoreID($store, 'd') . "\nGROUP BY d.department, t.dept_name order by d.department");
$otherR = $dbc->exec_statement($otherQ, $store_dates);
$others = WfcLib::getOtherCodes();
while ($row = $dbc->fetch_row($otherR)) {
    $others["{$row['0']}"][1] = $row[1];
    $others["{$row['0']}"][2] = $row[2];
}
echo "<br /><b>Other</b>";
echo WfcLib::tablify($others, array(1, 0, 2, 3), array("Account", "Dept", "Description", "Amount"), array(WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY), 3);
$equityQ = $dbc->prepare_statement("SELECT d.card_no,t.dept_name, -1*sum(total) as total \nFROM {$dlog} as d left join departments as t ON d.department = t.dept_no\nWHERE d.tdate BETWEEN ? AND ?\nAND d.department IN(991,992) AND d.register_no <> 20\nAND " . DTrans::isStoreID($store, 'd') . "\nGROUP BY d.card_no, t.dept_name ORDER BY d.card_no, t.dept_name");
$equityR = $dbc->exec_statement($equityQ, $store_dates);
$equityrows = array();
while ($row = $dbc->fetch_row($equityR)) {
    $newrow = array("00-" . str_pad($row[0], 7, "0", STR_PAD_LEFT), $row[0], $row[1], $row[2]);
    array_push($equityrows, $newrow);
}
echo "<br /><b>Equity Payments by Member Number</b>";
echo WfcLib::tablify($equityrows, array(1, 2, 3, 4), array("Account", "MemNum", "Description", "Amount"), array(0, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_LEFT, WfcLib::ALIGN_RIGHT | WfcLib::TYPE_MONEY));