Пример #1
0
function notify_emails($dbid, $req_id)
{
    if ("{$req_id}" == "") {
        return "";
    }
    $query = "SELECT email, fullname FROM usr, request_interested ";
    $query .= "WHERE request_interested.user_no = usr.user_no ";
    $query .= " AND request_interested.request_id = {$req_id} ";
    $query .= " AND usr.active ";
    $query .= "UNION ";
    $query .= "SELECT email, fullname FROM usr, request_allocated ";
    $query .= "WHERE request_allocated.allocated_to_id = usr.user_no ";
    $query .= " AND request_allocated.request_id = {$req_id} ";
    $query .= " AND usr.active ";
    $peopleq = awm_pgexec($dbid, $query, "notify-eml");
    $to = "";
    if ($peopleq) {
        $rows = pg_NumRows($peopleq);
        for ($i = 0; $i < $rows; $i++) {
            $interested = pg_Fetch_Object($peopleq, $i);
            if ($i > 0) {
                $to .= ", ";
            }
            $to .= "{$interested->fullname} <{$interested->email}>";
        }
    }
    return $to;
}
Пример #2
0
function get_system_list($access = "", $current = 0, $maxwidth = 50)
{
    global $dbconn;
    global $session, $roles;
    $system_id_list = "";
    function int_val(&$item)
    {
        $item = strval(intval($item));
    }
    if (is_array($current)) {
        array_walk($current, 'int_val');
    } else {
        $current = intval("{$current}");
    }
    $query = "SELECT work_system.system_id, system_desc ";
    $query .= "FROM work_system WHERE active ";
    if ($access != "" && !is_member_of('Admin', 'Support')) {
        $query .= " AND EXISTS (SELECT system_usr.system_id FROM system_usr WHERE system_usr.system_id=work_system.system_id";
        $query .= " AND user_no={$session->user_no} ";
        $query .= " AND role~*'[{$access}]') ";
    }
    if (is_array($current)) {
        $query .= " OR work_system.system_id IN (" . implode(",", $current) . ") ";
    } else {
        if ($current != "") {
            $query .= " OR work_system.system_id={$current}";
        }
    }
    $query .= " ORDER BY LOWER(system_desc);";
    $rid = awm_pgexec($dbconn, $query);
    if (!$rid) {
        return;
    }
    if (pg_NumRows($rid) > 0) {
        // Build table of systems found
        $rows = pg_NumRows($rid);
        for ($i = 0; $i < $rows; $i++) {
            $system_id = pg_Fetch_Object($rid, $i);
            $system_id_list .= "<option value=\"" . urlencode($system_id->system_id) . "\"";
            if (is_array($current) && in_array($system_id->system_id, $current, true) || "{$system_id->system_id}" == "{$current}") {
                $system_id_list .= " SELECTED";
            }
            $system_id->system_desc = substr($system_id->system_desc, 0, $maxwidth);
            $system_id_list .= ">{$system_id->system_desc}</option>\n";
        }
    }
    return $system_id_list;
}
Пример #3
0
function get_user_list($roles = "", $org = "", $current)
{
    global $dbconn;
    global $session;
    $user_list = "";
    $query = "SELECT DISTINCT usr.user_no, usr.fullname, organisation.abbreviation ";
    $query .= "FROM usr , organisation";
    $query .= " WHERE usr.active ";
    $query .= " AND usr.org_code = organisation.org_code ";
    if ($roles != "") {
        $role_array = split(',', $roles);
        $in_roles = "";
        foreach ($role_array as $v) {
            $in_roles .= $in_roles == "" ? "" : ",";
            $in_roles .= "'{$v}'";
        }
        $query .= "AND EXISTS (SELECT role_member.user_no FROM role_member JOIN roles USING(role_no) ";
        $query .= "WHERE role_member.user_no = usr.user_no ";
        $query .= "AND roles.role_name IN ({$in_roles}) )";
    }
    if ("{$org}" != "") {
        $query .= " AND usr.org_code='{$org}' ";
    }
    $query .= " ORDER BY usr.fullname; ";
    $rid = awm_pgexec($dbconn, $query, "userlist", false, 7);
    if (!$rid) {
        echo "<p>{$query}";
    } else {
        if (pg_NumRows($rid) > 0) {
            // Build table of users found
            $rows = pg_NumRows($rid);
            for ($i = 0; $i < $rows; $i++) {
                $user = pg_Fetch_Object($rid, $i);
                $user_list .= "<OPTION VALUE=\"{$user->user_no}\"";
                if (is_array($current) && in_array($user->user_no, $current, true) || "{$user->user_no}" == "{$current}") {
                    $user_list .= " selected=\"SELECTED\"";
                }
                $user->fullname = substr($user->fullname, 0, 25) . " ({$user->abbreviation})";
                $user_list .= ">{$user->fullname}";
            }
        }
    }
    return $user_list;
}
Пример #4
0
function get_code_list($table, $field, $current = "", $misc = "", $tag = "option", $varname = "")
{
    global $dbconn;
    $query = "SELECT * FROM lookup_code WHERE source_table = '{$table}' AND source_field = '{$field}' ORDER BY source_table, source_field, lookup_seq, lookup_code";
    $rid = awm_pgexec($dbconn, $query, "codelist", false);
    $rows = pg_NumRows($rid);
    $lookup_code_list = "";
    if ($tag != "option") {
        $prestuff = "input type=";
        $selected = " checked";
    } else {
        $prestuff = "";
        $selected = " selected";
    }
    for ($i = 0; $i < $rows; $i++) {
        $lookup_code = pg_Fetch_Object($rid, $i);
        $lookup_code_list .= "<{$prestuff}{$tag} value=\"{$lookup_code->lookup_code}\"";
        if ("{$varname}" != "") {
            $lookup_code_list .= " name={$varname}";
        }
        if ("{$lookup_code->lookup_code}" == "{$current}") {
            $lookup_code_list .= $selected;
        }
        $lookup_code_list .= ">";
        $lookup_code_list .= "{$lookup_code->lookup_desc}";
        if ("{$misc}" != "" && "{$lookup_code->lookup_misc}" != "") {
            $lookup_code_list .= " - {$lookup_code->lookup_misc}";
        }
        if ("{$tag}" == "option") {
            $lookup_code_list .= "</{$tag}>";
        } else {
            $lookup_code_list .= "&nbsp;\n";
        }
    }
    return $lookup_code_list;
}
Пример #5
0
<table border="0" cellspacing="0" cellpadding="1">
<?php 
$query = "SELECT lookup_code, lookup_desc FROM lookup_code ";
$query .= " WHERE source_table='codes' AND source_field='menus' ";
$query .= " ORDER BY lookup_seq;";
$result = awm_pgexec($dbconn, $query, "lookhead");
if ($result && pg_NumRows($result) > 0) {
    echo "<tr><td>\n";
    for ($i = 0; $i < pg_NumRows($result); $i++) {
        $codes = pg_Fetch_Object($result, $i);
        list($s_table, $s_field) = explode("|", "{$codes->lookup_code}");
        if ($agent == "moz4" && $i > 0) {
            echo " | ";
        }
        printf("<a class=submit href=\"lookups.php?table={$s_table}&field={$s_field}\">%s{$codes->lookup_desc}%s</a>\n", "{$table}{$field}" == "{$s_table}{$s_field}" ? "<b>*" : "", "{$table}{$field}" == "{$s_table}{$s_field}" ? "*</b>" : "");
    }
    echo "</td></tr>\n";
}
?>
</table>
Пример #6
0
         echo "<td>{$thisnote->fullname}</td>\n";
         echo "<td colspan=\"5\">" . html_format($thisnote->note_detail) . "</td>\n";
         echo "</tr>\n";
     }
 }
 if ($show_work) {
     $subquery = "SELECT *, to_char( work_on, 'DD/MM/YYYY') AS nice_date ";
     $subquery .= "FROM request_timesheet, usr ";
     $subquery .= "WHERE request_id = {$thisrequest->request_id} ";
     $subquery .= "AND usr.user_no = request_timesheet.work_by_id ";
     $subquery .= "ORDER BY request_id, work_on ";
     $total = 0.0;
     $qty_total = 0.0;
     $subres = awm_pgexec($dbconn, $subquery, "requestlist");
     for ($j = 0; $subres && $j < pg_NumRows($subres); $j++) {
         $thiswork = pg_Fetch_Object($subres, $j);
         printf("<tr class=row%1d valign=top>\n", $i % 2);
         echo "<td>{$thiswork->nice_date}</td>\n";
         echo "<td>{$thiswork->fullname}</td>\n";
         echo "<td colspan=\"2\">{$thiswork->work_description}</td>\n";
         printf("<td align=\"right\">%9.2f &nbsp; </td>\n", $thiswork->work_quantity);
         printf("<td align=\"right\">%9.2f &nbsp; </td>\n", $thiswork->work_rate);
         $value = $thiswork->work_quantity * $thiswork->work_rate;
         $total += $value;
         $qty_total += $thiswork->work_quantity;
         printf("<td align=\"right\">%9.2f &nbsp; </td>\n", $value);
         echo "</tr>\n";
     }
     if ($j > 0) {
         printf("<tr class=\"row%1d\">\n<td colspan=\"4\">&nbsp; &nbsp; &nbsp; Request #{$thisrequest->request_id} total</td>\n<td align=\"right\">%9.2f &nbsp; </td><td>&nbsp;</td><td align=right>%9.2f &nbsp; </td>\n</tr>\n", $i % 2, $qty_total, $total);
     }
Пример #7
0
 if ("{$style}" != "stripped") {
     echo "<p><small>&nbsp;" . pg_NumRows($result) . " timesheets found\n";
     if (pg_NumRows($result) == $maxresults) {
         echo " (limit reached)";
     }
     if ("{$uncharged}" != "") {
         printf("<form enctype=\"multipart/form-data\" method=post action=\"%s%s\">\n", $REQUEST_URI, !strpos($REQUEST_URI, "uncharged") ? "&uncharged=1" : "");
     }
 }
 echo "<table border=\"0\" cellspacing=1 align=center>\n";
 header_row();
 $grand_total = 0.0;
 $total_hours = 0.0;
 // Build table of organisations found
 for ($i = 0; $i < pg_NumRows($result); $i++) {
     $timesheet = pg_Fetch_Object($result, $i);
     $grand_total += doubleval($timesheet->work_quantity * $timesheet->work_rate);
     switch ($timesheet->work_units) {
         case 'hours':
             $total_hours += doubleval($timesheet->work_quantity);
             break;
         case 'days':
             $total_hours += doubleval($timesheet->work_quantity * 8);
             break;
     }
     printf("<tr class=row%1d>\n", $i % 2);
     echo "<td class=sml nowrap>{$timesheet->requester_name}</td>\n";
     if (isset($GLOBALS[org_code]) && $GLOBALS[org_code] > 0) {
         echo "<td class=sml nowrap>{$timesheet->abbreviation}</td>\n";
     }
     echo "<td class=sml align=center nowrap><a href=\"{$base_url}/wr.php?request_id={$timesheet->request_id}\">{$timesheet->request_id}</a></td>\n";
Пример #8
0
 $query .= " LIMIT 30 ";
 $result = awm_pgexec($dbconn, $query);
 if (!$result) {
     $error_loc = "sessionlist-form.php";
     $error_qry = "{$query}";
     include "error.php";
 } else {
     echo "<p>" . pg_NumRows($result) . " sessions found</p>";
     echo "<table border=\"0\" align=center><tr>\n";
     echo "<th class=cols>Session #</th><th class=cols>Name</th>";
     echo "<th class=cols align=left>Start</th>";
     echo "<th class=cols align=left>Duration</th>";
     echo "</tr>";
     // Build table of sessions found
     for ($i = 0; $i < pg_NumRows($result); $i++) {
         $thissession = pg_Fetch_Object($result, $i);
         if ($i % 2 == 0) {
             echo "<tr bgcolor={$colors['6']}>";
         } else {
             echo "<tr bgcolor={$colors['7']}>";
         }
         echo "<td align=center>&nbsp;{$thissession->session_id}&nbsp;</td>\n";
         echo "<td>&nbsp;<a href=\"user.php?user_no={$thissession->user_no}\">{$thissession->fullname}";
         if ("{$thissession->fullname}" == "") {
             echo "{$thissession->username}";
         }
         echo "</a>&nbsp;</td>\n";
         echo "<td>" . nice_date($thissession->session_start) . "</td>\n";
         echo "<td>{$thissession->duration}</td>\n";
         echo "</tr>\n";
     }
Пример #9
0
echo "</tr>";
for ($i = 0; $i < pg_NumRows($result); $i++) {
    $thisrequest = pg_Fetch_Object($result, $i);
    printf("<tr class=row%1d>", $i % 2);
    echo "<td class=sml><a href=\"request.php?request_id={$thisrequest->request_id}\">{$thisrequest->request_id}</a></td>";
    echo "<td class=sml>{$thisrequest->brief}</td>";
    echo "<td class=sml>{$thisrequest->importance}</td>";
    echo "<td class=sml>{$thisrequest->urgency}</td>";
    echo "<td class=sml>{$thisrequest->by_date}</td>";
    echo "<td class=sml>" . str_replace(' ', '&nbsp;', $thisrequest->status) . "</td>";
    echo "<td class=sml>";
    // Display request quote info.
    $quotes_query = "SELECT quote_id, quoted_on::DATE AS quoted_date, quote_type, quote_amount, quote_units, " . "approved_on::DATE AS approved_date, quote_brief, quoted_by, username " . "FROM request_quote " . "LEFT OUTER JOIN usr ON usr.user_no = request_quote.approved_by_id " . "WHERE request_quote.request_id = {$thisrequest->request_id}";
    $quotes_result = awm_pgexec($dbconn, $quotes_query, "requestrank", false, 7);
    for ($ii = 0; $ii < pg_NumRows($quotes_result); $ii++) {
        $quote_result = pg_Fetch_Object($quotes_result, $ii);
        echo "<INPUT TYPE=checkbox NAME=q_{$quote_result->quote_id} CHECKED " . "title='Quoted by {$quote_result->quoted_by} on {$quote_result->quoted_date}: {$quote_result->quote_amount}" . "&nbsp;{$quote_result->quote_units}'>";
        if ($quote_result->approved_date != "") {
            echo "&nbsp;<INPUT TYPE=checkbox NAME=a_{$quote_result->quote_id} CHECKED " . "title='Approved by {$quote_result->username} on {$quote_result->approved_date}'>";
        }
        echo "<BR>";
    }
    echo "</td>";
    echo "<td class=sml>" . str_replace(' ', '&nbsp;', $thisrequest->type) . "</td>";
    echo "<td class=sml>{$thisrequest->ranking}</td>";
    echo "</tr>\n";
}
echo "</table>";
/*      if ( intval("$user_no") > 0 )
        $query .= " AND requester_id = " . intval($user_no);
      else if ( intval("$requested_by") > 0 )
Пример #10
0
 if (!$result) {
     $error_loc = "orglist-form.php";
     $error_qry = "{$query}";
     include "error.php";
 } else {
     echo "<p><small>" . pg_NumRows($result) . " organisations found</small></p>";
     echo "<table border=\"0\" align=center width=100%><tr>\n";
     echo "<th class=cols align=left>Abbrev.</th>\n";
     echo "<th class=cols align=left>Full Name</th>";
     if (is_member_of('Admin', 'Support')) {
         echo "<th class=cols>Debtor #</th>";
     }
     echo "<th class=cols align=center>Actions</th></tr>";
     // Build table of organisations found
     for ($i = 0; $i < pg_NumRows($result); $i++) {
         $thisorganisation = pg_Fetch_Object($result, $i);
         printf("<tr class=row%1d>", $i % 2);
         echo "<td class=sml>&nbsp;<a href=\"org.php?org_code={$thisorganisation->org_code}\">{$thisorganisation->abbreviation}</a>&nbsp;</td>\n";
         echo "<td class=sml>&nbsp;<a href=\"org.php?org_code={$thisorganisation->org_code}\">{$thisorganisation->org_name}";
         if ("{$thisorganisation->org_name}" == "") {
             echo "-- no description --";
         }
         echo "</a>&nbsp;</td>\n";
         if (is_member_of('Admin', 'Support')) {
             printf("<td class=sml align=right>%s &nbsp; &nbsp;</td>\n", intval($thisorganisation->debtor_no) > 0 ? "{$thisorganisation->debtor_no}" : "-");
         }
         echo "<td class=sml><a class=submit href=\"requestlist.php?org_code={$thisorganisation->org_code}\">Requests</a>";
         echo "<a class=submit href=\"usrsearch.php?org_code={$thisorganisation->org_code}\">Users</a>";
         echo "<a class=submit href=\"form.php?org_code={$thisorganisation->org_code}&form=syslist\">Systems</a>";
         if (is_member_of('Admin', 'Support')) {
             echo "<a class=submit href=\"form.php?org_code={$thisorganisation->org_code}&form=timelist&uncharged=1\">Work</a>";
Пример #11
0
    if (!$rid) {
        $error_loc = "request-form.php";
        $error_qry = "{$query}";
        include "error.php";
    }
    $rows = pg_NumRows($rid);
    if (!$rows) {
        echo "<p>No records for request: {$request_id}</p>";
        if (is_member_of('Admin', 'Support')) {
            echo "<p>There is probably a bug in the following query:</p>";
            echo "<p>{$query}</p>";
        }
        exit;
        /* Make sure that code below does not get executed when we redirect. */
    }
    $request = pg_Fetch_Object($rid, 0);
    $is_request = true;
} else {
    $is_request = false;
    $request = "";
}
if (isset($request->active) && strtolower("{$request->active}") == "t") {
    $request->active = "TRUE";
}
/* get the user's roles relative to the current request */
include "get-request-roles.php";
/* Current request is editable if the user requested it or user is sysmgr, cltmgr or allocated the job */
if (!isset($style)) {
    $style = "";
}
if (!isset($plain) && isset($style)) {
Пример #12
0
    if ("{$action}" == "edit") {
        echo "Update";
    } else {
        echo "Add";
    }
    echo "\" name=submit></td>\n";
    echo "</form>";
    $edited = true;
}
$max_desc = 0;
$edited = false;
if (pg_NumRows($result) == 0) {
    echo "<tr><td colspan=99><H3>No codes found</h3></td></tr>";
} else {
    for ($i = 0; $i < pg_NumRows($result); $i++) {
        $lookup = pg_Fetch_Object($result, $i);
        // Note these tags aren't terminated until below...
        printf("<tr class=row%1d%s>\n", $i % 2, "{$action}" == "edit" && "{$lookup_code}" == "{$lookup->lookup_code}" ? " valign=top" : "");
        $maxdesc = max($maxdesc, strlen($lookup->lookup_desc));
        if ("{$action}" == "edit" && "{$lookup_code}" == "{$lookup->lookup_code}") {
            edit_line();
        } else {
            echo "<td class=sml>{$lookup->lookup_seq}&nbsp;</td>";
            echo "<td class=sml>{$lookup->lookup_code}&nbsp;</td>";
            echo "<td class=sml>{$lookup->lookup_desc}&nbsp;</td>";
            echo "<td class=sml>{$lookup->lookup_misc}&nbsp;</td>\n";
            echo "<td align=center class=sml><font size=1>\n";
            echo "<a class=submit href=\"{$look_href}&lookup_code=" . rawurlencode($lookup->lookup_code) . "&action=edit\">Edit</a> \n";
            echo "<a class=submit href=\"{$look_href}&lookup_code=" . rawurlencode($lookup->lookup_code) . "&action=delete\">Delete</a>";
            echo "</font></td>";
        }
Пример #13
0
 } else {
     $words = split("[^a-zA-Z0-9]+", strtolower($nodename), 4);
     $query = "";
     while (list($k, $v) = each($words)) {
         if ($query != "") {
             $query .= "UNION ";
         }
         $query .= "SELECT * FROM infonode WHERE LOWER(nodename) ~ '{$v}' ";
     }
     $query .= "LIMIT 100;";
     echo "<p>I can't find an exact match for \"{$nodename}\" but perhaps one of these is the answer you need:";
     $rid = awm_pgexec($dbconn, $query, "wu-form");
     if ($rid && pg_NumRows($rid) > 0) {
         echo "<ul>";
         for ($i = 0; $i < pg_NumRows($rid); $i++) {
             $node = pg_Fetch_Object($rid, $i);
             echo "<li><a href=\"/wu.php?node_id={$node->node_id}&last={$last}\">{$node->nodename}</a></li>\n";
         }
         echo "</ul></p>";
         if ($can_edit) {
             echo "<p><br>&nbsp;<br><p>Alternatively, if none of these fits the bill, enter your new editorial directly in the space below:";
         }
     }
 }
 if ($can_edit) {
     if (isset($my_wu)) {
         $submitlabel = "Update Editorial";
     } else {
         $submitlabel = "Add New Editorial";
     }
     $seq = intval($seq);
Пример #14
0
     echo link_writeups("<h1>{$help->title}</h1>\n");
     echo link_writeups("{$help->content}\n");
     if (is_member_of('Admin', 'Support')) {
         echo "<p><br><p><br><a href=\"/help.php?action=edit&h=" . htmlspecialchars($help->topic) . "&seq={$help->seq}\">edit this help text</a>\n";
         echo " &nbsp;| &nbsp;<a href=\"/help.php?action=add&h=" . htmlspecialchars($help->topic) . "\">add new help text</a>\n";
     }
 } else {
     // Many results so display a table of contents
     if (isset($show_all)) {
         echo "<h1>Detailed Help</h1>\n";
     } else {
         echo "<h1>Select Your Help Topic</h1>\n";
     }
     echo "<ol type=\"1\">";
     for ($i = 0; $i < $rows; $i++) {
         $help = pg_Fetch_Object($rid, $i);
         if (isset($seq) && $help->seq == $seq || isset($show_all)) {
             echo link_writeups("<li><b><big>{$help->title}</big></b></li>\n");
             echo link_writeups("{$help->content}\n");
             if (is_member_of('Admin', 'Support')) {
                 echo "<p align=right><a href=\"/help.php?action=edit&h=" . htmlspecialchars($help->topic) . "&seq={$help->seq}\">edit this help text</a></p>\n";
             }
         } else {
             echo link_writeups("<li><a href=\"/help.php?h=" . htmlspecialchars($help->topic) . "&seq={$help->seq}\">{$help->title}</a></li>\n");
         }
     }
     echo "</ol>";
     if (is_member_of('Admin', 'Support')) {
         echo "<p align=right><a href=\"/help.php?action=add&h=" . htmlspecialchars($topic) . "\">add new help text</a>\n";
     }
     if (!isset($show_all)) {
Пример #15
0
$user_no = "";
$query = "SELECT user_no FROM usr WHERE username=LOWER('{$l}') and password=LOWER('{$p}')";
$result = pg_Exec($dbconn, $query);
if (pg_NumRows($result) > 0) {
    $user_no = pg_Result($result, 0, "user_no");
}
$requests = "<p><small>";
if ("{$user_no}" != "") {
    $query = "SELECT DISTINCT request.request_id, brief, last_activity, ";
    $query .= "lookup_desc AS status_desc, severity_code ";
    $query .= "FROM request, request_interested, lookup_code AS status ";
    $query .= "WHERE request.request_id=request_interested.request_id ";
    $query .= "AND status.source_table='request' ";
    $query .= "AND status.source_field='status_code' ";
    $query .= "AND status.lookup_code=request.last_status ";
    $query .= "AND request_interested.user_no={$user_no} ";
    $query .= "AND request.active ";
    $query .= "AND request.last_status~*'[AILNRQA]' ";
    $query .= "ORDER BY request.severity_code DESC LIMIT 20; ";
    $result = pg_Exec($dbconn, $query);
    if (!$result) {
        error_log("wrms wap/inc/getRequests.php query error: {$query}", 0);
    }
    for ($i = 0; $i < pg_NumRows($result); $i++) {
        $thisrequest = pg_Fetch_Object($result, $i);
        $requests .= "<a href=\"wrms.php?id={$thisrequest->request_id}\">" . tidy($thisrequest->brief) . "</a><br/>\n";
    }
} else {
    $requests .= "I'm sorry you must login first";
}
$requests .= "</small></p>";
Пример #16
0
$query .= "AND su.role IN ( 'A', 'S', 'C', 'E', 'O', 'V' ) ";
$query .= "AND (r.last_activity > (current_timestamp - '30 days'::interval) ";
$query .= "     OR r.last_status NOT IN ( 'F', 'C' ) ) ";
$query .= "GROUP BY lower(s.system_desc), s.system_id, s.system_desc ";
$query .= "HAVING COUNT(r.request_id) > 0 ";
$query .= "ORDER BY lower(s.system_desc) ";
$result = awm_pgexec($dbconn, $query, "indexsupport", false, 5);
if ($result && pg_NumRows($result)) {
    echo "<table border=\"0\" align=center width=100%><tr>\n";
    echo "<th class=cols align=left>Organisation Name</th>";
    echo "<th class=cols align=center>Requests</th>";
    echo "<th class=cols align=center>Last Request</th>";
    echo "<th class=cols align=center>Show:</th></tr>";
    // Build table of organisations found
    for ($i = 0; $i < pg_NumRows($result); $i++) {
        $this_system = pg_Fetch_Object($result, $i);
        printf("<tr class=row%1d>", $i % 2);
        echo "<td class=sml>&nbsp;<a href=\"requestlist.php?system_id={$this_system->system_id}\">{$this_system->system_desc}";
        if ("{$this_system->system_desc}" == "") {
            echo "-- no description --";
        }
        echo "</a>&nbsp;</td>\n";
        echo "<td class=sml align=right>&nbsp;{$this_system->active_sys_requests}</td>\n";
        echo "<td class=sml align=center>&nbsp;{$this_system->last_request_date}</td>\n";
        echo "<td class=sml align=center><a class=\"submit\" href=\"org.php?org_code={$this_system->org_code}\">Details</a>";
        echo "&nbsp;&nbsp;<a class=submit href=\"usrsearch.php?org_code={$this_system->org_code}\">Users</a>";
        echo "&nbsp;&nbsp;<a class=submit href=\"form.php?org_code={$this_system->org_code}&form=timelist&uncharged=1\">Work</a>";
        //echo "&nbsp;&nbsp;<a class=submit href=\"form.php?org_code=$this_system->org_code&form=simpletimelist&uncharged=1\">Work by Person</a>";
        echo "</td></tr>\n";
    }
    echo "</table>\n";
Пример #17
0
 echo "</select>\n";
 echo "</th>\n";
 echo '<th class=cols>Dbtr. No.';
 echo '<input type="Image" src="$theme->images/down.gif" title="Sort" border="0" name="sort[organisation.org_code]" >';
 echo "</th>\n";
 echo '<th class=cols>WR No.<input TYPE="Image" src="/' . $theme->images . '/down.gif" alt="Sort" BORDER="0" name="sort[request_timesheet.request_id]" ></th>' . "\n";
 echo "<th class=cols>WR Status";
 echo '<select class=sml name="filter[request.last_status]">' . "\n";
 echo "<option class=sml value=''>All</option>\n";
 $select_query = "SELECT lookup_code, lookup_desc FROM lookup_code";
 $select_query .= " WHERE lookup_code.source_table = 'request' ";
 $select_query .= " AND lookup_code.source_field = 'status_code' ";
 $select_query .= " ORDER BY lookup_code.lookup_desc";
 $select_result = awm_pgexec($dbconn, $select_query);
 for ($i = 0; $i < pg_NumRows($select_result); $i++) {
     $select_option = pg_Fetch_Object($select_result, $i);
     echo "<option class=sml value=\"'{$select_option->lookup_code}'\"";
     if ("'" . $select_option->lookup_code . "'" == $filter["request.last_status"]) {
         echo ' selected';
     }
     echo ">{$select_option->lookup_desc}</option>\n";
 }
 echo "</select>\n";
 echo "</th>\n";
 echo "<th class=cols>Status On</th>\n";
 echo "<th class=cols>WR Brief</th>\n";
 echo '<th class=cols>';
 echo '<table cellpadding=2 cellspacing=0 border=0>';
 echo '<tr>';
 echo '<td></td>';
 echo '<td align="middle"><input TYPE="Image" src="/' . $theme->images . '/up.gif" alt="Sort Ascending" BORDER="0" name="sort_asc[request_timesheet.work_description]" ></td>';