public function getNumRows($name) { if (isset($this->result[$name]) && (gettype($this->result[$name]) == 'object' || gettype($this->result[$name]) == 'resource')) { return pg_NumRows($this->result[$name]); } return 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; }
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; }
function execute($sql, $db, $type = "mysql") { $start = $this->row * $this->numrowsperpage; if ($type == "mysql") { $result = mysql_query($sql, $db); $this->total_records = mysql_num_rows($result); $sql .= " LIMIT {$start}, {$this->numrowsperpage}"; $result = mysql_query($sql, $db); } elseif ($type == "pgsql") { $result = pg_Exec($db, $sql); $this->total_records = pg_NumRows($result); $sql .= " LIMIT {$this->numrowsperpage}, {$start}"; $result = pg_Exec($db, $sql); } return $result; }
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; }
function execute($sql, $db, $type = "mysql") { global $total_records, $row, $numtoshow; $numtoshow = $this->numrowsperpage; if (!isset($row)) { $row = 0; } $start = $row * $numtoshow; if ($type == "mysql") { $result = mysql_query($sql, $db); $total_records = mysql_num_rows($result); $sql .= " LIMIT {$start}, {$numtoshow}"; $result = mysql_query($sql, $db); } elseif ($type == "pgsql") { $result = pg_Exec($db, $sql); $total_records = pg_NumRows($result); $sql .= " LIMIT {$numtoshow}, {$start}"; $result = pg_Exec($db, $sql); } return $result; }
function listOptionsLabel($dataset, $choixdef) { global $database; $result = pg_Exec($database, "SELECT * FROM " . $dataset); $Nbr = pg_NumRows($result); for ($i = 0; $i < $Nbr; $i++) { $tablo[$i] = pg_fetch_array($result, $i); } if ($Nbr > 2) { sort($tablo); } echo "<select name=liste_" . $dataset . ">\n"; for ($i = 0; $i < $Nbr; $i++) { list($cle, $label) = $tablo[$i]; if ($cle == $choixdef) { echo " <option selected>" . $cle . " = " . $label . "</option>\n"; } else { echo " <option>" . $cle . " = " . $label . "</option>\n"; } } echo "</select>\n"; return 1; }
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 .= " \n"; } } return $lookup_code_list; }
function Sincronizar($db) { $rows = 0; // Number of rows $qid = 0; // Query result resource // See PostgreSQL developer manual (www.postgresql.org) for system table spec. // Get catalog data from system tables. $sql = 'SELECT * FROM migracion.f_sincronizacion()'; $qid = pg_Exec($db, $sql); // Check error if (!is_resource($qid)) { print 'Error en la Sincronizacion'; return null; } $rows = pg_NumRows($qid); // Store meta data for ($i = 0; $i < $rows; $i++) { $res = pg_Result($qid, $i, 0); // Field Name } echo 'Sincronizacion terminada (' . $res . ') - ' . date("m-d-Y H:i:s") . '<BR>'; return $res; }
function execute($sql, $db, $type = "mysql") { global $total_records, $row, $numtoshow; $numtoshow = $this->numrowsperpage; if (!isset($_GET['row'])) { $row = 0; } else { $row = $_GET['row']; } $start = $row * $numtoshow; if ($type == "mysql") { // echo " the sql statement is --".$sql."and Db is --".$db; $query_result = mysql_query($sql, $db); //$total_records = mysql_num_rows($query_result); $sql .= " LIMIT {$start}, {$numtoshow}"; $query_result = mysql_query($sql, $db); } elseif ($type == "pgsql") { $query_result = pg_Exec($db, $sql); $total_records = pg_NumRows($query_result); $sql .= " LIMIT {$numtoshow}, {$start}"; $query_result = pg_Exec($db, $sql); } return $query_result; }
$numAcredit = ($_REQUEST['pagFin'] - $_REQUEST['pagInicio'] + 1) * 20; $desplazamiento = $_REQUEST['pagInicio'] * 20; $consulta = "Select * from usuario where estado='3' order by ape1 limit " . $numAcredit . " offset " . $desplazamiento . ";"; } } $plantilla = "plantilla.rtf"; $salida = rtf($consulta, $plantilla, "acreditaciones.rtf"); descarga($salida); // Se redirige a la página de administración echo "<script type='text/javascript'> location.href='imprimirAcreditaciones.php'; </script>"; } else { $usuariosconfirm = ejecutaConsulta("Select * from usuario where estado='3';"); $numrowsconfirm = pg_NumRows($usuariosconfirm); $numrowsconfirm = (int) ($numrowsconfirm / 20) + 1; $usuariosinscrit = ejecutaConsulta("Select * from usuario where estado='1';"); $numrowsinscrit = pg_NumRows($usuariosinscrit); $numrowsinscrit = (int) ($numrowsinscrit / 20) + 1; ?> <FORM name="formImpresion" METHOD="post" ACTION="imprimirRTF.php" target="_self"> <p>El número de páginas de acreditaciones para personas inscritas sin confirmar actual es: <?php echo $numrowsinscrit; ?> </p> <p>El número de páginas de acreditaciones para personas inscritas y confirmadas actual es: <?php echo $numrowsconfirm; ?> </p> <p>Elegir el tipo de usuario del que se desea imprimir acreditaciones: <label for="inscritos">Inscritos<input id="inscritos" type="radio" value="1" checked name="tipousuario"></label>
function numrows($result) { return pg_NumRows($result); }
if ($conn == "") { printf("{$s}%s%s", "Unable to connect to application.<br>", "Please verify that the application is running and ", "listening on port {$port}.<br>"); exit; } // Headings print "<table border=3 cellpadding=4 align=center width=65%>\n"; print "<tr><th>Table Name</th><th>Description</th></tr>\n"; // execute query $command = "SELECT name, help, nrows FROM rta_tables"; $result = pg_exec($conn, $command); if ($result == "") { print "<p><font color=\"red\" size=+1>SQL Command failed!</p>"; print "<p>Command: {$command}</p>\n"; exit; } for ($row = 0; $row < pg_NumRows($result); $row++) { $tblname = pg_result($result, $row, 0); $tblhelp = pg_result($result, $row, 1); $tblrows = pg_result($result, $row, 2); print "<tr>\n<td><a href=rta_view.php?table={$tblname}&offset=0"; print "&nrows={$tblrows}&port={$port}>{$tblname}</a></td>\n"; print "<td>{$tblhelp}</td></tr>\n"; } print "</table>\n"; // free the result and close the connection pg_freeresult($result); pg_close($conn); ?> </body> </html>
$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>";
$error_loc = "get-request-roles.php"; $error_qry = "{$query}"; include "error.php"; } if ($rid && pg_NumRows($rid) > 0) { $allocated_to = TRUE; } /* Is the person client or support manager for this (or any?) system? */ $query = "SELECT * FROM system_usr WHERE system_usr.user_no={$session->user_no}"; $query .= " AND system_usr.role ~ '[CS]' "; if ($is_request) { $query .= " AND system_usr.system_id = '{$request->system_id}' "; } $rid = awm_pgexec($dbconn, $query, "req-roles2"); if (!$rid) { $error_loc = "get-request-roles.php"; $error_qry = "{$query}"; include "error.php"; } if ($rid && pg_NumRows($rid) > 0) { $sysman_role = pg_fetch_object($rid, 0); if (eregi('S', $sysman_role->role)) { $sysmgr = TRUE; } else { $cltmgr = TRUE; } } // Also set $sysmgr if the person is Admin... if (is_member_of('Admin')) { $sysmgr = TRUE; }
} } 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> <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"; }
<?php } else { $usuariosconfirm = ejecutaConsulta("SELECT u.* FROM usuarios u INNER JOIN usuarios_tipoparticipacion utp ON (u.id = utp.usuario_id) WHERE utp.tipoparticipacion_id = 1 AND u.estado='3' AND u.jornada_id = {$jornada_id};"); $numrowsconfirm = pg_NumRows($usuariosconfirm); $numrowsconfirm = $numrowsconfirm > 0 ? (int) ($numrowsconfirm / 20) + 1 : 0; $usuariosinscrit = ejecutaConsulta("SELECT u.* FROM usuarios u INNER JOIN usuarios_tipoparticipacion utp ON (u.id = utp.usuario_id) WHERE utp.tipoparticipacion_id = 1 AND u.estado='1' AND u.jornada_id = {$jornada_id};"); $numrowsinscrit = pg_NumRows($usuariosinscrit); $numrowsinscrit = $numrowsinscrit > 0 ? (int) ($numrowsinscrit / 20) + 1 : 0; $usuariosOrganizadores = ejecutaConsulta("SELECT u.* FROM usuarios u INNER JOIN usuarios_tipoparticipacion utp ON (u.id = utp.usuario_id) WHERE utp.tipoparticipacion_id = 0 AND u.jornada_id = {$jornada_id};"); $numrowsOrganizadores = pg_NumRows($usuariosOrganizadores); $numrowsOrganizadores = $numrowsOrganizadores > 0 ? (int) ($numrowsOrganizadores / 20) + 1 : 0; $usuariosPonente = ejecutaConsulta("SELECT u.* FROM usuarios u INNER JOIN usuarios_tipoparticipacion utp ON (u.id = utp.usuario_id) WHERE utp.tipoparticipacion_id = 2 AND u.jornada_id = {$jornada_id};"); $numrowsPonente = pg_NumRows($usuariosPonente); $numrowsPonente = $numrowsPonente > 0 ? (int) ($numrowsPonente / 20) + 1 : 0; $usuariosComite = ejecutaConsulta("SELECT u.* FROM usuarios u INNER JOIN usuarios_tipoparticipacion utp ON (u.id = utp.usuario_id) WHERE utp.tipoparticipacion_id = 3 AND u.jornada_id = {$jornada_id};"); $numrowsComite = pg_NumRows($usuariosComite); $numrowsComite = $numrowsComite > 0 ? (int) ($numrowsComite / 20) + 1 : 0; ?> <FORM name="formImpresion" METHOD="post" ACTION="../imprimirRTF.php" target="_self"> <table border="0" width="100%" height="100%" class="tabla"> <!-- <tr> <td class="titulopanel tdHead"> <?php echo __("Imprimir acreditaciones"); ?> </td> </tr> --> <tr height="82%"> <td valign="top"> <table width="100%" heigh="100%" border="0"> <tr> <th class="txttabla"><b><?php
} if ( "$type_code" != "" ) $query .= " AND request_type=" . intval($type_code); if ( "$from_date" != "" ) $query .= " AND request.last_activity >= '$from_date' "; if ( "$to_date" != "" ) $query .= " AND request.last_activity<='$to_date' "; if ( $where_clause != "" ) { $query .= " AND $where_clause "; } if ( isset($incstat) && is_array( $incstat ) ) { reset($incstat); $query .= " AND (request.last_status ~* '["; while( list( $k, $v) = each( $incstat ) ) { $query .= $k ; } $query .= "]') "; error_log( "wrms requestlist: DBG: 1-> $query", 0); if ( eregi("save", "$submit") && "$savelist" != "" ) { $savelist = tidy($savelist); $qquery = tidy($query); $query = "DELETE FROM saved_queries WHERE user_no = '$session->user_no' AND LOWER(query_name) = LOWER('$savelist'); INSERT INTO saved_queries (user_no, query_name, query_sql) VALUES( '$session->user_no', '$savelist', '$qquery'); $query"; } } } */ echo "\n<small>" . pg_NumRows($result) . " requests found</small>"; include "page-footer.php";
function num_rows($query_id) { return $query_id ? pg_NumRows($query_id) : 0; }
static function num_row($ret) { return pg_NumRows($ret); }
for ($i = 1; $i <= $break_columns; $i++) { if ($xtds[$i - 1]->get_content() != $prev_break[$i]) { if ($key != 0) { insert_subtotal($xtrows[$key - 1], $subtotal[$i], $i); } if ($i < $break_columns) { $prev_break[$i + 1] = ""; } $prev_break[$i] = $xtds[$i - 1]->get_content(); } } // Accumulate subtotals for ($i = $subtotal_column_start; $i < count($xtds); $i++) { for ($j = 0; $j <= $break_columns; $j++) { $subtotal[$j][$i] = $subtotal[$j][$i] + $xtds[$i]->get_content(); } } } // Last totals. for ($i = 0; $i <= $break_columns; $i++) { insert_subtotal($xtrows[count($xtrows) - 1], $subtotal[$i], $i); } $xtbody = $xtbody->next_sibling(); } } $xtd = $xtfr->new_child("td", "Rows selected: " . pg_NumRows($result)); $xtd->set_attribute("colspan", count($xthr->child_nodes())); // Output the html table echo $doc->html_dump_mem(true); } include "page-footer.php";
$header_cell .= "&incstat[{$k}]={$v}"; } } if ("{$style}" != "") { $header_cell .= "&style={$style}"; } if ("{$format}" != "") { $header_cell .= "&format={$format}"; } $header_cell .= "\">%s"; // %s for the Cell heading $header_cell .= "%s</th>"; // %s For the image if ("{$style}" != "stripped") { echo "<p><small> " . 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; $requests = array(); // Build table of organisations found while ($timesheet = $qry->Fetch()) { $grand_total += doubleval($timesheet->work_quantity * $timesheet->work_rate); switch ($timesheet->work_units) {
$query .= " LEFT OUTER JOIN lookup_code AS urgency ON urgency.source_table='request' AND urgency.source_field='urgency' AND int4(urgency.lookup_code)=request.urgency"; $query .= " LEFT OUTER JOIN lookup_code AS sla_response ON sla_response.source_table='request' AND sla_response.source_field='sla_response' AND sla_response.lookup_code=request_sla_code(sla_response_time,sla_response_type)"; $query .= " LEFT OUTER JOIN lookup_code AS importance ON importance.source_table='request' AND importance.source_field='importance' AND int4(importance.lookup_code)=request.importance"; $query .= " LEFT OUTER JOIN work_system USING( system_id )"; $query .= " WHERE request.request_id = '{$request_id}'"; if (!$session->AllowedTo('see_other_orgs')) { $query .= " AND organisation.org_code = '{$session->org_code}' "; } /* now actually query the database... */ $rid = awm_pgexec($dbconn, $query, "getrequest", false, 7); 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 = ""; }
function fcdb_num_rows($res) { global $fcdb_sel, $fcdb_conn; set_error_handler("fcdb_error_handler"); switch ($fcdb_sel) { case "PostgreSQL": $rows = pg_NumRows($res); break; case "MySQL": $rows = mysql_num_rows($res); break; } restore_error_handler(); return $rows; }
echo "<td>{$thisnote->nice_date}</td>\n"; 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 </td>\n", $thiswork->work_quantity); printf("<td align=\"right\">%9.2f </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 </td>\n", $value); echo "</tr>\n"; } if ($j > 0) { printf("<tr class=\"row%1d\">\n<td colspan=\"4\"> Request #{$thisrequest->request_id} total</td>\n<td align=\"right\">%9.2f </td><td> </td><td align=right>%9.2f </td>\n</tr>\n", $i % 2, $qty_total, $total);
} 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>';
print "<td><input type=\"hidden\" name=\"__table\" value=\"{$tbl}\">\n"; print "<td><input type=\"hidden\" name=\"__row\" value=\"{$row}\">\n"; print "<td><input type=\"hidden\" name=\"__port\" value=\"{$port}\">\n"; // print name, help, value of each column print "<center><table border=3 cellpadding=4 width=85%>\n"; // execute query $command = "SELECT name, flags, help, length, type FROM rta_columns WHERE table='{$tbl}'"; $r1 = pg_exec($c1, $command); if ($r1 == "") { print "<p><font color=\"red\" size=+1>SQL Command failed!</p>"; print "<p>Command: {$command}</p>\n"; exit; } print "<tr><th>Column</th><th width=20%>Value</th></tr>\n"; print "</tr>\n"; for ($col = 0; $col < pg_NumRows($r1); $col++) { $colname = pg_result($r1, $col, 0); $colflags = pg_result($r1, $col, 1); $colhelp = pg_result($r1, $col, 2); $collength = pg_result($r1, $col, 3); $coltype = pg_result($r1, $col, 4); $colvalue = ""; if ($coltype != 0 && $coltype != 4) { // "4" is the type for pointer to string. $collength = 20; $colvalue = 0; } // Get column value from table if an edit if ($row >= 0) { $command = "SELECT \"{$colname}\" FROM \"{$tbl}\" LIMIT 1 OFFSET {$row}"; $r2 = pg_exec($c1, $command);