DIFF -U dump of demographics.php
From OpenEMR Project Wiki
--- OpenEMR-DevTip/openemr/interface/patient_file/summary/demographics.php 2009-08-20 15:57:48.000000000 -0700 +++ mi2-ui/openemr/interface/patient_file/summary/demographics.php 2009-12-15 13:48:35.000000000 -0800 @@ -6,6 +6,7 @@ require_once("$srcdir/classes/InsuranceCompany.class.php"); require_once("./patient_picture.php"); require_once("$srcdir/options.inc.php"); + require_once("../history/history.inc.php"); if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { include_once("$srcdir/pid.inc"); setpid($_GET['set_pid']); @@ -30,12 +31,16 @@ <head> <?php html_header_show();?> <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css"> +<link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" /> <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style> <script type="text/javascript" src="../../../library/textformat.js"></script> <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script> <script type="text/javascript" src="../../../library/dynarch_calendar_en.js"></script> <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script> <script type="text/javascript" src="../../../library/dialog.js"></script> +<script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script> +<script type="text/javascript" src="../../../library/js/common.js"></script> +<script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script> <script language="JavaScript"> var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>'; @@ -102,9 +107,78 @@ } </script> + +<script type="text/javascript"> +/// todo, move this to a common library + +function toggle( target, div ) { + + $mode = $(target).find(".indicator").text(); + if ( $mode == "collapse" ) { + $(target).find(".indicator").text( "expand" ); + $(div).hide(); + } else { + $(target).find(".indicator").text( "collapse" ); + $(div).show(); + } + +} + +$(document).ready(function(){ + + $("#dem_view").click( function() { + toggle( $(this), "#DEM" ); + }); + + $("#his_view").click( function() { + toggle( $(this), "#HIS" ); + }); + + $("#ins_view").click( function() { + toggle( $(this), "#INSURANCE" ); + }); + + $("#notes_view").click( function() { + toggle( $(this), "#notes_div" ); + }); + + // load divs + $("#stats_div").load("stats.php"); + $("#notes_div").load("pnotes_fragment.php"); + + // fancy box + enable_modals(); + + tabbify(); + + // special size for + $(".large_modal").fancybox( { + 'overlayOpacity' : 0.0, + 'showCloseButton' : true, + 'frameHeight' : 600, + 'frameWidth' : 1000 + }); + + // special size for + $(".medium_modal").fancybox( { + 'overlayOpacity' : 0.0, + 'showCloseButton' : true, + 'frameHeight' : 500, + 'frameWidth' : 800 + }); + +}); + +</script> + +<style type="css/text"> +</style> + </head> <body class="body_top"> +<table cellspacing='0' cellpadding='0' border='0'> +<tr> <?php $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD"); $result2 = getEmployerData($pid); @@ -123,16 +197,31 @@ if ($thisauth == 'write') { foreach (pic_array() as $var) {print $var;} - echo "<p><a href='demographics_full.php'"; + echo "<td><a href='demographics_full.php'"; if (! $GLOBALS['concurrent_layout']) echo " target='Main'"; echo " onclick='top.restoreSession()'><span class='title'>" . - xl('Demographics') . "</span>" . - " <span class='more'>$tmore</span></a>"; + getPatientName($pid) . "</span></a> </td>"; + + echo "<td><a class='css_button' href='demographics_full.php'"; + if (! $GLOBALS['concurrent_layout']) echo " target='Main'"; + echo " onclick='top.restoreSession()'><span>Edit</span></a></td>"; + if (acl_check('admin', 'super')) { - echo " <a href='' onclick='return deleteme()'>" . - "<span class='more' style='color:red'>(".xl('Delete').")</span></a>"; + echo "<td><a class='css_button iframe' href='../deleter.php?patient=" . $pid . "'>" . + "<span>".xl('Delete')."</span></a></td>"; + } + if ($GLOBALS['oer_config']['ws_accounting']['enabled']) { + // Show current balance and billing note, if any. + echo "<td> <span class='bold'><font color='#ee6600'>" . xl('Balance Due') . ": " . xl('$') . + get_patient_balance($pid) . "</font><br />"; + if ($result['genericname2'] == 'Billing') { + xl('Billing Note') . ":"; + echo "<span class='bold'><font color='red'>" . + $result['genericval2'] . "</font></span>"; + } + echo "</span></td>"; } - echo "</p>\n"; + } // Get the document ID of the patient ID card if access to it is wanted here. @@ -148,21 +237,112 @@ if ($tmp) $document_id = $tmp['id']; } ?> +</tr> + +<tr> +<td class="small" colspan='4'> +<a href="rx_frameset.php" class='iframe medium_modal'>Rx</a> +| +<a href="../history/history.php" class='iframe large_modal'>History</a> +| +<a href="../report/patient_report.php" class='iframe medium_modal'>Report</a> +| +<a href="../../../controller.php?document&list&patient_id=<?php echo $pid;?>" class='iframe medium_modal'>Documents</a> +| +<a href="../transaction/transactions.php" class='iframe large_modal'>Transactions</a> +</div> +</td> +</tr> +</table> <!-- end header --> -<table border="0" width="100%"> +<div style='margin-top:10px'> <!-- start main content div --> +<table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> - <!-- Left column of main table; contains another table --> <td align="left" valign="top"> + <!-- start left column div --> + <div style='float:left; margin-right:20px'> + <table cellspacing=0 cellpadding=0> + <tr> + <td> + <div class="section-header"> + <a href='javascript:;' class='small' id='dem_view'><span class='text'><b>Demographics</b></span> (<span class="indicator">collapse</span>)</a> + </div> + + <!-- Demographics --> <div id="DEM"> - <table border='0' cellpadding='0'> -<?php display_layout_rows('DEM', $result, $result2); ?> - </table> + <ul class="tabNav"> + <?php display_layout_tabs('DEM', $result, $result2); ?> + </ul> + <div class="tabContainer"> + <?php display_layout_tabs_data('DEM', $result, $result2); ?> + </div> </div> + </td> + </tr> + + <tr> + <td> + <?php + + $insurance_count = 0; + foreach (array('primary','secondary','tertiary') as $instype) { + $enddate = 'Present'; + + $query = "SELECT * FROM insurance_data WHERE " . + "pid = '$pid' AND type = '$instype' " . + "ORDER BY date DESC"; + $res = sqlStatement($query); + while( $row = sqlFetchArray($res) ) { + if ($row['provider'] ) $insurance_count++; + } + } + + if ( $insurance_count > 0 ) { + + ?> + <div class="section-header"> + <a href='javascript:;' class='small' id='ins_view'><span class='text'><b>Insurance</b></span> (<span class="indicator">collapse</span>)</a> + </div> + + <div id="INSURANCE"> - <table border='0' cellpadding='0' width='100%'> <?php + if ( $insurance_count > 1 ) { + + ?><ul class="tabNav"><?php + ///////////////////////////////// INSURANCE SECTION + $first = true; + foreach (array('primary','secondary','tertiary') as $instype) { + + $query = "SELECT * FROM insurance_data WHERE " . + "pid = '$pid' AND type = '$instype' " . + "ORDER BY date DESC"; + $res = sqlStatement($query); + $enddate = 'Present'; + + while( $row = sqlFetchArray($res) ) { + if ($row['provider'] ) { + + $ins_description = ucfirst($instype); + $ins_description .= strcmp($enddate, 'Present') != 0 ? " (Old)" : ""; + ?> + <li <?php echo $first ? 'class="current"' : '' ?>><a href="/play/javascript-tabbed-navigation/"><?php xl(ucfirst($ins_description),'e'); ?></a></li> + <?php + $first = false; + } + $enddate = $row['date']; + } + } + + ?></ul><?php + + } ?> + + <div class="tabContainer"> + <?php + $first = true; foreach (array('primary','secondary','tertiary') as $instype) { $enddate = 'Present'; @@ -170,22 +350,27 @@ "pid = '$pid' AND type = '$instype' " . "ORDER BY date DESC"; $res = sqlStatement($query); + while ($row = sqlFetchArray($res)) { + if ($row['provider']) { + ?> + <div class="tab <?php echo $first ? 'current' : '' ?>"> + <table border='0' cellpadding='0' width='100%'> + <?php $icobj = new InsuranceCompany($row['provider']); $adobj = $icobj->get_address(); $insco_name = trim($icobj->get_name()); ?> <tr> <td valign='top' colspan='3'> - <br><span class='bold'> + <span class='text'> <?php if (strcmp($enddate, 'Present') != 0) echo "Old "; ?> <?php xl(ucfirst($instype) . ' Insurance','e'); ?> <?php if (strcmp($row['date'], '0000-00-00') != 0) { ?> <?php xl(' from','e'); echo ' ' . $row['date']; ?> <?php } ?> - <?php xl(' until ','e'); echo $enddate; ?> - :</span> + <?php xl(' until ','e'); echo $enddate; ?>:</span> </td> </tr> <tr> @@ -257,23 +442,54 @@ <td valign='top'></td> <td valign='top'></td> </tr> + + </table> + </div> <?php + } // end if ($row['provider']) $enddate = $row['date']; + $first = false; } // end while } // end foreach ///////////////////////////////// END INSURANCE SECTION - ?> - </table> + </div> + + <?php } // ?> + + </td> + </tr> + + <tr> + <td width='650px'> + <div class="section-header"> + <a href='javascript:;' class='small' id='notes_view'><span class='text'><b>Notes</b></span> (<span class="indicator">collapse</span>)</a> + </div> + <!-- Demographics --> + <div id='notes_div' class='tab current' style='height:auto' > + <br/> + <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/> + </div> </td> + </tr> - <!-- Right column of main table --> + </table> + + </div> - <td valign="top" class="text"> -<?php + </div> + <!-- end left column div --> + + <!-- start right column div --> + <div class='text'> + <table> + <tr> + <td> + + <?php // This is a feature for a specific client. -- Rod if ($GLOBALS['cene_specific']) { echo " <br />\n"; @@ -352,18 +568,6 @@ echo " </form>\n"; } -if ($GLOBALS['oer_config']['ws_accounting']['enabled']) { - // Show current balance and billing note, if any. - echo "<span class='bold'><font color='#ee6600'>" . xl('Balance Due') . ": " . xl('$') . - get_patient_balance($pid) . "</font><br />"; - if ($result['genericname2'] == 'Billing') { - xl('Billing Note') . ":"; - echo "<span class='bold'><font color='red'>" . - $result['genericval2'] . "</font></span>"; - } - echo "</span><br />"; -} - // If there is a patient ID card, then show a link to it. if ($document_id) { echo "<a href='" . $web_root . "/controller.php?document&retrieve" . @@ -384,13 +588,30 @@ $res = sqlStatement($query); if (isset($res) && $res != null) { - echo "<div id='appts'><span id='apptstitle'>" . xl('Upcoming Appointments') . "</span><br>"; - // link to create a new appointment - echo "<span class='link' style='margin: 2px 0px 5px 0px; width:100%; text-align: center;'>"; - echo "<a href='#' onclick='return newEvt()'>".xl('New Appointment')."</a>"; - echo "</span><br>"; + ?> + + <div> + <div style='float:left; margin-right: 5px'> + <span class='text'><b><?php echo xl('Appointments')?></b></span> + </div> + <div> + <div> + <a class="iframe css_button_small" href="../../main/calendar/add_edit_event.php?patientid=<?php echo $pid ?>"> + <span><?php echo xl('Add') ?></span> + </a> + </div> + </div> + </div> + + <?php } + ?> + <br/> + <div class='small' style='margin-top: -10px'> + <?php + $count = 0; while($row = sqlFetchArray($res)) { + $count++; $dayname = date("l", strtotime($row['pc_eventDate'])); $dispampm = "am"; $disphour = substr($row['pc_startTime'], 0, 2) + 0; @@ -403,29 +624,41 @@ if ($row['pc_hometext'] != "") { $etitle = xl('Comments').": ".addslashes($row['pc_hometext'])."\r\n".$etitle; } - echo "<a href='javascript:oldEvt(" . $row['pc_eid'] . ")' title='$etitle'>"; + echo "<a class='iframe' href='../../main/calendar/add_edit_event.php?eid=" . $row['pc_eid'] . "' "; echo "<b>" . xl($dayname) . ", " . $row['pc_eventDate'] . "</b><br>"; echo "$disphour:$dispmin " . xl($dispampm) . " " . xl_appt_category($row['pc_catname']) . "<br>\n"; echo $row['fname'] . " " . $row['lname'] . "</a><br> <br>\n"; } - if (isset($res) && $res != null) { echo "</div>"; } + if (isset($res) && $res != null) { + if ( $count < 1 ) { echo "None."; } + echo "</div>"; + } } ?> + </div> + + <div id='stats_div' style='float:left'> + <br/> + <div style='margin-left:10px' class='text'><image src='../../pic/ajax-loader.gif'/></div><br/> + </div> + + </td> + </tr> + </table> + + </div> <!-- end right column div --> + </td> </tr> </table> +</div> <!-- end main content div --> + <?php if ($GLOBALS['concurrent_layout'] && $_GET['set_pid']) { ?> <script language='JavaScript'> - parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "','', ' ".xl('DOB').": ".$result['DOB_YMD']." ".xl('Age').": ".getPatientAge($result['DOB_YMD'])."'"; ?>); + parent.left_nav.setPatient(<?php echo "'" . addslashes($result['fname']) . " " . addslashes($result['lname']) . "',$pid,'" . addslashes($result['pubpid']) . "','', ' ".xl('DOB').": ".date("m-d-y",strtotime($result['DOB_YMD'])) ." ".xl('Age').": ".getPatientAge($result['DOB_YMD'])."'"; ?>); parent.left_nav.setRadio(window.name, 'dem'); -<?php if (!$_GET['is_new']) { // if new pt, do not load other frame ?> - var othername = (window.name == 'RTop') ? 'RBot' : 'RTop'; - parent.left_nav.forceDual(); - parent.left_nav.setRadio(othername, 'sum'); - parent.left_nav.loadFrame('sum1', othername, 'patient_file/summary/summary_bottom.php'); -<?php } ?> </script> <?php } ?>