standard header in about page (#676)
[openemr.git] / interface / new / new.php
blob27fd96f7c8093fd6e558372633e472367f93fd16
1 <?php
2 /**
4 * LICENSE: This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 3
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
15 * @package OpenEMR
16 * @author Brady Miller <brady.g.miller@gmail.com>
17 * @link http://www.open-emr.org
20 include_once("../globals.php");
22 if ($GLOBALS['full_new_patient_form']) {
23 require("new_comprehensive.php");
24 exit;
27 // For a layout field return 0=unused, 1=optional, 2=mandatory.
28 function getLayoutUOR($form_id, $field_id) {
29 $crow = sqlQuery("SELECT uor FROM layout_options WHERE " .
30 "form_id = '$form_id' AND field_id = '$field_id' LIMIT 1");
31 return 0 + $crow['uor'];
34 // Determine if the registration date should be requested.
35 $regstyle = getLayoutUOR('DEM','regdate') ? "" : " style='display:none'";
37 $form_pubpid = $_POST['pubpid' ] ? trim($_POST['pubpid' ]) : '';
38 $form_title = $_POST['title' ] ? trim($_POST['title' ]) : '';
39 $form_fname = $_POST['fname' ] ? trim($_POST['fname' ]) : '';
40 $form_mname = $_POST['mname' ] ? trim($_POST['mname' ]) : '';
41 $form_lname = $_POST['lname' ] ? trim($_POST['lname' ]) : '';
42 $form_refsource = $_POST['refsource'] ? trim($_POST['refsource']) : '';
43 $form_sex = $_POST['sex' ] ? trim($_POST['sex' ]) : '';
44 $form_refsource = $_POST['refsource'] ? trim($_POST['refsource']) : '';
45 $form_dob = $_POST['DOB' ] ? trim($_POST['DOB' ]) : '';
46 $form_regdate = $_POST['regdate' ] ? trim($_POST['regdate' ]) : date('Y-m-d');
48 <html>
50 <head>
51 <?php html_header_show(); ?>
52 <link rel="stylesheet" href="<?php echo xl($css_header,'e');?>" type="text/css">
53 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
55 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
56 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
57 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
59 <?php include_once("{$GLOBALS['srcdir']}/options.js.php"); ?>
61 <script LANGUAGE="JavaScript">
63 var mypcc = '1';
65 function validate() {
66 var f = document.forms[0];
67 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
68 if (f.refsource.selectedIndex <= 0) {
69 alert('Please select a referral source!');
70 return false;
72 <?php } ?>
73 <?php if (getLayoutUOR('DEM','sex') == 2) { ?>
74 if (f.sex.selectedIndex <= 0) {
75 alert('Please select a value for sex!');
76 return false;
78 <?php } ?>
79 <?php if (getLayoutUOR('DEM','DOB') == 2) { ?>
80 if (f.DOB.value.length == 0) {
81 alert('Please select a birth date!');
82 return false;
84 <?php } ?>
85 top.restoreSession();
86 return true;
89 $(document).ready(function(){
90 $('.datepicker').datetimepicker({
91 <?php $datetimepicker_timepicker = false; ?>
92 <?php $datetimepicker_showseconds = false; ?>
93 <?php $datetimepicker_formatInput = false; ?>
94 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
95 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
96 });
97 $('.datetimepicker').datetimepicker({
98 <?php $datetimepicker_timepicker = true; ?>
99 <?php $datetimepicker_showseconds = false; ?>
100 <?php $datetimepicker_formatInput = false; ?>
101 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
102 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
106 </script>
108 </head>
110 <body class="body_top" onload="javascript:document.new_patient.fname.focus();">
112 <form name='new_patient' method='post' action="new_patient_save.php"
113 onsubmit='return validate()'>
114 <span class='title'><?php xl('Add Patient Record','e');?></span>
116 <br><br>
118 <center>
120 <?php if ($GLOBALS['omit_employers']) { ?>
121 <input type='hidden' name='title' value='' />
122 <?php } ?>
124 <table border='0'>
126 <?php if (!$GLOBALS['omit_employers']) { ?>
127 <tr>
128 <td>
129 <span class='bold'><?php xl('Title','e');?>: </span>
130 </td>
131 <td>
132 <select name='title'>
133 <?php
134 $ores = sqlStatement("SELECT option_id, title FROM list_options " .
135 "WHERE list_id = 'titles' AND activity = 1 ORDER BY seq");
136 while ($orow = sqlFetchArray($ores)) {
137 echo " <option value='" . $orow['option_id'] . "'";
138 if ($orow['option_id'] == $form_title) echo " selected";
139 echo ">" . $orow['title'] . "</option>\n";
142 </select>
143 </td>
144 </tr>
145 <?php } ?>
147 <tr>
148 <td>
149 <span class='bold'><?php xl('First Name','e');?>: </span>
150 </td>
151 <td>
152 <input type='entry' size='15' name='fname' value='<?php echo $form_fname; ?>'>
153 </td>
154 </tr>
156 <tr>
157 <td>
158 <span class='bold'><?php xl('Middle Name','e');?>: </span>
159 </td>
160 <td>
161 <input type='entry' size='15' name='mname' value='<?php echo $form_mname; ?>'>
162 </td>
163 </tr>
165 <tr>
166 <td>
167 <span class='bold'><?php xl('Last Name','e');?>: </span>
168 </td>
169 <td>
170 <input type='entry' size='15' name='lname' value='<?php echo $form_lname; ?>'>
171 </td>
172 </tr>
174 <tr>
175 <td>
176 <span class='bold'><?php xl('Sex','e'); ?>: </span>
177 </td>
178 <td>
179 <select name='sex'>
180 <option value=''>Unassigned</option>
181 <?php
182 $ores = sqlStatement("SELECT option_id, title FROM list_options " .
183 "WHERE list_id = 'sex' AND activity = 1 ORDER BY seq");
184 while ($orow = sqlFetchArray($ores)) {
185 echo " <option value='" . $orow['option_id'] . "'";
186 if ($orow['option_id'] == $form_sex) echo " selected";
187 echo ">" . $orow['title'] . "</option>\n";
190 </select>
191 </td>
192 </tr>
194 <?php if ($GLOBALS['inhouse_pharmacy']) { ?>
195 <tr>
196 <td>
197 <span class='bold'><?php xl('Referral Source','e'); ?>: </span>
198 </td>
199 <td>
200 <select name='refsource'>
201 <option value=''>Unassigned</option>
202 <?php
203 $ores = sqlStatement("SELECT option_id, title FROM list_options " .
204 "WHERE list_id = 'refsource' AND activity = 1 ORDER BY seq");
205 while ($orow = sqlFetchArray($ores)) {
206 echo " <option value='" . $orow['option_id'] . "'";
207 if ($orow['option_id'] == $form_refsource) echo " selected";
208 echo ">" . $orow['title'] . "</option>\n";
211 </select>
212 </td>
213 </tr>
214 <?php } ?>
216 <tr>
217 <td>
218 <span class='bold'><?php xl('Birth Date','e');?>: </span>
219 </td>
220 <td>
221 <input type='text' size='10' class='datepicker' name='DOB' id='DOB'
222 value='<?php echo $form_dob; ?>'
223 title='yyyy-mm-dd' />
224 </td>
225 </tr>
227 <tr<?php echo $regstyle ?>>
228 <td>
229 <span class='bold'><?php xl('Registration Date','e');?>: </span>
230 </td>
231 <td>
232 <input type='text' size='10' class='datepicker' name='regdate' id='regdate'
233 value='<?php echo $form_regdate; ?>'
234 title='yyyy-mm-dd' />
235 </td>
236 </tr>
238 <tr>
239 <td>
240 <span class='bold'><?php xl('Patient Number','e');?>: </span>
241 </td>
242 <td>
243 <input type='entry' size='5' name='pubpid' value='<?php echo $form_pubpid; ?>'>
244 <span class='text'><?php xl('omit to autoassign','e');?> &nbsp; &nbsp; </span>
245 </td>
246 </tr>
248 <tr>
249 <td colspan='2'>
250 &nbsp;<br>
251 <input type='submit' name='form_create' value=<?php xl('Create New Patient','e'); ?> />
252 </td>
253 <td>
254 </td>
255 </tr>
257 </table>
258 </center>
259 </form>
260 <script language="Javascript">
261 <?php
262 if ($form_pubpid) {
263 echo "alert('" . xl('This patient ID is already in use!') . "');\n";
266 </script>
268 </body>
269 </html>