From bebf35f7e2e20163e4daf4a98875085421823a03 Mon Sep 17 00:00:00 2001 From: Brady Miller Date: Sat, 11 Mar 2017 21:52:39 -0800 Subject: [PATCH] added new datepicker to forms in contrib --- contrib/forms/example2/new.php | 75 ++++++++------- contrib/forms/example2/view.php | 84 +++++++++-------- contrib/forms/formmaker/formscript.pl | 78 +++++++++------- .../psychiatrySet/brief_aan_verwijzer/new.php | 96 +++++++++++-------- .../psychiatrySet/brief_aan_verwijzer/view.php | 76 +++++++++------ contrib/forms/psychiatrySet/intakeverslag/new.php | 97 ++++++++++--------- contrib/forms/psychiatrySet/intakeverslag/view.php | 93 ++++++++++--------- .../psychiatrySet/psychiatrisch_onderzoek/new.php | 103 +++++++++++---------- .../psychiatrySet/psychiatrisch_onderzoek/view.php | 96 ++++++++++--------- interface/orders/orders_results.php | 38 ++++---- 10 files changed, 462 insertions(+), 374 deletions(-) diff --git a/contrib/forms/example2/new.php b/contrib/forms/example2/new.php index 5bd0131ec..8593a7b36 100644 --- a/contrib/forms/example2/new.php +++ b/contrib/forms/example2/new.php @@ -1,6 +1,21 @@ . + * + * @package OpenEMR + * @author Brady Miller + * @link http://www.open-emr.org */ include_once("../../globals.php"); @@ -21,18 +36,14 @@ $returnurl = 'encounter_top.php'; - - + + + - - - - - - - + + diff --git a/contrib/forms/example2/view.php b/contrib/forms/example2/view.php index 7d46c8713..5b761f618 100644 --- a/contrib/forms/example2/view.php +++ b/contrib/forms/example2/view.php @@ -1,8 +1,25 @@ . + * + * @package OpenEMR + * @author Jason Morrill + * @author Brady Miller + * @link http://www.open-emr.org */ + include_once("../../globals.php"); include_once("$srcdir/api.inc"); @@ -40,18 +57,14 @@ if ($record['sig_date'] != "") { - - + + + - - - - - - - + + diff --git a/contrib/forms/formmaker/formscript.pl b/contrib/forms/formmaker/formscript.pl index 8d62d0b1e..5916f2af6 100755 --- a/contrib/forms/formmaker/formscript.pl +++ b/contrib/forms/formmaker/formscript.pl @@ -48,10 +48,10 @@ for the sql database field name. If you use a SQL reserved word, the form gener will fail and this program will notify you of the word(s) you used. The '::' is the standard delimiter that I use between items. The second item on the line -is the form widget type. You can choose from: +is the form widget type. You can choose from: textfield -textarea +textarea checkbox checkbox_group radio_group @@ -70,7 +70,7 @@ have the following line entered: chest pain, shortness of breath. Negative for palpitations. -The remaining items after the fieldname and the widget type are the names for +The remaining items after the fieldname and the widget type are the names for checkboxes or radio buttons or default text for a textfield or text area. You can also start a line with a '#' as the first character and this will be an ignored comment line. If you put html tags on their own lines, they will be integrated @@ -93,7 +93,7 @@ Please send feedback to drleeds@gmail.com. START -#info.txt +#info.txt my $info_txt=<<'START'; FORM_NAME START @@ -103,13 +103,24 @@ START #for the popup javascript calendar my $date_field_exists = 0; my $date_header =<<'START'; - + - - - - + + + + + START #new.php @@ -122,6 +133,7 @@ $returnurl = 'encounter_top.php'; ?> + topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> DATE_HEADER @@ -191,7 +203,7 @@ print "\n"; } print "
"; } -?> +?> START #save.php @@ -220,7 +232,7 @@ foreach($field_names as $key=>$val) { if (array_key_exists($key,$negatives)) #a field requests reporting of negatives { - if ($_POST[$key]) + if ($_POST[$key]) { foreach($_POST[$key] as $var) #check positives against list { @@ -230,17 +242,17 @@ foreach($field_names as $key=>$val) } } } - if (is_array($negatives[$key]) && count($negatives[$key])>0) + if (is_array($negatives[$key]) && count($negatives[$key])>0) { $neg = "Negative for ".implode(', ',$negatives[$key]).'.'; } } - if (is_array($_POST[$key]) && count($_POST[$key])>0) + if (is_array($_POST[$key]) && count($_POST[$key])>0) { $pos = implode(', ',$_POST[$key]); } if($pos) {$pos = 'Positive for '.$pos.'. ';} - $field_names[$key] = $pos.$neg; + $field_names[$key] = $pos.$neg; } else { @@ -250,7 +262,7 @@ foreach($field_names as $key=>$val) { // $field_names[$key] .= '.'; $field_names[$key] = preg_replace('/\s*,\s*([^,]+)\./',' and $1.',$field_names[$key]); // replace last comma with 'and' and ending period - } + } } //end special processing @@ -342,7 +354,7 @@ START my $preview_html =<<'START'; - +

