Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
014e242
javascript to export table data as .xls file
vinay-easwaran Feb 23, 2024
6d2abb8
dynamic options for excel column names
vinay-easwaran Mar 7, 2024
7e192d8
updated query in export file
vinay-easwaran Mar 7, 2024
d19c828
patient custom fields selectable
vinay-easwaran Mar 8, 2024
eaa531e
get field list outside if condition
vinay-easwaran Mar 8, 2024
9e4ea43
reinstated old patient fields
vinay-easwaran Mar 8, 2024
e4f6ab3
new form for specimen custom fields with .php file for facilty based …
vinay-easwaran Mar 8, 2024
796ca7f
export to excel
Mar 8, 2024
8dc169d
Revert "export to excel"
Mar 8, 2024
27eecc4
push custom fields to headers
vinay-easwaran Mar 8, 2024
ccdbda5
push custom field name and value to header and rows
vinay-easwaran Mar 8, 2024
a0e342d
field name obfuscation
vinay-easwaran Mar 8, 2024
6d855be
Update htdocs/export/export_to_excel_get_custom_patient_fields.php
vinay-easwaran Mar 13, 2024
aa99c9a
Update htdocs/export/export_to_excel_get_custom_patient_fields.php
vinay-easwaran Mar 13, 2024
661910a
Update htdocs/export/export_to_excel_get_custom_patient_fields.php
vinay-easwaran Mar 13, 2024
b286599
demo feedback and updated sql
vinay-easwaran Mar 14, 2024
92bcda3
moved the tip to a tip box
vinay-easwaran Mar 14, 2024
8903ce3
Merge branch 'master' of https://github.com/C4G/BLIS into dev-vinay
vinay-easwaran Mar 20, 2024
4250228
fixed date picker bug
vinay-easwaran Mar 21, 2024
b0dd60b
survey and PR feedback
vinay-easwaran Mar 21, 2024
230b9e5
read only acess
Mar 27, 2024
3ac1fad
Merge pull request #85 from mobo1216/dev-mobo-2
vinay-easwaran Mar 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions htdocs/Language/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@
"HEIGHT" => "Height",
"FONT_SIZE" => "Font Size",
"COL_COUNT" => "Column-Count",
"CMD_REFRESH" => "Refresh"
"CMD_REFRESH" => "Refresh",
"SPECIMEN_CUSTOM_FIELDS" => "Specimen Custom Fields",
"PATIENT_CUSTOM_FIELDS" => "Patient Custom Fields"
) ,
"header" => array (
"TITLE" => "",
Expand Down Expand Up @@ -563,7 +565,7 @@
"TIPS_SPECIMEN" => "Select Specimen to view Report of all tests done on it",
"TIPS_TESTRECORDS" => "Select Site, Test Type, Date Interval and Fields to print Test Records.",
"TIPS_PENDINGTESTS" => "Select Site and Test Type to view tests pending at the site.",
"TIPS_DAILYLOGS" => "Print all records handled on a given day.",
"TIPS_DAILYLOGS" => "View/Print all records handled on a given day.",
"TIPS_INFECTIONSUMMARY" => "Select facility and date range to view infection graph and prevalence rates.",
"TIPS_COUNTS" => "Select Site and Date Interval to view number of Specimens or Tests Handled over the specified duration.",
"TIPS_TAT" => "Select Site and Date Interval to view average test-wise Turn around Times over the specified duration.",
Expand Down
6 changes: 4 additions & 2 deletions htdocs/Language/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@
"HEIGHT" => "Height",
"FONT_SIZE" => "Font Size",
"COL_COUNT" => "Column-Count",
"CMD_REFRESH" => "Refresh"
"CMD_REFRESH" => "Refresh",
"SPECIMEN_CUSTOM_FIELDS" => "Specimen Custom Fields",
"PATIENT_CUSTOM_FIELDS" => "Patient Custom Fields"
) ,
"header" => array (
"TITLE" => "",
Expand Down Expand Up @@ -563,7 +565,7 @@
"TIPS_SPECIMEN" => "Select Specimen to view Report of all tests done on it",
"TIPS_TESTRECORDS" => "Select Site, Test Type, Date Interval and Fields to print Test Records.",
"TIPS_PENDINGTESTS" => "Select Site and Test Type to view tests pending at the site.",
"TIPS_DAILYLOGS" => "Print all records handled on a given day.",
"TIPS_DAILYLOGS" => "View/Print all records handled on a given day.",
"TIPS_INFECTIONSUMMARY" => "Select facility and date range to view infection graph and prevalence rates.",
"TIPS_COUNTS" => "Select Site and Date Interval to view number of Specimens or Tests Handled over the specified duration.",
"TIPS_TAT" => "Select Site and Date Interval to view average test-wise Turn around Times over the specified duration.",
Expand Down
20 changes: 18 additions & 2 deletions htdocs/export/export_to_excel.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
$end_date = intval($_REQUEST['yyyy_to'])."-".intval($_REQUEST['mm_to'])."-".intval($_REQUEST['dd_to']);

$test_type_ids = $_REQUEST['test_types'];
$patient_custom_fields = $_REQUEST['patient_custom_fields'];
$specimen_custom_fields = $_REQUEST['specimen_custom_fields'];

$include_name = ($_REQUEST["include_patient_name"] == "true");
$include_sex = ($_REQUEST["include_patient_sex"] == "true");
Expand Down Expand Up @@ -100,6 +102,20 @@
"t.ts AS test_timestamp"
);

