Contributed GYM Forms, some of the table.sql files include inserts into list_options...
[openemr.git] / contrib / forms / dub_soap / report.php
blob83a36b8ca25312dc021da4619152e8f680cb3f9d
1 <?php
2 /*
3 * this file's contents are included in both the encounter page as a 'quick summary' of a form, and in the medical records' reports page.
4 */
6 /* for $GLOBALS[], ?? */
7 require_once('../../globals.php');
8 /* for acl_check(), ?? */
9 require_once($GLOBALS['srcdir'].'/api.inc');
10 /* for generate_form_field, ?? */
11 require_once($GLOBALS['srcdir'].'/options.inc.php');
12 /* The name of the function is significant and must match the folder name */
13 function dub_soap_report( $pid, $encounter, $cols, $id) {
14 $count = 0;
15 /** CHANGE THIS - name of the database table associated with this form **/
16 $table_name = 'form_dub_soap';
19 /* an array of all of the fields' names and their types. */
20 $field_names = array('menstrual_history' => 'checkbox_combo_list','previous_sonogram' => 'textfield','previous_blood_work' => 'textfield','previous_needs_rx' => 'textfield','other' => 'textarea','dub_objective' => 'checkbox_combo_list','a_dub' => 'checkbox_combo_list','plan_lab_work' => 'checkbox_combo_list','plan_tests_procedures' => 'checkbox_combo_list','plan_medications' => 'checkbox_combo_list');/* in order to use the layout engine's draw functions, we need a fake table of layout data. */
21 $manual_layouts = array(
22 'menstrual_history' =>
23 array( 'field_id' => 'menstrual_history',
24 'data_type' => '25',
25 'fld_length' => '140',
26 'description' => '',
27 'list_id' => 'DUB_Menstrual_History' ),
28 'previous_sonogram' =>
29 array( 'field_id' => 'previous_sonogram',
30 'data_type' => '2',
31 'fld_length' => '163',
32 'max_length' => '255',
33 'description' => '',
34 'list_id' => '' ),
35 'previous_blood_work' =>
36 array( 'field_id' => 'previous_blood_work',
37 'data_type' => '2',
38 'fld_length' => '163',
39 'max_length' => '255',
40 'description' => '',
41 'list_id' => '' ),
42 'previous_needs_rx' =>
43 array( 'field_id' => 'previous_needs_rx',
44 'data_type' => '2',
45 'fld_length' => '163',
46 'max_length' => '255',
47 'description' => '',
48 'list_id' => '' ),
49 'other' =>
50 array( 'field_id' => 'other',
51 'data_type' => '3',
52 'fld_length' => '151',
53 'max_length' => '4',
54 'description' => '',
55 'list_id' => '' ),
56 'dub_objective' =>
57 array( 'field_id' => 'dub_objective',
58 'data_type' => '25',
59 'fld_length' => '140',
60 'description' => '',
61 'list_id' => 'DUB_Objective' ),
62 'a_dub' =>
63 array( 'field_id' => 'a_dub',
64 'data_type' => '25',
65 'fld_length' => '140',
66 'description' => '',
67 'list_id' => 'DUB_Diagnosis' ),
68 'plan_lab_work' =>
69 array( 'field_id' => 'plan_lab_work',
70 'data_type' => '25',
71 'fld_length' => '140',
72 'description' => '',
73 'list_id' => 'DUB_Lab_Work' ),
74 'plan_tests_procedures' =>
75 array( 'field_id' => 'plan_tests_procedures',
76 'data_type' => '25',
77 'fld_length' => '140',
78 'description' => '',
79 'list_id' => 'DUB_Tests_Procedures' ),
80 'plan_medications' =>
81 array( 'field_id' => 'plan_medications',
82 'data_type' => '25',
83 'fld_length' => '140',
84 'description' => '',
85 'list_id' => 'DUB_Medications' )
87 /* an array of the lists the fields may draw on. */
88 $lists = array();
89 $data = formFetch($table_name, $id);
90 if ($data) {
92 echo '<table><tr>';
94 foreach($data as $key => $value) {
95 if ($key == 'id' || $key == 'pid' || $key == 'user' ||
96 $key == 'groupname' || $key == 'authorized' ||
97 $key == 'activity' || $key == 'date' ||
98 $value == '' || $value == '0000-00-00 00:00:00' ||
99 $value == 'n')
101 /* skip built-in fields and "blank data". */
102 continue;
105 /* display 'yes' instead of 'on'. */
106 if ($value == 'on') {
107 $value = 'yes';
110 /* remove the time-of-day from the 'date' fields. */
111 if ($field_names[$key] == 'date')
112 if ($value != '') {
113 $dateparts = split(' ', $value);
114 $value = $dateparts[0];
117 if ( $field_names[$key] == 'checkbox_combo_list' ) {
118 $value = generate_display_field( $manual_layouts[$key], $value );
121 /* replace underscores with spaces, and uppercase all words. */
122 /* this is a primitive form of converting the column names into something displayable. */
123 $key=ucwords(str_replace('_',' ',$key));
124 $mykey = $key;
125 $myval = $value;
126 echo '<td><span class=bold>'.xl("$mykey").': </span><span class=text>'.xl("$myval").'</span></td>';
129 $count++;
130 if ($count == $cols) {
131 $count = 0;
132 echo '</tr><tr>' . PHP_EOL;
136 echo '</tr></table><hr>';