public function inventoryManagementReportingAction() { $this->_helper->layout->setLayout('reports'); $this->view->report_id = 'SNONREPDIST'; $this->view->report_title = 'Inventory Management Reporting Report'; $this->view->actionpage = 'inventory-management-reporting'; $this->view->parameters = 'TS01IP'; $this->view->parameter_width = '100%'; $item_pack_sizes = new Model_ItemPackSizes(); $locations = new Model_Locations(); //FOR BCG ITEM $item_pack_sizes->form_values = 6; $items = $item_pack_sizes->getItemForConsumptionReport(); $this->view->items = $items; //For locations Combo $lct = $locations->conusmptionReportLocations(); $this->view->location = $lct; if (!empty($this->_request->from_year_sel) && !empty($this->_request->from_month_sel)) { $this->view->from_year_sel = $from_year = $this->_request->from_year_sel; $this->view->from_month_sel = $from_month = $this->_request->from_month_sel; } else { $from_year = date("Y"); $this->view->from_year_sel = $from_year; $this->view->from_month_sel = $from_month = date("m", strtotime("-4 month")); } if (!empty($this->_request->year_sel) && !empty($this->_request->month_sel)) { $this->view->year_sel = $year = $this->_request->year_sel; $this->view->month_sel = $month = $this->_request->month_sel; } else { $year = date("Y"); if (date('d') > 10) { $month = date("m", strtotime("-2 month")); } else { $month = date("m", strtotime("-2 month")); } $this->view->year_sel = $year; $this->view->month_sel = $month; } if (isset($this->_request->province) && !empty($this->_request->province)) { $this->view->prov_sel = $province = $this->_request->province; } else { $this->view->prov_sel = $province = 2; } if (isset($this->_request->district) && !empty($this->_request->district)) { $this->view->district_id = $district_id = $this->_request->district; } else { $this->view->district_id = $district_id = 30; } if (isset($this->_request->tehsil) && !empty($this->_request->tehsil)) { $this->view->tehsil = $this->_request->tehsil; } else { $this->view->tehsil = 1; } if (isset($this->_request->wh_type) && !empty($this->_request->wh_type)) { $this->view->wh_type = $wh_type = $this->_request->wh_type; } else { $this->view->wh_type = $wh_type = 4; } if ($this->_request->wh_type == 4) { $locations->form_values['pk_id'] = $this->_request->district; $this->view->loc_name = "District:" . ' ' . $locations->getLocationName(); } elseif ($this->_request->wh_type == 5) { $locations->form_values['pk_id'] = $this->_request->tehsil; $this->view->loc_name = "Tehsil:" . ' ' . $locations->getLocationName(); } else { $this->view->loc_name = "District:" . ' ' . 'Badin'; } $locations->form_values['geo_level_id'] = '4'; $locations->form_values['province_id'] = $province; $district = $locations->getLocationsByLevelByProvinceConsumption(); $this->view->district = $district; $this->view->prov_sel = $province; $locations->form_values['dist_id'] = $district_id; $locations->form_values['year'] = $year; $distrctName = $locations->getLocationForReport(); $res = $locations->getLocationsForConsumptionReport(); $this->view->result = $res; //FOR Excel File Name $reportingDate = $year . '-' . $month . '-01'; $fileName = 'BCG-Vaccine-Coverage' . $distrctName . '_for_' . date('M-Y', strtotime($reportingDate)); $this->view->file_name = $fileName; }