Example #1
0
function user_permissions_form()
{
    global $special_user_bitfield;
    page_head('Manage user privileges');
    start_table();
    row1("Current special users", 99);
    echo "<tr><th>User</th>";
    for ($i = 0; $i < S_NFLAGS; $i++) {
        echo "<th>" . $special_user_bitfield[$i] . "</th>\n";
    }
    echo "<th> </th></tr>";
    $result = _mysql_query("SELECT prefs.userid, prefs.special_user, user.id, user.name \n        FROM forum_preferences as prefs, user \n        WHERE CONVERT(special_user, DECIMAL) > 0 and prefs.userid=user.id");
    $i = 0;
    while ($foo = _mysql_fetch_object($result)) {
        echo "<tr class=row{$i}>\n            <td>{$foo->name} ({$foo->id})</td>\n            <form action=\"user_permissions.php\" method=\"POST\">\n            <input type=\"hidden\" name=\"userid\" value=\"{$foo->userid}\">\n        ";
        for ($j = 0; $j < S_NFLAGS; $j++) {
            $bit = substr($foo->special_user, $j, 1);
            $c = $bit == 1 ? "checked" : "";
            echo "<td>\n                <input type=\"checkbox\" name=\"role" . $j . "\" value=\"1\" {$c}>\n                </td>\n            ";
        }
        echo "<td><input class=\"btn btn-default\" type=\"submit\" value=\"Update\"></td>";
        echo "</form></tr>\n";
        $i = 1 - $i;
    }
    echo "\n        <tr class=row{$i}>\n        <form action=\"user_permissions.php\" method=\"POST\">\n        <td>Add User ID:<input type=\"text\" name=\"userid\" size=\"6\"></td>\n    ";
    for ($j = 0; $j < S_NFLAGS; $j++) {
        echo "<td>\n            <input type=\"checkbox\" name=\"role" . $j . "\" value=\"1\">\n            </td>\n        ";
    }
    echo "<td>\n        <input class=\"btn btn-default\" type=\"submit\" value=\"Update\">\n        </td>\n        </form>\n        </tr>\n    ";
    end_table();
    page_tail();
}
Example #2
0
function display_wo_issue_details($issue_no)
{
    $result = get_work_order_issue_details($issue_no);
    if (db_num_rows($result) == 0) {
        display_note(_("There are no items for this issue."));
    } else {
        start_table(TABLESTYLE);
        $th = array(_("Component"), _("Quantity"), _("Units"));
        table_header($th);
        $j = 1;
        $k = 0;
        //row colour counter
        $total_cost = 0;
        while ($myrow = db_fetch($result)) {
            alt_table_row_color($k);
            label_cell($myrow["stock_id"] . " - " . $myrow["description"]);
            qty_cell($myrow["qty_issued"], false, get_qty_dec($myrow["stock_id"]));
            label_cell($myrow["units"]);
            end_row();
            $j++;
            if ($j == 12) {
                $j = 1;
                table_header($th);
            }
            //end of page full new headings if
        }
        //end of while
        end_table();
    }
}
Example #3
0
function bjtable($res, $frame_caption)
{
    $htmlout = '';
    $htmlout .= begin_frame($frame_caption, true);
    $htmlout .= begin_table();
    $htmlout .= "<tr>\r\n\t<td class='colhead'>Rank</td>\r\n\t<td class='colhead' align='left'>User</td>\r\n\t<td class='colhead' align='right'>Wins</td>\r\n\t<td class='colhead' align='right'>Losses</td>\r\n\t<td class='colhead' align='right'>Games</td>\r\n\t<td class='colhead' align='right'>Percentage</td>\r\n\t<td class='colhead' align='right'>Win/Loss</td>\r\n\t</tr>";
    $num = 0;
    while ($a = mysqli_fetch_assoc($res)) {
        ++$num;
        //==Calculate Win %
        $win_perc = number_format($a['wins'] / $a['games'] * 100, 1);
        //==Add a user's +/- statistic
        $plus_minus = $a['wins'] - $a['losses'];
        if ($plus_minus >= 0) {
            $plus_minus = mksize(($a['wins'] - $a['losses']) * 100 * 1024 * 1024);
        } else {
            $plus_minus = "-";
            $plus_minus .= mksize(($a['losses'] - $a['wins']) * 100 * 1024 * 1024);
        }
        $htmlout .= "<tr><td>{$num}</td><td align='left'>" . "<b><a href='userdetails.php?id=" . $a['id'] . "'>" . $a['username'] . "</a></b></td>" . "<td align='right'>" . number_format($a['wins'], 0) . "</td>" . "<td align='right'>" . number_format($a['losses'], 0) . "</td>" . "<td align='right'>" . number_format($a['games'], 0) . "</td>" . "<td align='right'>{$win_perc}</td>" . "<td align='right'>{$plus_minus}</td>" . "</tr>\n";
    }
    $htmlout .= end_table();
    $htmlout .= end_frame();
    return $htmlout;
}
Example #4
0
function bjtable($res, $frame_caption)
{
    begin_frame($frame_caption, true);
    begin_table();
    ?>
<tr>
<td class="colhead">Rank</td>
<td align="left" class="colhead">User</td>
<td align="right" class="colhead">Wins</td>
<td align="right" class="colhead">Losses</td>
<td align="right" class="colhead">Games</td>
<td align="right" class="colhead">Percentage</td>
<td align="right" class="colhead">Win/Loss</td>
</tr>
<?php 
    $num = 0;
    while ($a = mysql_fetch_assoc($res)) {
        ++$num;
        //Calculate Win %
        $win_perc = number_format($a[wins] / $a[games] * 100, 1);
        // Add a user's +/- statistic
        $plus_minus = $a[wins] - $a[losses];
        if ($plus_minus >= 0) {
            $plus_minus = mksize(($a[wins] - $a[losses]) * 100 * 1024 * 1024);
        } else {
            $plus_minus = "-";
            $plus_minus .= mksize(($a[losses] - $a[wins]) * 100 * 1024 * 1024);
        }
        print "<tr><td>{$num}</td><td align=left><table border=0 class=main cellspacing=0 cellpadding=0><tr><td class=embedded>" . "<b><a href=userdetails.php?id=" . $a[id] . ">" . $a[username] . "</a></b></td>" . "</tr></table></td><td align=right>" . number_format($a[wins], 0) . "</td>" . "</td><td align=right>" . number_format($a[losses], 0) . "</td>" . "</td><td align=right>" . number_format($a[games], 0) . "</td>" . "</td><td align=right>{$win_perc}</td>" . "</td><td align=right>{$plus_minus}</td>" . "</tr>\n";
    }
    end_table();
    end_frame();
}
Example #5
0
function edit_form($user, $team, $forum, $first)
{
    page_head("Team forum");
    echo '
		<form action="team_forum.php" method="post">
		<input type="hidden" name="teamid" value="$team->id">
		<input type="hidden" name="cmd" value="edit_action">
	';
    echo form_tokens($user->authenticator);
    start_table();
    if (!strlen($forum->title)) {
        $forum->title = $team->name;
    }
    if (!strlen($forum->description)) {
        $forum->description = "Discussion among members of {$team->name}";
    }
    row2('Title', '<input name="title" value="$forum->title">');
    row2('Description', '<textarea name="description">$forum->description</textarea>');
    row2('Minimum time between posts (seconds)', '<input name="post_min_interval" value="$forum->post_min_interval">');
    row2('Minimum total credit to post', '<input name="post_min_total_credit" value="$forum->post_min_total_credit">');
    row2('Minimum average credit to post', '<input name="post_min_expavg_credit" value="$forum->post_min_expavg_credit">');
    row2('', '<input type="submit" value="OK">');
    end_table();
    echo "</form>";
    if (!$first) {
        echo '<p><a href="team_forum.php?teamid=$team->id&amp;cmd=remove_confirm$tokens">Remove your team\'s message board.</a></p>';
    }
    page_tail();
}
function edit_allocations_for_transaction($type, $trans_no)
{
    global $systypes_array;
    $cart = $_SESSION['alloc'];
    display_heading(sprintf(_("Allocation of %s # %d"), $systypes_array[$cart->type], $cart->trans_no));
    display_heading($cart->person_name);
    display_heading2(_("Date:") . " <b>" . $cart->date_ . "</b>");
    display_heading2(_("Total:") . " <b>" . price_format($cart->bank_amount) . ' ' . $cart->currency . "</b>");
    if ($cart->currency != $cart->person_curr) {
        $total = _("Total in clearing currency:") . " <b>" . price_format($cart->amount) . "</b>" . sprintf(" %s (%s %s/%s)", $cart->person_curr, exrate_format($cart->bank_amount / $cart->amount), $cart->currency, $cart->person_curr);
        display_heading2($total);
    }
    echo "<br>";
    start_form();
    div_start('alloc_tbl');
    if (count($cart->allocs) > 0) {
        show_allocatable(true);
        //ML Start
        start_table();
        //text_row_ex(_("Number: "), 'num', 10);
        end_table();
        br();
        //ML End
        submit_center_first('UpdateDisplay', _("Refresh"), _('Start again allocation of selected amount'), true);
        submit('Process', _("Process"), true, _('Process allocations'), 'default');
        submit_center_last('Cancel', _("Back to Allocations"), _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    } else {
        display_note(_("There are no unsettled transactions to allocate."), 0, 1);
        submit_center('Cancel', _("Back to Allocations"), true, _('Abandon allocations and return to selection of allocatable amounts'), 'cancel');
    }
    div_end();
    end_form();
}
Example #7
0
function display_trial_balance()
{
    global $table_style, $path_to_root;
    start_table($table_style);
    $tableheader = "<tr>\n        <td rowspan=2 class='tableheader'>" . tr("Account") . "</td>\n        <td rowspan=2 class='tableheader'>" . tr("Account Name") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Brought Forward") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("This Period") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Balance") . "</td>\n\t\t</tr><tr>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n        <td class='tableheader'>" . tr("Credit") . "</td>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n\t\t<td class='tableheader'>" . tr("Credit") . "</td>\n        <td class='tableheader'>" . tr("Debit") . "</td>\n        <td class='tableheader'>" . tr("Credit") . "</td>\n        </tr>";
    echo $tableheader;
    $k = 0;
    $accounts = get_gl_accounts();
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = null;
        } else {
            $begin = begin_fiscalyear();
            if ($_POST['TransFromDate'] < $begin) {
                $begin = $_POST['TransFromDate'];
            }
            $begin = add_days($begin, -1);
        }
        $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false);
        $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']);
        if (check_value("NoZero") && !$prev_balance && !$curr_balance) {
            continue;
        }
        alt_table_row_color($k);
        $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>";
        label_cell($url);
        label_cell($account["account_name"]);
        display_debit_or_credit_cells($prev_balance);
        display_debit_or_credit_cells($curr_balance);
        display_debit_or_credit_cells($prev_balance + $curr_balance);
        end_row();
    }
    end_table(1);
}
Example #8
0
function gl_inquiry_controls()
{
    $dim = get_company_pref('use_dimension');
    start_form();
    start_table(TABLESTYLE_NOBORDER);
    $date = today();
    if (!isset($_POST['TransFromDate'])) {
        $_POST['TransFromDate'] = begin_month($date);
    }
    if (!isset($_POST['TransToDate'])) {
        $_POST['TransToDate'] = end_month($date);
    }
    date_cells(_("From:"), 'TransFromDate');
    date_cells(_("To:"), 'TransToDate');
    if ($dim >= 1) {
        dimensions_list_cells(_("Dimension") . " 1:", 'Dimension', null, true, " ", false, 1);
    }
    if ($dim > 1) {
        dimensions_list_cells(_("Dimension") . " 2:", 'Dimension2', null, true, " ", false, 2);
    }
    check_cells(_("No zero values"), 'NoZero', null);
    check_cells(_("Only balances"), 'Balance', null);
    submit_cells('Show', _("Show"), '', '', 'default');
    end_table();
    end_form();
}
Example #9
0
function show_stats($brand)
{
    switch ($brand) {
        case 1:
            $x = "HTC Power to Give";
            break;
        default:
            error_page("invalid brand");
    }
    $hosts = BoincHost::enum("os_name='Android' and serialnum like '%{$x}%'");
    $n = 0;
    $t = 0;
    $a = 0;
    foreach ($hosts as $h) {
        $t += $h->total_credit;
        $a += $h->expavg_credit;
        if ($h->expavg_credit > 0.1) {
            $n++;
        }
    }
    page_head("Stats for {$x}");
    start_table();
    row2("Active devices", $n);
    row2("Average daily credit", $a);
    row2("Total credit", $t);
    end_table();
    page_tail();
}
Example #10
0
function edit_form($user, $team, $forum, $first)
{
    page_head(tra("Team Message Board"));
    echo "\n        <form action=team_forum.php method=post>\n        <input type=hidden name=teamid value={$team->id}>\n        <input type=hidden name=cmd value=edit_action>\n    ";
    echo form_tokens($user->authenticator);
    start_table();
    if (!strlen($forum->title)) {
        $forum->title = $team->name;
    }
    if (!strlen($forum->description)) {
        $forum->description = tra("Discussion among members of %1", $team->name);
    }
    row2(tra("Title"), "<input name=title size=80 value=\"{$forum->title}\">");
    row2(tra("Description"), "<textarea name=description>{$forum->description}</textarea>");
    row2(tra("Minimum time between posts (seconds)"), "<input name=post_min_interval value={$forum->post_min_interval}>");
    row2(tra("Minimum total credit to post"), "<input name=post_min_total_credit value={$forum->post_min_total_credit}>");
    row2(tra("Minimum average credit to post"), "<input name=post_min_expavg_credit value={$forum->post_min_expavg_credit}>");
    row2("", "<input class=\"btn btn-default\" type=submit value=" . tra("Submit") . ">");
    end_table();
    echo "\n        </form>\n    ";
    if (!$first) {
        echo "\n            <p>\n            <a href=team_forum.php?teamid={$team->id}&cmd=remove_confirm{$tokens}>\n            " . tra("Remove your team's message board.") . "</a>\n        ";
    }
    page_tail();
}
function commenttable_new($rows)
{
    global $CURUSER, $HTTP_SERVER_VARS;
    begin_main_frame();
    begin_frame();
    $count = 0;
    foreach ($rows as $row) {
        $subres = mysql_query("SELECT name from torrents where id=" . unsafeChar($row["torrent"])) or sqlerr(__FILE__, __LINE__);
        $subrow = mysql_fetch_array($subres);
        print "<br /><a href=\"details.php?id=" . safeChar($row["torrent"]) . "\">" . safeChar($subrow["name"]) . "</a><br />\n";
        print "<p class=sub>#" . $row["id"] . " by ";
        if (isset($row["username"])) {
            print "<a name=comm" . $row["id"] . " href=userdetails.php?id=" . safeChar($row["user"]) . "><b>" . safechar($row["username"]) . "</b></a>" . ($row["warned"] == "yes" ? "<img src=" . "pic/warned.gif alt=\"Warned\">" : "");
        } else {
            print "<a name=\"comm" . safeChar($row["id"]) . "\"><i>(orphaned)</i></a>\n";
        }
        print " at " . safeChar($row["added"]) . " GMT" . "- [<a href=comment.php?action=edit&cid={$row['id']}>Edit</a>]" . "- [<a href=deletecomment.php?id={$row['id']}>Delete</a>]</p>\n";
        $avatar = $CURUSER["avatars"] == "yes" ? safechar($row["avatar"]) : "";
        if (!$avatar) {
            $avatar = "pic/default_avatar.gif";
        }
        begin_table(true);
        print "<tr valign=top>\n";
        print "<td align=center width=150 style='padding: 0px'><img width=150 src={$avatar}></td>\n";
        print "<td class=text>" . format_comment($row["text"]) . "</td>\n";
        print "</tr>\n";
        end_table();
    }
    end_frame();
    end_main_frame();
}
Example #12
0
function display_customer_summary($customer_record)
{
    global $table_style;
    $past1 = get_company_pref('past_due_days');
    $past2 = 2 * $past1;
    if ($customer_record["dissallow_invoices"] != 0) {
        echo "<center><font color=red size=4><b>" . tr("CUSTOMER ACCOUNT IS ON HOLD") . "</font></b></center>";
    }
    $nowdue = "1-" . $past1 . " " . tr('Days');
    $pastdue1 = $past1 + 1 . "-" . $past2 . " " . tr('Days');
    $pastdue2 = tr('Over') . " " . $past2 . " " . tr('Days');
    start_table("width=80% {$table_style}");
    $th = array(tr("Currency"), tr("Terms"), tr("Current"), $nowdue, $pastdue1, $pastdue2, tr("Total Balance"));
    table_header($th);
    start_row();
    label_cell($customer_record["curr_code"]);
    label_cell($customer_record["terms"]);
    amount_cell($customer_record["Balance"] - $customer_record["Due"]);
    amount_cell($customer_record["Due"] - $customer_record["Overdue1"]);
    amount_cell($customer_record["Overdue1"] - $customer_record["Overdue2"]);
    amount_cell($customer_record["Overdue2"]);
    amount_cell($customer_record["Balance"]);
    end_row();
    end_table();
}
Example #13
0
function gl_payment_controls()
{
    global $table_style2;
    $home_currency = get_company_currency();
    start_form(false, true);
    start_table($table_style2, 5, 7);
    echo "<tr><td valign=top>";
    // outer table
    echo "<table>";
    bank_accounts_list_row(tr("From Account:"), 'FromBankAccount', null, true);
    bank_accounts_list_row(tr("To Account:"), 'ToBankAccount', null, true);
    date_row(tr("Transfer Date:"), 'DatePaid');
    $from_currency = get_bank_account_currency($_POST['FromBankAccount']);
    $to_currency = get_bank_account_currency($_POST['ToBankAccount']);
    if ($from_currency != "" && $to_currency != "" && $from_currency != $to_currency) {
        amount_row(tr("Amount:"), 'amount', null, null, $from_currency);
        exchange_rate_display($from_currency, $to_currency, $_POST['DatePaid']);
    } else {
        amount_row(tr("Amount:"), 'amount');
    }
    echo "</table>";
    echo "</td><td valign=top class='tableseparator'>";
    // outer table
    echo "<table>";
    bank_trans_types_list_row(tr("Transfer Type:"), 'TransferType', null);
    ref_row(tr("Reference:"), 'ref', references::get_next(systypes::bank_transfer()));
    textarea_row(tr("Memo:"), 'memo_', null, 40, 4);
    end_table(1);
    echo "</td></tr>";
    end_table(1);
    // outer table
    submit_center('AddPayment', tr("Enter Transfer"));
    end_form();
}
Example #14
0
function show_admins($user, $teamid)
{
    page_head("Add or remove Team Admins");
    echo "\n\t\tYou can select team members as 'Team Admins'.\n\t\tTeam Admins can:\n\t\t<ul>\n\t\t<li>Edit team information (name, URL, description, country).</li>\n\t\t<li>View the team's join/quit history.</li>\n\t\t<li>Moderate the team forum, if any (admins get emails notification of moderation events and red X reports).</li>\n\t\t</ul>\n\t\tTeam Admins cannot:\n\t\t<ul>\n\t\t<li>Change the team founder.</li>\n\t\t<li>Remove members.</li>\n\t\t<li>Add or remove Team Admins.</li>\n\t\t</ul>\n\t\tIf a Team Admin quits the team, they cease to be a Team Admin.\n\t\t<p>\n\t\tWe recommend that you select only people\n\t\tyou know and trust very well as Team Admins.\n\t";
    $admins = BoincTeamAdmin::enum("teamid={$teamid}");
    start_table();
    if (count($admins) == 0) {
        row1("There are currently no Team Admins");
    } else {
        row1("Current Team Admins", 3);
        table_header("Name", "Became Team Admin on", "");
        foreach ($admins as $admin) {
            show_admin($user, $admin);
        }
    }
    end_table();
    echo '
		<p>
		<form action="team_admins.php">
		<input type="hidden" name="action" value="add">
		<input type="hidden" name="teamid" value="$teamid">
	';
    echo form_tokens($user->authenticator);
    start_table();
    row1("Add Team Admin");
    row2('Email address of team member:', '<input name="email_addr">');
    row2('', '<input type="submit" action value="Add">');
    end_table();
    echo "</form>";
    page_tail();
}
Example #15
0
function show_admins($user, $teamid)
{
    page_head(tra("Add or remove Team Admins"));
    echo tra("You can select team members as 'Team Admins'. Team Admins can:") . "\n        <ul>\n        <li>" . tra("Edit team information (name, URL, description, country)") . "\n        <li>" . tra("View the team's join/quit history") . "\n        <li>" . tra("Moderate the team forum, if any (admins get email notification of moderation events and red X reports)") . "\n        </ul>\n        " . tra("Team Admins cannot:") . "\n        <ul>\n        <li>" . tra("Change the team founder") . "\n        <li>" . tra("Remove members") . "\n        <li>" . tra("Add or remove Team Admins") . "\n        </ul>\n        " . tra("If a Team Admin quits the team, they cease to be a Team Admin.") . "\n        <br /><br />" . tra("We recommend that you select only people you know and trust very well as Team Admins.");
    $admins = BoincTeamAdmin::enum("teamid={$teamid}");
    start_table();
    if (count($admins) == 0) {
        row1(tra("There are currently no Team Admins"));
    } else {
        row1(tra("Current Team Admins"), 3);
        table_header(tra("Name"), tra("Became Team Admin on"), "");
        foreach ($admins as $admin) {
            show_admin($user, $admin);
        }
    }
    end_table();
    echo "\n        <p>\n        <form action=team_admins.php>\n        <input type=hidden name=action value=add>\n        <input type=hidden name=teamid value={$teamid}>\n    ";
    echo form_tokens($user->authenticator);
    start_table();
    row1(tra("Add Team Admin"));
    row2(tra("Email address of team member:"), "<input name=email_addr>");
    row2("", "<input type=submit action value=\"" . tra("Add") . "\">");
    end_table();
    echo "</form>";
    page_tail();
}
Example #16
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     $today = date2sql(Today());
     $sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM " . TB_PREF . "bank_trans bt" . " INNER JOIN " . TB_PREF . "bank_accounts ba ON bt.bank_act = ba.id" . " WHERE trans_date < '{$today}'" . " AND inactive <> 1";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP BY bank_act, bank_account_name" . " ORDER BY bank_account_name";
     $result = db_query($sql);
     br();
     $th = array(_("Account"), _("Balance"));
     start_table(TABLESTYLE, "width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         label_cell($myrow["bank_account_name"]);
         amount_cell($myrow['balance']);
         end_row();
     }
     end_table(1);
 }
