Restyled Form Vitals (#1714)
[openemr.git] / interface / forms / vitals / templates / vitals / general_new.html
blob6d7339517c21ca3bbdc2c46733314ea14b0d936b
1 <html>
2 <head>
3 {headerTemplate assets='datetime-picker'}
6 <script type="text/javascript">
7 var mypcc = '{php} echo $GLOBALS['phone_country_code'] {/php}';
8 {literal}
9 // Only load jquery if not already closing. This page serves two purposes now,
10 // for entring of vitals and for graphing/trending previous vitals by being embedded
11 // in the interface/patient_file/encounter/trend_form.php page.
12 if (typeof jQuery == 'undefined') {
13 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}")
15 </script>
19 {literal}
20 <script type="text/javascript">
21 function vitalsFormSubmitted() {
22 var invalid = "";
24 var elementsToValidate = new Array();
26 elementsToValidate[0] = new Array();
27 elementsToValidate[0][0] = 'weight_input';
28 elementsToValidate[0][1] = '{/literal}{xl t="Weight"}{literal}' + ' (' + '{/literal}{xl t="lbs"}{literal}' + ')';
30 elementsToValidate[1] = new Array();
31 elementsToValidate[1][0] = 'weight_input_metric';
32 elementsToValidate[1][1] = '{/literal}{xl t="Weight"}{literal}' + ' (' + '{/literal}{xl t="kg"}{literal}' + ')';
34 elementsToValidate[2] = new Array();
35 elementsToValidate[2][0] = 'height_input';
36 elementsToValidate[2][1] = '{/literal}{xl t="Height/Length"}{literal}' + ' (' + '{/literal}{xl t="in"}{literal}' + ')';
38 elementsToValidate[3] = new Array();
39 elementsToValidate[3][0] = 'height_input_metric';
40 elementsToValidate[3][1] = '{/literal}{xl t="Height/Length"}{literal}' + ' (' + '{/literal}{xl t="cm"}{literal}' + ')';
42 elementsToValidate[4] = new Array();
43 elementsToValidate[4][0] = 'bps_input';
44 elementsToValidate[4][1] = '{/literal}{xl t="BP Systolic"}{literal}';
46 elementsToValidate[5] = new Array();
47 elementsToValidate[5][0] = 'bpd_input';
48 elementsToValidate[5][1] = '{/literal}{xl t="BP Diastolic"}{literal}';
50 for (var i = 0; i < elementsToValidate.length; i++) {
51 var current_elem_id = elementsToValidate[i][0];
52 var tag_name = elementsToValidate[i][1];
54 document.getElementById(current_elem_id).classList.remove('error');
56 if (isNaN(document.getElementById(current_elem_id).value)) {
57 invalid += "{/literal}{xl t="The following field has an invalid value"}{literal}" + ": " + tag_name + "\n";
58 document.getElementById(current_elem_id).className = document.getElementById(current_elem_id).className + " error";
59 document.getElementById(current_elem_id).focus();
63 if (invalid.length > 0) {
64 invalid += "\n" + "{/literal}{xl t="Please correct the value(s) before proceeding!"}{literal}";
65 alert(invalid);
67 return false;
68 } else {
70 return top.restoreSession();
73 </script>
74 <style type="text/css" title="mystyles" media="all">
75 .title {
76 font-size: 120%;
77 font-weight: bold;
79 .currentvalues {
80 border-right: 1px solid black;
81 padding-right:5px;
82 text-align: left;
85 th.currentvalues, th.historicalvalues{
86 background: #E5E5E5;
88 .valuesunfocus {
89 border-right: 1px solid black;
90 padding-right:5px;
91 background-color: #ccc;
92 text-align: left;
94 .unfocus {
95 background-color: #ccc;
97 .historicalvalues {
98 background-color: #ccc;
99 border-bottom: 1px solid #ddd;
100 border-right: 1px solid #ddd;
101 text-align: right;
102 background: #E5E5E5;
104 table {
105 border-collapse: collapse;
106 font-size:smaller;
107 font-weight:600;
109 td,th {
110 padding-right: 10px;
111 padding-left: 10px;
114 font-weight:800;
117 padding-top:0px !Important;
118 padding-bottom:0px !Important;
120 input[type=text], select{
121 margin:1px !Important;
123 .hide {
124 display:none;
126 .readonly {
127 display:none;
129 .error {
130 border:2px solid red;
132 </style>
133 {/literal}
135 <title>{xl t='Vitals'}</title>
136 </head>
137 <body bgcolor="{$STYLE.BGCOLOR2}">
139 <div class="container">
140 <div class="row">
141 <div class="col-sm-12">
142 <div class="page-header">
143 <h2>{xl t="Vitals"}&nbsp;&nbsp;&nbsp;<a href="../summary/demographics.php" onclick="top.restoreSession()" title="{xl t='Back to patient dashboard'}"><i id="advanced-tooltip" class="readonly fa fa-arrow-circle-o-left fa-2x small" aria-hidden="true"></i> </a></h2>
144 </div>
145 </div>
146 </div>
147 <div class="row">
148 <div class="col-sm-5 col-sm-offset-3">
149 <form name="vitals" method="post" action="{$FORM_ACTION}/interface/forms/vitals/save.php" onSubmit="return vitalsFormSubmitted()">
150 <div id="chart" class="chart-dygraphs" style="margin-left:-15px"></div>
151 <table class="table table-condensed">
152 <thead>
153 <tr>
154 <th align="left" >{xl t="Name"}</th>
155 <th align="left" >{xl t="Unit"}</th>
156 <th class='currentvalues' title='{xl t='Date and time of this observation'}'>
157 <input type='text' size='14' class='datetimepicker oe-patient-background' name='date' id='date' value='{$vitals->get_date()|date_format:"%Y-%m-%d %H:%M"}'>
158 </th>
159 {foreach item=result from=$results}
160 <th class='historicalvalues'>{$result.date|date_format:"%Y-%m-%d %H:%M"}</th>
161 {/foreach}
162 </tr>
163 </thead>
164 <tbody>
165 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
166 {if $units_of_measurement == 2}<td class="unfocus graph" id="weight">{else}<td class="graph" id="weight">{/if}{xl t="Weight"}</td>
167 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="lbs"}</td>
168 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
169 <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)"}'/>
170 </td>
171 {foreach item=result from=$results}
172 <td class='historicalvalues'>{$vitals->display_weight($result.weight)}</td>
173 {/foreach}</tr>
175 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
176 {if $units_of_measurement == 1}<td class="unfocus graph" id="weight_metric">{else}<td class="graph" id="weight_metric">{/if}{xl t="Weight"}</td>
177 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="kg"}</td>
178 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
179 <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');"/>
180 </td>
181 {foreach item=result from=$results}
182 <td class='historicalvalues'>{if $result.weight != 0}{math equation="number * constant" number=$result.weight constant=0.45359237 format="%.2f"}{/if}</td>
183 {/foreach}</tr>
185 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
186 {if $units_of_measurement == 2}<td class="unfocus graph" id="height">{else}<td class="graph" id="height">{/if}{xl t="Height/Length"}</td>
187 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
188 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
189 <input type="text" size='5' name='height' id='height_input' value="{if $vitals->get_height() != 0}{$vitals->get_height()}{/if}" onChange="convIntoCm('height_input');"/>
190 </td>
191 {foreach item=result from=$results}
192 <td class='historicalvalues'>{if $result.height != 0}{$result.height}{/if}</td>
193 {/foreach}</tr>
195 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
196 {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>
197 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
198 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
199 <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');"/>
200 </td>
201 {foreach item=result from=$results}
202 <td class='historicalvalues'>{if $result.height != 0}{math equation="number * constant" number=$result.height constant=2.54 format="%.2f"}{/if}</td>
203 {/foreach}</tr>
205 <tr><td class="graph" id="bps">{xl t="BP Systolic"}</td><td>{xl t="mmHg"}</td>
206 <td class='currentvalues'><input type="text" size='5'
207 name='bps' id='bps_input' value="{$vitals->get_bps()}"/></td>
208 {foreach item=result from=$results}
209 <td class='historicalvalues'>{$result.bps}</td>
210 {/foreach}</tr>
212 <tr><td class="graph" id="bpd">{xl t="BP Diastolic"}</td><td>{xl t="mmHg"}</td>
213 <td class='currentvalues'><input type="text" size='5'
214 name='bpd' id='bpd_input' value="{$vitals->get_bpd()}"/></td>
215 {foreach item=result from=$results}
216 <td class='historicalvalues'>{$result.bpd}</td>
217 {/foreach}</tr>
219 <tr><td class="graph" id="pulse">{xl t="Pulse"}</td><td>{xl t="per min"}</td>
220 <td class='currentvalues'><input type="text" size='5'
221 name='pulse' id='pulse_input' value="{if $vitals->get_pulse() != 0}{$vitals->get_pulse()|string_format:"%.0f"}{/if}"/></td>
222 {foreach item=result from=$results}
223 <td class='historicalvalues'>{if $result.pulse != 0}{$result.pulse|string_format:"%.0f"}{/if}</td>
224 {/foreach}</tr>
226 <tr><td class="graph" id="respiration">{xl t="Respiration"}</td><td>{xl t="per min"}</td>
227 <td class='currentvalues'><input type="text" size='5'
228 name='respiration' id='respiration_input' value="{if $vitals->get_respiration() != 0}{$vitals->get_respiration()|string_format:"%.0f"}{/if}"/></td>
229 {foreach item=result from=$results}
230 <td class='historicalvalues'>{if $result.respiration != 0}{$result.respiration|string_format:"%.0f"}{/if}</td>
231 {/foreach}</tr>
233 {if $units_of_measurement == 4}<tr class="hide">{else}<tr>{/if}
234 {if $units_of_measurement == 2}<td class="unfocus graph" id="temperature">{else}<td class="graph" id="temperature">{/if}{xl t="Temperature"}</td>
235 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="F"}</td>
236 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
237 <input type="text" size='5' name='temperature' id='temperature_input' value="{if $vitals->get_temperature() != 0}{$vitals->get_temperature()}{/if}" onChange="convFtoC('temperature_input');"/>
238 </td>
239 {foreach item=result from=$results}
240 <td class='historicalvalues'>{if $result.temperature != 0}{$result.temperature}{/if}</td>
241 {/foreach}</tr>
243 {if $units_of_measurement == 3}<tr class="hide">{else}<tr>{/if}
244 {if $units_of_measurement == 1}<td class="unfocus graph" id="temperature_metric">{else}<td class="graph" id="temperature_metric">{/if}{xl t="Temperature"}</td>
245 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="C"}</td>
246 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
247 <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');"/>
248 </td>
249 {foreach item=result from=$results}
250 <td class='historicalvalues'>{if $result.temperature != 0}{math equation="(number - constant2 ) * constant" number=$result.temperature constant=0.5556 constant2=32 format="%.2f"}{/if}</td>
251 {/foreach}</tr>
253 <tr><td>{xl t="Temp Location"}<td></td></td>
254 <td class='currentvalues'><select name="temp_method" id='temp_method'/><option value=""> </option>
255 <option value="Oral" {if $vitals->get_temp_method() == "Oral" || $vitals->get_temp_method() == 2 } selected{/if}>{xl t="Oral"}
256 <option value="Tympanic Membrane" {if $vitals->get_temp_method() == "Tympanic Membrane" || $vitals->get_temp_method() == 1 } selected{/if}>{xl t="Tympanic Membrane"}
257 <option value="Rectal" {if $vitals->get_temp_method() == "Rectal" || $vitals->get_temp_method() == 3 } selected{/if}>{xl t="Rectal"}
258 <option value="Axillary" {if $vitals->get_temp_method() == "Axillary" || $vitals->get_temp_method() == 4 } selected{/if}>{xl t="Axillary"}
259 <option value="Temporal Artery" {if $vitals->get_temp_method() == "Temporal Artery" } selected{/if}>{xl t="Temporal Artery"}
260 </select></td>
261 {foreach item=result from=$results}
262 <td class='historicalvalues'>{if $result.temp_method}{xl t=$result.temp_method}{/if}</td>
263 {/foreach}</tr>
265 <tr><td class="graph" id="oxygen_saturation">{xl t="Oxygen Saturation"}</td><td>{xl t="%"}</td>
266 <td class='currentvalues'><input type="text" size='5'
267 name='oxygen_saturation' id='oxygen_saturation_input' value="{if $vitals->get_oxygen_saturation() != 0}{$vitals->get_oxygen_saturation()|string_format:"%.0f"}{/if}"/></td>
268 {foreach item=result from=$results}
269 <td class='historicalvalues'>{if $result.oxygen_saturation != 0}{$result.oxygen_saturation|string_format:"%.0f"}{/if}</td>
270 {/foreach}</tr>
272 {if $units_of_measurement == 4 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
273 {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>
274 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
275 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
276 <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');"/>
277 </td>
278 {foreach item=result from=$results}
279 <td class='historicalvalues'>{if $result.head_circ != 0}{$result.head_circ}{/if}</td>
280 {/foreach}</tr>
282 {if $units_of_measurement == 3 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
283 {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>
284 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
285 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
286 <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');"/>
287 </td>
288 {foreach item=result from=$results}
289 <td class='historicalvalues'>{if $result.head_circ != 0}{math equation="number * constant" number=$result.head_circ constant=2.54 format="%.2f"}{/if}</td>
290 {/foreach}</tr>
292 {if $units_of_measurement == 4 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
293 {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>
294 {if $units_of_measurement == 2}<td class="unfocus">{else}<td>{/if}{xl t="in"}</td>
295 {if $units_of_measurement == 2}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
296 <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');"/>
297 </td>
298 {foreach item=result from=$results}
299 <td class='historicalvalues'>{if $result.waist_circ != 0}{$result.waist_circ}{/if}</td>
300 {/foreach}</tr>
302 {if $units_of_measurement == 3 || $gbl_vitals_options > 0}<tr class="hide">{else}<tr>{/if}
303 {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>
304 {if $units_of_measurement == 1}<td class="unfocus">{else}<td>{/if}{xl t="cm"}</td>
305 {if $units_of_measurement == 1}<td class="valuesunfocus">{else}<td class='currentvalues'>{/if}
306 <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');"/>
307 </td>
308 {foreach item=result from=$results}
309 <td class='historicalvalues'>{if $result.waist_circ != 0}{math equation="number * constant" number=$result.waist_circ constant=2.54 format="%.2f"}{/if}</td>
310 {/foreach}</tr>
312 <tr><td class="graph" id="BMI">{xl t="BMI"}</td><td>{xl t="kg/m^2"}</td>
313 <td class='currentvalues'><input type="text" size='5'
314 name='BMI' id='BMI_input' value="{if $vitals->get_BMI() != 0}{$vitals->get_BMI()|substr:0:5}{/if}"/></td>
315 {foreach item=result from=$results}
316 <td class='historicalvalues'>{if $result.BMI != 0}{$result.BMI|substr:0:5}{/if}</td>
317 {/foreach}
318 </tr>
320 <tr>
321 <td>{xl t="BMI Status"}</td><td>{xl t="Type"}</td>
322 <td class='currentvalues'><input type="text" size='20'
323 name="BMI_status" id="BMI_status' value="{$vitals->get_BMI_status()}"/></td>
324 {foreach item=result from=$results}
325 <td class='historicalvalues'>{if $result.BMI_status}{xl t=$result.BMI_status}{/if}</td>
326 {/foreach}
327 </tr>
329 <tr>
330 <td>{xl t="Other Notes"}</td>
331 <td>&nbsp;</td>
332 <td class='currentvalues'><input type="text" size='20'
333 name="note" id='note' value="{$vitals->get_note()}" /></td>
334 {foreach item=result from=$results}
335 <td class='historicalvalues'>{$result.note}</td>
336 {/foreach}
337 </tr>
338 <tr><td>&nbsp;</td></tr>
340 <tr>
341 <td colspan='5' align="center" style='text-align:center'>
342 {if $patient_age <= 20 || (preg_match('/month/', $patient_age))}
343 <!-- only show growth-chart button for patients < 20 years old -->
344 <!-- <input type="button" id="growthchart" value="{xl t="Growth-Chart"}" style='margin-left: 20px;'> -->
345 <input type="button" id="pdfchart" value='{xl t="Growth-Chart"} ({xl t="PDF"})' style=''>
346 <input type="button" id="htmlchart" value='{xl t="Growth-Chart"} ({xl t="HTML"})' style=''>
347 {/if}
348 </td>
349 </tr>
350 </tr>
351 </tbody>
352 </table>
354 <div class="form-group clearfix">
355 <div class="text-left position-override">
356 <div class="btn-group" role="group">
357 <button type="submit" class="btn btn-default btn-save editonly" name="Submit" value=''>{xl t="Save"}</button>
358 <button type="button" class="btn btn-link btn-cancel btn-separate-left editonly" id="cancel" value=''>{xl t="Cancel"}</button>
359 </div>
360 </div>
361 </div>
362 </div>
363 <br><br>
364 <input type="hidden" name="id" id='id' value="{$vitals->get_id()}" />
365 <input type="hidden" name="activity" id='activity' value="{$vitals->get_activity()}">
366 <input type="hidden" name="pid" id='pid' value="{$vitals->get_pid()}">
367 <input type="hidden" name="process" id='process' value="true">
368 </form>
369 </div>
370 </div>
371 </body>
373 <script language="javascript">
374 var formdate = '{$vitals->get_date()|date_format:"%Y%m%d"}';
375 // vitals array elements are in the format:
376 // date-height-weight-head_circumference
377 var vitals = new Array();
378 // get values from the current form elements
379 vitals[0] = formdate+'-{$vitals->get_height()}-{$vitals->get_weight()}-{$vitals->get_head_circ()}';
380 // historic values
381 {foreach item=result from=$results}
382 vitals[vitals.length] = '{$result.date|date_format:"%Y%m%d"}-{$result.height}-{$result.weight}-{$result.head_circ}';
383 {/foreach}
384 var patientAge='{$patient_age}';
385 var patient_dob='{$patient_dob}';
386 var webroot = '{$FORM_ACTION}';
387 var pid = '{$vitals->get_pid()}';
388 var cancellink = '{$DONT_SAVE_LINK}';
389 var birth_xl='{xl t="Birth-24 months"}'
390 var older_xl='{xl t="2-20 years"}';
391 {literal}
392 function addGCSelector()
394 var options=new Array();
395 var birth={'display':birth_xl,'param':'birth'};
396 var age2={'display':older_xl,'param':'2-20'}
397 if((patientAge.indexOf('24 month')>=0) || (patientAge.indexOf('month')==-1))
399 var dob_data=patient_dob.split("-");
400 var dob_date=new Date(dob_data[0],parseInt(dob_data[1])-1,dob_data[2]);
401 options[0]=age2;
402 for(var idx=0;idx<vitals.length;idx++)
404 var str_data_date=vitals[idx].split("-")[0];
405 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));
406 if(((data_date-dob_date)/86400000)<=2*365)
408 idx=vitals.length;
409 options[1]=birth
413 else
415 options[0]=birth;
417 var chart_buttons_cell=$("#pdfchart").parent("td");
418 var select=$("<select id='chart_type'></select>");
419 chart_buttons_cell.prepend(select);
420 for(idx=0;idx<options.length;idx++)
422 var option=$("<option value='"+options[idx].param+"'>"+options[idx].display+"</option>");
423 select.append(option);
425 select.find("option:first").attr("selected","true");
426 if(options.length<2)
428 select.css("display","none");
432 $(document).ready(function(){
433 $("#growthchart").click(function() { ShowGrowthchart(); });
434 $("#pdfchart").click(function() { ShowGrowthchart(1); });
435 $("#htmlchart").click(function() { ShowGrowthchart(2); });
436 $("#cancel").click(function() { location.href=cancellink; });
437 addGCSelector();
439 $('.datetimepicker').datetimepicker({
440 {/literal}{php} $datetimepicker_timepicker = true; {/php}
441 {php} $datetimepicker_showseconds = false; {/php}
442 {php} $datetimepicker_formatInput = false; {/php}
443 {php} require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); {/php}
444 {php} // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma {/php}{literal}
449 function ShowGrowthchart(doPDF) {
450 // get values from the current form elements
451 {/literal}
452 vitals[0] = formdate+'-'+$("#height_input").val()+'-'+$("#weight_input").val()+'-'+$("#head_circ_input").val();
453 {literal}
454 // build the data string
455 var datastring = "";
456 for(var i=0; i<vitals.length; i++) {
457 datastring += vitals[i]+"~";
459 newURL = webroot+'/interface/forms/vitals/growthchart/chart.php?pid='+pid+'&data='+datastring;
460 if (doPDF == 1) newURL += "&pdf=1";
461 if (doPDF == 2) newURL += "&html=1";
462 newURL+="&chart_type="+$("#chart_type").val();
463 // do the new window stuff
464 top.restoreSession();
465 window.open(newURL, '_blank', "menubar=1,toolbar=1,scrollbars=1,resizable=1,width=600,height=450");
468 function convLbtoKg(name) {
469 var lb = $("#"+name).val();
470 var hash_loc=lb.indexOf("#");
471 if(hash_loc>=0)
473 var pounds=lb.substr(0,hash_loc);
474 var ounces=lb.substr(hash_loc+1);
475 var num=parseInt(pounds)+parseInt(ounces)/16;
476 lb=num;
477 $("#"+name).val(lb);
479 if (lb == "0") {
480 $("#"+name+"_metric").val("0");
482 else if (lb == parseFloat(lb)) {
483 kg = lb*0.45359237;
484 kg = kg.toFixed(2);
485 $("#"+name+"_metric").val(kg);
487 else {
488 $("#"+name+"_metric").val("");
491 if (name == "weight_input") {
492 calculateBMI();
496 function convKgtoLb(name) {
497 var kg = $("#"+name+"_metric").val();
499 if (kg == "0") {
500 $("#"+name).val("0");
502 else if (kg == parseFloat(kg)) {
503 lb = kg/0.45359237;
504 lb = lb.toFixed(2);
505 $("#"+name).val(lb);
507 else {
508 $("#"+name).val("");
511 if (name == "weight_input") {
512 calculateBMI();
516 function convIntoCm(name) {
517 var inch = $("#"+name).val();
519 if (inch == "0") {
520 $("#"+name+"_metric").val("0");
522 else if (inch == parseFloat(inch)) {
523 cm = inch*2.54;
524 cm = cm.toFixed(2);
525 $("#"+name+"_metric").val(cm);
527 else {
528 $("#"+name+"_metric").val("");
531 if (name == "height_input") {
532 calculateBMI();
536 function convCmtoIn(name) {
537 var cm = $("#"+name+"_metric").val();
539 if (cm == "0") {
540 $("#"+name).val("0");
542 else if (cm == parseFloat(cm)) {
543 inch = cm/2.54;
544 inch = inch.toFixed(2);
545 $("#"+name).val(inch);
547 else {
548 $("#"+name).val("");
551 if (name == "height_input") {
552 calculateBMI();
556 function convFtoC(name) {
557 var Fdeg = $("#"+name).val();
558 if (Fdeg == "0") {
559 $("#"+name+"_metric").val("0");
561 else if (Fdeg == parseFloat(Fdeg)) {
562 Cdeg = (Fdeg-32)*0.5556;
563 Cdeg = Cdeg.toFixed(2);
564 $("#"+name+"_metric").val(Cdeg);
566 else {
567 $("#"+name+"_metric").val("");
571 function convCtoF(name) {
572 var Cdeg = $("#"+name+"_metric").val();
573 if (Cdeg == "0") {
574 $("#"+name).val("0");
576 else if (Cdeg == parseFloat(Cdeg)) {
577 Fdeg = (Cdeg/0.5556)+32;
578 Fdeg = Fdeg.toFixed(2);
579 $("#"+name).val(Fdeg);
581 else {
582 $("#"+name).val("");
586 function calculateBMI() {
587 var bmi = 0;
588 var height = $("#height_input").val();
589 var weight = $("#weight_input").val();
590 if(height == 0 || weight == 0) {
591 $("#BMI").val("");
593 else if((height == parseFloat(height)) && (weight == parseFloat(weight))) {
594 bmi = weight/height/height*703;
595 bmi = bmi.toFixed(1);
596 $("#BMI_input").val(bmi);
598 else {
599 $("#BMI_input").val("");
603 </script>
604 {/literal}
606 </html>