예제 #1
0
 public function ajaxConsumptionAction()
 {
     $this->_helper->layout->setLayout('ajax');
     if (isset($this->_request->do) && !empty($this->_request->do)) {
         $base_url = Zend_Registry::get('baseurl');
         $this->view->headLink()->appendStylesheet($base_url . '/common/assets/global/plugins/datatables/plugins/bootstrap/dataTables.bootstrap.css');
         $this->view->headLink()->appendStylesheet($base_url . '/common/assets/global/plugins/datatables/media/css/jquery.dataTables.css');
         $this->view->inlineScript()->appendFile($base_url . '/common/theme/scripts/plugins/tables/DataTables/media/js/jquery.dataTables_1.js');
         $this->view->inlineScript()->appendFile($base_url . '/common/theme/scripts/plugins/tables/DataTables/extras/TableTools/media/js/TableTools.js');
         $this->view->inlineScript()->appendFile($base_url . '/common/theme/scripts/demo/tables.js');
         $temp = $this->_request->do;
         $warehouse_data = new Model_WarehousesData();
         $warehouse_data->temp = $temp;
         $arr_temp = $warehouse_data->monthlyConsumtionTemp();
         $this->view->month = $arr_temp['month'];
         $this->view->mm = $arr_temp['mm'];
         $this->view->year = $arr_temp['yy'];
         $this->view->is_new_report = $arr_temp['is_new_rpt'];
         $this->view->prev_month_date = $arr_temp['prev_month_date'];
         $this->view->check_date = $arr_temp['check_date'];
         $this->view->first_month = Zend_Registry::get('first_month');
         $item_pack_sizes = new Model_ItemPackSizes();
         $item_pack_sizes->form_values = array('month' => $arr_temp['mm'], 'year' => $arr_temp['yy'], 'wh_id' => $arr_temp['wh_id']);
         $warehouse_data->warehouse_id = $arr_temp['wh_id'];
         $province_id = $warehouse_data->getProvinceId();
         $this->view->province_id = $province_id;
         $this->view->rpt_date = $arr_temp['rpt_date'];
         $this->view->wh_id = $arr_temp['wh_id'];
         if ($arr_temp['mm'] . "-" . $arr_temp['yy'] >= '05-2015' && $province_id == 2) {
             $item_pack_sizes = new Model_ItemPackSizes();
             $items = $item_pack_sizes->monthlyConsumtion2();
             $items_non_vaccines = $item_pack_sizes->monthlyConsumtion2_non_vaccinces();
             $items_tt = $item_pack_sizes->monthlyConsumtion2_tt();
             $this->view->items = $items;
             $this->view->items_non_vaccinces = $items_non_vaccines;
             $this->view->items_tt = $items_tt;
         } else {
             $item_pack_sizes = new Model_ItemPackSizes();
             $item_pack_sizes->form_values = array('month' => $arr_temp['mm'], 'year' => $arr_temp['yy'], 'wh_id' => $arr_temp['wh_id']);
             $items = $item_pack_sizes->monthlyConsumtion();
             $this->view->items = $items;
         }
         $reports = new Model_Reports();
         $reports->form_values = array("wh_id" => $arr_temp['wh_id']);
         $max_date = $reports->getLastModifiedDate();
         if (!empty($max_date)) {
             $this->view->modified_date = date("d/m/Y", strtotime($max_date));
         }
     }
 }