added some optional cosmetic features
[openemr.git] / interface / forms / newpatient / new.php
blobb0aceefb455725e108d43ead07e5db72a3865074
1 <?
2 include_once("../../globals.php");
3 include_once("$srcdir/calendar.inc");
4 include_once("$srcdir/lists.inc");
5 include_once("$srcdir/patient.inc");
6 include_once("$srcdir/acl.inc");
8 // Check permission to create encounters.
9 $tmp = getPatientData($pid, "squad");
10 if (($tmp['squad'] && ! acl_check('squads', $tmp['squad'])) ||
11 ! (acl_check('encounters', 'notes_a' ) ||
12 acl_check('encounters', 'notes' ) ||
13 acl_check('encounters', 'coding_a') ||
14 acl_check('encounters', 'coding' ) ||
15 acl_check('encounters', 'relaxed' )))
17 echo "<body>\n<html>\n";
18 echo "<p>(New encounters not authorized)</p>\n";
19 echo "</body>\n</html>\n";
20 exit();
23 $months = array("01","02","03","04","05","06","07","08","09","10","11","12");
24 $days = array("01","02","03","04","05","06","07","08","09","10","11","12","13","14",
25 "15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
26 $thisyear = date("Y");
27 $years = array($thisyear-1, $thisyear, $thisyear+1, $thisyear+2);
29 // get issues
30 $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " .
31 "pid = $pid AND enddate IS NULL " .
32 "ORDER BY type, begdate");
35 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
37 <html>
38 <head>
39 <title>New Encounter</title>
41 <script type="text/javascript" src="../../../library/dialog.js"></script>
42 <script type="text/javascript" src="../../../library/overlib_mini.js"></script>
43 <script type="text/javascript" src="../../../library/calendar.js"></script>
44 <script type="text/javascript" src="../../../library/textformat.js"></script>
46 <script language="JavaScript">
48 var mypcc = '<? echo $GLOBALS['phone_country_code'] ?>';
50 // Process click on issue title.
51 function newissue() {
52 dlgopen('../../patient_file/summary/add_edit_issue.php', '_blank', 600, 475);
53 return false;
56 // callback from add_edit_issue.php:
57 function refreshIssue(issue, title) {
58 var s = document.forms[0]['issues[]'];
59 s.options[s.options.length] = new Option(title, issue, true, true);
62 </script>
63 </head>
65 <body <?echo $top_bg_line;?> topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0'
66 marginwidth='2' marginheight='0' onload="javascript:document.new_encounter.reason.focus();">
68 <!-- Required for the popup date selectors -->
69 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
71 <form method='post' action="<?echo $rootdir?>/forms/newpatient/save.php" name='new_encounter' target='Main'>
72 <input type='hidden' name='mode' value='new'>
73 <span class='title'>New Encounter Form</span>
74 <br>
75 <center>
76 <table width='96%'>
78 <tr>
79 <td colspan='2' width='50%' nowrap class='text'>Chief Complaint:</td>
80 <td class='text' width='50%' nowrap>
81 Issues (Problems, Medications, Surgeries, Allergies):
82 </td>
83 </tr>
85 <tr>
86 <td colspan='2'>
87 <textarea name='reason' cols='40' rows='5' wrap='virtual' style='width:96%'
88 ><?php echo $GLOBALS['default_chief_complaint'] ?></textarea>
89 </td>
90 <td rowspan='4' valign='top'>
91 <select multiple name='issues[]' size='10' style='width:100%'
92 title='Hold down [Ctrl] for multiple selections or to unselect'>
94 while ($irow = sqlFetchArray($ires)) {
95 $tcode = $irow['type'];
96 /****
97 if ($tcode == 'medical_problem' || $tcode == 'problem') $tcode = 'P';
98 else if ($tcode == 'allergy') $tcode = 'A';
99 else if ($tcode == 'medication') $tcode = 'M';
100 else if ($tcode == 'surgery') $tcode = 'S';
101 ****/
102 if ($ISSUE_TYPES[$tcode]) $tcode = $ISSUE_TYPES[$tcode][2];
104 echo " <option value='" . $irow['id'] . "'>$tcode: ";
105 echo $irow['begdate'] . " " . htmlspecialchars(substr($irow['title'], 0, 40)) . "</option>\n";
108 </select>
109 </td>
110 </tr>
112 <tr>
113 <td class='text' width='1%' nowrap>Facility:</td>
114 <td>
115 <select name='facility'>
117 $dres = sqlStatement("select facility from users where username='".$_SESSION{"authUser"}."'");
118 $drow = sqlFetchArray($dres);
119 $fres = sqlStatement("select * from facility order by name");
120 if ($fres) {
121 for ($iter = 0; $frow = sqlFetchArray($fres); $iter++)
122 $result[$iter] = $frow;
123 foreach($result as $iter) {
125 <option value="<?echo $iter{name};?>" <?if ($drow{facility} == $iter{name}) {echo "selected";};?>><?echo $iter{name};?></option>
130 </select>
131 </td>
132 </tr>
134 <tr>
135 <td class='text' nowrap>Date of Service:</td>
136 <td nowrap>
138 <input type='text' size='10' name='form_date' <? echo $disabled ?>
139 value='<? echo date('Y-m-d') ?>'
140 title='yyyy-mm-dd Date of service'
141 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
142 <a href="javascript:show_calendar('new_encounter.form_date')"
143 title="Click here to choose a date"
144 ><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' border='0' alt='[?]'></a>
146 <!--
147 <select name='month'>
149 foreach($months as $month) {
151 <option value="<?echo $month;?>" <?if($month == date("m")) echo "selected";?>><?echo $month?></option>
155 </select>
156 <select name='day'>
158 foreach($days as $day){
160 <option value="<?echo $day;?>" <?if($day == date("d")) echo "selected";?>><?echo $day?></option>
164 </select>
165 <select name='year'>
167 foreach($years as $year){
169 <option value="<?echo $year;?>" <?if($year == date("Y")) echo "selected";?>><?echo $year?></option>
173 </select>
176 </td>
177 </tr>
179 <tr>
180 <td class='text' nowrap>Onset/hospitalization date:</td>
181 <td nowrap>
183 <input type='text' size='10' name='form_onset_date'
184 value='<? echo date('Y-m-d') ?>'
185 title='yyyy-mm-dd Date of onset or hospitalization'
186 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' />
187 <a href="javascript:show_calendar('new_encounter.form_onset_date')"
188 title="Click here to choose a date"
189 ><img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22' border='0' alt='[?]'></a>
191 <!--
192 <select name='onset_month'>
194 foreach($months as $month){
196 <option value="<?echo $month;?>" <?if($month == date("m")) echo "selected";?>><?echo $month?></option>
200 </select>
201 <select name='onset_day'>
203 foreach($days as $day){
205 <option value="<?echo $day;?>" <?if($day == date("d")) echo "selected";?>><?echo $day?></option>
209 </select>
210 <select name='onset_year'>
212 foreach($years as $year){
214 <option value="<?echo $year;?>" <?if($year == date("Y")) echo "selected";?>><?echo $year?></option>
218 </select>
221 </td>
222 </tr>
224 </table>
227 <a href="javascript:document.new_encounter.submit();" class="link_submit">[Save]</a>
228 <? if (!isset($_GET["autoloaded"]) || $_GET["autoloaded"] != "1") { ?>
229 &nbsp; &nbsp;
230 <a href="<?echo "$rootdir/patient_file/encounter/patient_encounter.php";?>" class="link_submit">[Don't Save]</a>
231 <? } ?>
232 &nbsp; &nbsp;
233 <a href="" onclick="return newissue()" class="link_submit">[Add Issue]</a>
235 </center>
237 </form>
239 </body>
240 </html>