Beispiel #1
0
 public function get_county_dashboard_notifications_graph_data()
 {
     $county_id = $this->session->userdata('county_id');
     $county_stock = facility_stocks::get_county_stock_amc($county_id);
     // echo "<pre> Here";print_r($county_stock);exit;
     $county_stock_count = count($county_stock);
     $graph_id = "container";
     $graph_data = array();
     $graph_data = array_merge($graph_data, array("graph_id" => $graph_id));
     $graph_data = array_merge($graph_data, array("graph_title" => "County Store Stock Level"));
     $graph_data = array_merge($graph_data, array("graph_type" => "bar"));
     $graph_data = array_merge($graph_data, array("graph_yaxis_title" => "Total Stock Level"));
     $graph_data = array_merge($graph_data, array("graph_categories" => array()));
     $graph_data = array_merge($graph_data, array("series_data" => array("Current Pack Balance" => array(), "Current Unit Balance" => array())));
     $graph_data['stacking'] = 'normal';
     foreach ($county_stock as $county_stock) {
         $graph_data['graph_categories'] = array_merge($graph_data['graph_categories'], array($county_stock['commodity_name']));
         $graph_data['series_data']['Current Pack Balance'] = array_merge($graph_data['series_data']['Current Pack Balance'], array((double) $county_stock['pack_balance']));
         $graph_data['series_data']['Current Unit Balance'] = array_merge($graph_data['series_data']['Current Unit Balance'], array((double) $county_stock['commodity_balance']));
     }
     $county_stock_data = $this->hcmp_functions->create_high_chart_graph($graph_data);
     //echo "<pre>"; print_r($county_stock_data); echo "</pre>"; exit;
     $loading_icon = base_url('assets/img/no-record-found.png');
     $county_stock_data = $county_stock_count > 0 ? $county_stock_data : "\$('#container').html('<img src={$loading_icon}>');";
     $actual_expiries = count(facility_stocks::county_drug_store_act_expiries($county_id));
     $potential_expiries = count(facility_stocks::county_drug_store_pte_expiries($county_id));
     // echo "<pre> This";print_r($actual_expiries);exit;
     $county_donations = count(redistribution_data::get_all_active_drug_store_county($county_id));
     //$real_county_donations = county(redistribution_data::get_all_active_drug_store($county_id, "to-me"));
     return array("county_stock_count" => $county_stock_count, "county_stock_graph" => $county_stock_data, "potential_expiries" => $potential_expiries, "actual_expiries" => $actual_expiries, "county_donations" => $county_donations);
 }