db_change($lab['db_name']);

foreach($patient_custom_fields as $patient_custom_field_id) {
$field_name = get_custom_field_name_patient($patient_custom_field_id);
array_push($headers, $field_name);
array_push($fields, "pcd.field_value");
}

foreach($specimen_custom_fields as $specimen_custom_field_id) {
$field_name = get_custom_field_name_specimen($specimen_custom_field_id);
array_push($headers, $field_name);
array_push($fields, "scd.field_value");
}

// Push additional field for test result - the headers for this will be generated separately
// Must be the last field! There is logic in the loop below that depends on it.
array_push($fields, "t.result AS test_result");
Expand All @@ -118,15 +134,15 @@
INNER JOIN specimen_type AS st ON s.specimen_type_id = st.specimen_type_id
INNER JOIN test AS t ON s.specimen_id = t.specimen_id
INNER JOIN patient AS p ON s.patient_id = p.patient_id
LEFT JOIN patient_custom_data AS pcd ON p.patient_id = pcd.patient_id
LEFT JOIN specimen_custom_data AS scd ON s.specimen_id = scd.specimen_id
WHERE s.date_collected BETWEEN '$start_date' AND '$end_date'
AND t.test_type_id = '$test_type_id';
EOQ;


$sheet = $objPHPExcel->createSheet();

db_change($lab['db_name']);

// Grab all the measures for this test type from the database.
$test_type = TestType::getById($test_type_id, $lab['lab_config_id']);

Expand Down
49 changes: 49 additions & 0 deletions htdocs/export/export_to_excel_get_custom_patient_fields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

require_once("../includes/composer.php");
require_once("../includes/db_lib.php");
require_once("../includes/db_util.php");
require_once("../includes/user_lib.php");

$lab_id = intval($_REQUEST['lab_config_id']);
if (!$lab_id) {
header('HTTP/1.1 404 Not Found', true, 404);
echo "[]";
exit;
}

$current_user_id = $_SESSION['user_id'];
$current_user = get_user_by_id($current_user_id);

$unauthorized = true;

if (is_super_admin($current_user) || is_country_dir($current_user)) {
$unauthorized = false;
}

if ($unauthorized) {
// If the user is not a super admin or country director, they should only
// be able to access data for their own lab, and only if they are an admin.
if ($lab_id == $current_user->labConfigId && is_admin($current_user)) {
$unauthorized = false;
}
}

if ($unauthorized) {
header('HTTP/1.1 401 Unauthorized', true, 401);
echo "You do not have permission to view this page.";
exit;
}


$lab_config = LabConfig::getById($lab_id);
$custom_field_list = $lab_config->getPatientCustomFields();

foreach($custom_field_list as $idx => $custom_field) {
echo '{ "id": '.$custom_field->id.', "fieldName": "'.$custom_field->fieldName.'" }';
if ($idx < count($output_fields) - 1) {
echo ",\n";
}
}

echo "\n]";
49 changes: 49 additions & 0 deletions htdocs/export/export_to_excel_get_custom_specimen_fields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

require_once("../includes/composer.php");
require_once("../includes/db_lib.php");
require_once("../includes/db_util.php");
require_once("../includes/user_lib.php");

$lab_id = intval($_REQUEST['lab_config_id']);
if (!$lab_id) {
header('HTTP/1.1 404 Not Found', true, 404);
echo "[]";
exit;
}

$current_user_id = $_SESSION['user_id'];
$current_user = get_user_by_id($current_user_id);

$unauthorized = true;

if (is_super_admin($current_user) || is_country_dir($current_user)) {
$unauthorized = false;
}