FORM_NAME

@@ -424,7 +436,7 @@ my %negatives; #key=field name: these are the fields that require my @reserved_used; #strip outer spaces from field names and field types and change inner spaces to underscores #and check field names for SQL reserved words now -for (@field_data) +for (@field_data) { if ($_->[0] and $_->[1]) #$_->[0] is field name and $_->[1] is field type. IE: @field_data[4]->[0] and @field_data[4]->[1] { @@ -558,15 +570,15 @@ sub replace_save_php #a special case { push @fields, "'$_->[0]' => '$_->[1]'"; if ($negatives{$_->[0]}) - { + { my @temp; my $count = 3; while ($count < scalar(@$_)) { - push @temp, "'$_->[$count]' => '$_->[$count]'"; + push @temp, "'$_->[$count]' => '$_->[$count]'"; $count++; } - push @negatives, "'$_->[0]' => array(".join(',', @temp).")"; + push @negatives, "'$_->[0]' => array(".join(',', @temp).")"; } } } @@ -581,7 +593,7 @@ sub replace_sql #a special case { my $text = shift; my $replace = ''; - for (grep{$_->[0] and $_->[1]} @_) + for (grep{$_->[0] and $_->[1]} @_) { next if $_->[0] eq 'redirect'; $replace .= $_->[0]." TEXT,\n" if $_->[1] !~ /^date$/; @@ -605,15 +617,15 @@ sub replace_view_php #a special case (They're all special cases aren' $selname = $1; goto go; } - + goto go if $_ =~ s/()/$1$2$3/; #TEXTAREA - + goto go if $_ =~ s/(]*)/$1$2$3$4 value=""/; #TEXT - + goto go if $_ =~ s/(]*)/$1$2$3$4$5$6 /; #CHECKBOX-GROUP - + goto go if $_ =~ s/(]*)/$1$2$3$4$5 /; #CHECKBOX - + goto go if $_ =~ s/(]*)/$1$2$3$4$5 /; #RADIO-GROUP goto go if $_ =~ s/( - -
. + * + * @package OpenEMR + * @author Larry Lart + * @link http://www.open-emr.org + */ include_once("../../globals.php"); include_once("$srcdir/api.inc"); @@ -20,13 +34,13 @@ $age = getPatientAge($result["DOB_YMD"]); // Function: getPatientDateOfLastEncounter function getPatientDateOfLastEncounter( $nPid ) { - $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max - FROM openemr_postcalendar_events - WHERE pc_pid = $nPid - AND pc_apptstatus = '@' - AND ( pc_catid = 12 OR pc_catid = 16 ) + $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max + FROM openemr_postcalendar_events + WHERE pc_pid = $nPid + AND pc_apptstatus = '@' + AND ( pc_catid = 12 OR pc_catid = 16 ) AND pc_eventDate >= '2007-01-01'"); - + // now check if there was a previous encounter if( $strEventDate['max'] != "" ) return( $strEventDate['max'] ); @@ -37,12 +51,12 @@ function getPatientDateOfLastEncounter( $nPid ) $m_strEventDate = getPatientDateOfLastEncounter( $result['pid'] ); // get autosave id -$vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_intakeverslag +$vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_intakeverslag WHERE pid = ".$_SESSION["pid"]. " AND groupname='".$_SESSION["authProvider"]. "' AND user='".$_SESSION["authUser"]."' AND authorized=$userauthorized AND activity=1 - AND autosave_flag=1 + AND autosave_flag=1 ORDER by id DESC limit 1" ); //$obj = formFetch("form_intakeverslag", $vectAutosave['id']); @@ -50,7 +64,7 @@ $vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form if( $vectAutosave['id'] && $vectAutosave['id'] != "" && $vectAutosave['id'] > 0 ) { $obj = formFetch("form_intakeverslag", $vectAutosave['id']); - + } else { $obj = formFetch("form_intakeverslag", (int)$_GET["id"] ); @@ -64,6 +78,7 @@ if( $tmpDate && $tmpDate != '0000-00-00 00:00:00' ) $m_strEventDate = $tmpDate; + topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> @@ -72,8 +87,6 @@ include_once("$srcdir/api.inc"); //$obj = formFetch("form_intakeverslag", (int)$_GET["id"]); ?> - - - - - - - - - - + + + + $(document).ready(function(){ autosave(); + $('.datepicker').datetimepicker({ + + + + + + }); }); function delete_autosave( ) @@ -112,7 +128,7 @@ function delete_autosave( ) { type: "POST", url: "../../forms/intakeverslag/delete_autosave.php", - data: "id=" + + data: "id=" + , cache: false, success: function( message ) @@ -121,7 +137,7 @@ function delete_autosave( ) } }); return true; - + } else { return false; @@ -132,7 +148,7 @@ function delete_autosave( ) function autosave( ) { var t = setTimeout("autosave()", 20000); - + var a_intakedatum = $("#intakedatum").val(); var a_reden_van_aanmelding = $("#reden_van_aanmelding").val(); var a_klachten_probleemgebieden = $("#klachten_probleemgebieden").val(); @@ -150,14 +166,14 @@ function autosave( ) var a_indruk_observaties = $("#indruk_observaties").val(); var a_beschrijvende_conclusie = $("#beschrijvende_conclusie").val(); var a_behandelvoorstel = $("#behandelvoorstel").val(); - + if( a_intakedatum.length > 0 || a_reden_van_aanmelding.length > 0 ) { $.ajax( { type: "POST", url: "../../forms/intakeverslag/autosave.php", - data: "id=" + + + data: "id=" + + "&intakedatum=" + $("#intakedatum").val() + "&reden_van_aanmelding=" + a_reden_van_aanmelding + "&klachten_probleemgebieden=" + a_klachten_probleemgebieden + @@ -196,14 +212,11 @@ function autosave( ) @@ -255,7 +268,7 @@ function autosave( )
: -: yyyy-mm-dd'> -[?]'> +: yyyy-mm-dd'> - -
-
@@ -267,10 +280,6 @@ function autosave( ) onclick="top.restoreSession()">[] - -
. + * + * @package OpenEMR + * @author Larry Lart + * @link http://www.open-emr.org + */ include_once("../../globals.php"); include_once("$srcdir/api.inc"); @@ -20,13 +34,13 @@ $provider_results = sqlQuery("select * from users where username='" . $_SESSION{ function getPatientDateOfLastEncounter( $nPid ) { // get date of last encounter F103 or F153 - $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max - FROM openemr_postcalendar_events - WHERE pc_pid = $nPid - AND pc_apptstatus = '@' - AND ( pc_catid = 17 OR pc_catid = 25 OR pc_catid = 13 OR pc_catid = 26 ) + $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max + FROM openemr_postcalendar_events + WHERE pc_pid = $nPid + AND pc_apptstatus = '@' + AND ( pc_catid = 17 OR pc_catid = 25 OR pc_catid = 13 OR pc_catid = 26 ) AND pc_eventDate >= '2007-01-01'"); - + // now check if there was a previous encounter if( $strEventDate['max'] != "" ) return( $strEventDate['max'] ); @@ -37,21 +51,21 @@ function getPatientDateOfLastEncounter( $nPid ) $m_strEventDate = getPatientDateOfLastEncounter( $result['pid'] ); // get last saved id for intakeverslag -$vectIntakeverslagQuery = sqlQuery( "SELECT id FROM form_intakeverslag +$vectIntakeverslagQuery = sqlQuery( "SELECT id FROM form_intakeverslag WHERE pid = ".$_SESSION["pid"]. " AND groupname='".$_SESSION["authProvider"]. "' AND user='".$_SESSION["authUser"]."' AND authorized=$userauthorized AND activity=1 - AND autosave_flag=0 + AND autosave_flag=0 ORDER by id DESC limit 1" ); // get autosave id for Psychiatrisch Onderzoek -$vectAutosavePO = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_psychiatrisch_onderzoek +$vectAutosavePO = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_psychiatrisch_onderzoek WHERE pid = ".$_SESSION["pid"]. " AND groupname='".$_SESSION["authProvider"]. "' AND user='".$_SESSION["authUser"]."' AND authorized=$userauthorized AND activity=1 - AND autosave_flag=1 + AND autosave_flag=1 ORDER by id DESC limit 1" ); //fetch data from INTAKE-VERSLAG @@ -60,7 +74,7 @@ $obj_iv = formFetch("form_intakeverslag", $vectIntakeverslagQuery['id']); $obj_po = formFetch("form_psychiatrisch_onderzoek", $vectAutosavePO['id']); ///////////////// // here we mix the data -// Reden van aanmelding +// Reden van aanmelding if( $obj_po['reden_van_aanmelding'] != '' ) $obj['reden_van_aanmelding'] = $obj_po['reden_van_aanmelding']; elseif( $obj_iv['reden_van_aanmelding'] != '' ) @@ -112,13 +126,12 @@ if( $tmpDate && $tmpDate != '0000-00-00 00:00:00' ) $m_strEventDate = $tmpDate; + - - topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> - + topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> - - - - - - - - + + + + $(document).ready(function(){ autosave(); + $('.datepicker').datetimepicker({ + + + + + + }); }); @@ -159,7 +175,7 @@ function delete_autosave( ) { type: "POST", url: "../../forms/psychiatrisch_onderzoek/delete_autosave.php", - data: "id=" + + data: "id=" + , cache: false, success: function( message ) @@ -168,7 +184,7 @@ function delete_autosave( ) } }); return true; - + } else { return false; @@ -180,7 +196,7 @@ function delete_autosave( ) function autosave( ) { var t = setTimeout("autosave()", 20000); - + var a_datum_onderzoek = $("#datum_onderzoek").val(); var a_reden_van_aanmelding = $("#reden_van_aanmelding").val(); var a_conclusie_van_intake = $("#conclusie_van_intake").val(); @@ -189,14 +205,14 @@ function autosave( ) var a_psychiatrisch_onderzoek = $("#psychiatrisch_onderzoek").val(); var a_beschrijvende_conclusie = $("#beschrijvende_conclusie").val(); var a_behandelvoorstel = $("#behandelvoorstel").val(); - + if( a_datum_onderzoek.length > 0 || a_reden_van_aanmelding.length > 0 ) { $.ajax( { type: "POST", url: "../../forms/psychiatrisch_onderzoek/autosave.php", - data: "id=" + + + data: "id=" + + "&datum_onderzoek=" + $("#datum_onderzoek").val() + "&reden_van_aanmelding=" + a_reden_van_aanmelding + "&conclusie_van_intake=" + a_conclusie_van_intake + @@ -217,7 +233,7 @@ function autosave( ) } - +


