AMC changes for summary of care and CPOE, see note below:
[openemr.git] / library / transactions.inc
blobfdcddff2961fab450e02c273d1ce7c28d5a1296a
1 <?php
2 require_once("{$GLOBALS['srcdir']}/sql.inc");
4 function getTransById ($id, $cols = "*")
6   $row = sqlQuery("SELECT $cols FROM transactions WHERE id = ?", array($id));
7   $fres = sqlStatement("SELECT field_id, field_value FROM lbt_data WHERE form_id = ?", array($id));
8   while ($frow = sqlFetchArray($fres)) {
9     $row[$frow['field_id']] = $frow['field_value'];
10   }
11   return $row;
14 function getTransByPid ($pid, $cols = "*")
16   $res = sqlStatement("select $cols from transactions where pid = ? " .
17     "order by date DESC", array($pid) );
18   for ($iter = 0; $row = sqlFetchArray($res); $iter++) {
19     $fres = sqlStatement("SELECT field_id, field_value FROM lbt_data WHERE form_id = ?",
20       array($row['id']));
21     while ($frow = sqlFetchArray($fres)) {
22       $row[$frow['field_id']] = $frow['field_value'];
23     }
24     $all[$iter] = $row;
25   }
26   return $all;
29 function newTransaction($pid, $body, $title, $authorized = "0",
30   $status = "1", $assigned_to = "*")
32   $body = add_escape_custom($body);
33   $id = sqlInsert("insert into transactions ( " .
34     "date, title, pid, user, groupname, authorized " .
35     ") values ( " .
36     "NOW(), '$title', '$pid', '" . $_SESSION['authUser'] .
37     "', '" . $_SESSION['authProvider'] . "', '$authorized' " .
38     ")");
39   sqlStatement("INSERT INTO lbt_data (form_id, field_id, field_value) VALUES (?, ?, ?)",
40     array($id, 'body', $body));
41   return $id;
44 function authorizeTransaction($id, $authorized = "1")
46   sqlQuery("update transactions set authorized = '$authorized' where " .
47     "id = '$id'");