Ejemplo n.º 1
0
 public function getExplorerReport()
 {
     $warehouse_data = new Model_HfDataMaster();
     $warehouses = new Model_Warehouses();
     $reports = new Model_Reports();
     $temp = $this->temp;
     $temp = base64_decode(substr($temp, 1, strlen($temp) - 1));
     $temp = explode("|", $temp);
     $wh_id = $temp[0];
     $loc_id = $temp[1];
     $report_date = $temp[2];
     $is_new_report = $temp[3];
     $tt = explode("-", $report_date);
     $yy = $tt[0];
     $mm = $tt[1];
     $dd = $tt[2];
     if ($mm == '1') {
         $month = "Jan";
     }
     if ($mm == '2') {
         $month = "Feb";
     }
     if ($mm == '3') {
         $month = "Mar";
     }
     if ($mm == '4') {
         $month = "Apr";
     }
     if ($mm == '5') {
         $month = "May";
     }
     if ($mm == '6') {
         $month = "Jun";
     }
     if ($mm == '7') {
         $month = "Jul";
     }
     if ($mm == '8') {
         $month = "Aug";
     }
     if ($mm == '9') {
         $month = "Sep";
     }
     if ($mm == '10') {
         $month = "Oct";
     }
     if ($mm == '11') {
         $month = "Nov";
     }
     if ($mm == '12') {
         $month = "Dec";
     }
     $warehouses->form_values['pk_id'] = $wh_id;
     $stakeholder_id = $warehouses->getStakeholderIdByWarehouseId();
     if ($is_new_report == 1) {
         $prev_month_date = $reports->getPreviousMonthReportDate($report_date);
     } else {
         $prev_month_date = $report_date;
     }
     $warehouses->form_values['location_id'] = $loc_id;
     $uc_centers = $warehouses->getAllUCCenters();
     $warehouse_data->form_values['warehouse_id'] = $wh_id;
     $reports = $warehouse_data->getMonthYearByWarehouseId();
     $warehouse_level = $warehouses->getWarehouseLevelById();
     $array_data = array('wh_id' => $wh_id, 'loc_id' => $loc_id, 'rpt_date' => $report_date, 'is_new_rpt' => $is_new_report, 'yy' => $yy, 'mm' => $mm, 'dd' => $dd, 'prev_month_date' => $prev_month_date, 'stakeholder_id' => $stakeholder_id, 'month' => $month, 'warehouse_level' => $warehouse_level);
     return $array_data;
 }
Ejemplo n.º 2
0
 public function printMonthlyConsumption2Action()
 {
     $this->_helper->layout->setLayout('print-consumption2');
     $form = new Form_MonthlyConsumption();
     $warehouse = new Model_Warehouses();
     $warehouses = $warehouse->getWarehouseNames();
     $this->view->warehouses = $warehouses;
     if (isset($this->_request->do) && !empty($this->_request->do)) {
         $temp = $this->_request->do;
         // App_Controller_Functions::pr(base64_decode(substr($temp, 1, strlen($temp) - 1)));
         $warehouse_data = new Model_HfDataMaster();
         $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']);
         $items = $item_pack_sizes->monthlyConsumtion2();
         $items_non_vaccines = $item_pack_sizes->monthlyConsumtion2_non_vaccinces();
         $items_tt = $item_pack_sizes->monthlyConsumtion2_tt();
         $warehouse_data->form_values = array('warehouse_id' => $arr_temp['wh_id']);
         $result = $warehouse_data->getMonthYearByWarehouseId();
         if ($result != false) {
             $arr_combo = array();
             $arr_combo[] = array("key" => "", "value" => "Select");
             foreach ($result as $row) {
                 $loc_id = $row['location_id'];
                 $do = 'Z' . base64_encode($arr_temp['wh_id'] . '|' . $row['report_year'] . '-' . str_pad($row['report_month'], 2, "0", STR_PAD_LEFT) . '-01' . '|2');
                 $arr_combo[] = array("key" => $do, "value" => $row['report_month'] . '-' . $row['report_year']);
             }
         }
         $warehouse_id = $arr_temp['wh_id'];
         $wh = $this->_em->getRepository("Warehouses")->find($warehouse_id);
         $warehouse_name = $wh->getWarehouseName();
         // $form->monthly_report->setMultiOptions($arr_combo);
         //  $form->monthly_report->setValue($temp);
         $this->view->rpt_date = $arr_temp['rpt_date'];
         $this->view->wh_id = $arr_temp['wh_id'];
         $this->view->warehouse_name = $warehouse_name;
         $this->view->locid = $loc_id;
         $this->view->items = $items;
         $this->view->items_non_vaccinces = $items_non_vaccines;
         $this->view->items_tt = $items_tt;
         if (!empty($warehouse_id)) {
             $uc = $wh->getLocation()->getPkId();
             $district = $wh->getDistrict()->getPkId();
             $province = $wh->getProvince()->getPkId();
             $uc_tbl = $this->_em->getRepository("Locations")->find($uc);
             $uc_name = $uc_tbl->getLocationName();
             $this->view->uc_name = $uc_name;
             $tehsil = $uc_tbl->getParent()->getPkId();
             $tehsil_tbl = $this->_em->getRepository("Locations")->find($tehsil);
             $tehsil_name = $tehsil_tbl->getLocationName();
             $this->view->tehsil_name = $tehsil_name;
             $district_tbl = $this->_em->getRepository("Locations")->find($district);
             $district_name = $district_tbl->getLocationName();
             $this->view->district_name = $district_name;
             $province_tbl = $this->_em->getRepository("Locations")->find($province);
             $provinc_name = $province_tbl->getLocationName();
             $this->view->provinc_name = $provinc_name;
         }
     }
     // $this->view->form = $form;
     $this->view->do = $this->_request->do;
     $this->view->username = $this->_identity->getUserName();
     $this->view->print_title = "Monthly Consumption Reporting Form (EPI Center)";
 }