3 * This module is invoked by add_edit_issue.php as an extension to
4 * add support for issue types that are specific to IPPF.
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2008-2009 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
12 * @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;
50 if (strlen($last_group) > 0) {
57 function issue_ippf_gcac_newtype()
59 echo " var gcadisp = (aitypes[index] == 3) ? '' : 'none';\n";
60 echo " document.getElementById('ippf_gcac').style.display = gcadisp;\n";
63 function issue_ippf_gcac_save($issue)
65 $sets = "id = '" . add_escape_custom($issue) . "'";
66 $fres = sqlStatement("SELECT * FROM layout_options " .
67 "WHERE form_id = 'GCA' AND uor > 0 AND field_id != '' AND edit_options != 'H' " .
68 "ORDER BY group_id, seq");
69 while ($frow = sqlFetchArray($fres)) {
70 $field_id = $frow['field_id'];
71 $value = get_layout_form_value($frow);
72 $sets .= ", " . add_escape_custom($field_id) . " = '" . add_escape_custom($value) . "'";
75 // This replaces the row if its id exists, otherwise inserts it.
76 sqlStatement("REPLACE INTO lists_ippf_gcac SET $sets");
79 function issue_ippf_gcac_form($issue, $thispid)
81 global $pprow, $item_count, $cell_count, $last_group;
83 $shrow = getHistoryData($thispid);
86 $pprow = sqlQuery("SELECT * FROM lists_ippf_gcac WHERE id = ?", array($issue));
91 echo "<div id='ippf_gcac' style='display:none'>\n";
93 // Load array of properties for this layout and its groups.
95 getLayoutProperties('GCA', $grparr);
97 $fres = sqlStatement("SELECT * FROM layout_options " .
98 "WHERE form_id = 'GCA' AND uor > 0 " .
99 "ORDER BY group_id, seq");
103 $display_style = 'block';
105 while ($frow = sqlFetchArray($fres)) {
106 $this_group = $frow['group_id'];
107 $titlecols = $frow['titlecols'];
108 $datacols = $frow['datacols'];
109 $data_type = $frow['data_type'];
110 $field_id = $frow['field_id'];
111 $list_id = $frow['list_id'];
115 if ($frow['edit_options'] == 'H') {
116 // This data comes from static history
117 if (isset($shrow[$field_id])) {
118 $currvalue = $shrow[$field_id];
121 if (isset($pprow[$field_id])) {
122 $currvalue = $pprow[$field_id];
126 // Handle a data category (group) change.
127 if (strcmp($this_group, $last_group) != 0) {
129 $group_seq = 'gca' . substr($this_group, 0, 1);
130 $group_name = $grparr[$this_group]['grp_title'];
131 $last_group = $this_group;
132 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_" . attr($group_seq) . "' value='1' " .
133 "onclick='return divclick(this," . attr_js('div_'.$group_seq) . ");'";
134 if ($display_style == 'block') {
138 echo " /><b>" . text(xl_layout_label($group_name)) . "</b></span>\n";
139 echo "<div id='div_" . attr($group_seq) . "' class='section' style='display:$display_style;'>\n";
140 echo " <table border='0' cellpadding='0' width='100%'>\n";
141 $display_style = 'none';
144 // Handle starting of a new row.
145 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
150 if ($item_count == 0 && $titlecols == 0) {
154 // Handle starting of a new label cell.
155 if ($titlecols > 0) {
157 echo "<td valign='top' colspan='" . attr($titlecols) . "' width='1%' nowrap";
158 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
159 if ($cell_count == 2) {
160 echo " style='padding-left:10pt'";
164 $cell_count +
= $titlecols;
170 if ($frow['title']) {
171 echo (text(xl_layout_label($frow['title'])) . ":");
178 // Handle starting of a new data cell.
181 echo "<td valign='top' colspan='" . attr($datacols) . "' class='text'";
182 if ($cell_count > 0) {
183 echo " style='padding-left:5pt'";
187 $cell_count +
= $datacols;
192 if ($frow['edit_options'] == 'H') {
193 echo generate_display_field($frow, $currvalue);
195 generate_form_field($frow, $currvalue);
203 function issue_ippf_con_newtype()
205 echo " var condisp = (aitypes[index] == 4) ? '' : 'none';\n";
206 echo " document.getElementById('ippf_con').style.display = condisp;\n";
209 function issue_ippf_con_save($issue)
211 $sets = "id = '" . add_escape_custom($issue) . "'";
212 $fres = sqlStatement("SELECT * FROM layout_options " .
213 "WHERE form_id = 'CON' AND uor > 0 AND field_id != '' AND edit_options != 'H' " .
214 "ORDER BY group_id, seq");
215 while ($frow = sqlFetchArray($fres)) {
216 $field_id = $frow['field_id'];
217 $value = get_layout_form_value($frow);
218 $sets .= ", " . add_escape_custom($field_id) . " = '" . add_escape_custom($value) . "'";
221 // This replaces the row if its id exists, otherwise inserts it.
222 sqlStatement("REPLACE INTO lists_ippf_con SET $sets");
225 function issue_ippf_con_form($issue, $thispid)
227 global $pprow, $item_count, $cell_count, $last_group;
229 $shrow = getHistoryData($thispid);
232 $pprow = sqlQuery("SELECT * FROM lists_ippf_con WHERE id = ?", array($issue));
237 echo "<div id='ippf_con' style='display:none'>\n";
239 // Load array of properties for this layout and its groups.
241 getLayoutProperties('CON', $grparr);
243 $fres = sqlStatement("SELECT * FROM layout_options " .
244 "WHERE form_id = 'CON' AND uor > 0 " .
245 "ORDER BY group_id, seq");
249 $display_style = 'block';
251 while ($frow = sqlFetchArray($fres)) {
252 $this_group = $frow['group_id'];
253 $titlecols = $frow['titlecols'];
254 $datacols = $frow['datacols'];
255 $data_type = $frow['data_type'];
256 $field_id = $frow['field_id'];
257 $list_id = $frow['list_id'];
261 if ($frow['edit_options'] == 'H') {
262 // This data comes from static history
263 if (isset($shrow[$field_id])) {
264 $currvalue = $shrow[$field_id];
267 if (isset($pprow[$field_id])) {
268 $currvalue = $pprow[$field_id];
272 // Handle a data category (group) change.
273 if (strcmp($this_group, $last_group) != 0) {
275 $group_seq = 'con' . substr($this_group, 0, 1);
276 $group_name = $grparr[$this_group]['grp_title'];
277 $last_group = $this_group;
278 echo "<br /><span class='bold'><input type='checkbox' name='form_cb_" . attr($group_seq) . "' value='1' " .
279 "onclick='return divclick(this," . attr_js('div_'.$group_seq) . ");'";
280 if ($display_style == 'block') {
284 echo " /><b>" . text($group_name) . "</b></span>\n";
285 echo "<div id='div_" . attr($group_seq) . "' class='section' style='display:$display_style;'>\n";
286 echo " <table border='0' cellpadding='0' width='100%'>\n";
287 $display_style = 'none';
290 // Handle starting of a new row.
291 if (($titlecols > 0 && $cell_count >= $CPR) ||
$cell_count == 0) {
296 if ($item_count == 0 && $titlecols == 0) {
300 // Handle starting of a new label cell.
301 if ($titlecols > 0) {
303 echo "<td valign='top' colspan='" . attr($titlecols) . "' width='1%' nowrap";
304 echo ($frow['uor'] == 2) ?
" class='required'" : " class='bold'";
305 if ($cell_count == 2) {
306 echo " style='padding-left:10pt'";
310 $cell_count +
= $titlecols;
316 if ($frow['title']) {
317 echo text($frow['title']) . ":";
324 // Handle starting of a new data cell.
327 echo "<td valign='top' colspan='" . attr($datacols) . "' class='text'";
328 if ($cell_count > 0) {
329 echo " style='padding-left:5pt'";
333 $cell_count +
= $datacols;
338 if ($frow['edit_options'] == 'H') {
339 echo generate_display_field($frow, $currvalue);
341 generate_form_field($frow, $currvalue);