public function storageCapacityByArea4cAction() { //ccem 4.4.4 $this->_helper->layout->setLayout('reports'); $data_arr = array(); $search_form = new Form_ReportsSearch(); $ccm_warehouse = new Model_CcmWarehouses(); $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_warehouse->form_values = $form_values; $data_arr = $ccm_warehouse->getStorageCapacityByArea4c(); } } $xmlstore = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $xmlstore .= "<rows>"; foreach ($data_arr as $sub_arr) { $xmlstore .= "<row>"; $xmlstore .= "<cell>" . $sub_arr['Province'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['District'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['warehouse_type_name'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['cap4'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['req4'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['diff4'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['surplus30'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['surplus1030'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['match10'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['shortage1030'] . "</cell>"; $xmlstore .= "<cell>" . $sub_arr['shortage30'] . "</cell>"; $xmlstore .= "</row>"; } $xmlstore .= "</rows>"; $this->view->main_heading = "CCEM Reports"; $this->view->report_title = "Capacity shortages 4c by area"; $this->view->headers = 'Province,District,Facility Type,Net Storage (Ltr) Actual,Net Storage (Ltr) Required,Net Storage (Ltr) Difference, Surplus > 30%, Surplus 10-30%,Match +/- 10%, Shortage 10-30%,Shortage >30%'; $this->view->rspan = ''; $this->view->cspan = '#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan,#cspan'; $this->view->width = '*,*,*,*,*,*,*,*,*,*,*'; $this->view->aligns = 'left,left,left,right,right,right,right,right,right,right,right,right'; $this->view->ro = 'ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro'; $this->view->aligns = 'left,left,left,right,right,right,right,right,right,right,right,right'; $this->view->xmlstore = $xmlstore; $this->view->search_form = $search_form; $this->view->data = $data_arr; $search_form->facility_type->setValue($form_values['facility_type']); $this->view->form_values = $form_values; $this->view->inlineScript()->appendFile(Zend_Registry::get('baseurl') . '/js/all_level_area_combo_report_graph.js'); }