Fixed php short tags
[openemr.git] / contrib / forms / clinical_notes / new.php
blob0c86729b8fb947a9edcc13332840d8f0dacb2f8a
1 <?php
2 //////////////////////////////////////////////////////////////////////
3 // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
4 // View.php is an exact duplicate of new.php. If you wish to make
5 // any changes, then change new.php and either (recommended) make
6 // view.php a symbolic link to new.php, or copy new.php to view.php.
7 //
8 // And if you check in a change to either module, be sure to check
9 // in the other (identical) module also.
11 // This nonsense will go away if we ever move to subversion.
12 //////////////////////////////////////////////////////////////////////
14 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
16 // This program is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU General Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
21 include_once("../../globals.php");
22 include_once("$srcdir/api.inc");
23 include_once("$srcdir/forms.inc");
25 $row = array();
27 if (! $encounter) { // comes from globals.php
28 die("Internal error: we do not seem to be in an encounter!");
31 function rbvalue($rbname) {
32 $tmp = $_POST[$rbname];
33 if (! $tmp) $tmp = '0';
34 return "'$tmp'";
37 function cbvalue($cbname) {
38 return $_POST[$cbname] ? '1' : '0';
41 function rbinput($name, $value, $desc, $colname) {
42 global $row;
43 $ret = "<input type='radio' name='$name' value='$value'";
44 if ($row[$colname] == $value) $ret .= " checked";
45 $ret .= " />$desc";
46 return $ret;
49 function rbcell($name, $value, $desc, $colname) {
50 return "<td width='25%' nowrap>" . rbinput($name, $value, $desc, $colname) . "</td>\n";
53 function cbinput($name, $colname) {
54 global $row;
55 $ret = "<input type='checkbox' name='$name' value='1'";
56 if ($row[$colname]) $ret .= " checked";
57 $ret .= " />";
58 return $ret;
61 function cbcell($name, $desc, $colname) {
62 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
65 $formid = $_GET['id'];
67 // If Save was clicked, save the info.
69 if ($_POST['bn_save']) {
71 $fu_timing = $_POST['fu_timing'];
73 // If updating an existing form...
75 if ($formid) {
76 $query = "UPDATE form_clinical_notes SET " .
77 "history = '" . $_POST['form_history'] . "', " .
78 "examination = '" . $_POST['form_examination'] . "', " .
79 "plan = '" . $_POST['form_plan'] . "', " .
80 "followup_required = " . rbvalue('fu_required') . ", " .
81 "followup_timing = '$fu_timing'" . " " .
82 // "outcome = " . rbvalue('outcome') . ", " .
83 // "destination = " . rbvalue('destination') . " " .
84 "WHERE id = '$formid'";
85 sqlStatement($query);
88 // If adding a new form...
90 else {
91 $query = "INSERT INTO form_clinical_notes ( " .
92 "history, examination, plan, followup_required, followup_timing " .
93 // ",outcome, destination " .
94 ") VALUES ( " .
95 "'" . $_POST['form_history'] . "', " .
96 "'" . $_POST['form_examination'] . "', " .
97 "'" . $_POST['form_plan'] . "', " .
98 rbvalue('fu_required') . ", " .
99 "'$fu_timing'" . " " .
100 // rbvalue('outcome') . ", " .
101 // rbvalue('destination') . " " .
102 ")";
103 $newid = sqlInsert($query);
104 addForm($encounter, "Clinical Notes", $newid, "clinical_notes", $pid, $userauthorized);
107 formHeader("Redirecting....");
108 formJump();
109 formFooter();
110 exit;
113 if ($formid) {
114 $row = sqlQuery ("SELECT * FROM form_clinical_notes WHERE " .
115 "id = '$formid' AND activity = '1'") ;
118 <html>
119 <head>
120 <?php html_header_show();?>
121 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
122 <script language="JavaScript">
123 </script>
124 </head>
126 <body <?php echo $top_bg_line;?> topmargin="0" rightmargin="0" leftmargin="2"
127 bottommargin="0" marginwidth="2" marginheight="0">
128 <form method="post" action="<?php echo $rootdir ?>/forms/clinical_notes/new.php?id=<?php echo $formid ?>"
129 onsubmit="return top.restoreSession()">
131 <center>
134 <table border='1' width='95%'>
136 <tr bgcolor='#dddddd'>
137 <td colspan='2' align='center'><b>This Encounter</b></td>
138 </tr>
140 <tr>
141 <td width='5%' nowrap> History </td>
142 <td width='95%' nowrap>
143 <textarea name='form_history' rows='7' style='width:100%'><?php echo $row['history'] ?></textarea>
144 </td>
145 </tr>
147 <tr>
148 <td nowrap> Examination </td>
149 <td nowrap>
150 <textarea name='form_examination' rows='7' style='width:100%'><?php echo $row['examination'] ?></textarea>
151 </td>
152 </tr>
154 <tr>
155 <td nowrap> Plan </td>
156 <td nowrap>
157 <textarea name='form_plan' rows='7' style='width:100%'><?php echo $row['plan'] ?></textarea>
158 </td>
159 </tr>
161 <tr>
162 <td nowrap>Follow Up</td>
163 <td nowrap>
164 <table width='100%'>
165 <tr>
166 <td width='5%' nowrap>
167 <?php echo rbinput('fu_required', '1', 'Required in:', 'followup_required') ?>
168 </td>
169 <td nowrap>
170 <input type='text' name='fu_timing' size='10' style='width:100%'
171 title='When to follow up'
172 value='<?php echo addslashes($row['followup_timing']) ?>' />
173 </td>
174 </tr>
175 <tr>
176 <td colspan='2' nowrap>
177 <?php echo rbinput('fu_required', '2', 'Pending investigation', 'followup_required') ?>
178 </td>
179 </tr>
180 <tr>
181 <td colspan='2' nowrap>
182 <?php echo rbinput('fu_required', '0', 'None required', 'followup_required') ?>
183 </td>
184 </tr>
185 </table>
186 </td>
187 </tr>
189 <!--
191 <tr bgcolor='#dddddd'>
192 <td colspan='2' align='center'><b>Final Discharge</b></td>
193 </tr>
195 <tr>
196 <td nowrap>Outcome</td>
197 <td nowrap>
198 <table width='100%'>
199 <tr>
200 <?php // echo rbcell('outcome', '1', 'Resolved' , 'outcome') ?>
201 <?php // echo rbcell('outcome', '2', 'Improved' , 'outcome') ?>
202 <?php // echo rbcell('outcome', '3', 'Status Quo', 'outcome') ?>
203 <?php // echo rbcell('outcome', '4', 'Worse' , 'outcome') ?>
204 </tr>
205 </table>
206 </td>
207 </tr>
209 <tr>
210 <td nowrap>Destination</td>
211 <td nowrap>
212 <table width='100%'>
213 <tr>
214 <?php // echo rbcell('destination', '1', 'GP' , 'destination') ?>
215 <?php // echo rbcell('destination', '2', 'Hospital Specialist', 'destination') ?>
216 <td width='25%'>&nbsp;</td>
217 <td width='25%'>&nbsp;</td>
218 </tr>
219 </table>
220 </td>
221 </tr>
225 </table>
228 <input type='submit' name='bn_save' value='Save' />
229 &nbsp;
230 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url'] ?>'" />
231 </p>
233 </center>
235 </form>
236 </body>
237 </html>