public function districtsYearlyReportAction()
 {
     $this->_helper->layout->setLayout('reports');
     $this->view->report_id = 'DISTRICTWAREHOUSE';
     $this->view->report_title = 'District Yearly Report';
     $this->view->actionpage = 'districts-yearly-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();
     if ($this->_request->prov_sel) {
         $province = $this->_request->prov_sel;
     } else {
         $province = 1;
     }
     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");
         //            if (date('d') > 10) {
         //                $month = date("m", strtotime("-1"));
         //            } else {
         $month = date("m", strtotime("-2 month"));
         //            }
         $this->view->year_sel = $year;
         $this->view->month_sel = $month;
     }
     if (!empty($this->_request->rep_indicators)) {
         $this->view->sel_indicator = $sel_indicator = $this->_request->rep_indicators;
     } else {
         $this->view->sel_indicator = $sel_indicator = 1;
     }
     if (!empty($this->_request->prod_sel)) {
         $this->view->sel_prod = $this->_request->prod_sel;
     } else {
         $this->view->sel_prod = 28;
     }
     if (!empty($this->_request->prov_sel)) {
         $this->view->prov_sel = $prov_sel = $this->_request->prov_sel;
     } else {
         $this->view->prov_sel = 1;
     }
     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;
     }
     $item_pack_sizes = new Model_ItemPackSizes();
     if ($this->_request->prod_sel) {
         $item_pack_sizes->form_values['pk_id'] = $this->_request->prod_sel;
         $this->view->item_name = $item_pack_sizes->getProductName();
     } else {
         $item_pack_sizes->form_values['pk_id'] = '28';
         $this->view->item_name = $item_pack_sizes->getProductName();
     }
     if (isset($this->_request->dist_id) && !empty($this->_request->dist_id)) {
         $locations = new Model_Locations();
         $locations->form_values['geo_level_id'] = '4';
         $locations->form_values['province_id'] = $this->_request->prov_sel;
         $district = $locations->getLocationsByLevelByProvince();
         $this->view->district = $district;
         $this->view->sel_dist = $this->_request->dist_id;
         $location->form_values['province_id'] = $province;
         $location->form_values['district_id'] = $this->_request->dist_id;
         $location_name = $location->tehsilLocationsDistrict();
         $item = $item_pack_sizes->productsReport();
         $this->view->item_id = $item;
         $this->view->location_id = $location_name;
         $locations->form_values['pk_id'] = $this->_request->dist_id;
         $this->view->district_name = "District:" . ' ' . $locations->getLocationName();
     } else {
         $locations = new Model_Locations();
         $locations->form_values['geo_level_id'] = '4';
         $locations->form_values['province_id'] = '1';
         $district = $locations->getLocationsByLevelByProvince();
         $this->view->district = $district;
         $this->view->sel_dist = "";
         $location->form_values['province_id'] = $province;
         $location_name = $location->getLocations();
         $item = $item_pack_sizes->productsReport();
         $this->view->item_id = $item;
         $this->view->location_id = $location_name;
         $this->view->district_name = "";
     }
     $locations = new Model_Locations();
     if ($this->_request->prov_sel) {
         $locations->form_values['pk_id'] = $this->_request->prov_sel;
         $this->view->location_name = "Province:" . ' ' . $locations->getLocationName();
         // $this->view->location_name = $locations->getLocationName();
     } else {
         $this->view->location_name = "Province:" . ' ' . "Punjab";
     }
     if ($sel_indicator == 1) {
         $str_indicator = "\\'Consumption\\'";
     } else {
         if ($sel_indicator == 2) {
             $str_indicator = "\\'Stock on Hand\\'";
         } else {
             if ($sel_indicator == 3) {
                 $str_indicator = "\\'Received\\'";
             } else {
                 if ($sel_indicator == 4) {
                     $str_indicator = "\\'Issued\\'";
                 }
             }
         }
     }
     $this->view->str_indicator = $str_indicator;
     $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("-364 days", strtotime($end_date)));
     // 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;
     $this->view->sel_item = $this->_request->prod_sel;
     $stakeholder = new Model_Stakeholders();
     $stk = $stakeholder->nationReport();
     $this->view->stk = $stk;
     $locations = new Model_Locations();
     $lct = $locations->devisionalReport();
     $this->view->location = $lct;
     $locations->form_values['province_id'] = '1';
     $locations->form_values['district_id'] = '';
     $lct2 = $locations->tehsilLocations();
     $this->view->loc = $lct2;
 }