Example #1
0
 public function manage_commodities()
 {
     $data['title'] = "Commodities";
     $data['content_view'] = "Admin/commodities_v";
     $data['commodity_list'] = commodity_sub_category::get_all();
     $this->load->view("shared_files/template/dashboard_v", $data);
 }
Example #2
0
 public function county_consumption()
 {
     $county_id = $this->session->userdata('county_id');
     $data['district_data'] = districts::getDistrict($county_id);
     $data['c_data'] = Commodities::get_all_2();
     $data['categories'] = commodity_sub_category::get_all_pharm();
     $data['title'] = "Consumption";
     $data['banner_text'] = "Consumption";
     $data['content_view'] = "facility/facility_reports/reports_v";
     $data['report_view'] = "subcounty/reports/county_consumption_data_filter_v";
     $data['sidebar'] = "shared_files/report_templates/side_bar_sub_county_v";
     $data['active_panel'] = 'consumption';
     $this->load->view("shared_files/template/template", $data);
 }
 public function get_consumption_chart_ajax($sub_category = null)
 {
     $commodity_id = $this->input->post('commodity_id');
     $from = $this->input->post('from');
     $to = $this->input->post('to');
     $total = 0;
     $to = $to == "NULL" || !isset($to) ? date('Y-m-d 23:59:59') : date('Y-m-d 23:59:59', strtotime(urldecode($to)));
     $from = $from == "NULL" || !isset($from) ? date('Y-m-d 00:00:00') : date('Y-m-d 00:00:00', strtotime(urldecode($from)));
     $consumption = facility_stocks::get_dispensing_consumption_by_age($commodity_id, $from, $to, $sub_category);
     $commodity_name = '';
     if ($commodity_id != '') {
         $commodity_details = Commodities::get_commodity_name($commodity_id);
         $commodity_name = $commodity_details[0]['commodity_name'];
     } else {
         $commodity_details = commodity_sub_category::get_dets_one($sub_category);
     }
     $val1 = intval($consumption['5']);
     $val2 = intval($consumption['above']);
     $graph_id = 'dem_graph_';
     $data['graph_id'] = 'dem_graph_';
     $text_title = $commodity_name . ' consumption by Age between ' . date('F d Y', strtotime($from)) . ' and ' . date('F d Y', strtotime($to));
     $result_chart = " \$('#{$graph_id}').highcharts({\n            chart: {\n                plotBackgroundColor: null,\n                plotBorderWidth: null,\n                plotShadow: false,\n                type: 'pie'\n            },\n            title: {\n                text: '{$text_title}'\n            },\n            tooltip: {\n                pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'\n            },\n            plotOptions: {\n                pie: {\n                    allowPointSelect: false,\n                    cursor: 'pointer',\n                    dataLabels: {\n                        enabled: true\n                    },\n                    showInLegend: true\n                }\n            },\n            series: [{\n                name: '{$commodity_name}',\n                colorByPoint: true,\n                data: [{\n                    name: 'Under 5 years ({$val1} units)',\n                    y: {$val1}\n                }, {\n                    name: 'Over 5 Years ({$val2} units)',\n                    y:{$val2},\n                    sliced: true,\n                    selected: true\n                }]\n            }]\n        });";
     // $result_table .= '
     $data['high_graph'] = $result_chart;
     return $this->load->view("shared_files/report_templates/high_charts_template_v", $data);
     echo $result_chart;
 }