datepicker in standard forms (#520)
[openemr.git] / interface / forms / vitals / templates / vitals / general_new.html
blob3b6ddea1b1621af71a2ca50534af9a6ae36a383c
1 <html>
2 <head>
3 {php}html_header_show();{/php}
5 <link rel="stylesheet" href="{php}echo $GLOBALS['assets_static_relative'];{/php}/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
7 <script type="text/javascript">
8 var mypcc = '{php} echo $GLOBALS['phone_country_code'] {/php}';
9 {literal}
10 // Only load jquery if not already closing. This page serves two purposes now,
11 // for entring of vitals and for graphing/trending previous vitals by being embedded
12 // in the interface/patient_file/encounter/trend_form.php page.
13 if (typeof jQuery == 'undefined') {
14 document.write("<script type='text/javascript' src='{/literal}{php}echo $GLOBALS['assets_static_relative'];{/php}{literal}/jquery-min-1-7-2/index.js'><\/script>{/literal}")
16 </script>
18 <script type="text/javascript" src="{$FORM_ACTION}/library/dialog.js?v={php} echo $v_js_includes; {/php}"></script>
19 <script type="text/javascript" src="{$FORM_ACTION}/library/textformat.js?v={php} echo $v_js_includes; {/php}"></script>
20 <script type='text/javascript' src="{php}echo $GLOBALS['assets_static_relative'];{/php}/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
22 {literal}
23 <script type="text/javascript">
24 function vitalsFormSubmitted() {
25 var invalid = "";
27 var elementsToValidate = new Array();
29 elementsToValidate[0] = new Array();
30 elementsToValidate[0][0] = 'weight_input';
31 elementsToValidate[0][1] = '{/literal}{xl t="Weight"}{literal}' + ' (' + '{/literal}{xl t="lbs"}{literal}' + ')';
33 elementsToValidate[1] = new Array();
34 elementsToValidate[1][0] = 'weight_input_metric';
35 elementsToValidate[1][1] = '{/literal}{xl t="Weight"}{literal}' + ' (' + '{/literal}{xl t="kg"}{literal}' + ')';
37 elementsToValidate[2] = new Array();
38 elementsToValidate[2][0] = 'height_input';
39 elementsToValidate[2][1] = '{/literal}{xl t="Height/Length"}{literal}' + ' (' + '{/literal}{xl t="in"}{literal}' + ')';
41 elementsToValidate[3] = new Array();
42 elementsToValidate[3][0] = 'height_input_metric';
43 elementsToValidate[3][1] = '{/literal}{xl t="Height/Length"}{literal}' + ' (' + '{/literal}{xl t="cm"}{literal}' + ')';
45 elementsToValidate[4] = new Array();
46 elementsToValidate[4][0] = 'bps_input';
47 elementsToValidate[4][1] = '{/literal}{xl t="BP Systolic"}{literal}';
49 elementsToValidate[5] = new Array();
50 elementsToValidate[5][0] = 'bpd_input';
51 elementsToValidate[5][1] = '{/literal}{xl t="BP Diastolic"}{literal}';
53 for (var i = 0; i < elementsToValidate.length; i++) {
54 var current_elem_id = elementsToValidate[i][0];
55 var tag_name = elementsToValidate[i][1];
57 document.getElementById(current_elem_id).classList.remove('error');
59 if (isNaN(document.getElementById(current_elem_id).value)) {
60 invalid += "{/literal}{xl t="The following field has an invalid value"}{literal}" + ": " + tag_name + "\n";
61 document.getElementById(current_elem_id).className = document.getElementById(current_elem_id).className + " error";
62 document.getElementById(current_elem_id).focus();
66 if (invalid.length > 0) {
67 invalid += "\n" + "{/literal}{xl t="Please correct the value(s) before proceeding!"}{literal}";
68 alert(invalid);
70 return false;
71 } else {
73 return top.restoreSession();
76 </script>
77 <style type="text/css" title="mystyles" media="all">
78 .title {
79 font-size: 120%;
80 font-weight: bold;
82 .currentvalues {
83 border-right: 1px solid black;
84 padding-right:5px;
85 text-align: left;
87 .valuesunfocus {
88 border-right: 1px solid black;
89 padding-right:5px;
90 background-color: #ccc;
91 text-align: left;
93 .unfocus {
94 background-color: #ccc;
96 .historicalvalues {
97 background-color: #ccc;
98 border-bottom: 1px solid #ddd;
99 border-right: 1px solid #ddd;
100 text-align: right;
102 table {
103 border-collapse: collapse;
105 td,th {
106 padding-right: 10px;
107 padding-left: 10px;
109 .hide {
110 display:none;
112 .readonly {
113 display:none;
116 .error {
117 border:2px solid red;
119 </style>
120 {/literal}
122 </head>
123 <body bgcolor="{$STYLE.BGCOLOR2}">
124 <p><table><tr><td><span class="title">{xl t="Vitals"}</span></td><td>&nbsp;&nbsp;&nbsp;<a href="../summary/demographics.php" class="readonly css_button_small" onclick="top.restoreSession()"> <span>{xl t="View Patient"}</span></a></td></tr></table></p>
125 <form name="vitals" method="post" action="{$FORM_ACTION}/interface/forms/vitals/save.php" onSubmit="return vitalsFormSubmitted()">
126 <div id="chart"></div>
127 <table>
128 <tr><th align="left">{xl t="Name"}</th><th align="left">{xl t="Unit"}</th>
129 <th class='currentvalues' title='{xl t='Date and time of this observation'}'>
130 <input type='text' size='14' class='datetimepicker' name='date' id='date'
131 value='{$vitals->get_date()|date_format:"%Y-%m-%d %H:%M"}' />
132 </th>
133 {foreach item=result from=$results}
134 <th class='historicalvalues'>{$result.date|date_format:"%Y-%m-%d %H:%M"}</th>
135 {/foreach}</tr>
137 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
138 {if $units_of_measurement == 2}<td class="unfocus graph" id="weight">{else}<td class="graph" id="weight">{/if}{xl t="Weight"}</td>
139 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="lbs"}</td>
140 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
141 <input type="text" size='5' name='weight' id='weight_input' value="{if $vitals->get_weight() != 0}{$vitals->get_weight()}{/if}" onChange="convLbtoKg('weight_input');" title='{xl t="Decimal pounds or pounds and ounces separated by #(e.g. 5#4)"}'/>
142 </td>
143 {foreach item=result from=$results}
144 <td class='historicalvalues'>{$vitals->display_weight($result.weight)}</td>
145 {/foreach}</tr>
147 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
148 {if $units_of_measurement == 1}<td class="unfocus graph" id="weight_metric">{else}<td class="graph" id="weight_metric">{/if}{xl t="Weight"}</td>
149 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="kg"}</td>
150 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
151 <input type="text" size='5' id='weight_input_metric' value="{if $vitals->get_weight() != 0}{math equation="number * constant" number=$vitals->get_weight() constant=0.45359237 format="%.2f"}{/if}" onChange="convKgtoLb('weight_input');"/>
152 </td>
153 {foreach item=result from=$results}
154 <td class='historicalvalues'>{if $result.weight != 0}{math equation="number * constant" number=$result.weight constant=0.45359237 format="%.2f"}{/if}</td>
155 {/foreach}</tr>
157 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
158 {if $units_of_measurement == 2}<td class="unfocus graph" id="height">{else}<td class="graph" id="height">{/if}{xl t="Height/Length"}</td>
159 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
160 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
161 <input type="text" size='5' name='height' id='height_input' value="{if $vitals->get_height() != 0}{$vitals->get_height()}{/if}" onChange="convIntoCm('height_input');"/>
162 </td>
163 {foreach item=result from=$results}
164 <td class='historicalvalues'>{if $result.height != 0}{$result.height}{/if}</td>
165 {/foreach}</tr>
167 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
168 {if $units_of_measurement == 1}<td class="unfocus graph" id="height_metric">{else}<td class="graph" id="height_metric">{/if}{xl t="Height/Length"}</td>
169 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
170 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
171 <input type="text" size='5' id='height_input_metric' value="{if $vitals->get_height() != 0}{math equation="round(number * constant,1)" number=$vitals->get_height() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('height_input');"/>
172 </td>
173 {foreach item=result from=$results}
174 <td class='historicalvalues'>{if $result.height != 0}{math equation="number * constant" number=$result.height constant=2.54 format="%.2f"}{/if}</td>
175 {/foreach}</tr>
177 <tr><td class="graph" id="bps">{xl t="BP Systolic"}</td><td>{xl t="mmHg"}</td>
178 <td class='currentvalues'><input type="text" size='5'
179 name='bps' id='bps_input' value="{$vitals->get_bps()}"/></td>
180 {foreach item=result from=$results}
181 <td class='historicalvalues'>{$result.bps}</td>
182 {/foreach}</tr>
184 <tr><td class="graph" id="bpd">{xl t="BP Diastolic"}</td><td>{xl t="mmHg"}</td>
185 <td class='currentvalues'><input type="text" size='5'
186 name='bpd' id='bpd_input' value="{$vitals->get_bpd()}"/></td>
187 {foreach item=result from=$results}
188 <td class='historicalvalues'>{$result.bpd}</td>
189 {/foreach}</tr>
191 <tr><td class="graph" id="pulse">{xl t="Pulse"}</td><td>{xl t="per min"}</td>
192 <td class='currentvalues'><input type="text" size='5'
193 name='pulse' id='pulse_input' value="{if $vitals->get_pulse() != 0}{$vitals->get_pulse()|string_format:"%.0f"}{/if}"/></td>
194 {foreach item=result from=$results}
195 <td class='historicalvalues'>{if $result.pulse != 0}{$result.pulse|string_format:"%.0f"}{/if}</td>
196 {/foreach}</tr>
198 <tr><td class="graph" id="respiration">{xl t="Respiration"}</td><td>{xl t="per min"}</td>
199 <td class='currentvalues'><input type="text" size='5'
200 name='respiration' id='respiration_input' value="{if $vitals->get_respiration() != 0}{$vitals->get_respiration()|string_format:"%.0f"}{/if}"/></td>
201 {foreach item=result from=$results}
202 <td class='historicalvalues'>{if $result.respiration != 0}{$result.respiration|string_format:"%.0f"}{/if}</td>
203 {/foreach}</tr>
205 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
206 {if $units_of_measurement == 2}<td class="unfocus graph" id="temperature">{else}<td class="graph" id="temperature">{/if}{xl t="Temperature"}</td>
207 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="F"}</td>
208 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
209 <input type="text" size='5' name='temperature' id='temperature_input' value="{if $vitals->get_temperature() != 0}{$vitals->get_temperature()}{/if}" onChange="convFtoC('temperature_input');"/>
210 </td>
211 {foreach item=result from=$results}
212 <td class='historicalvalues'>{if $result.temperature != 0}{$result.temperature}{/if}</td>
213 {/foreach}</tr>
215 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
216 {if $units_of_measurement == 1}<td class="unfocus graph" id="temperature_metric">{else}<td class="graph" id="temperature_metric">{/if}{xl t="Temperature"}</td>
217 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="C"}</td>
218 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
219 <input type="text" size='5' id='temperature_input_metric' value="{if $vitals->get_temperature() != 0}{math equation="(number - constant2 ) * constant" number=$vitals->get_temperature() constant=0.5556 constant2=32 format="%.2f"}{/if}" onChange="convCtoF('temperature_input');"/>
220 </td>
221 {foreach item=result from=$results}
222 <td class='historicalvalues'>{if $result.temperature != 0}{math equation="(number - constant2 ) * constant" number=$result.temperature constant=0.5556 constant2=32 format="%.2f"}{/if}</td>
223 {/foreach}</tr>
225 <tr><td>{xl t="Temp Location"}<td></td></td>
226 <td class='currentvalues'><select name="temp_method" id='temp_method'/><option value=""> </option>
227 <option value="Oral" {if $vitals->get_temp_method() == "Oral" || $vitals->get_temp_method() == 2 } selected{/if}>{xl t="Oral"}
228 <option value="Tympanic Membrane" {if $vitals->get_temp_method() == "Tympanic Membrane" || $vitals->get_temp_method() == 1 } selected{/if}>{xl t="Tympanic Membrane"}
229 <option value="Rectal" {if $vitals->get_temp_method() == "Rectal" || $vitals->get_temp_method() == 3 } selected{/if}>{xl t="Rectal"}
230 <option value="Axillary" {if $vitals->get_temp_method() == "Axillary" || $vitals->get_temp_method() == 4 } selected{/if}>{xl t="Axillary"}
231 <option value="Temporal Artery" {if $vitals->get_temp_method() == "Temporal Artery" } selected{/if}>{xl t="Temporal Artery"}
232 </select></td>
233 {foreach item=result from=$results}
234 <td class='historicalvalues'>{if $result.temp_method}{xl t=$result.temp_method}{/if}</td>
235 {/foreach}</tr>
237 <tr><td class="graph" id="oxygen_saturation">{xl t="Oxygen Saturation"}</td><td>{xl t="%"}</td>
238 <td class='currentvalues'><input type="text" size='5'
239 name='oxygen_saturation' id='oxygen_saturation_input' value="{if $vitals->get_oxygen_saturation() != 0}{$vitals->get_oxygen_saturation()|string_format:"%.0f"}{/if}"/></td>
240 {foreach item=result from=$results}
241 <td class='historicalvalues'>{if $result.oxygen_saturation != 0}{$result.oxygen_saturation|string_format:"%.0f"}{/if}</td>
242 {/foreach}</tr>
244 {if $units_of_measurement == 4 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
245 {if $units_of_measurement == 2}<td class="unfocus graph" id="head_circ">{else}<td class="graph" id="head_circ">{/if}{xl t="Head Circumference"}</td>
246 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
247 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
248 <input type="text" size='5' name='head_circ' id='head_circ_input' value="{if $vitals->get_head_circ() != 0}{$vitals->get_head_circ()}{/if}" onChange="convIntoCm('head_circ_input');"/>
249 </td>
250 {foreach item=result from=$results}
251 <td class='historicalvalues'>{if $result.head_circ != 0}{$result.head_circ}{/if}</td>
252 {/foreach}</tr>
254 {if $units_of_measurement == 3 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
255 {if $units_of_measurement == 1}<td class="unfocus graph" id="head_circ_metric">{else}<td class="graph" id="head_circ_metric">{/if}{xl t="Head Circumference"}</td>
256 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
257 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
258 <input type="text" size='5' id='head_circ_input_metric' value="{if $vitals->get_head_circ() != 0}{math equation="round(number * constant,1)" number=$vitals->get_head_circ() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('head_circ_input');"/>
259 </td>
260 {foreach item=result from=$results}
261 <td class='historicalvalues'>{if $result.head_circ != 0}{math equation="number * constant" number=$result.head_circ constant=2.54 format="%.2f"}{/if}</td>
262 {/foreach}</tr>
264 {if $units_of_measurement == 4 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
265 {if $units_of_measurement == 2}<td class="unfocus graph" id="waist_circ">{else}<td class="graph" id="waist_circ">{/if}{xl t="Waist Circumference"}</td>
266 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
267 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
268 <input type="text" size='5' name='waist_circ' id='waist_circ_input' value="{if $vitals->get_waist_circ() != 0}{$vitals->get_waist_circ()}{/if}" onChange="convIntoCm('waist_circ_input');"/>
269 </td>
270 {foreach item=result from=$results}
271 <td class='historicalvalues'>{if $result.waist_circ != 0}{$result.waist_circ}{/if}</td>
272 {/foreach}</tr>
274 {if $units_of_measurement == 3 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
275 {if $units_of_measurement == 1}<td class="unfocus graph" id="waist_circ_metric">{else}<td class="graph" id="waist_circ_metric">{/if}{xl t="Waist Circumference"}</td>
276 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
277 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
278 <input type="text" size='5' id='waist_circ_input_metric' value="{if $vitals->get_waist_circ() != 0}{math equation="round(number * constant,1)" number=$vitals->get_waist_circ() constant=2.54 format="%.2f"}{/if}" onChange="convCmtoIn('waist_circ_input');"/>
279 </td>
280 {foreach item=result from=$results}
281 <td class='historicalvalues'>{if $result.waist_circ != 0}{math equation="number * constant" number=$result.waist_circ constant=2.54 format="%.2f"}{/if}</td>
282 {/foreach}</tr>
284 <tr><td class="graph" id="BMI">{xl t="BMI"}</td><td>{xl t="kg/m^2"}</td>
285 <td class='currentvalues'><input type="text" size='5'
286 name='BMI' id='BMI_input' value="{if $vitals->get_BMI() != 0}{$vitals->get_BMI()|substr:0:5}{/if}"/></td>
287 {foreach item=result from=$results}
288 <td class='historicalvalues'>{if $result.BMI != 0}{$result.BMI|substr:0:5}{/if}</td>
289 {/foreach}</tr>
291 <tr><td>{xl t="BMI Status"}</td><td>{xl t="Type"}</td>
292 <td class='currentvalues'><input type="text" size='15'
293 name="BMI_status" id="BMI_status' value="{$vitals->get_BMI_status()}"/></td>
294 {foreach item=result from=$results}
295 <td class='historicalvalues'>{if $result.BMI_status}{xl t=$result.BMI_status}{/if}</td>
296 {/foreach}
297 </tr>
299 <tr><td>{xl t="Other Notes"}<td></td></td>
300 <td class='currentvalues'><input type="text" size='20'
301 name="note" id='note' value="{$vitals->get_note()}" /></td>
302 {foreach item=result from=$results}
303 <td class='historicalvalues'>{$result.note}</td>
304 {/foreach}</tr>
306 <tr>
307 <td colspan='3' style='text-align:center'>
308 {if $patient_age <= 20 || (preg_match('/month/', $patient_age))}
309 <!-- only show growth-chart button for patients < 20 years old -->
310 <!-- <input type="button" id="growthchart" value="{xl t="Growth-Chart"}" style='margin-left: 20px;'> -->
311 <input type="button" id="pdfchart" value="{xl t="Growth-Chart"} ({xl t="PDF"})" style='margin-left: 20px;'>
312 <input type="button" id="htmlchart" value="{xl t="Growth-Chart"} ({xl t="HTML"})" style='margin-left: 20px;'>
313 {/if}
314 </td>
315 </tr>
317 <tr><td colspan='3' style='text-align:center'>&nbsp;</td></tr>
318 <tr>
319 <td colspan='3' style='text-align:center'>
320 <input type="submit" class="editonly" name="Submit" value="{xl t="Save Form"}">
321 <input type="button" class="editonly" id="cancel" value="{xl t="Don't Save"}">
322 </td>
323 </tr>
324 </table>
325 <br><br>
326 <input type="hidden" name="id" id='id' value="{$vitals->get_id()}" />
327 <input type="hidden" name="activity" id='activity' value="{$vitals->get_activity()}">
328 <input type="hidden" name="pid" id='pid' value="{$vitals->get_pid()}">
329 <input type="hidden" name="process" id='process' value="true">
330 </form>
331 </body>
333 <script language="javascript">
334 var formdate = '{$vitals->get_date()|date_format:"%Y%m%d"}';
335 // vitals array elements are in the format:
336 // date-height-weight-head_circumference
337 var vitals = new Array();
338 // get values from the current form elements
339 vitals[0] = formdate+'-{$vitals->get_height()}-{$vitals->get_weight()}-{$vitals->get_head_circ()}';
340 // historic values
341 {foreach item=result from=$results}
342 vitals[vitals.length] = '{$result.date|date_format:"%Y%m%d"}-{$result.height}-{$result.weight}-{$result.head_circ}';
343 {/foreach}
344 var patientAge='{$patient_age}';
345 var patient_dob='{$patient_dob}';
346 var webroot = '{$FORM_ACTION}';
347 var pid = '{$vitals->get_pid()}';
348 var cancellink = '{$DONT_SAVE_LINK}';
349 var birth_xl='{xl t="Birth-24 months"}'
350 var older_xl='{xl t="2-20 years"}';
351 {literal}
352 function addGCSelector()
354 var options=new Array();
355 var birth={'display':birth_xl,'param':'birth'};
356 var age2={'display':older_xl,'param':'2-20'}
357 if((patientAge.indexOf('24 month')>=0) || (patientAge.indexOf('month')==-1))
359 var dob_data=patient_dob.split("-");
360 var dob_date=new Date(dob_data[0],parseInt(dob_data[1])-1,dob_data[2]);
361 options[0]=age2;
362 for(var idx=0;idx<vitals.length;idx++)
364 var str_data_date=vitals[idx].split("-")[0];
365 var data_date=new Date(str_data_date.substr(0,4),parseInt(str_data_date.substr(4,2))-1,str_data_date.substr(6,2));
366 if(((data_date-dob_date)/86400000)<=2*365)
368 idx=vitals.length;
369 options[1]=birth
373 else
375 options[0]=birth;
377 var chart_buttons_cell=$("#pdfchart").parent("td");
378 var select=$("<select id='chart_type'></select>");
379 chart_buttons_cell.prepend(select);
380 for(idx=0;idx<options.length;idx++)
382 var option=$("<option value='"+options[idx].param+"'>"+options[idx].display+"</option>");
383 select.append(option);
385 select.find("option:first").attr("selected","true");
386 if(options.length<2)
388 select.css("display","none");
392 $(document).ready(function(){
393 $("#growthchart").click(function() { ShowGrowthchart(); });
394 $("#pdfchart").click(function() { ShowGrowthchart(1); });
395 $("#htmlchart").click(function() { ShowGrowthchart(2); });
396 $("#cancel").click(function() { location.href=cancellink; });
397 addGCSelector();
399 $('.datetimepicker').datetimepicker({
400 {/literal}{php} $datetimepicker_timepicker = true; {/php}
401 {php} $datetimepicker_showseconds = false; {/php}
402 {php} $datetimepicker_formatInput = false; {/php}
403 {php} require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); {/php}
404 {php} // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma {/php}{literal}
409 function ShowGrowthchart(doPDF) {
410 // get values from the current form elements
411 {/literal}
412 vitals[0] = formdate+'-'+$("#height_input").val()+'-'+$("#weight_input").val()+'-'+$("#head_circ_input").val();
413 {literal}
414 // build the data string
415 var datastring = "";
416 for(var i=0; i<vitals.length; i++) {
417 datastring += vitals[i]+"~";
419 newURL = webroot+'/interface/forms/vitals/growthchart/chart.php?pid='+pid+'&data='+datastring;
420 if (doPDF == 1) newURL += "&pdf=1";
421 if (doPDF == 2) newURL += "&html=1";
422 newURL+="&chart_type="+$("#chart_type").val();
423 // do the new window stuff
424 top.restoreSession();
425 window.open(newURL, '_blank', "menubar=1,toolbar=1,scrollbars=1,resizable=1,width=600,height=450");
428 function convLbtoKg(name) {
429 var lb = $("#"+name).val();
430 var hash_loc=lb.indexOf("#");
431 if(hash_loc>=0)
433 var pounds=lb.substr(0,hash_loc);
434 var ounces=lb.substr(hash_loc+1);
435 var num=parseInt(pounds)+parseInt(ounces)/16;
436 lb=num;
437 $("#"+name).val(lb);
439 if (lb == "0") {
440 $("#"+name+"_metric").val("0");
442 else if (lb == parseFloat(lb)) {
443 kg = lb*0.45359237;
444 kg = kg.toFixed(2);
445 $("#"+name+"_metric").val(kg);
447 else {
448 $("#"+name+"_metric").val("");
451 if (name == "weight_input") {
452 calculateBMI();
456 function convKgtoLb(name) {
457 var kg = $("#"+name+"_metric").val();
459 if (kg == "0") {
460 $("#"+name).val("0");
462 else if (kg == parseFloat(kg)) {
463 lb = kg/0.45359237;
464 lb = lb.toFixed(2);
465 $("#"+name).val(lb);
467 else {
468 $("#"+name).val("");
471 if (name == "weight_input") {
472 calculateBMI();
476 function convIntoCm(name) {
477 var inch = $("#"+name).val();
479 if (inch == "0") {
480 $("#"+name+"_metric").val("0");
482 else if (inch == parseFloat(inch)) {
483 cm = inch*2.54;
484 cm = cm.toFixed(2);
485 $("#"+name+"_metric").val(cm);
487 else {
488 $("#"+name+"_metric").val("");
491 if (name == "height_input") {
492 calculateBMI();
496 function convCmtoIn(name) {
497 var cm = $("#"+name+"_metric").val();
499 if (cm == "0") {
500 $("#"+name).val("0");
502 else if (cm == parseFloat(cm)) {
503 inch = cm/2.54;
504 inch = inch.toFixed(2);
505 $("#"+name).val(inch);
507 else {
508 $("#"+name).val("");
511 if (name == "height_input") {
512 calculateBMI();
516 function convFtoC(name) {
517 var Fdeg = $("#"+name).val();
518 if (Fdeg == "0") {
519 $("#"+name+"_metric").val("0");
521 else if (Fdeg == parseFloat(Fdeg)) {
522 Cdeg = (Fdeg-32)*0.5556;
523 Cdeg = Cdeg.toFixed(2);
524 $("#"+name+"_metric").val(Cdeg);
526 else {
527 $("#"+name+"_metric").val("");
531 function convCtoF(name) {
532 var Cdeg = $("#"+name+"_metric").val();
533 if (Cdeg == "0") {
534 $("#"+name).val("0");
536 else if (Cdeg == parseFloat(Cdeg)) {
537 Fdeg = (Cdeg/0.5556)+32;
538 Fdeg = Fdeg.toFixed(2);
539 $("#"+name).val(Fdeg);
541 else {
542 $("#"+name).val("");
546 function calculateBMI() {
547 var bmi = 0;
548 var height = $("#height_input").val();
549 var weight = $("#weight_input").val();
550 if(height == 0 || weight == 0) {
551 $("#BMI").val("");
553 else if((height == parseFloat(height)) && (weight == parseFloat(weight))) {
554 bmi = weight/height/height*703;
555 bmi = bmi.toFixed(1);
556 $("#BMI_input").val(bmi);
558 else {
559 $("#BMI_input").val("");
563 </script>
564 {/literal}
566 </html>