示例#1
0
文件: finances.php 项目: asmenon/pdb
function printEventIncomeStatement()
{
    $events = buildArrayFromQuery("SELECT distinct u_event from f_upside order by u_id", 'u_event');
    foreach ($events as $event) {
        $income = sprintf("%.2f", runQuery("select sum(t_amount) as amt from f_transactions where t_event=\"{$event}\" and t_credit=0", 'amt'));
        $expense = sprintf("%.2f", runQuery("select sum(t_amount) as amt from f_transactions where t_event=\"{$event}\" and t_credit=1", 'amt'));
        $patronincome = sprintf("%.2f", runQuery("Select u_amount from f_upside where u_event like \"{$event}\"", 'u_amount'));
        //$patrons = sprintf("%d",runQuery("Select u_patrons from f_upside where u_event like \"$event\"",'u_patrons'));
        $net = $income + $patronincome - $expense;
        echo "<P><table class=ptables>\n";
        printRow("Financial Details for {$event}", '', '', 'H');
        printRow("Revenues", '', $income);
        printRow("Expenses", '', $expense);
        //	printRow("Patron Signups",'',$patrons);
        printRow("Patron Donations", '', $patronincome);
        printRow("<strong>Net Income</strong>", '', $net);
        echo "</table>";
    }
}
示例#2
0
文件: budgets.php 项目: asmenon/pdb
function printBudgets()
{
    $events = buildArrayFromQuery("SELECT distinct(b_event) from BUDGET order by b_date", 'b_event');
    foreach ($events as $event) {
        printTitle("{$event}");
        $balance = 0;
        $res = mysql_query("SELECT * from BUDGET where b_event=\"{$event}\" order by b_revenue DESC");
        $num = mysql_num_rows($res);
        $i = 0;
        echo "<table class=ptables>\n";
        echo "<tr><td class=pcellheads>Budget Item</td><td class=pcellheads>POC</td><td class=pcellheads>Due Date</td><td class=pcellheads>Revenue</td><td class=pcellheads>Expense</td><td class=pcellheads>Balance</td></tr>";
        while ($i < $num) {
            $b_id = mysql_result($res, $i, "b_id");
            $b_item = mysql_result($res, $i, "b_item");
            $b_rev = mysql_result($res, $i, "b_revenue");
            $b_poc = mysql_result($res, $i, "b_poc");
            $b_date = mysql_result($res, $i, "b_date");
            $b_exp = mysql_result($res, $i, "b_expense");
            if ($b_rev > 0) {
                echo "<tr><td class=pcells>{$b_item}</td><td class=pcells>{$b_poc}</td><td class=pcells>{$b_date}</td><td class=pcells>{$b_rev}</td><td>&nbsp;</td>";
                $balance = $balance + $b_rev;
            } else {
                echo "<tr><td class=pcells>{$b_item}</td><td class=pcells>{$b_poc}</td><td class=pcells>{$b_date}</td><td class=pcells>&nbsp;</td><td class=pcells>({$b_exp})</td>";
                $balance = $balance - $b_exp;
            }
            $pbalance = money_format("%.2i", $balance);
            echo "<td class=pcells>{$pbalance} <a href=\"budgets.php?t=Edit&b_id={$b_id}\">Edit</a></td></tr>";
            $i++;
        }
        echo "</table>";
    }
}
示例#3
0
function addSelectRows($t, $table, $column, $default)
{
    echo "<tr><td class=pcells>Category</td><td class=pcells>";
    $entries = buildArrayFromQuery("SELECT DISTINCT {$column} FROM {$table}", "{$column}");
    sort($entries);
    echo "<select name=category>\n";
    if ($default) {
        $cid = runQuery("SELECT c_id from {$table} where c_name=\"{$default}\"", 'c_id');
        echo "<option name=\"{$default}\" value={$cid} selected>{$default}</option>\n";
    } else {
        echo "<option name=\"Select One\">Select One</option>\n";
    }
    foreach ($entries as $entry) {
        $cid = runQuery("SELECT c_id from {$table} where c_name=\"{$entry}\"", 'c_id');
        echo "<option name={$entry} value={$cid}>{$entry}</option>";
    }
    echo "</select>";
    echo "</td></tr>";
}