Change formatting of initial comment block.
[openemr.git] / contrib / forms / specialist_notes / view.php
blob4e95f9c6028ebf83a37d459ad556e36d23532758
1 <?php
2 //////////////////////////////////////////////////////////////////////
3 // ------------------ DO NOT MODIFY VIEW.PHP !!! ---------------------
4 // View.php is an exact duplicate of new.php. If you wish to make
5 // any changes, then change new.php and either (recommended) make
6 // view.php a symbolic link to new.php, or copy new.php to view.php.
7 //
8 // And if you check in a change to either module, be sure to check
9 // in the other (identical) module also.
11 // This nonsense will go away if we ever move to subversion.
12 //////////////////////////////////////////////////////////////////////
14 // Copyright (C) 2005 Rod Roark <rod@sunsetsystems.com>
16 // This program is free software; you can redistribute it and/or
17 // modify it under the terms of the GNU General Public License
18 // as published by the Free Software Foundation; either version 2
19 // of the License, or (at your option) any later version.
21 include_once("../../globals.php");
22 include_once("$srcdir/api.inc");
23 include_once("$srcdir/forms.inc");
25 $row = array();
27 if (! $encounter) { // comes from globals.php
28 die("Internal error: we do not seem to be in an encounter!");
31 function cbvalue($cbname) {
32 return $_POST[$cbname] ? '1' : '0';
35 function cbinput($name, $colname) {
36 global $row;
37 $ret = "<input type='checkbox' name='$name' value='1'";
38 if ($row[$colname]) $ret .= " checked";
39 $ret .= " />";
40 return $ret;
43 function cbcell($name, $desc, $colname) {
44 return "<td width='25%' nowrap>" . cbinput($name, $colname) . "$desc</td>\n";
47 $formid = $_GET['id'];
49 // If Save was clicked, save the info.
51 if ($_POST['bn_save']) {
53 $fu_timing = $_POST['fu_timing'];
54 $fu_location = $_POST['fu_location'];
56 // If updating an existing form...
58 if ($formid) {
59 $query = "UPDATE form_specialist_notes SET " .
60 "notes = '" . $_POST['form_notes'] . "', " .
61 "followup_required = " . cbvalue('fu_required') . ", " .
62 "followup_timing = '$fu_timing'" . ", " .
63 "followup_location = '$fu_location'" . " " .
64 "WHERE id = '$formid'";
65 sqlStatement($query);
68 // If adding a new form...
70 else {
71 $query = "INSERT INTO form_specialist_notes ( " .
72 "notes, followup_required, followup_timing, followup_location " .
73 ") VALUES ( " .
74 "'" . $_POST['form_notes'] . "', " .
75 cbvalue('fu_required') . ", " .
76 "'$fu_timing'" . ", " .
77 "'$fu_location'" . " " .
78 ")";
79 $newid = sqlInsert($query);
80 addForm($encounter, "Specialist Notes", $newid, "specialist_notes", $pid, $userauthorized);
83 formHeader("Redirecting....");
84 formJump();
85 formFooter();
86 exit;
89 if ($formid) {
90 $row = sqlQuery ("SELECT * FROM form_specialist_notes WHERE " .
91 "id = '$formid' AND activity = '1'") ;
94 <html>
95 <head>
96 <?php html_header_show();?>
97 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
98 <script type="text/javascript" src="../../../library/dialog.js"></script>
99 <script language='JavaScript'>
100 function newEvt() {
101 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo $pid ?>',
102 '_blank', 550, 270);
103 return false;
105 </script>
106 </head>
108 <body class="body_top">
109 <form method="post" action="<?php echo $rootdir ?>/forms/specialist_notes/new.php?id=<?php echo $formid ?>" onsubmit="return top.restoreSession()">
111 <center>
114 <table border='1' width='95%'>
116 <tr bgcolor='#dddddd'>
117 <td colspan='2' align='center'><b>Notes from Specialist</b></td>
118 </tr>
120 <tr>
121 <td width='5%' nowrap> Notes </td>
122 <td width='95%' nowrap>
123 <textarea name='form_notes' rows='18' style='width:100%'><?php echo $row['notes'] ?></textarea>
124 </td>
125 </tr>
127 <tr>
128 <td nowrap>Follow Up</td>
129 <td nowrap>
130 <table width='100%'>
131 <tr>
132 <td width='1%' nowrap>
133 <?php echo cbinput('fu_required', 'followup_required') ?>Required on&nbsp;
134 </td>
135 <td width='49%' nowrap>
136 <input type='text' name='fu_timing' size='10' style='width:100%'
137 title='When to follow up'
138 value='<?php echo addslashes($row['followup_timing']) ?>' />
139 </td>
140 <td width='1%' nowrap>
141 &nbsp;at&nbsp;
142 </td>
143 <td width='49%' nowrap>
144 <input type='text' name='fu_location' size='10' style='width:100%'
145 title='Where to follow up'
146 value='<?php echo addslashes($row['followup_location']) ?>' />
147 </td>
148 </tr>
149 </table>
150 </td>
151 </tr>
153 </table>
156 <input type='submit' name='bn_save' value='Save' />
157 &nbsp;
158 <input type='button' value='Add Appointment' onclick='newEvt()' />
159 &nbsp;
160 <input type='button' value='Cancel' onclick="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />
161 </p>
163 </center>
165 </form>
166 </body>
167 </html>