Example #17
0
function main()
{
    page_head("Bossa apps");
    start_table();
    show_apps();
    end_table();
    page_tail();
}
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     if (!isset($this->top)) {
         $this->top = 10;
     }
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM((trans.ov_amount + trans.ov_discount) * rate) AS total, s.supplier_id, s.supp_name FROM\n            " . TB_PREF . "supp_trans AS trans, " . TB_PREF . "suppliers AS s WHERE trans.supplier_id=s.supplier_id\n            AND (trans.type = " . ST_SUPPINVOICE . " OR trans.type = " . ST_SUPPCREDIT . ")\n            AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= "GROUP by s.supplier_id ORDER BY total DESC, s.supplier_id " . " LIMIT " . $this->top;
     $result = db_query($sql);
     if ($this->graph_type == 'Table') {
         $th = array(_("Supplier"), _("Amount"));
         start_table(TABLESTYLE, "width=98%");
         table_header($th);
         $k = 0;
         //row colour counter
         while ($myrow = db_fetch($result)) {
             alt_table_row_color($k);
             $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
             label_cell($name);
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $name = $myrow["supplier_id"] . " " . $myrow["supp_name"];
             $pg->x[$i] = $name;
             $pg->y[$i] = $myrow['total'];
             $i++;
         }
         $pg->title = $title;
         $pg->axis_x = _("Supplier");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 2;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #19
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM(amount) AS total, c.class_name, c.ctype FROM\n            " . TB_PREF . "gl_trans," . TB_PREF . "chart_master AS a, " . TB_PREF . "chart_types AS t,\n            " . TB_PREF . "chart_class AS c WHERE\n            account = a.account_code AND a.account_type = t.id AND t.class_id = c.cid\n            AND IF(c.ctype > 3, tran_date >= '{$begin1}', tran_date >= '0000-00-00')\n            AND tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP BY c.cid ORDER BY c.cid";
     $result = db_query($sql, "Transactions could not be calculated");
     $calculated = _("Calculated Return");
     if ($this->graph_type == 'Table') {
         start_table(TABLESTYLE2, "width=98%");
         $total = 0;
         while ($myrow = db_fetch($result)) {
             if ($myrow['ctype'] > 3) {
                 $total += $myrow['total'];
                 $myrow['total'] = -$myrow['total'];
             }
             label_row($myrow['class_name'], number_format2($myrow['total'], user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
         }
         label_row("&nbsp;", "");
         label_row($calculated, number_format2(-$total, user_price_dec()), "class='label' style='font-weight:bold;'", "style='font-weight:bold;' align=right");
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         $total = 0;
         while ($myrow = db_fetch($result)) {
             if ($myrow['ctype'] > 3) {
                 $total += $myrow['total'];
                 $myrow['total'] = -$myrow['total'];
                 $pg->x[$i] = $myrow['class_name'];
                 $pg->y[$i] = abs($myrow['total']);
                 $i++;
             }
         }
         $pg->x[$i] = $calculated;
         $pg->y[$i] = -$total;
         $pg->title = $title;
         $pg->axis_x = _("Class");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 5;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #20
0
 function render($id, $title)
 {
     global $path_to_root;
     if (!isset($this->top)) {
         $this->top = 10;
     }
     global $path_to_root;
     $pg = new graph();
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM(-t.amount) AS total, d.reference, d.name FROM\n            " . TB_PREF . "gl_trans AS t," . TB_PREF . "dimensions AS d WHERE\n            (t.dimension_id = d.id OR t.dimension2_id = d.id) AND\n            t.tran_date >= '{$begin1}' AND t.tran_date <= '{$today1}' ";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= "GROUP BY d.id ORDER BY total DESC LIMIT " . $this->top;
     $result = db_query($sql, "Transactions could not be calculated");
     if ($this->graph_type == 'Table') {
         $title = _("Top 10 Dimensions in fiscal year");
         br(2);
         display_heading($title);
         br();
         $th = array(_("Dimension"), _("Amount"));
         start_table(TABLESTYLE, "width=98%");
         table_header($th);
         $k = 0;
         //row colour counter
         while ($myrow = db_fetch($result)) {
             alt_table_row_color($k);
             label_cell($myrow['reference'] . " " . $myrow["name"]);
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(2);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $pg->x[$i] = $myrow['reference'] . " " . $myrow["name"];
             $pg->y[$i] = abs($myrow['total']);
             $i++;
         }
         $pg->title = $title;
         $pg->axis_x = _("Dimension");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 5;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #21
0
 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/reporting/includes/class.graphic.inc";
     if (!defined('FLOAT_COMP_DELTA')) {
         define('FLOAT_COMP_DELTA', 0.004);
     }
     if (!isset($this->top)) {
         $this->top = 10;
     }
     $begin = begin_fiscalyear();
     $today = Today();
     $begin1 = date2sql($begin);
     $today1 = date2sql($today);
     $sql = "SELECT SUM((ov_amount + ov_discount) * rate * IF(trans.type = " . ST_CUSTCREDIT . ", -1, 1)) AS total,d.debtor_no, d.name" . " FROM " . TB_PREF . "debtor_trans AS trans, " . TB_PREF . "debtors_master AS d" . " WHERE trans.debtor_no=d.debtor_no" . " AND (trans.type = " . ST_SALESINVOICE . " OR trans.type = " . ST_CUSTCREDIT . ")" . " AND tran_date >= '{$begin1}' AND tran_date <= '{$today1}'";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP by d.debtor_no ORDER BY total DESC, d.debtor_no " . " LIMIT " . $this->top;
     $result = db_query($sql);
     if ($this->graph_type == 'Table') {
         $th = array(null, _("Customer"), _("Amount"));
         start_table(TABLESTYLE, "width=98%");
         table_header($th);
         $k = 0;
         //row colour counter
         $i = 0;
         while ($myrow = db_fetch($result)) {
             alt_table_row_color($k);
             label_cell(viewer_link($myrow["debtor_no"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
             label_cell(viewer_link($myrow["name"], 'sales/inquiry/customer_inquiry.php?customer_id=' . $myrow["debtor_no"]));
             amount_cell($myrow['total']);
             end_row();
         }
         end_table(1);
     } else {
         $pg = new graph();
         $i = 0;
         while ($myrow = db_fetch($result)) {
             $pg->x[$i] = $myrow["debtor_no"] . " " . $myrow["name"];
             $pg->y[$i] = $myrow['total'];
             $i++;
         }
         $pg->title = $title;
         $pg->axis_x = _("Customer");
         $pg->axis_y = _("Amount");
         $pg->graphic_1 = $today;
         $pg->type = 2;
         $pg->skin = 1;
         $pg->built_in = false;
         $filename = company_path() . "/pdf_files/" . uniqid("") . ".png";
         $pg->display($filename, true);
         echo "<img src='{$filename}' border='0' alt='{$title}' style='max-width:100%'>";
     }
 }
Example #22
0
function insert_smilies_frame()
{
    global $smilies, $BASEURL;
    begin_frame("Smilies", true);
    begin_table(false, 5);
    print "<tr><td class=colhead>Type...</td><td class=colhead>To make a...</td></tr>\n";
    while (list($code, $url) = each($smilies)) {
        print "<tr><td>{$code}</td><td><img src={$BASEURL}/pic/smilies/{$url}></td>\n";
    }
    end_table();
    end_frame();
}
Example #23
0
function insert_smilies_frame()
{
    global $smilies, $DEFAULTBASEURL;
    begin_frame("Смайлы", true);
    begin_table(false, 5);
    print "<tr><td class=\"colhead\">Написание</td><td class=\"colhead\">Смайл</td></tr>\n";
    while (list($code, $url) = each($smilies)) {
        print "<tr><td>{$code}</td><td><img src=\"{$DEFAULTBASEURL}/pic/smilies/{$url}\"></td>\n";
    }
    end_table();
    end_frame();
}
Example #24
0
function show_batches($user)
{
    $batches = BoincBatch::enum("user_id={$user->id}");
    page_head("Batches");
    start_table();
    table_header("Batch ID", "Submitted", "# jobs");
    foreach ($batches as $batch) {
        echo "<tr>\n            <td><a href=submit_status.php?action=show_batch&batch_id={$batch->id}>{$batch->id}</a></td>\n            <td>" . time_str($batch->create_time) . "</td>\n            <td>{$batch->njobs}</td>\n            </tr>\n        ";
    }
    end_table();
    page_tail();
}
function display_po_receive_items()
{
    div_start('grn_items');
    start_table(TABLESTYLE, "colspan=7 width=90%");
    $th = array(_("Item Code"), _("Description"), _("Ordered"), _("Units"), _("Received"), _("Outstanding"), _("This Delivery"), _("Price"), _("Total"));
    table_header($th);
    /*show the line items on the order with the quantity being received for modification */
    $total = 0;
    $k = 0;
    //row colour counter
    if (count($_SESSION['PO']->line_items) > 0) {
        foreach ($_SESSION['PO']->line_items as $ln_itm) {
            alt_table_row_color($k);
            $qty_outstanding = $ln_itm->quantity - $ln_itm->qty_received;
            if (!isset($_POST['Update']) && !isset($_POST['ProcessGoodsReceived']) && $ln_itm->receive_qty == 0) {
                //If no quantites yet input default the balance to be received
                $ln_itm->receive_qty = $qty_outstanding;
            }
            $line_total = $ln_itm->receive_qty * $ln_itm->price;
            $total += $line_total;
            label_cell($ln_itm->stock_id);
            if ($qty_outstanding > 0) {
                text_cells(null, $ln_itm->stock_id . "Desc", $ln_itm->item_description, 30, 50);
            } else {
                label_cell($ln_itm->item_description);
            }
            $dec = get_qty_dec($ln_itm->stock_id);
            qty_cell($ln_itm->quantity, false, $dec);
            label_cell($ln_itm->units);
            qty_cell($ln_itm->qty_received, false, $dec);
            qty_cell($qty_outstanding, false, $dec);
            if ($qty_outstanding > 0) {
                qty_cells(null, $ln_itm->line_no, number_format2($ln_itm->receive_qty, $dec), "align=right", null, $dec);
            } else {
                label_cell(number_format2($ln_itm->receive_qty, $dec), "align=right");
            }
            amount_decimal_cell($ln_itm->price);
            amount_cell($line_total);
            end_row();
        }
    }
    $colspan = count($th) - 1;
    $display_sub_total = price_format($total);
    label_row(_("Sub-total"), $display_sub_total, "colspan={$colspan} align=right", "align=right");
    $taxes = $_SESSION['PO']->get_taxes(input_num('freight_cost'), true);
    $tax_total = display_edit_tax_items($taxes, $colspan, $_SESSION['PO']->tax_included);
    $display_total = price_format($total + input_num('freight_cost') + $tax_total);
    start_row();
    label_cells(_("Amount Total"), $display_total, "colspan={$colspan} align='right'", "align='right'");
    end_row();
    end_table();
    div_end();
}
Example #26
0
function insert_smilies_frame()
{
    global $smilies, $BASEURL, $pic_base_url;
    begin_frame("Smilies", true);
    begin_table(false, 5);
    print "<tr><td class='colhead'>Type...</td><td class='colhead'>To make a...</td></tr>\n";
    while (list($code, $url) = each($smilies)) {
        print "<tr><td>{$code}</td><td><img src=\"{$pic_base_url}smilies/{$url}\" alt='' /></td></tr>\n";
    }
    end_table();
    end_frame();
}
function handle_list()
{
    page_head("Project-wide management functions");
    echo "<h3>User permissions and quotas</h3>\n        The following users are allowed to submit jobs.\n        <p>\n    ";
    show_button("manage_project.php?action=add_form", "Add user", "Allow a new user to submit jobs");
    $us = BoincUserSubmit::enum("");
    start_table();
    table_header("User", "Can submit jobs for", "Quota");
    foreach ($us as $u) {
        user_row($u);
    }
    end_table();
    page_tail();
}
Example #28
0
function handle_list()
{
    page_head("Job submission access control");
    echo "The following users are allowed to submit jobs.\n        <p>\n    ";
    $us = BoincUserSubmit::enum("");
    start_table();
    table_header("User<br><p class=\"text-muted\">Click to change permissions or quota</p>", "Can submit jobs for", "Quota", "Max jobs in progress<br><p class=\"text-muted\">0 means no limit</p>", "Current priority<br><p class=\"text-muted\">Later time = lower priority</p>");
    foreach ($us as $u) {
        user_row($u);
    }
    end_table();
    show_button("manage_project.php?action=add_form", "Add user", "Allow a new user to submit jobs");
    page_tail();
}
Example #29
0
function insert_smilies_frame()
{
    global $smilies, $INSTALLER09;
    $htmlout = '';
    $htmlout .= begin_frame("Smilies", true);
    $htmlout .= begin_table(false, 5);
    $htmlout .= "<tr><td class='colhead'>Type...</td><td class='colhead'>To make a...</td></tr>\n";
    foreach ($smilies as $code => $url) {
        $htmlout .= "<tr><td>{$code}</td><td><img src=\"{$INSTALLER09['pic_base_url']}smilies/{$url}\" alt='' /></td></tr>\n";
    }
    $htmlout .= end_table();
    $htmlout .= end_frame();
    return $htmlout;
}
 function vorlage_waehlen($empf_typ = null, $kat = null)
 {
     // die($empf_typ);
     if ($empf_typ == null && $kat == null) {
         $db_abfrage = "SELECT * FROM PDF_VORLAGEN ORDER BY KURZTEXT ASC";
     }
     if ($empf_typ && $kat == null) {
         $db_abfrage = "SELECT * FROM PDF_VORLAGEN WHERE EMPF_TYP='{$empf_typ}' ORDER BY KURZTEXT ASC";
     }
     if ($empf_typ == null && $kat) {
         $db_abfrage = "SELECT * FROM PDF_VORLAGEN WHERE KAT='{$kat}' ORDER BY KURZTEXT ASC";
     }
     if ($empf_typ != null && $kat != null) {
         $db_abfrage = "SELECT * FROM PDF_VORLAGEN WHERE KAT='{$kat}' && EMPF_TYP='{$empf_typ}' ORDER BY KURZTEXT ASC";
     }
     $result = mysql_query($db_abfrage) or die(mysql_error());
     /* Wenn keine Vorlagen, dann alle anzeigen */
     $numrows = mysql_numrows($result);
     if (!$numrows) {
         $db_abfrage = "SELECT * FROM PDF_VORLAGEN ORDER BY KURZTEXT ASC";
         $result = mysql_query($db_abfrage) or die(mysql_error());
     }
     $numrows = mysql_numrows($result);
     if ($numrows) {
         start_table();
         $link_kat = "<a href=\"?daten=weg&option=serienbrief\">Alle Kats anzeigen</a>";
         echo "<tr><th>Vorlage / Betreff</th><th>KAT</th><th>BEARBEITEN</th><th>ANSEHEN</th></tr>";
         echo "<tr><td><b>{$empf_typ}<b></td><td>{$link_kat}</td><td></td><td></td></tr>";
         while ($row = mysql_fetch_assoc($result)) {
             $dat = $row['DAT'];
             $kurztext = $row['KURZTEXT'];
             $text = $row['TEXT'];
             $kat = $row['KAT'];
             if ($empf_typ == 'Eigentuemer') {
                 $link_ansehen = "<a href=\"?daten=weg&option=serienbrief_pdf&vorlagen_dat={$dat}\">Serienbrief als PDF</a>";
                 $link_kat = "<a href=\"?daten=weg&option=serienbrief&kat={$kat}\">{$kat}</a>";
             }
             if ($empf_typ == 'Partner') {
                 $link_ansehen = "<a href=\"?daten=partner&option=serienbrief_pdf&vorlagen_dat={$dat}\">Serienbrief als PDF</a>";
                 $link_kat = "<a href=\"?daten=partner&option=serienbrief&kat={$kat}\">{$kat}</a>";
             }
             $link_bearbeiten = "<a href=\"?daten=bk&option=vorlage_bearbeiten&vorlagen_dat={$dat}\">Vorlage bearbeiten</a>";
             echo "<tr><td>{$kurztext}</td><td>{$link_kat}</td><td>{$link_bearbeiten}</td><td>{$link_ansehen}</td></tr>";
         }
         end_table();
     } else {
         echo "Keine Vorlagen AA3";
     }
 }