4 * This module is invoked by add_edit_issue.php as an extension to
5 * add support for issue types that are specific to IPPF.
8 * @link https://www.open-emr.org
9 * @author Rod Roark <rod@sunsetsystems.com>
10 * @author Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2008-2009 Rod Roark <rod@sunsetsystems.com>
12 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 require_once("$srcdir/options.inc.php");
17 require_once("$srcdir/patient.inc");
19 $CPR = 4; // cells per row
25 global $item_count, $cell_count;
26 if ($item_count > 0) {
34 global $cell_count, $CPR;
36 if ($cell_count > 0) {
37 for (; $cell_count < $CPR; ++
$cell_count) {
49 if (strlen($last_group) > 0) {
56 function issue_ippf_gcac_newtype()
58 echo " var gcadisp = (aitypes[index] == 3) ? '' : 'none';\n";
59 echo " document.getElementById('ippf_gcac').style.display = gcadisp;\n";
62 function issue_ippf_gcac_save($issue)
64 $sets = "id = '" . add_escape_custom($issue) . "'";
65 $fres = sqlStatement("SELECT * FROM layout_options " .
66 "WHERE form_id = 'GCA' AND uor > 0 AND field_id != '' AND edit_options != 'H' " .
67 "ORDER BY group_id, seq");
68 while ($frow = sqlFetchArray($fres)) {
69 $field_id = $frow['field_id'];
70 $value = get_layout_form_value($frow);
71 $sets .= ", " . add_escape_custom($field_id) . " = '" . add_escape_custom($value) . "'";
74 // This replaces the row if its id exists, otherwise inserts it.
75 sqlStatement("REPLACE INTO lists_ippf_gcac SET $sets");
78 function issue_ippf_gcac_form($issue, $thispid)
80 global $pprow, $item_count, $cell_count, $last_group;
82 $shrow = getHistoryData($thispid);
85 $pprow = sqlQuery("SELECT * FROM lists_ippf_gcac WHERE id = ?", array($issue));
90 echo "<div id='ippf_gcac' style='display:none'>\n";
92 // Load array of properties for this layout and its groups.
94 getLayoutProperties('GCA', $grparr);
96 $fres = sqlStatement("SELECT * FROM layout_options " .
97 "WHERE form_id = 'GCA' AND uor > 0 " .
98 "ORDER BY group_id, seq");
102 $display_style = 'block';
104 while ($frow = sqlFetchArray($fres)) {
105 $this_group = $frow['group_id'];
106 $titlecols = $frow['titlecols'];
107 $datacols = $frow['datacols'];
108 $data_type = $frow['data_type'];
109 $field_id = $frow['field_id'];
110 $list_id = $frow['list_id'];
114 if ($frow['edit_options'] == 'H') {
115 // This data comes from static history
116 if (isset($shrow[$field_id])) {
117 $currvalue = $shrow[$field_id];
120 if (isset($pprow[$field_id])) {
121 $currvalue = $pprow[$field_id];
125 // Handle a data category (group) change.
126 if (strcmp($this_group, $last_group) != 0) {
128 $group_seq = 'gca' . substr($this_group, 0, 1);
129 $group_name = $grparr[$this_group]['grp_title'];
130 $last_group = $this_group;
131 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_" . attr($group_seq) . "' value='1' " .
132 "onclick='return divclick(this," . attr_js('div_' . $group_seq) . ");'";
133 if ($display_style == 'block') {
137 echo " /><b>" . text(xl_layout_label($group_name)) . "</b></span>\n";
138 echo "<div id='div_" . attr($group_seq) . "' class='section' style='display:$display_style;'>\n";
139 echo " <table border='0' cellpadding='0' width='100%'>\n";
140 $display_style = 'none';
143 // Handle starting of a new row.
144 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
149 if ($item_count == 0 && $titlecols == 0) {
153 // Handle starting of a new label cell.
154 if ($titlecols > 0) {
156 echo "<td valign='top' colspan='" . attr($titlecols) . "' width='1%' nowrap";
157 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
158 if ($cell_count == 2) {
159 echo " style='padding-left:10pt'";
163 $cell_count +
= $titlecols;
169 if ($frow['title']) {
170 echo (text(xl_layout_label($frow['title'])) . ":");
177 // Handle starting of a new data cell.
180 echo "<td valign='top' colspan='" . attr($datacols) . "' class='text'";
181 if ($cell_count > 0) {
182 echo " style='padding-left:5pt'";
186 $cell_count +
= $datacols;
191 if ($frow['edit_options'] == 'H') {
192 echo generate_display_field($frow, $currvalue);
194 generate_form_field($frow, $currvalue);
202 function issue_ippf_con_newtype()
204 echo " var condisp = (aitypes[index] == 4) ? '' : 'none';\n";
205 echo " document.getElementById('ippf_con').style.display = condisp;\n";
208 function issue_ippf_con_save($issue)
210 $sets = "id = '" . add_escape_custom($issue) . "'";
211 $fres = sqlStatement("SELECT * FROM layout_options " .
212 "WHERE form_id = 'CON' AND uor > 0 AND field_id != '' AND edit_options != 'H' " .
213 "ORDER BY group_id, seq");
214 while ($frow = sqlFetchArray($fres)) {
215 $field_id = $frow['field_id'];
216 $value = get_layout_form_value($frow);
217 $sets .= ", " . add_escape_custom($field_id) . " = '" . add_escape_custom($value) . "'";
220 // This replaces the row if its id exists, otherwise inserts it.
221 sqlStatement("REPLACE INTO lists_ippf_con SET $sets");
224 function issue_ippf_con_form($issue, $thispid)
226 global $pprow, $item_count, $cell_count, $last_group;
228 $shrow = getHistoryData($thispid);
231 $pprow = sqlQuery("SELECT * FROM lists_ippf_con WHERE id = ?", array($issue));
236 echo "<div id='ippf_con' style='display:none'>\n";
238 // Load array of properties for this layout and its groups.
240 getLayoutProperties('CON', $grparr);
242 $fres = sqlStatement("SELECT * FROM layout_options " .
243 "WHERE form_id = 'CON' AND uor > 0 " .
244 "ORDER BY group_id, seq");
248 $display_style = 'block';
250 while ($frow = sqlFetchArray($fres)) {
251 $this_group = $frow['group_id'];
252 $titlecols = $frow['titlecols'];
253 $datacols = $frow['datacols'];
254 $data_type = $frow['data_type'];
255 $field_id = $frow['field_id'];
256 $list_id = $frow['list_id'];
260 if ($frow['edit_options'] == 'H') {
261 // This data comes from static history
262 if (isset($shrow[$field_id])) {
263 $currvalue = $shrow[$field_id];
266 if (isset($pprow[$field_id])) {
267 $currvalue = $pprow[$field_id];
271 // Handle a data category (group) change.
272 if (strcmp($this_group, $last_group) != 0) {
274 $group_seq = 'con' . substr($this_group, 0, 1);
275 $group_name = $grparr[$this_group]['grp_title'];
276 $last_group = $this_group;
277 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_" . attr($group_seq) . "' value='1' " .
278 "onclick='return divclick(this," . attr_js('div_' . $group_seq) . ");'";
279 if ($display_style == 'block') {
283 echo " /><b>" . text($group_name) . "</b></span>\n";
284 echo "<div id='div_" . attr($group_seq) . "' class='section' style='display:$display_style;'>\n";
285 echo " <table border='0' cellpadding='0' width='100%'>\n";
286 $display_style = 'none';
289 // Handle starting of a new row.
290 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
295 if ($item_count == 0 && $titlecols == 0) {
299 // Handle starting of a new label cell.
300 if ($titlecols > 0) {
302 echo "<td valign='top' colspan='" . attr($titlecols) . "' width='1%' nowrap";
303 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
304 if ($cell_count == 2) {
305 echo " style='padding-left:10pt'";
309 $cell_count +
= $titlecols;
315 if ($frow['title']) {
316 echo text($frow['title']) . ":";
323 // Handle starting of a new data cell.
326 echo "<td valign='top' colspan='" . attr($datacols) . "' class='text'";
327 if ($cell_count > 0) {
328 echo " style='padding-left:5pt'";
332 $cell_count +
= $datacols;
337 if ($frow['edit_options'] == 'H') {
338 echo generate_display_field($frow, $currvalue);
340 generate_form_field($frow, $currvalue);