Skip to content

Commit

Permalink
Fixed issue-specific encounters list to include documents that are li…
Browse files Browse the repository at this point in the history
…nked to the issue.
  • Loading branch information
sunsetsystems committed Apr 20, 2011
1 parent 55906b3 commit 314984c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions interface/patient_file/history/encounters.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,20 @@ function closeNote(feid, fenote) {

<?php
$drow = false;
if (!$billing_view && !$issue) {
// Query the documents for this patient.
$dres = sqlStatement("SELECT d.id, d.type, d.url, d.docdate, d.list_id, c.name " .
"FROM documents AS d, categories_to_documents AS cd, categories AS c WHERE " .
"d.foreign_id = ? AND cd.document_id = d.id AND c.id = cd.category_id " .
"ORDER BY d.docdate DESC, d.id DESC", array($pid) );
$drow = sqlFetchArray($dres);
if (!$billing_view) {
// Query the documents for this patient. If this list is issue-specific
// then also limit the query to documents that are linked to the issue.
$queryarr = array($pid);
$query = "SELECT d.id, d.type, d.url, d.docdate, d.list_id, c.name " .
"FROM documents AS d, categories_to_documents AS cd, categories AS c WHERE " .
"d.foreign_id = ? AND cd.document_id = d.id AND c.id = cd.category_id ";
if ($issue) {
$query .= "AND d.list_id = ? ";
$queryarr[] = $issue;
}
$query .= "ORDER BY d.docdate DESC, d.id DESC";
$dres = sqlStatement($query, $queryarr);
$drow = sqlFetchArray($dres);
}

// $count = 0;
Expand Down

0 comments on commit 314984c

Please sign in to comment.