Esempio n. 1
0
 public function get_facility_bin_card_pdf($facility_code, $report_type, $commodity_id)
 {
     $county_id = $this->session->userdata('county_id');
     $district_id = $this->session->userdata('district_id');
     $param = implode('/', func_get_args());
     $args = array();
     $args = func_get_args();
     $facility_code = $args[0];
     $commodity_id = $args[1];
     $from_ = array($args[2], $args[3], $args[4]);
     $to_ = array($args[5], $args[6], $args[7]);
     $from = implode('/', $from_);
     $to = implode('/', $to_);
     $commodity_name = Commodities::get_commodity_name($commodity_id);
     $county = Counties::get_county_name($county_id);
     $district = Districts::get_district_name_($district_id);
     $county_name = $county['county'];
     $district_name = $district['district'];
     $bin_card_data = Facility_issues::get_bin_card($facility_code, $commodity_id, $from, $to);
     $myobj = Doctrine::getTable('Facilities')->findOneByfacility_code($facility_code);
     $facility_name = $myobj->facility_name;
     $bin_card_data_count = count(Facility_issues::get_bin_card($facility_code, $commodity_id, $from, $to));
     //create the table for displaying the order details
     $html_body = "<table class='data-table' width=100%>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>MFL No: {$facility_code}</td> \n\t\t\t\t\t\t\t<td>Health Facility Name:<br/> {$facility_name}</td>\n\t\t\t\t\t\t\t<td>Level:</td>\n\t\t\t\t\t\t\t<td>Dispensary</td>\n\t\t\t\t\t\t\t<td>Health Centre</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>County: {$county_name}</td> \n\t\t\t\t\t\t\t<td> District: {$district_name}</td>\n\t\t\t\t\t\t\t<td >Reporting Period <br/>\n\t\t\t\t\t\t\t\tStart Date:  <br/>  End Date: " . date('d M, Y') . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>";
     $html_body .= "\n\t\t\t\t\t<table class='data-table'>\n\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th><b>Commodity Name</b></th>\n\t\t\t\t\t\t\t\t<th><b>Date of Issue</b></th>\n\t\t\t\t\t\t\t\t<th><b>Reference No/S11 No</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Commodity Unit Size</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Batch No -Issued</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Expiry Date</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Opening Bal.</b></th>\n\t\t\t\t\t\t\t\t<th ><b>+ADJ</b></th>\n\t\t\t\t\t\t\t\t<th ><b>-ADJ</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Receipts/Issues</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Closing Bal.</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Service Point</b></th>\n\t\t\t\t\t\t\t\t<th ><b>Issuing/Receiving Officer</b></th>\n\t\t\t\t\t\t\t</tr> \n\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t<tbody>";
     $html_body .= '<ol type="a">';
     for ($i = 0; $i < $bin_card_data_count; $i++) {
         $closing_balance = $bin_card_data[$i]['balance_as_of'] - $bin_card_data[$i]['qty_issued'];
         $mydrug_name = $commodity_name;
         $html_body .= "<tr>";
         $html_body .= "<td>" . $commodity_name[0]['commodity_name'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['date_issued'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['s11_No'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['unit_size'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['batch_no'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['expiry_date'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['balance_as_of'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['adjustmentpve'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['adjustmentnve'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['qty_issued'] . "</td>";
         $html_body .= "<td>" . $closing_balance . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['service_point_name'] . "</td>";
         $html_body .= "<td>" . $bin_card_data[$i]['fname'] . " " . $bin_card_data[$i]['fname'] . "</td>";
         $html_body .= "</tr>";
     }
     $html_body .= '</tbody></table></ol>';
     $pdf_body = $html_body;
     //end of bin card pdf
     $file_name = $facility_name . '_facility_program_report_date_created_' . date('d-m-y');
     $pdf_data = array("pdf_title" => "Program Report For {$facility_name}", 'pdf_html_body' => $pdf_body, 'pdf_view_option' => 'download', 'file_name' => $file_name);
     $this->hcmp_functions->create_pdf($pdf_data);
     redirect();
 }
Esempio n. 2
0
 public function rtk_allocation_form_data($county_id)
 {
     $facility_code = $_POST['facility_code'];
     $allocation_data = $_POST['qty_allocated'];
     $commodity_id = $_POST['commodity_id'];
     $date = date('y-m-d');
     foreach ($allocation_data as $key => $value) {
         if ($value > 0) {
             $q = Doctrine_Manager::getInstance()->getCurrentConnection();
             $q->execute("insert into rtk_allocation set facility_code={$facility_code[$key]},qty={$value},`date_allocated`='{$date}',commodity_id={$commodity_id[$key]}");
             //$object_id = $this->db->insert_id();
             //$this->logData('16',$object_id);
         } else {
             //do nothing
         }
     }
     $county_name = Counties::get_county_name($county_id);
     $county_name = $county_name[0]['county'];
     $this->home("Allocation Details for {$county_name} County has been updated");
 }
Esempio n. 3
0
 public function login_submit()
 {
     $user = new Users();
     $password = $this->input->post('password');
     $username = $this->input->post('username');
     $returned_user = $user->login($username, $password);
     //If user successfully logs in, proceed here
     if ($returned_user) {
         //Create basic data to be saved in the session
         $reply = Users::login($username, $password);
         $user_data = $reply->toArray();
         $access_typeid = $user_data['usertype_id'];
         $fname = $user_data['fname'];
         $user_id = $user_data['id'];
         $lname = $user_data['lname'];
         $district_id = $user_data['district'];
         $facility_id = $user_data['facility'];
         $phone = $user_data['telephone'];
         $user_email = $user_data['email'];
         $county_id = $user_data['county_id'];
         $partner_id = $user_data['partner'];
         $fullname = $fname . ' ' . $lname;
         $banner_name = '';
         $access_level = Access_level::get_access_level_name($access_typeid);
         $user_indicator = $access_level['user_indicator'];
         if ($user_indicator == 'district') {
             //get county name
             $district_name = districts::get_district_name_($district_id);
             $banner_name = $district_name['district'] . " Sub-county";
         } elseif ($user_indicator == 'county') {
             //get county name
             $county_name = Counties::get_county_name($county_id);
             $banner_name = $county_name['county'] . " County";
         } elseif ($user_indicator == 'facility' || $user_indicator == 'facility_admin') {
             //get county name
             $facility_name = Facilities::get_facility_name2($facility_id);
             $banner_name = $facility_name['facility_name'];
         }
         $session_data = array('county_id' => $county_id, 'partner_id' => $partner_id, 'phone_no' => $phone, 'user_email' => $user_email, 'user_id' => $user_id, 'user_indicator' => $user_indicator, 'fname' => $fname, 'lname' => $lname, 'facility_id' => $facility_id, 'district_id' => $district_id, 'user_type_id' => $access_typeid, 'full_name' => $fullname, 'banner_name' => $banner_name);
         $this->session->set_userdata($session_data);
         //get menu items
         $menu_items = Menu::getByUsertype($access_typeid);
         //Create array that will hold all the accessible menus in the session
         $menus = array();
         $menuids = array();
         $counter = 0;
         foreach ($menu_items as $menu_item) {
             $menus[$counter] = array("menu_text" => $menu_item->menu_text, "menu_url" => $menu_item->menu_url, "menu_id" => $menu_item->id, "parent_status" => $menu_item->parent_status);
             $counter++;
             $menuids[] = $menu_item->id;
         }
         $sub_menus = array();
         foreach ($menuids as $parentid) {
             $sub_items = Sub_menu::getByparent((int) $parentid);
             foreach ($sub_items as $item) {
                 $sub_menus[] = array("submenu_text" => $item->subm_text, "submenu_url" => $item->subm_url, "menu_id" => $item->parent_id);
             }
         }
         //Save this menus array in the session
         $this->session->set_userdata("menus", $menus);
         //Save this sub menus array in the session
         $_SESSION["submenus"] = $sub_menus;
         //creating a new log value
         Log::update_log_out_action($this->session->userdata('user_id'));
         $u1 = new Log();
         $action = 'Logged In';
         $u1->user_id = $this->session->userdata('user_id');
         $u1->action = $action;
         $u1->save();
         redirect('home');
     } else {
         $data['popup'] = "errorpopup";
         $data['title'] = "Login";
         $this->load->view("shared_files/login_pages/login_v", $data);
     }
 }
<?php

$attributes = array('name' => 'myform', 'id' => 'myform');
foreach ($facilities as $facility) {
    $facility_name = $facility['facility_name'];
    $district = $facility['district'];
    $county_id = Districts::get_county_id($district);
    $district_name = Districts::get_district_name($district);
    $county_name = Counties::get_county_name($county_id['county']);
}
$facility_code = $this->session->userdata('facility_id');
$fname = $this->session->userdata('fname');
$lname = $this->session->userdata('lname');
$username = $fname . ' ' . $lname;
?>
		<div style="width: 65%; margin-left: auto; margin-right: auto; font-size: 14px;">
<div id="dialog-form" title="Enter the evaluation information here.">
	<h4>Kindly provide information in all the fields indicated for proper analysis and assessment to be performed. This evaluation will take at least 15 minutes.</h4>
	<form>
		<table id="eval"  width="100%" class="table table-bordered">
		<input type="hidden" name="facility_name" colspan = "3" style = "color:#000; border:none" value="<?php 
echo $facility_name;
?>
"></td>
		<input type="hidden" name="facility_code" colspan = "2" style = "color:#000; border:none" value="<?php 
echo $facility_code;
?>
"></td>
		<input type="hidden" name="district_name" colspan = "2" style = "color:#000; border:none" value="<?php 
echo $district;
?>
Esempio n. 5
0
 public function stocking_levels($county_id = NULL, $district_id = NULL, $facility_code = NULL, $commodity_id = NULL, $tracer_item = NULL, $division = NULL, $graph_type = NULL)
 {
     /*function does not take county if you give district,neither does it take district if you give facility. purpose: query optimisation*/
     // $commodity_id = 456;
     // echo $tracer_item;exit;
     $county_id = $county_id == "NULL" ? null : $county_id;
     $district_id = $district_id == "NULL" ? null : $district_id;
     $graph_type = $graph_type == "NULL" ? null : $graph_type;
     $facility_code = $facility_code == "NULL" ? null : $facility_code;
     $tracer_item = $tracer_item == "NULL" ? null : $tracer_item;
     $commodity_id = $commodity_id == "ALL" || $commodity_id == "NULL" ? null : $commodity_id;
     $division_details = Dashboard_model::get_division_details($division);
     // echo "<pre>";print_r($tracer_commodities);exit;
     if (isset($division) && $division > 0) {
         $page_title = $division_details[0]['division_name'];
         $tracer = "NULL";
     } else {
         $tracer = 1;
         $page_title = "Tracer Item";
     }
     $page_title = trim($page_title);
     $graph_title = $page_title . ' National Stock Level';
     if ($county_id > 0) {
         $county_name = Counties::get_county_name($county_id);
         $graph_title = $page_title . ' ' . $county_name['county'] . ' County Stock Level';
     }
     if ($district_id > 0) {
         $district_name = Districts::get_district_name_($district_id);
         $graph_title = $page_title . ' ' . $district_name['district'] . ' Sub-County Stock Level';
     }
     // echo $tracer_item;exit;
     // echo is_null($district_id);
     $filter = '';
     $filter .= $county_id > 0 && is_null($district_id) ? " AND counties.id = {$county_id}" : NULL;
     $filter .= $district_id > 0 && is_null($county_id) ? " AND districts.id = {$district_id}" : NULL;
     $filter .= $facility_code > 0 && is_null($county_id) && is_null($district_id) ? " AND facilities.facility_code = {$facility_code}" : NULL;
     $filter .= $commodity_id > 0 ? " AND commodities.id = {$commodity_id} " : NULL;
     $filter .= $tracer_item > 0 ? " AND commodities.tracer_item = 1 " : NULL;
     if ($division != 5) {
         $filter .= $division > 0 ? " AND commodities.commodity_division = {$division}" : NULL;
     }
     // echo $filter;exit;
     /*echo "SELECT 
     		    commodities.id,
     		    commodities.commodity_name,
     		    SUM(facility_stocks.current_balance) AS unit_balance,
     		    SUM(facility_stocks.current_balance) / commodities.total_commodity_units AS pack_balance,
     		    commodities.total_commodity_units
     		FROM
     		    hcmp_rtk.facility_stocks
     		        INNER JOIN
     		    facilities ON facility_stocks.facility_code = facilities.facility_code
     		        INNER JOIN
     		    districts ON facilities.district = districts.id
     		        INNER JOIN
     		    counties ON districts.county = counties.id
     		        INNER JOIN
     		    commodities ON facility_stocks.commodity_id = commodities.id
     		WHERE
     		    commodities.status = 1
     		         $filter
     		GROUP BY commodities.id ORDER BY commodities.commodity_name ASC";exit;*/
     $stocking_levels = $this->db->query("\n\t\t\tSELECT \n\t\t\t    commodities.id,\n\t\t\t    commodities.commodity_name,\n\t\t\t    SUM(facility_stocks.current_balance) AS unit_balance,\n\t\t\t    SUM(facility_stocks.current_balance) / commodities.total_commodity_units AS pack_balance,\n\t\t\t    commodities.total_commodity_units\n\t\t\tFROM\n\t\t\t    hcmp_rtk.facility_stocks\n\t\t\t        INNER JOIN\n\t\t\t    facilities ON facility_stocks.facility_code = facilities.facility_code\n\t\t\t        INNER JOIN\n\t\t\t    districts ON facilities.district = districts.id\n\t\t\t        INNER JOIN\n\t\t\t    counties ON districts.county = counties.id\n\t\t\t        INNER JOIN\n\t\t\t    commodities ON facility_stocks.commodity_id = commodities.id\n\t\t\tWHERE\n\t\t\t    commodities.status = 1\n\t\t\t         {$filter}\n\t\t\tGROUP BY commodities.id ORDER BY commodities.commodity_name ASC\n\t\t")->result_array();
     // echo "<pre>"; print_r($stocking_levels); exit;
     /*			
     $category_data = array();
     $series_data = $series_data_ = array();
     $temp_array = $temp_array_ = array();
     $graph_data = array();
     $graph_type = '';
     foreach ($stocking_levels as $data) :
     	$series_data = array_merge($series_data, array($data["commodity_name"] => (int)$data['cur_bal_packs']/(int)$data['amc_packs']));
     	$category_data = array_merge($category_data, array($data["commodity_name"]));
     endforeach;
     */
     /*CODE FOR MULTI BAR COLUMN*/
     $graph_data = array();
     $graph_data = array_merge($graph_data, array("graph_id" => 'dem_graph_mos'));
     $graph_data = array_merge($graph_data, array("graph_title" => $graph_title));
     $graph_data = array_merge($graph_data, array("color" => "['#7CB5EC', '#434348']"));
     $graph_data = array_merge($graph_data, array("graph_type" => 'bar'));
     // $graph_data=array_merge($graph_data,array("graph_yaxis_title"=>'National Stock Level (Units and Packs)'));
     $graph_data = array_merge($graph_data, array("graph_categories" => array()));
     // $graph_data=array_merge($graph_data,array("series_data"=>array("Pack Balance"=>array(),"Unit Balance"=>array())));
     $graph_data = array_merge($graph_data, array("series_data" => array("Pack Balance" => array())));
     $graph_data['stacking'] = 'normal';
     foreach ($stocking_levels as $stock_level) {
         // $category_name = $stock_level['commodity_name'].' ('.$facility_stock_['source_name'].')';
         $category_name = $stock_level['commodity_name'];
         $graph_data['graph_categories'] = array_merge($graph_data['graph_categories'], array($category_name));
         // $graph_data['series_data']['Unit Balance']=array_merge($graph_data['series_data']['Unit Balance'],array((float) $stock_level['unit_balance']));
         $graph_data['series_data']['Pack Balance'] = array_merge($graph_data['series_data']['Pack Balance'], array((double) $stock_level['pack_balance']));
     }
     // echo "<pre>";print_r($graph_data);exit;
     /*END OF THAT TITLE OVER THERE*/
     // echo "<pre>";print_r($graph_data);echo "</pre>";exit;
     /*
     $graph_type = 'bar';
     $graph_data = array_merge($graph_data, array("graph_id" => 'dem_graph_mos'));
     $graph_data = array_merge($graph_data, array("graph_title" => "$title Stock Level in Months of Stock (MOS)"));
     $graph_data = array_merge($graph_data, array("graph_type" => $graph_type));
     $graph_data = array_merge($graph_data, array("color" => "['#4572A7','#FFF263', '#6AF9C4']"));
     $graph_data = array_merge($graph_data, array("graph_yaxis_title" => "MOS"));
     $graph_data = array_merge($graph_data, array("graph_categories" => $category_data));
     // $graph_data = array_merge($graph_data, array("series_data" => array('total' => $series_data)));
     $graph_data=array_merge($graph_data,array("series_data"=>array("Unit Balance"=>array(),"Pack Balance"=>array())));
     $data = array();
     */
     $data['high_graph'] = $this->hcmp_functions->create_high_chart_graph($graph_data);
     // echo "<pre>";print_r($data['high_graph']);exit;
     $data['graph_id'] = 'dem_graph_mos';
     if ($graph_type == "excel") {
         // print_r($_GET); exit;
         // echo "<pre>"; print_r($stocking_levels); exit;
         $excel_data = array('doc_creator' => "HCMP", 'doc_title' => $page_title, 'file_name' => $page_title);
         $row_data = array();
         $column_data = array("Commoidity Name", "Unit Balance", "Pack Balance", "Total Commodity Units");
         foreach ($stocking_levels as $stocking_levels) {
             array_push($row_data, array($stocking_levels['commodity_name'], $stocking_levels['unit_balance'], $stocking_levels['pack_balance'], $stocking_levels['total_commodity_units']));
         }
         $excel_data['column_data'] = $column_data;
         $excel_data['row_data'] = $row_data;
         $this->hcmp_functions->create_excel($excel_data);
     }
     return $this->load->view("shared_files/report_templates/high_charts_template_v_national", $data);
     /*END OF THIS OLD SH!T*/
 }
Esempio n. 6
0
    public function send_potential_expiries($county_id = null, $district_id = null, $facility_code = null, $graph_type = null, $interval = null, $email_address = NULL)
    {
        $interval = isset($interval) && $interval > 0 ? $interval : 12;
        //default to select annual
        $email_address = isset($email_address) ? $email_address : "*****@*****.**";
        // $graph_type = "excel";//by default
        $time = date('M d Y');
        $county_id = 1;
        //for testing purposes
        $county_name = Counties::get_county_name($county_id);
        $county_name = $county_name['county'];
        $and_data = $district_id > 0 ? " AND d1.id = '{$district_id}'" : null;
        $and_data .= $facility_code > 0 ? " AND f.facility_code = '{$facility_code}'" : null;
        $and_data .= $county_id > 0 ? " AND d1.county='{$county_id}'" : null;
        $and_data = isset($and_data) ? $and_data : null;
        $excel_data = array('doc_creator' => "HCMP", 'doc_title' => "Potential Expiry  {$title}");
        $excel_data["file_name"] = "Stock Expiring {$title} in the Next {$interval} Months For {$county_name} County as at {$time}";
        $row_data = array();
        $column_data = array("Commodity", "Date of Expiry", "Unit Size", "Quantity (Packs)", "Quantity (Units)", "Unit Cost (Ksh)", "Total Cost Expired (Ksh)", "Supplier", "Manufacturer", "Facility Name", "Facility Code", "Sub-County", "County");
        $excel_data['column_data'] = $column_data;
        // echo  $and_data; exit;
        $facility_stock_data = Doctrine_Manager::getInstance()->getCurrentConnection()->fetchAll("select  c.county, d1.district as subcounty ,temp.drug_name,\n\t\t\tf.facility_code, f.facility_name,temp.manufacture, sum(temp.total) as total_ksh,\n\t\t\ttemp.unit_cost,temp.expiry_date,temp.unit_size,temp.units,\n\t\t\ttemp.packs\n\t\t\tfrom districts d1, counties c, facilities f left join\n\t\t\t(\n\t\t\t\tselect  ROUND( SUM(\n\t\t\t\t\tf_s.current_balance  / d.total_commodity_units ) * d.unit_cost, 1) AS total,\n\t\t\tROUND( SUM( f_s.current_balance  / d.total_commodity_units  ), 1) as packs,\n\t\t\tSUM( f_s.current_balance) as units,\n\t\t\tf_s.facility_code,d.id,d.commodity_name as drug_name, f_s.manufacture,\n\t\t\tf_s.expiry_date,d.unit_size,d.unit_cost\n\n\t\t\tfrom facility_stocks f_s, commodities d\n\t\t\twhere f_s.expiry_date between DATE_ADD(CURDATE(), INTERVAL 1 day) and  DATE_ADD(CURDATE(), INTERVAL {$interval} MONTH)\n\t\t\tand d.id=f_s.commodity_id\n\t\t\tand year(f_s.expiry_date) !=1970\n\t\t\tAND (f_s.status =1 or f_s.status =2)\n\t\t\tGROUP BY d.id,f_s.facility_code having total >1\n\n\t\t\t) temp\n\t\t\ton temp.facility_code = f.facility_code\n\t\t\twhere  f.district = d1.id\n\t\t\tand c.id=d1.county\n\t\t\tand temp.total>0\n\t\t\t{$and_data}\n\t\t\tgroup by temp.id,f.facility_code\n\t\t\torder by temp.drug_name asc,temp.total asc, temp.expiry_date desc\n\t\t\t");
        $date = date("d M y");
        array_push($row_data, array("The below commodities will expire in the next {$interval} months from {$date} {$title}"));
        // echo "<pre>";print_r($facility_stock_data);exit;
        foreach ($facility_stock_data as $facility_stock_data_item) {
            array_push($row_data, array($facility_stock_data_item["drug_name"], $facility_stock_data_item["expiry_date"], $facility_stock_data_item["unit_size"], $facility_stock_data_item["packs"], $facility_stock_data_item["units"], $facility_stock_data_item["unit_cost"], $facility_stock_data_item["total_ksh"], "KEMSA", $facility_stock_data_item["manufacture"], $facility_stock_data_item["facility_name"], $facility_stock_data_item["facility_code"], $facility_stock_data_item["subcounty"], $facility_stock_data_item["county"]));
        }
        $excel_data['row_data'] = $row_data;
        $excel_data['report_type'] = "Potential Expiries";
        $this->hcmp_functions->create_excel($excel_data);
        // $email_address = array();
        // $email_address[1]="*****@*****.**";
        // array_push($email_address, var);
        // $message = "Kindly find attached,potential expiries report for ".$county_name." County";
        $message = '';
        $message .= "<style> table {\n\t\t\t\tborder-collapse: collapse; \n\t\t\t}td,th{\n\t\t\t\tpadding: 12px;\n\t\t\t\ttext-align:center;\n\t\t\t}\n\n\t\t\t*{margin:0;padding:0}*{font-family:'Helvetica Neue',Helvetica,Helvetica,Arial,sans-serif}img{max-width:100%}.collapse{padding:0}body{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%}a{color:#2BA6CB}.btn{text-decoration:none;color:#FFF;background-color:#666;padding:10px 16px;font-weight:700;margin-right:10px;text-align:center;cursor:pointer;display:inline-block}p.callout{padding:15px;background-color:#ECF8FF;margin-bottom:15px}.callout a{font-weight:700;color:#2BA6CB}table.social{background-color:#ebebeb}.social .soc-btn{padding:3px 7px;font-size:12px;margin-bottom:10px;text-decoration:none;color:#FFF;font-weight:700;display:block;text-align:center}a.fb{background-color:#3B5998!important}a.tw{background-color:#1daced!important}a.gp{background-color:#DB4A39!important}a.ms{background-color:#000!important}.sidebar .soc-btn{display:block;width:100%}table.head-wrap{width:100%}.header.container table td.logo{padding:15px}.header.container table td.label{padding:15px 15px 15px 0}table.body-wrap{width:100%}table.footer-wrap{width:100%;clear:both!important}.footer-wrap .container td.content p{border-top:1px solid #d7d7d7;padding-top:15px;font-size:9px;font-weight:500}h1,h2,h3,h4,h5,h6{font-family:HelveticaNeue-Light,'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;line-height:1.1;margin-bottom:15px;color:#000}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-size:60%;color:#6f6f6f;line-height:0;text-transform:none}h1{font-weight:200;font-size:44px}h2{font-weight:200;font-size:37px}h3{font-weight:500;font-size:27px}h4{font-weight:500;font-size:23px}h5{font-weight:900;font-size:17px}h6{font-weight:900;font-size:14px;text-transform:uppercase;color:#444}.collapse{margin:0!important}p,ul{margin-bottom:10px;font-weight:400;font-size:14px;line-height:1.6}p.lead{font-size:17px}p.last{margin-bottom:0}ul li{margin-left:5px;list-style-position:inside}ul.sidebar{background:#ebebeb;display:block;list-style-type:none}ul.sidebar li{display:block;margin:0}ul.sidebar li a{text-decoration:none;color:#666;padding:10px 16px;cursor:pointer;border-bottom:1px solid #777;border-top:1px solid #FFF;display:block;margin:0}ul.sidebar li a.last{border-bottom-width:0}ul.sidebar li a h1,ul.sidebar li a h2,ul.sidebar li a h3,ul.sidebar li a h4,ul.sidebar li a h5,ul.sidebar li a h6,ul.sidebar li a p{margin-bottom:0!important}.container{display:block!important;max-width:100%!important;margin:0 auto!important;clear:both!important}.content{padding:15px;max-width:80%px;margin:0 auto;display:block}.content table{width:100%}.column{width:300px;float:left}.column tr td{padding:15px}.column-wrap{padding:0!important;margin:0 auto;max-width:600px!important}.column table{width:100%}.social .column{width:280px;min-width:279px;float:left}.clear{display:block;clear:both}@media only screen and (max-width:600px){a[class=btn]{display:block!important;margin-bottom:10px!important;background-image:none!important;margin-right:0!important}div[class=column]{width:auto!important;float:none!important}table.social div[class=column]{width:auto!important}}</style>";
        $message .= '
			<tr>
				<td colspan="12">
				</tr>
			</tbody>
		</table>';
        $message .= "<!-- BODY -->\n\t\t<table class='body-wrap'>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td class='container' bgcolor='#FFFFFF'>\n\n\t\t\t\t\t<div class='content'>\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\n\t\t\t\t\t\t\t\t\t<p class='lead'>Kindly find attached Potential Expiries in {$county_name} County, as at {$time}</p>\n\n\t\t\t\t\t\t\t\t\t<table class='social' width='100%'>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td>\n\n\t\t\t\t\t\t\t\t\t\t\t\t<!-- column 1 -->\n\t\t\t\t\t\t\t\t\t\t\t\t<table align='left' class='column'>\n\n\t\t\t\t\t\t\t\t\t\t\t\t</table><!-- /column 1 -->\t\n\n\t\t\t\t\t\t\t\t\t\t\t\t<!-- column 2 -->\n\t\t\t\t\t\t\t\t\t\t\t\t<table align='left' class='column'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<tr>\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t\t\t\t</table><!-- /column 2 -->\n\n\t\t\t\t\t\t\t\t\t\t\t\t<span class='clear'></span>\t\n\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</table><!-- /social & contact -->\n\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</div><!-- /content -->\n\n\t\t\t\t</td>\n\t\t\t\t<td></td>\n\t\t\t</tr>\n\t\t</table><!-- /BODY -->";
        $subject = "Potential Expiries";
        $attach_file = "./print_docs/excel/excel_files/" . $excel_data['file_name'] . '.xls';
        // echo $attach_file;exit;
        $this->hcmp_functions->send_email($email_address, $message, $subject, $attach_file);
    }
Esempio n. 7
0
 function county_allocation($county_id)
 {
     $county = Counties::get_county_name($county_id);
     $countyname = $county['county'];
     $data['county_name'] = $countyname;
     $data['banner_text'] = "Allocations in " . $countyname;
     $data['title'] = $countyname . " County RTK Allocations";
     $data['content_view'] = "rtk/allocation_committee/ajax_view/county_allocations_v";
     $data['county_allocation'] = $this->_allocation_county($county_id);
     $this->load->view("rtk/template", $data);
 }
 public function generate_antimalarial_graph_ajax($county_id)
 {
     $subcounties = Counties::get_subcounties_in_county($county_id);
     $county_dets = Counties::get_county_name($county_id);
     foreach ($county_dets as $value) {
         $county_name = $value;
     }
     $subcounties_listing = array();
     $sub_counties_graph = array();
     $sub_counties_names = array();
     foreach ($subcounties as $key => $value) {
         $subcounty_id = $value['id'];
         $subcounty_name = $value['district'];
         $antimalarial_data = Malaria_Data::get_sub_county_antimalaria($subcounty_id);
         if (count($antimalarial_data > 0)) {
             $b6 = $antimalarial_data[0]['quantity'] != '' ? $antimalarial_data[0]['quantity'] : 0;
             $b12 = $antimalarial_data[1]['quantity'] != '' ? $antimalarial_data[1]['quantity'] : 0;
             $b18 = $antimalarial_data[2]['qusantity'] != '' ? $antimalarial_data[2]['quantity'] : 0;
             $b24 = $antimalarial_data[3]['quantity'] != '' ? $antimalarial_data[3]['quantity'] : 0;
         }
         $b6 = intval($b6);
         $b12 = intval($b12);
         $b18 = intval($b18);
         $b24 = intval($b24);
         $sub_counties_names_list = array('Blister of 6', 'Blister of 12', 'Blister of 18', 'Blister of 24');
         array_push($sub_counties_names, $sub_counties_names_list);
         array_push($sub_counties_graph, $subcounty_name);
         $bdata = array('Blister of 6' => $b6, 'Blister of 12' => $b12, 'Blister of 18' => $b18, 'Blister of 24' => $b24);
         // $bdata = array($b6,$b12,$b18,$b24);
         $subcounties_listing[] = array('id' => $subcounty_id, 'name' => $subcounty_name, 'data' => $bdata);
     }
     // $sub_counties_names= array('Blister of 6','Blister of 12','Blister of 18','Blister of 24');
     // echo "<pre>";
     // print_r($subcounties_listing);die;
     // $data['count_records'] = count($sub_counties_graph);
     // $sub_counties_graph = json_encode($sub_counties_graph);
     // $data['sub_counties'] = str_replace('"', "'", $sub_counties_graph);
     $graph_data = array();
     $graph_data = array_merge($graph_data, array("graph_id" => 'graph-section'));
     $graph_data = array_merge($graph_data, array("graph_title" => $county_name . ' County Antimalarial Stocks'));
     $graph_data = array_merge($graph_data, array("graph_type" => 'bar'));
     $graph_data = array_merge($graph_data, array("graph_yaxis_title" => 'Quantity in Packs'));
     $graph_data = array_merge($graph_data, array("graph_categories" => array()));
     $graph_data = array_merge($graph_data, array("series_data" => array($subcounties_listing)));
     foreach ($subcounties_listing as $subcounties_graph_listing) {
         $graph_data['graph_categories'] = $sub_counties_graph;
         $graph_data['series_data']['Quantity'] = array($subcounties_graph_listing['data']);
     }
     // foreach ($subcounties_listing as $subcounties_graph_listing) :
     // echo "<pre>";
     // print_r($graph_data['series_data']);die;
     // 	$graph_data['graph_categories'] = $sub_counties_names;
     // 	$graph_data['series_data']= array($subcounties_graph_listing['data']);
     // endforeach;
     // echo "<pre>";
     // print_r($graph_data);die;
     $data['high_graph'] = $this->hcmp_functions->create_high_chart_graph($graph_data);
     // $data['sub_counties'] = $sub_counties_graph);
     // echo $data['high_graph'];die;
     // print_r($data['sub_counties']);die;
     // $data['graph_title'] = $county_name.' County Antimalarial Stocks';
     // // echo $data['graph_title'];die;
     // $data['report_view'] = "subcounty/reports/program_reports_v_titus";
     // $data['content_view'] = "facility/facility_reports/reports_v";
     // // $data['subcounties_listing']=json_encode($subcounties_listing);
     // $data['sidebar'] = "shared_files/report_templates/side_bar_v";
     // // $data['report_title'] =	"Divisional Malaria Reports";
     // $this -> load -> view('shared_files/template/template', $data);
     return $this->load->view("shared_files/report_templates/high_charts_template_v", $data);
 }