public function stockMovementReportAction() { $this->_helper->layout->setLayout('reports'); //$this->view->report_id = 'CENTRALWAREHOUSE'; $this->view->report_id = 'STOCKMOVEMENT'; $this->view->report_title = 'Stock Movement Report'; $this->view->actionpage = 'stock-movement-report'; $this->view->parameters = 'TS01I'; $this->view->parameter_width = '100%'; $item_pack_sizes = new Model_ItemPackSizes(); $warehouses_data = new Model_WarehousesData(); $item = $item_pack_sizes->productsReport(); $this->view->item_id = $item; if (!empty($this->_request->ending_month) && !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")); } $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; } $this->view->prov_sel = $prov_sel = $this->_request->prov_sel; 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; } 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 = 1; } if (isset($this->_request->warehouse_id) && !empty($this->_request->warehouse_id)) { $this->view->warehouse_id = $warehouse_id = $this->_request->warehouse_id; } else { $this->view->warehouse_id = $warehouse_id = 159; } if (isset($this->_request->wh_prov_sel) && !empty($this->_request->wh_prov_sel)) { $this->view->wh_prov_sel = $wh_prov_sel = $this->_request->wh_prov_sel; } else { $this->view->wh_prov_sel = $wh_prov_sel = ''; } //to warehouse if (isset($this->_request->to_wh_type) && !empty($this->_request->to_wh_type)) { $this->view->to_wh_type = $wh_type = $this->_request->to_wh_type; } else { $this->view->to_wh_type = $wh_type = 2; } if (isset($this->_request->to_warehouse_id) && !empty($this->_request->to_warehouse_id)) { $this->view->to_warehouse_id = $warehouse_id = $this->_request->to_warehouse_id; } else { $this->view->to_warehouse_id = $warehouse_id = 162; } if (isset($this->_request->to_wh_prov_sel) && !empty($this->_request->to_wh_prov_sel)) { $this->view->to_wh_prov_sel = $wh_prov_sel = $this->_request->to_wh_prov_sel; } else { $this->view->to_wh_prov_sel = $wh_prov_sel = ''; } //to warehouse end if ($sel_indicator == 1) { $str_indicator = "\\'Issue\\'"; } else { if ($sel_indicator == 2) { $str_indicator = "\\'Stock on Hand\\'"; } else { if ($sel_indicator == 3) { $str_indicator = "\\'Received\\'"; } } } $this->view->str_indicator = $str_indicator; $end_date = $year . '-' . $month . '-01'; $end_date = date('Y-m-d', strtotime("-1 days", strtotime("+1 month", strtotime($end_date)))); $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->nationalReport(); $this->view->location = $lct; }