@@ -225,14 +241,11 @@ function autosave( ) @@ -259,8 +272,8 @@ function autosave( )
: -: yyyy-mm-dd'> -[?]'> +: yyyy-mm-dd'> + - -
-
@@ -271,10 +284,6 @@ function autosave( ) " class="link_submit" onclick="delete_autosave();top.restoreSession()">[]
- -
. + * + * @package OpenEMR + * @author Larry Lart + * @link http://www.open-emr.org + */ include_once("../../globals.php"); include_once("$srcdir/api.inc"); @@ -20,13 +34,13 @@ $provider_results = sqlQuery("select * from users where username='" . $_SESSION{ function getPatientDateOfLastEncounter( $nPid ) { // get date of last encounter F103 or F153 - $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max - FROM openemr_postcalendar_events - WHERE pc_pid = $nPid - AND pc_apptstatus = '@' - AND ( pc_catid = 17 OR pc_catid = 25 OR pc_catid = 13 OR pc_catid = 26 ) + $strEventDate = sqlQuery("SELECT MAX(pc_eventDate) AS max + FROM openemr_postcalendar_events + WHERE pc_pid = $nPid + AND pc_apptstatus = '@' + AND ( pc_catid = 17 OR pc_catid = 25 OR pc_catid = 13 OR pc_catid = 26 ) AND pc_eventDate >= '2007-01-01'"); - + // now check if there was a previous encounter if( $strEventDate['max'] != "" ) return( $strEventDate['max'] ); @@ -37,24 +51,24 @@ function getPatientDateOfLastEncounter( $nPid ) $m_strEventDate = getPatientDateOfLastEncounter( $result['pid'] ); // get autosave id for Psychiatrisch Onderzoek -$vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_psychiatrisch_onderzoek +$vectAutosave = sqlQuery( "SELECT id, autosave_flag, autosave_datetime FROM form_psychiatrisch_onderzoek WHERE pid = ".$_SESSION["pid"]. " AND groupname='".$_SESSION["authProvider"]. "' AND user='".$_SESSION["authUser"]."' AND authorized=$userauthorized AND activity=1 - AND autosave_flag=1 + AND autosave_flag=1 ORDER by id DESC limit 1" ); if( $vectAutosave['id'] && $vectAutosave['id'] != "" && $vectAutosave['id'] > 0 ) { $obj = formFetch("form_psychiatrisch_onderzoek", $vectAutosave['id']); - + } else { $obj = formFetch("form_psychiatrisch_onderzoek", $_GET["id"] ); } - + $tmpDate = stripslashes($obj{"datum_onderzoek"}); if( $tmpDate && $tmpDate != '0000-00-00 00:00:00' ) $m_strEventDate = $tmpDate; @@ -63,11 +77,11 @@ if( $tmpDate && $tmpDate != '0000-00-00 00:00:00' ) $m_strEventDate = $tmpDate; + topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0> - - - - - - - - - + + + + $(document).ready(function(){ autosave(); + $('.datepicker').datetimepicker({ + + + + + + }); }); @@ -108,7 +125,7 @@ function delete_autosave( ) { type: "POST", url: "../../forms/psychiatrisch_onderzoek/delete_autosave.php", - data: "id=" + + data: "id=" + , cache: false, success: function( message ) @@ -117,7 +134,7 @@ function delete_autosave( ) } }); return true; - + } else { return false; @@ -129,7 +146,7 @@ function delete_autosave( ) function autosave( ) { var t = setTimeout("autosave()", 20000); - + var a_datum_onderzoek = $("#datum_onderzoek").val(); var a_reden_van_aanmelding = $("#reden_van_aanmelding").val(); var a_conclusie_van_intake = $("#conclusie_van_intake").val(); @@ -138,14 +155,14 @@ function autosave( ) var a_psychiatrisch_onderzoek = $("#psychiatrisch_onderzoek").val(); var a_beschrijvende_conclusie = $("#beschrijvende_conclusie").val(); var a_behandelvoorstel = $("#behandelvoorstel").val(); - + if( a_datum_onderzoek.length > 0 || a_reden_van_aanmelding.length > 0 ) { $.ajax( { type: "POST", url: "../../forms/psychiatrisch_onderzoek/autosave.php", - data: "id=" + + + data: "id=" + + "&datum_onderzoek=" + $("#datum_onderzoek").val() + "&reden_van_aanmelding=" + a_reden_van_aanmelding + "&conclusie_van_intake=" + a_conclusie_van_intake + @@ -154,7 +171,7 @@ function autosave( ) "&psychiatrisch_onderzoek=" + a_psychiatrisch_onderzoek + "&beschrijvende_conclusie=" + a_beschrijvende_conclusie + "&behandelvoorstel=" + a_behandelvoorstel + - "&mode=update" + "&mode=update" , cache: false, success: function( message ) @@ -180,14 +197,11 @@ include_once("$srcdir/api.inc"); @@ -209,7 +223,7 @@ include_once("$srcdir/api.inc");
: -: yyyy-mm-dd'> -[?]'> +: yyyy-mm-dd'> - -
-
@@ -221,10 +235,6 @@ include_once("$srcdir/api.inc"); onclick="delete_autosave();top.restoreSession()">[] - -
diff --git a/interface/orders/orders_results.php b/interface/orders/orders_results.php index 2304a4ad0..8fc20e650 100644 --- a/interface/orders/orders_results.php +++ b/interface/orders/orders_results.php @@ -1,24 +1,24 @@ -* Copyright (C) 2017 Brady Miller -* -* LICENSE: This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -* @package OpenEMR -* @author Rod Roark -* @author Brady Miller -* @link http://www.open-emr.org -*/ + * Copyright (C) 2010-2010 Rod Roark + * Copyright (C) 2017 Brady Miller + * + * LICENSE: This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * @package OpenEMR + * @author Rod Roark + * @author Brady Miller + * @link http://www.open-emr.org + */ require_once("../globals.php"); require_once("$srcdir/acl.inc"); -- 2.11.4.GIT