if ($unauthorized) {
// If the user is not a super admin or country director, they should only
// be able to access data for their own lab, and only if they are an admin.
if (count($lab_ids) == 1 && $lab_ids[0] == $current_user->labConfigId && is_admin($current_user)) {
$unauthorized = false;
}
}

if ($unauthorized) {
header('HTTP/1.1 401 Unauthorized', true, 401);
echo "You do not have permission to view this page.";
exit;
}


$lab_config = LabConfig::getById($_REQUEST['lab_config_id']);
$custom_field_list = $lab_config->getSpecimenCustomFields();

foreach($custom_field_list as $idx => $custom_field) {
echo '{ "id": '.$custom_field->id.', "fieldName": "'.$custom_field->fieldName.'" }';
if ($idx < count($output_fields) - 1) {
echo ",\n";
}
}

echo "\n]";
54 changes: 39 additions & 15 deletions htdocs/includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,47 @@
if (isset($top_menu_options)) {
foreach ($top_menu_options as $key => $value) {
//echo "hello "."<br/>";

echo "<li ";
echo "><a href='".$value."' ";
if (
(strpos($_SERVER['PHP_SELF'], $value) !== false)
&& !(strpos($_SERVER['PHP_SELF'], "_home.php") !== false && $value == "home.php")
) {
# Highlight current page tab
echo " class='here' ";
}
if (strpos($key, LangUtil::$pageTerms['MENU_BACKUP']) !== false) {
// echo " target='_blank' ";
if($_SESSION['user_level'] == $READONLYMODE){
if ($value == 'home.php' || $value == 'reports.php')
{
echo "<li ";
echo "><a href='".$value."' ";
if (
(strpos($_SERVER['PHP_SELF'], $value) !== false)
&& !(strpos($_SERVER['PHP_SELF'], "_home.php") !== false && $value == "home.php")
) {
# Highlight current page tab
echo " class='here' ";
}
if (strpos($key, LangUtil::$pageTerms['MENU_BACKUP']) !== false) {
// echo " target='_blank' ";
}
if (strpos($_SERVER['PHP_SELF'], "_home.php") !== false && strpos($value, "lab_configs.php") !== false) {
echo " class='here' ";
}
echo ">".$key."</a></li>";
}

}
if (strpos($_SERVER['PHP_SELF'], "_home.php") !== false && strpos($value, "lab_configs.php") !== false) {
echo " class='here' ";
else{
echo "<li ";
echo "><a href='".$value."' ";
if (
(strpos($_SERVER['PHP_SELF'], $value) !== false)
&& !(strpos($_SERVER['PHP_SELF'], "_home.php") !== false && $value == "home.php")
) {
# Highlight current page tab
echo " class='here' ";
}
if (strpos($key, LangUtil::$pageTerms['MENU_BACKUP']) !== false) {
// echo " target='_blank' ";
}
if (strpos($_SERVER['PHP_SELF'], "_home.php") !== false && strpos($value, "lab_configs.php") !== false) {
echo " class='here' ";
}
echo ">".$key."</a></li>";
}
echo ">".$key."</a></li>";

}
} ?>
<span id='backup_div' style='float:right;margin-right:15px;'>
Expand Down
30 changes: 30 additions & 0 deletions htdocs/includes/page_elems.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,36 @@ public function getLabUserTypeOptions($selected_value="")

}

public function getCustomPatientFieldCheckBoxes()
{
$lab_config = LabConfig::getById($_SESSION['lab_config_id']);
$custom_field_list = $lab_config->getPatientCustomFields();

if ( $lab_config ) { ?>
<?php
foreach($custom_field_list as $custom_field) {
echo '<input type="checkbox" name="patient_custom_fields[]" id='.$custom_field->id.' value='.$custom_field->id.' checked';
echo ">Include ". $custom_field->fieldName."</input><br/>";
}
?>
<?php }
}

public function getCustomSpecimenFieldCheckBoxes()
{
$lab_config = LabConfig::getById($_SESSION['lab_config_id']);
$custom_field_list = $lab_config->getSpecimenCustomFields();

if ( $lab_config ) { ?>
<?php
foreach($custom_field_list as $custom_field) {
echo '<input type="checkbox" name="specimen_custom_fields[]" id='.$custom_field->id.' value='.$custom_field->id.' checked';
echo ">Include ". $custom_field->fieldName."</input><br/>";
}
?>
<?php }
}

public function getSpecimenTypesSelect($lab_config_id)
{

Expand Down
Loading