Example #1
0
 function __construct()
 {
     $this->dateNow = date('Ymd');
     $this->timeNow = date('YmdHisO');
     $this->Encounter = new Encounter();
     $this->Facilities = new Facilities();
     $this->CombosData = new CombosData();
     $this->User = new User();
     $this->Patient = new Patient();
     $this->facility = $this->Facilities->getCurrentFacility(true);
 }
Example #2
0
 public function Header()
 {
     // Logo
     $siteLogo = site_path . '/logo.png';
     $image_file = file_exists($siteLogo) ? $siteLogo : ROOT . '/resources/images/gaiaehr_small_white.png';
     $y = 16;
     $x = 70;
     $f = new Facilities();
     $facility = $f->getCurrentFacility(true);
     $address1 = $facility['address'];
     $address2 = $facility['address_cont'];
     $address3 = $facility['city'] . ', ' . $facility['state'] . ' ' . $facility['postal_code'];
     $phone1 = '';
     $phone2 = 'Tel. ' . $facility['phone'];
     $phone3 = 'Fax ' . $facility['fax'];
     // Logo
     $this->Image($image_file, 10, 13, '', '', 'PNG', '', 'T', false, 1200, '', false, false, 0, false, false, false);
     // Address
     $this->SetFont('helvetica', '', 9);
     $this->SetY($y);
     $this->SetX($x);
     if ($address1 != '') {
         $this->Cell(95, 0, $address1, '', false, 'L', 0, '', 0, false, 'M', 'M');
     }
     $this->SetY($y + 4);
     $this->SetX($x);
     if ($address2 != '') {
         $this->Cell(95, 0, $address2, '', false, 'L', 0, '', 0, false, 'M', 'M');
     }
     $this->SetY($y + 8);
     $this->SetX($x);
     if ($address3 != '') {
         $this->Cell(95, 0, $address3, '', false, 'L', 0, '', 0, false, 'M', 'M');
     }
     // set phones
     $this->SetY($y);
     $this->SetX(165);
     if ($phone1 != '') {
         $this->Cell(0, 0, $phone1, '', false, 'R', 0, '', 0, false, 'M', 'M');
     }
     $this->SetY($y + 4);
     $this->SetX(165);
     if ($phone2 != '') {
         $this->Cell(0, 0, $phone2, '', false, 'R', 0, '', 0, false, 'M', 'M');
     }
     $this->SetY($y + 8);
     $this->SetX(165);
     if ($phone3 != '') {
         $this->Cell(0, 0, $phone3, '', false, 'R', 0, '', 0, false, 'M', 'M');
     }
     $this->Line(10, 30, 200, 30, array('color' => array(0, 0, 0)));
 }
Example #3
0
 public function updateFacilties()
 {
     $total = Facilities::getTotalNumber();
     $message = "";
     if ($total < 9800) {
         $this->load->library('PHPExcel');
         $inputFileType = 'Excel5';
         $inputFileName = $_SERVER['DOCUMENT_ROOT'] . '/ADT/assets/facility_list.xls';
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);
         $objPHPExcel = $objReader->load($inputFileName);
         $highestColumm = $objPHPExcel->setActiveSheetIndex(0)->getHighestColumn();
         $highestRow = $objPHPExcel->setActiveSheetIndex(0)->getHighestRow();
         $arr = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
         $facilities = array();
         $facility_code = $this->session->userdata("facility");
         $lists = Facilities::getParentandSatellites($facility_code);
         for ($row = 2; $row < $highestRow; $row++) {
             $facility_id = $arr[$row]['A'];
             $facility_name = $arr[$row]['B'];
             $facility_type_name = str_replace(array("'"), "", $arr[$row]['G']);
             $facility_type_id = Facility_Types::getTypeID($facility_type_name);
             $district_name = str_replace(array("'"), "", $arr[$row]['E']);
             $district_id = District::getID($district_name);
             $county_name = str_replace(array("'"), "", $arr[$row]['D']);
             $county_id = Counties::getID($county_name);
             $email = $arr[$row]['T'];
             $phone = $arr[$row]['R'];
             $adult_age = 15;
             $weekday_max = '';
             $weekend_max = '';
             $supported_by = '';
             $service_art = 0;
             if (strtolower($arr[$row]['AD']) == "y") {
                 $service_art = 1;
             }
             $service_pmtct = 0;
             if (strtolower($arr[$row]['AR']) == "y") {
                 $service_pmtct = 1;
             }
             $service_pep = 0;
             $supplied_by = '';
             $parent = '';
             $map = 0;
             //if is this facility or satellite of this facility
             if (in_array($facility_id, $lists)) {
                 $details = Facilities::getCurrentFacility($facility_id);
                 if ($details) {
                     $parent = $details[0]['parent'];
                     $supported_by = $details[0]['supported_by'];
                     $supplied_by = $details[0]['supplied_by'];
                     $service_pep = $details[0]['service_pep'];
                     $weekday_max = $details[0]['weekday_max'];
                     $weekend_max = $details[0]['weekend_max'];
                     $map = $details[0]['map'];
                 }
             }
             //append to facilities data array
             $facilities[$row] = array('facilitycode' => $facility_id, 'name' => $facility_name, 'facilitytype' => $facility_type_id, 'district' => $district_id, 'county' => $county_id, 'email' => $email, 'phone' => $phone, 'adult_age' => $adult_age, 'weekday_max' => $weekday_max, 'weekend_max' => $weekend_max, 'supported_by' => $supported_by, 'service_art' => $service_art, 'service_pmtct' => $service_pmtct, 'service_pep' => $service_pep, 'supplied_by' => $supplied_by, 'parent' => $parent, 'map' => $map);
         }
         $sql = "TRUNCATE facilities";
         $this->db->query($sql);
         $this->db->insert_batch('facilities', $facilities);
         $counter = count($facilities);
         $message = $counter . " facilities have been added!<br/>";
     }
     return $message;
 }
Example #4
0
 public function edit()
 {
     $access_level = $this->session->userdata('user_indicator');
     $user_type = "1";
     $facilities = "";
     //If user is a super admin, allow him to add only facilty admin and nascop pharmacist
     if ($access_level == "system_administrator") {
         $user_type = "indicator='nascop_pharmacist' or indicator='facility_administrator'";
         $facilities = Facilities::getAll();
     } else {
         if ($access_level == "facility_administrator") {
             $facility_code = $this->session->userdata('facility');
             $user_type = "indicator='pharmacist'";
             $facilities = Facilities::getCurrentFacility($facility_code);
         }
     }
     $user_id = $this->input->get('u_id');
     $data['users'] = Users::getUserAdmin($user_id);
     $data['user_type'] = Access_Level::getAll($user_type);
     echo json_encode($data);
 }
 public function base_params($data)
 {
     $source = $this->session->userdata('facility');
     $access_level = $this->session->userdata('user_indicator');
     $data['quick_link'] = "facility";
     if ($access_level == "system_administrator") {
         $data['facilities_list'] = Facilities::getAll($source);
         $this->load->view("facility_v", $data);
     } else {
         $data['facilities'] = Facilities::getCurrentFacility($source);
         $this->load->view("facility_user_v", $data);
     }
 }