Ejemplo n.º 1
0
// $count = 0;
$sqlBindArray = array();
$from = "FROM form_encounter AS fe " . "JOIN forms AS f ON f.pid = fe.pid AND f.encounter = fe.encounter AND " . "f.formdir = 'newpatient' AND f.deleted = 0 ";
if ($issue) {
    $from .= "JOIN issue_encounter AS ie ON ie.pid = ? AND " . "ie.list_id = ? AND ie.encounter = fe.encounter ";
    array_push($sqlBindArray, $pid, $issue);
}
$from .= "LEFT JOIN users AS u ON u.id = fe.provider_id WHERE fe.pid = ? ";
$sqlBindArray[] = $pid;
$query = "SELECT fe.*, f.user, u.fname, u.mname, u.lname " . $from . "ORDER BY fe.date DESC, fe.id DESC";
$countQuery = "SELECT COUNT(*) as c " . $from;
$countRes = sqlStatement($countQuery, $sqlBindArray);
$count = sqlFetchArray($countRes);
$numRes = $count['c'];
if ($pagesize > 0) {
    $query .= " LIMIT " . escape_limit($pagestart) . "," . escape_limit($pagesize);
}
$upper = $pagestart + $pagesize;
if ($upper > $numRes || $pagesize == 0) {
    $upper = $numRes;
}
if ($pagesize > 0 && $pagestart > 0) {
    generatePageElement($pagestart - $pagesize, $pagesize, $billing_view, $issue, "⇐" . htmlspecialchars(xl("Prev"), ENT_NOQUOTES) . " ");
}
echo $pagestart + 1 . "-" . $upper . " " . htmlspecialchars(xl('of'), ENT_NOQUOTES) . " " . $numRes;
if ($pagesize > 0 && $pagestart + $pagesize <= $numRes) {
    generatePageElement($pagestart + $pagesize, $pagesize, $billing_view, $issue, " " . htmlspecialchars(xl("Next"), ENT_NOQUOTES) . "&rArr;");
}
$res4 = sqlStatement($query, $sqlBindArray);
if ($billing_view && $accounting_enabled && !$INTEGRATED_AR) {
    SLConnect();
Ejemplo n.º 2
0
function Menu_myGetRegistered($state = "1", $limit = "unlimited", $offset = "0")
{
    $sql = "SELECT category, nickname, name, state, directory, id, sql_run, " . "unpackaged, date FROM registry WHERE " . "state LIKE ? ORDER BY category, priority, name";
    if ($limit != "unlimited") {
        $sql .= " limit " . escape_limit($limit) . ", " . escape_limit($offset);
    }
    $res = sqlStatement($sql, array($state));
    if ($res) {
        for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
            $all[$iter] = $row;
        }
    } else {
        return false;
    }
    return $all;
}
Ejemplo n.º 3
0
require_once "{$srcdir}/formdata.inc.php";
require_once "{$srcdir}/formatting.inc.php";
require_once "{$srcdir}/jsonwrapper/jsonwrapper.php";
$popup = empty($_REQUEST['popup']) ? 0 : 1;
// With the ColReorder or ColReorderWithResize plug-in, the expected column
// ordering may have been changed by the user.  So we cannot depend on
// list_options to provide that.
//
$aColumns = explode(',', $_GET['sColumns']);
// Paging parameters.  -1 means not applicable.
//
$iDisplayStart = isset($_GET['iDisplayStart']) ? 0 + $_GET['iDisplayStart'] : -1;
$iDisplayLength = isset($_GET['iDisplayLength']) ? 0 + $_GET['iDisplayLength'] : -1;
$limit = '';
if ($iDisplayStart >= 0 && $iDisplayLength >= 0) {
    $limit = "LIMIT " . escape_limit($iDisplayStart) . ", " . escape_limit($iDisplayLength);
}
// Column sorting parameters.
//
$orderby = '';
if (isset($_GET['iSortCol_0'])) {
    for ($i = 0; $i < intval($_GET['iSortingCols']); ++$i) {
        $iSortCol = intval($_GET["iSortCol_{$i}"]);
        if ($_GET["bSortable_{$iSortCol}"] == "true") {
            $sSortDir = escape_sort_order($_GET["sSortDir_{$i}"]);
            // ASC or DESC
            // We are to sort on column # $iSortCol in direction $sSortDir.
            $orderby .= $orderby ? ', ' : 'ORDER BY ';
            //
            if ($aColumns[$iSortCol] == 'name') {
                $orderby .= "lname {$sSortDir}, fname {$sSortDir}, mname {$sSortDir}";
Ejemplo n.º 4
0
 public function escapeLimit($val)
 {
     return escape_limit($val);
 }
Ejemplo n.º 5
0
 /**
  * Get the data in an array for this form.
  * 
  * First, we check the forms table to get the row id in the
  * specific table. Then we get the row of data from the specific
  * form_* table.
  * 
  * @see \ESign\SignableIF::getData()
  */
 public function getData()
 {
     // Use default standards based on formdir value
     // Exceptions are specified in formdir_keys list
     $row = sqlQuery("SELECT title FROM list_options WHERE list_id = ? AND option_id = ? AND activity = 1", array('formdir_keys', $this->_formDir));
     if (isset($row['title'])) {
         $excp = json_decode("{" . $row['title'] . "}");
     }
     $tbl = isset($excp->tbl) ? $excp->tbl : "form_" . $this->_formDir;
     $id = isset($excp->id) ? $excp->id : 'id';
     $limit = isset($excp->limit) ? $excp->limit : 1;
     // Get form data based on key from forms table
     $sql = sprintf("SELECT fd.* FROM %s fd\n      \t\tINNER JOIN forms f ON fd.%s = f.form_id\n      \t\tWHERE f.id = ?", escape_table_name($tbl), escape_sql_column_name($id, array($tbl)));
     if ($limit != '*') {
         $sql .= ' LIMIT ' . escape_limit($limit);
     }
     $rs = sqlStatement($sql, array($this->_formId));
     if (sqlNumRows($rs) == 1) {
         // maintain legacy hash
         $frs = sqlFetchArray($rs);
     } else {
         $frs = array();
         while ($fr = sqlFetchArray($rs)) {
             array_push($frs, $fr);
         }
     }
     return $frs;
 }