Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
714 changes: 714 additions & 0 deletions app/Includes/commonfunctions.php

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions app/Includes/dropdownlists.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

# This class require_onces functions to access and use the different drop down lists within
# this application

/**
* function to return the results of an options query as array. This function assumes that
* the query returns two columns optionvalue and optiontext which correspond to the corresponding key
* and values respectively.
*
* The selection of the names is to avoid name collisions with database reserved words
*
* @param String $query The database query
*
* @return Array of values for the query
*/
function getOptionValuesFromDatabaseQuery($query) {
//$conn = getDatabaseConnection();
//echo $query;
$result = DB::select($query);
//print_r($result);
//exit;
$valuesarray = array();
foreach ($result as $value) {
$valuesarray[$value->optionvalue] = htmlentities($value->optiontext);
}
//print_r($valuesarray);
//exit;
return decodeHtmlEntitiesInArray($valuesarray);
}


function getActiveTeachers($status = '1'){
$teachers = \App\Employee::where('status', '=', $status)
->where('role_id','=',2)
->pluck('name', 'id');
return $teachers;
}

function getUnassignedBikesforHub($hubid){
$valuesquery = "SELECT id as optionvalue, numberplate as optiontext FROM equipment
WHERE hubid = '".$hubid."' ORDER BY optiontext";
return getOptionValuesFromDatabaseQuery($valuesquery);
}

function getGenerateHtmlforAjaxSelect($options, $empty_string = 'Select One'){
$select_string = '<option value="">'.$empty_string.'</option>';
foreach($options as $key => $value){
$select_string .= '<option value="'.$key.'">'.$value.'</option>';
}
return $select_string;
}

?>
10 changes: 5 additions & 5 deletions app/config/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
return [

'DISTRICT_ID' => '1',
'DISTRICT_NAME' => 'WAKISO',
'FACILITY_LEVEL_ID' => '2',
'DISTRICT_NAME' => 'KABAROLE',
'FACILITY_LEVEL_ID' => '1',
'FACILITY_ID' => '1',
'FACILITY_NAME' => 'ENTEBBE GENERAL HOSPITAL LABORATORY',
'FACILITY_CODE' => 'ENTB01',
'FACILITY_NAME' => 'FORT PORTAL REGIONAL REFERRAL HOSPITAL',
'FACILITY_CODE' => 'FPRRHL/PRO/025 F2',
'FACILITY_OWNERSHIP_ID' => '1',
'FIN_YEAR_ID' => '1',
'FIN_YEAR_NAME' => '2018/2019',
'FIN_YEAR_NAME' => '2019/2020',
'INCOMING_STOCK_FLAG' => 'I',
'OUTGOING_STOCK_FLAG' => 'O',
'LOSSES_ADJUSTMENTS_STOCK_FLAG' => 'A',
Expand Down
2 changes: 1 addition & 1 deletion app/config/kblis.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
|--------------------------------------------------------------------------
|
*/
'address-info' => 'Plot 39/43 Kampala Road, P.O. BOX 29, Entebbe <br> Tel: +256 773 547 114, +256 753 385 163 <br> Email: info.ebhl@gmail.com <br><br>',
'address-info' => 'Plot No.1 Kamwenge Road P.O. BOX 10 <br> FPRRHL/PRO/025 F2: Laboratory Report Form <br><br>',

/*
|--------------------------------------------------------------------------
Expand Down
Binary file added app/controllers.zip
Binary file not shown.
160 changes: 160 additions & 0 deletions app/controllers/DashboardController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
<?php
use Illuminate\Support\MessageBag;

class DashboardController extends Controller {


/**
* Display dashboard.
*
* @return Response
*/
public function index(){

$dateFrom = date('Y-m-01');
$dateTo =date('Y-m-d');

$from = Input::get('date_from');
$to = Input::get('date_to');

if(isset($from)){
$dateFrom= $from;
}else{
$from = $dateFrom;
}
if(isset($to)){
$dateTo = $to;
}else{
$to =$dateTo;
}



$patients = UnhlsVisit::whereBetween('created_at', [$from, $to]);
$patientCounts = $patients->count();
if($patientCounts > 0){
$outPatients = round($patients->whereVisitType('Out-Patient')->count() * 100/$patientCounts, 0);
}else{
$outPatients = 0.00;
}

$tests = UnhlsTest::whereBetween('time_created', [$from, $to]);
$testCounts =$tests->whereTestStatusId('5')->orWhere('test_status_id', '=', '4')->count();
$testsReffered =$tests->whereTestStatusId('8')->count();

$samples = UnhlsSpecimen::whereBetween('time_collected', [$from, $to]);
$sampleCounts = $samples->count();
if($sampleCounts > 0){
$samplesAccepted = round($samples->whereSpecimenStatusId('2')->count() * 100/$sampleCounts, 2);
}else{
$samplesAccepted = 0.00;
}
$samplesRejected = $samples->whereSpecimenStatusId('3')->count();

$staffCount = User::count();

// $testTypeID =TestType::getTestTypeIdByTestName('Malaria RDTs');

$getPrevalenceCounts = TestType::getPrevalenceCounts($from, $to, $testTypeID=0, $ageRange=null);
$tb = $hiv = $malaria = 0.00;

foreach($getPrevalenceCounts as $prevalence){
if ($prevalence['test'] == 'Malaria RDT'){
$malaria = $prevalence['rate'];
}
elseif ($prevalence['test'] == 'ZN'|| $prevalence['test']=='ZN stain for AFBS' || $prevalence['test']=='TB') {
$tb = $prevalence['rate'];
}
elseif($prevalence['test'] == 'HIV' || $prevalence['test'] == 'H.I.V'){
$hiv = $prevalence['rate'];
}
}


return View::make("dashboard.home")
->with('dateFrom', $dateFrom)
->with('dateTo', $dateTo)
->with('malaria', $malaria)
->with('tb', $tb)
->with('hiv', $hiv)
->with('patientCount', $patientCounts)
->with('outPatients', $outPatients)
->with('testCounts', $testCounts)
->with('sampleCounts', $sampleCounts)
->with('samplesAccepted', $samplesAccepted)
->with('samplesRejected', $samplesRejected)
->with('staff', $staffCount);
}

/**
* Show the form for creating a new resource.
* GET /dashboard/create
*
* @return Response
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
* POST /dashboard
*
* @return Response
*/
public function store()
{
//
}

/**
* Display the specified resource.
* GET /dashboard/{id}
*
* @param int $id
* @return Response
*/
public function show($id)
{
//
}

/**
* Show the form for editing the specified resource.
* GET /dashboard/{id}/edit
*
* @param int $id
* @return Response
*/
public function edit($id)
{
//
}

/**
* Update the specified resource in storage.
* PUT /dashboard/{id}
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
}

/**
* Remove the specified resource from storage.
* DELETE /dashboard/{id}
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}


}
Loading