2 include_once("../../globals.php");
3 include_once("$srcdir/sql.inc");
4 include_once("$srcdir/options.inc.php");
8 <?php
html_header_show();?
>
9 <script type
="text/javascript" src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js"></script
>
10 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
11 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
12 <script type
="text/javascript" src
="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
13 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
14 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
15 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
16 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
17 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script
>
18 <SCRIPT LANGUAGE
="JavaScript">
19 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
20 function validate(f
) {
21 if (f
.form_adreviewed
.value
== "")
23 alert("<?php xl('Please enter a date for Last Reviewed.','e'); ?>");
24 f
.form_adreviewed
.focus();
29 $
(document
).ready(function(){
30 $
("#cancel").click(function() { window
.close(); });
35 <body
class="body_top">
37 if ($_POST['form_yesno'])
39 sqlQuery("UPDATE patient_data SET completed_ad='".formData('form_yesno','P',true)."', ad_reviewed='".formData('form_adreviewed','P',true)."' where pid='$pid'");
40 // Close this window and refresh the calendar display.
41 echo "<html>\n<body>\n<script language='JavaScript'>\n";
42 echo " if (!opener.closed && opener.refreshme) opener.refreshme();\n";
43 echo " window.close();\n";
44 echo "</script>\n</body>\n</html>\n";
47 $sql = "select completed_ad, ad_reviewed from patient_data where pid='$pid'";
48 $myrow = sqlQuery($sql);
51 $form_completedad = $myrow['completed_ad'];
52 $form_adreviewed = $myrow['ad_reviewed'];
55 <span
class="title"><?php
xl('Advance Directives','e'); ?
></span
>
57 <form action
='advancedirectives.php' method
='post' onsubmit
='return validate(this)' enctype
="multipart/form-data">
58 <table border
=0 cellpadding
=1 cellspacing
=1>
60 echo "<tr><td class='required'>";
62 echo ":</td><td width=10></td><td class='text'>";
63 generate_form_field(array('data_type'=>1,'field_id'=>'yesno','list_id'=>'yesno','empty_title'=>'SKIP'), $form_completedad);
64 echo "</td></tr><tr><td class='required'>";
65 xl('Last Reviewed','e');
66 echo ":</td><td width=10></td><td class='text'>";
67 generate_form_field(array('data_type'=>4,'field_id'=>'adreviewed'), $form_adreviewed);
68 echo "<script language='JavaScript'>Calendar.setup({inputField:'form_adreviewed', ifFormat:'%Y-%m-%d', button:'img_adreviewed'});</script>";
70 echo "<tr><td class=text colspan=2><br><input type=submit id=create value='" . xl('Save') . "' /> <input type=button id=cancel value='" . xl('Cancel') . "' /></td></tr>";
75 $query = "SELECT id FROM categories WHERE name='Advance Directive'";
76 $myrow2 = sqlQuery($query);
78 $parentId = $myrow2['id'];
79 $query = "SELECT id, name FROM categories WHERE parent='$parentId'";
80 $resNew1 = sqlStatement($query);
81 while ($myrows3 = sqlFetchArray($resNew1)) {
82 $categoryId = $myrows3['id'];
83 $nameDoc = $myrows3['name'];
84 $query = "SELECT documents.date, documents.id " .
86 "INNER JOIN categories_to_documents " .
87 "ON categories_to_documents.document_id=documents.id " .
88 "WHERE categories_to_documents.category_id='$categoryId' " .
89 "AND documents.foreign_id='$pid' " .
90 "ORDER BY documents.date DESC";
91 $resNew2 = sqlStatement($query);
92 $counterFlag = false; //flag used to check for empty categories
93 while ($myrows4 = sqlFetchArray($resNew2)) {
94 $dateTimeDoc = $myrows4['date'];
95 $idDoc = $myrows4['id'];
97 echo "<a href='$web_root/controller.php?document&retrieve&patient_id=$pid&document_id=".$idDoc."&as_file=true'>".xl_document_category($nameDoc)."</a> ".$dateTimeDoc;
100 // if no associated docs with category then show it's empty
103 echo $nameDoc . " <span style='color:red;'>[" . xl('EMPTY') . "]</span>";