public function ajaxRefrigeratorsFreezersModelsByAgeGroupAction()
 {
     $this->_helper->layout->disableLayout();
     $ccm_models = new Model_CcmModels();
     $form_values['office'] = $this->_request->getParam('office', '');
     $form_values['combo1'] = $this->_request->getParam('combo1', '');
     $form_values['combo2'] = $this->_request->getParam('combo2', '');
     $ccm_models->form_values = $form_values;
     $data_arr = $ccm_models->getRefrigeratorModelsByAgeGroupReport();
     $main_heading = "Refrigerators/Freezers models by age group";
     $str_sub_heading = "";
     $number_prefix = "";
     $number_suffix = "%";
     $s_number_prefix = "";
     $xmlstore = "<?xml version = \"1.0\"?>";
     $xmlstore = "<?xml version=\"1.0\"?>";
     $xmlstore .= '<chart caption="' . $main_heading . '" numberprefix="' . $number_prefix . '" showvalues="0" exportEnabled="1" rotateValues="1" theme="fint">';
     $categories = '<categories>';
     $dataset_1 = '<dataset seriesname="0-2 Years" >';
     $dataset_2 = '<dataset seriesname="3-5 Years" >';
     $dataset_3 = '<dataset seriesname="6-10 Years" >';
     $dataset_4 = '<dataset seriesname=">10 Years" >';
     $dataset_5 = '<dataset seriesname="Unknown" >';
     $counter = 0;
     foreach ($data_arr as $sub_arr) {
         if ($counter >= 10) {
             break;
         }
         $categories .= '<category label="' . $sub_arr['ccm_model_name'] . '" />';
         $dataset_1 .= '<set value="' . $sub_arr['0-2 Years'] . '" />';
         $dataset_2 .= '<set value="' . $sub_arr['3-5 Years'] . '" />';
         $dataset_3 .= '<set value="' . $sub_arr['6-10 Years'] . '" />';
         $dataset_4 .= '<set value="' . $sub_arr['>10 Years'] . '" />';
         $dataset_5 .= '<set value="' . $sub_arr['Unknown'] . '" />';
         $counter++;
     }
     $categories .= '</categories>';
     $dataset_1 .= '</dataset>';
     $dataset_2 .= '</dataset>';
     $dataset_3 .= '</dataset>';
     $dataset_4 .= '</dataset>';
     $dataset_5 .= '</dataset>';
     $xmlstore .= $categories;
     $xmlstore .= $dataset_1;
     $xmlstore .= $dataset_2;
     $xmlstore .= $dataset_3;
     $xmlstore .= $dataset_4;
     $xmlstore .= $dataset_5;
     $xmlstore .= "</chart>";
     $this->view->xmlstore = $xmlstore;
     $this->view->main_heading = $main_heading;
     $this->view->str_sub_heading = $str_sub_heading;
     $this->view->chart_type = 'StackedBar2D';
     $this->view->width = '80%';
     $this->view->height = '400';
 }
 public function refrigeratorModelsByAgeGroupAction()
 {
     //ccem 4.4.12
     $this->_helper->layout->setLayout('reports');
     $data_arr = array();
     $search_form = new Form_ReportsSearch();
     $ccm_models = new Model_CcmModels();
     $form_values['facility_type'] = $this->_request->getParam('facility_type', '');
     $form_values['office'] = $this->_request->getParam('office', '');
     $form_values['combo1'] = $this->_request->getParam('combo1', '');
     $form_values['combo2'] = $this->_request->getParam('combo2', '');
     if ($this->_request->isPost()) {
         if ($search_form->isValid($this->_request->getPost())) {
             $form_values = array_merge($form_values, $search_form->getValues());
             $ccm_models->form_values = $form_values;
             $data_arr = $ccm_models->getRefrigeratorModelsByAgeGroupReport();
         }
     }
     $xmlstore = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
     $xmlstore .= "<rows>";
     foreach ($data_arr as $sub_arr) {
         $xmlstore .= "<row>";
         $xmlstore .= "<cell><![CDATA[" . $sub_arr['ccm_model_name'] . "]]></cell>";
         $xmlstore .= "<cell>" . $sub_arr['total'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['0-2 Years'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['0-2 Years Per'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['3-5 Years'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['3-5 Years Per'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['6-10 Years'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['6-10 Years Per'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['>10 Years'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['>10 Years Per'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['Unknown'] . "</cell>";
         $xmlstore .= "<cell>" . $sub_arr['Unknown Per'] . "</cell>";
         $xmlstore .= "</row>";
     }
     $xmlstore .= "</rows>";
     $this->view->main_heading = "CCEM Reports";
     $this->view->report_title = "Refrigerator/Freezers Models by Age Group";
     $this->view->headers = 'Model,Total #,0-2 Years #,0-2 Years %,3-5 Years #,3-5 Years %,6-10 Years #,6-10 Years %,>10 Years #,>10 Years %,Unknown #,Unknown %';
     $this->view->cspan = '#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan';
     $this->view->width = '*,*,*,*,*,*,*,*,*,*,*,*';
     $this->view->ro = 'ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro';
     $this->view->xmlstore = $xmlstore;
     $this->view->search_form = $search_form;
     $this->view->form_values = $form_values;
     $search_form->facility_type->setValue($form_values['facility_type']);
     $this->view->data = $data_arr;
     $this->view->inlineScript()->appendFile(Zend_Registry::get('baseurl') . '/js/all_level_area_combo_report_graph.js');
 }