public function distributionRefrigeratorByModelByFTypeAction() { ini_set('memory_limit', '128M'); $this->_helper->layout->setLayout('reports'); $header = ''; $header .= 'Model'; //$header1 = '#rspan'; $cspan = '#cspan'; $width = '60'; $ro = 'ro'; $align = "left"; $data_arr = array(); $search_form = new Form_ReportsSearch(); $cold_chain = new Model_ColdChain(); $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()); $cold_chain->form_values = $form_values; $qry_res = $cold_chain->getColdchainModelsByFacilityType(); $warehouse = new Model_Warehouses(); $warehouse_asset_types = $warehouse->getWarehouseByAssetType(); foreach ($qry_res as $row) { $data_arr[$row['pk_id']][] = $row['ccm_model_name']; $count = 1; foreach ($warehouse_asset_types as $warehouse_asset_type) { $data_arr[$row['pk_id']][$warehouse_asset_type['warehouse_type_id']] = 0; } } foreach ($warehouse_asset_types as $row2) { $header .= ',' . $row2['warehouse_type_name']; //$header1 .= ',#rspan'; $cspan .= ',#cspan'; $width .= ',*'; $ro .= ',ro'; $align .= ',right'; $warehouse_warehouse_types = $cold_chain->getColdChainByWarehouseType($row2['warehouse_type_id']); $count = 1; foreach ($warehouse_warehouse_types as $warehouse_warehouse_type) { if ($data_arr[$warehouse_warehouse_type['pk_id']][0] && $data_arr[$warehouse_warehouse_type['pk_id']][0] != "") { $data_arr[$warehouse_warehouse_type['pk_id']][$row2['warehouse_type_id']] = $warehouse_warehouse_type['TotalAssets']; } } } } } if ($data_arr && count($data_arr) > 0) { $xmlstore = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; $xmlstore .= "<rows>"; foreach ($data_arr as $item => $sub_arr) { $xmlstore .= "<row>"; if (array_key_exists('0', $sub_arr)) { $xmlstore .= "<cell>" . $sub_arr[0] . "</cell>"; } else { $xmlstore .= "<cell> - </cell>"; } foreach ($sub_arr as $key => $value) { if ($key > 0) { $xmlstore .= "<cell style=\"text-align:right\">" . number_format($value) . "</cell>"; } } $xmlstore .= "</row>"; } $xmlstore .= "</rows>"; } else { $xmlstore = ""; } $this->view->main_heading = "CCEM Reports"; $this->view->report_title = "Distribution of Refrigerators/Freezers by Model and Facility Type"; $this->view->data = $data_arr; $this->view->headers = $header; $this->view->width = $width; $this->view->ro = $ro; $this->view->cspan = $cspan; $this->view->xmlstore = $xmlstore; $this->view->search_form = $search_form; $this->view->form_values = $form_values; $this->view->inlineScript()->appendFile(Zend_Registry::get('baseurl') . '/js/all_level_area_combo_report_graph.js'); }