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.
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");
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) {
37 $ret = "<input type='checkbox' name='$name' value='1'";
38 if ($row[$colname]) $ret .= " checked";
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...
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'";
68 // If adding a new form...
71 $query = "INSERT INTO form_specialist_notes ( " .
72 "notes, followup_required, followup_timing, followup_location " .
74 "'" . $_POST['form_notes'] . "', " .
75 cbvalue('fu_required') . ", " .
76 "'$fu_timing'" . ", " .
77 "'$fu_location'" . " " .
79 $newid = sqlInsert($query);
80 addForm($encounter, "Specialist Notes", $newid, "specialist_notes", $pid, $userauthorized);
83 formHeader("Redirecting....");
90 $row = sqlQuery ("SELECT * FROM form_specialist_notes WHERE " .
91 "id = '$formid' AND activity = '1'") ;
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'>
101 dlgopen('../../main/calendar/add_edit_event.php?patientid=<?php echo $pid ?>',
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()">
114 <table border
='1' width
='95%'>
116 <tr bgcolor
='#dddddd'>
117 <td colspan
='2' align
='center'><b
>Notes from Specialist
</b
></td
>
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
>
128 <td nowrap
>Follow Up
</td
>
132 <td width
='1%' nowrap
>
133 <?php
echo cbinput('fu_required', 'followup_required') ?
>Required on
 
;
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
']) ?>' />
140 <td width
='1%' nowrap
>
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
']) ?>' />
156 <input type
='submit' name
='bn_save' value
='Save' />
158 <input type
='button' value
='Add Appointment' onclick
='newEvt()' />
160 <input type
='button' value
='Cancel' onclick
="top.restoreSession();location='<?php echo $GLOBALS['form_exit_url']; ?>'" />