public function wastagesReportAction() { $this->_helper->layout->setLayout('reports'); $this->view->report_id = 'WASTAGESREPORTING'; $this->view->report_title = 'Reporting and Wastages Rate'; $this->view->actionpage = 'wastages-report'; $this->view->parameters = 'TS01IP'; $this->view->parameter_width = '95%'; $item_pack_sizes = new Model_ItemPackSizes(); $location = new Model_Locations(); $warehouses_data = new Model_WarehousesData(); $item = $item_pack_sizes->VaccineProductsReport(); if (!empty($this->_request->level)) { $this->view->sel_level = $level_sel = $this->_request->level; } else { $this->view->sel_level = $level_sel = '2'; } if (isset($this->_request->province) && !empty($this->_request->province)) { $this->view->province = $province = $this->_request->province; } else { $this->view->province = $province = 1; } if (isset($this->_request->district) && !empty($this->_request->district)) { $this->view->district = $district = $this->_request->district; } else { $this->view->district = $district = 1; } 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 = 2; } if ($this->_request->wh_type == 2) { $location->form_values['pk_id'] = $this->_request->province; $this->view->loc_name = "Province:" . ' ' . $location->getLocationName(); } elseif ($this->_request->wh_type == 4) { $location->form_values['pk_id'] = $this->_request->district; $this->view->loc_name = "District:" . ' ' . $location->getLocationName(); } else { $this->view->loc_name = "Province:" . ' ' . 'Punjab'; } $location->form_values['level_id'] = $wh_type; $location->form_values['province_id'] = $province; $location->form_values['district_id'] = $district; $location_name = $location->getLocationWastages(); $this->view->item_id = $item; $this->view->location_id = $location_name; if (!empty($this->_request->year_sel) && !empty($this->_request->ending_month)) { $this->view->year_sel = $year = $this->_request->year_sel; $this->view->month_sel = $month = $this->_request->ending_month; } else { $year = date("Y"); $month = date("m", strtotime("-2 month")); $this->view->year_sel = $year; $this->view->month_sel = $month; } if (!empty($this->_request->prod_sel)) { $this->view->sel_prod = $this->_request->prod_sel; $this->view->sel_item = $this->_request->prod_sel; } else { $this->view->sel_prod = 6; $this->view->sel_item = 6; } 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 = 2; } if (isset($this->_request->stk_sel) && !empty($this->_request->stk_sel)) { $this->view->stk_sel = $sel_stk = $this->_request->stk_sel; } else { $this->view->stk_sel = $sel_stk = 1; } $end_date1 = $year . '-' . $month . '-01'; $end_date = date('Y-m-d', strtotime("-1 days", strtotime("+1 month", strtotime($end_date1)))); $start_date = date('Y-m-d', strtotime("-5 month", strtotime($end_date1))); //$end_date = date('Y-m-d', strtotime("-1 days", strtotime("+1 month", strtotime($endDate1)))); //$start_date = date('Y-m-d', strtotime("-5 month", strtotime($endDate1))); // Start date and End date $begin = new DateTime($start_date); $end = new DateTime($end_date); $diff = $begin->diff($end); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($begin, $interval, $end); $this->view->period = $period; $stakeholder = new Model_Stakeholders(); $stk = $stakeholder->nationReport(); $this->view->stk = $stk; $locations = new Model_Locations(); $lct = $locations->devisionalReport(); $this->view->location = $lct; }