added new datepicker to forms in contrib
[openemr.git] / contrib / forms / psychiatrySet / brief_aan_verwijzer / view.php
blobe433ff06000d255f68374063705401746ef8d165
1 <?php
2 /*
3 * brief_aan_verwijzer
4 * letter to ... - Dutch specific form
5 * Version: 1.0 - 30-03-2008
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
18 * @package OpenEMR
19 * @author Larry Lart
20 * @link http://www.open-emr.org
23 include_once("../../globals.php");
24 include_once("$srcdir/api.inc");
25 include_once("$srcdir/patient.inc");
27 $returnurl = 'encounter_top.php';
29 $result = getPatientData($pid, "fname,lname,pid,pubpid,phone_home,sex,pharmacy_id,DOB,DATE_FORMAT(DOB,'%Y%m%d') as DOB_YMD");
30 $provider_results = sqlQuery("select * from users where username='" . $_SESSION{"authUser"} . "'");
32 ////////////////////////////////////////////////////////////////////
33 // Function: getPatientDateOfLastEncounter
34 function getPatientDateOfLastEncounter( $nPid )
36 // get date of last encounter no codes
37 $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max
38 FROM openemr_postcalendar_events
39 WHERE pc_pid = $nPid
40 AND pc_apptstatus = '@'
41 AND pc_eventDate >= '2007-01-01'");
43 // now check if there was a previous encounter
44 if( $strEventDate['max'] != "" )
45 return( $strEventDate['max'] );
46 else
47 return( "00-00-0000" );
50 $m_strEventDate = getPatientDateOfLastEncounter( $result['pid'] );
52 // get autosave id for Psychiatrisch Onderzoek
53 $vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_brief_aan_verwijzer
54 WHERE pid = ".$_SESSION["pid"].
55 " AND groupname='".$_SESSION["authProvider"].
56 "' AND user='".$_SESSION["authUser"]."' AND
57 authorized=$userauthorized AND activity=1
58 AND autosave_flag=1
59 ORDER by id DESC limit 1" );
61 if( $vectAutosave['id'] && $vectAutosave['id'] != "" && $vectAutosave['id'] > 0 )
63 $obj = formFetch("form_brief_aan_verwijzer", $vectAutosave['id']);
65 } else
67 $obj = formFetch("form_brief_aan_verwijzer", (int)$_GET["id"] );
72 <html>
73 <head>
74 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
75 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
76 </head>
78 <body <?php echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
80 <style type="text/css">
81 body { font-family:sans-serif; font-size:10pt; font-weight:normal }
82 .dehead { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:bold;
83 padding-left:3px; padding-right:3px; }
84 .detail { color:#000000; font-family:sans-serif; font-size:10pt; font-weight:normal;
85 padding-left:3px; padding-right:3px; }
86 </style>
88 <script type="text/javascript" src="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
89 <script type="text/javascript" src="../../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
90 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
91 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
93 <?php
95 if( $_GET["id"] )
96 $brief_aan_verwijzer_id = $_GET["id"];
97 else
98 $brief_aan_verwijzer_id = "0";
101 <script type="text/javascript">
102 $(document).ready(function(){
103 autosave();
104 $('.datepicker').datetimepicker({
105 <?php $datetimepicker_timepicker = false; ?>
106 <?php $datetimepicker_showseconds = false; ?>
107 <?php $datetimepicker_formatInput = false; ?>
108 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
109 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
113 function delete_autosave( )
115 if( confirm("<?php xl('Are you sure you want to completely remove this form?','e'); ?>") )
117 $.ajax(
119 type: "POST",
120 url: "../../forms/brief_aan_verwijzer/delete_autosave.php",
121 data: "id=" + <?php echo $brief_aan_verwijzer_id ?>
123 cache: false,
124 success: function( message )
126 $("#timestamp").empty().append(message);
129 return true;
131 } else
133 return false;
138 function autosave( )
140 var t = setTimeout("autosave()", 20000);
142 var a_introductie = $("#introductie").val();
143 var a_reden_van_aanmelding = $("#reden_van_aanmelding").val();
144 var a_anamnese = $("#anamnese").val();
145 var a_psychiatrisch_onderzoek = $("#psychiatrisch_onderzoek").val();
146 var a_beschrijvend_conclusie = $("#beschrijvend_conclusie").val();
147 var a_advies_beleid = $("#advies_beleid").val();
149 if( a_introductie.length > 0 || a_reden_van_aanmelding.length > 0 )
151 $.ajax(
153 type: "POST",
154 url: "../../forms/brief_aan_verwijzer/autosave.php",
155 data: "id=" + <?php echo $brief_aan_verwijzer_id ?> +
156 "&introductie=" + $("#introductie").val() +
157 "&reden_van_aanmelding=" + a_reden_van_aanmelding +
158 "&anamnese=" + a_anamnese +
159 "&psychiatrisch_onderzoek=" + a_psychiatrisch_onderzoek +
160 "&beschrijvend_conclusie=" + a_beschrijvend_conclusie +
161 "&advies_beleid=" + a_advies_beleid +
162 "&mode=update"
164 cache: false,
165 success: function( message )
167 $("#timestamp").empty().append(message);
174 </script>
176 <?php
177 include_once("$srcdir/api.inc");
178 //$obj = formFetch("form_brief_aan_verwijzer", (int)$_GET["id"]);
181 <form method=post action="<?php echo $rootdir?>/forms/brief_aan_verwijzer/save.php?mode=update&id=<?php echo $_GET["id"];?>" name="my_form">
182 <span class="title"><?php xl('Psychiatric Brief Letter','e'); ?></span><Br><br>
184 <br><span class=text><?php xl('Introduction','e'); ?></span><br>
185 <textarea cols=80 rows=5 wrap=virtual name="introductie" id="introductie"><?php echo stripslashes($obj{"introductie"});?></textarea><br>
187 <br><span class=text><?php xl('Reason for Visit','e'); ?></span><br>
188 <textarea cols=80 rows=5 wrap=virtual name="reden_van_aanmelding" id="reden_van_aanmelding"><?php echo stripslashes($obj{"reden_van_aanmelding"});?></textarea><br>
189 <br><span class=text><?php xl('History','e'); ?></span><br>
190 <textarea cols=80 rows=5 wrap=virtual name="anamnese" id="anamnese"><?php echo stripslashes($obj{"anamnese"});?></textarea><br>
191 <br><span class=text><?php xl('Psychiatric Examination','e'); ?></span><br>
192 <textarea cols=80 rows=5 wrap=virtual name="psychiatrisch_onderzoek" id="psychiatrisch_onderzoek"><?php echo stripslashes($obj{"psychiatrisch_onderzoek"});?></textarea><br>
193 <br><span class=text><?php xl('Conclusions','e'); ?></span><br>
194 <textarea cols=80 rows=5 wrap=virtual name="beschrijvend_conclusie" id="beschrijvend_conclusie"><?php echo stripslashes($obj{"beschrijvend_conclusie"});?></textarea><br>
195 <br><span class=text><?php xl('Treatment Plan','e'); ?></span><br>
196 <textarea cols=80 rows=5 wrap=virtual name="advies_beleid" id="advies_beleid"><?php echo stripslashes($obj{"advies_beleid"});?></textarea><br>
198 <table><tr>
199 <?php
200 // this to be used/moved above for form header with patient name/etc
202 </tr></table>
204 <br><br>
205 <a href="javascript:document.my_form.submit();" class="link_submit">[<?php xl('Save','e'); ?>]</a>
206 <br>
207 <a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="link_submit"
208 onclick="delete_autosave();top.restoreSession()">[<?php xl('Don\'t Save Changes','e'); ?>]</a>
209 </form>
211 <div id="timestamp"></div>
213 <?php
214 formFooter();