コード例 #1
0
 public function init()
 {
     //Generate Products(items) Combo
     $items = new Model_ItemPackSizes();
     $result2 = $items->getAllItems();
     foreach ($result2 as $item) {
         $this->_list["item_pack_size_id"][$item['pkId']] = $item['itemName'];
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "searchinput":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "status":
                 $this->addElement("radio", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => array("6" => "All Priorities", "1" => "Priority 1", "2" => "Priority 2", "3" => "Priority 3", "4" => "Finished", "5" => "Expired by date", "7" => "Expired by VVM"), 'options' => array('label' => 'Title', 'labelAttributes' => array('class' => 'radio-inline'))));
                 //$this->getElement($col)->setAttrib("label_class", "radio-inline");
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag")->removeDecorator("<br>");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
コード例 #2
0
 public function addReport($stockId, $type, $from = NULL)
 {
     $stock_master = new Model_StockMaster();
     $stock_master->form_values['pk_id'] = $stockId;
     $stock_master->form_values['from'] = $from;
     $result = $stock_master->getItemDetailFromStock();
     if ($result != FALSE) {
         foreach ($result as $stockdata) {
             $tdate = $stockdata['transaction_date'];
             $product = $stockdata['item_id'];
             $month = App_Controller_Functions::dateFormat($tdate, "first day of this month", "m");
             $year = App_Controller_Functions::dateFormat($tdate, "first day of this month", "Y");
             $wh_id = $this->_identity->getWarehouseId();
             if ($month == date("m") && $year == date("Y")) {
                 $item = new Model_ItemPackSizes();
                 $items = $item->getAllItems();
                 foreach ($items as $one) {
                     $this->form_values['report_month'] = $month;
                     $this->form_values['report_year'] = $year;
                     $this->form_values['item_id'] = $one['pkId'];
                     $this->form_values['warehouse_id'] = $wh_id;
                     $this->form_values['created_by'] = $this->_user_id;
                     $this->adjustStockReport();
                 }
             } else {
                 $this->form_values['report_month'] = $month;
                 $this->form_values['report_year'] = $year;
                 $this->form_values['item_id'] = $product;
                 $this->form_values['warehouse_id'] = $wh_id;
                 $this->form_values['created_by'] = $this->_user_id;
                 $this->adjustStockReport();
             }
         }
     }
 }
コード例 #3
0
 public function init()
 {
     //Generate Products(items) Combo
     $item_pack_sizes = new Model_ItemPackSizes();
     $result2 = $item_pack_sizes->getAllItems();
     $this->_list["product"][''] = "Select";
     foreach ($result2 as $item) {
         $this->_list["product"][$item['pkId']] = $item['itemName'];
     }
     $warehouses = new Model_Warehouses();
     $result3 = $warehouses->getUserReceiveFromWarehouse();
     foreach ($result3 as $whs) {
         $this->_list["warehouses"][''] = "Select";
         $this->_list["warehouses"][$whs['pkId']] = $whs['warehouseName'];
     }
     $date_from = date('01/m/Y');
     $date_to = date('d/m/Y');
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "number":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "date_from":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => $date_from));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "date_to":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => $date_to));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         if (in_array($col, array_keys($this->_list))) {
             $this->addElement("select", $col, array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
         //Generate Purpose(activity_id) combo
         $stk_activities = new Model_StakeholderActivities();
         $result4 = $stk_activities->getAllStakeholderActivitiesIssues();
         if ($result4) {
             $stakeholder_id = $result4[0]['pkId'];
             foreach ($result4 as $stk_activity) {
                 $this->_list["activity_id"][''] = "Select";
                 $this->_list["activity_id"][$stk_activity['pkId']] = $stk_activity['activity'];
             }
         }
     }
 }
コード例 #4
0
 public function ajaxGetPreMonthReceiveAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $params = $this->_request->getParams();
     $obj_item = new Model_ItemPackSizes();
     $items = $obj_item->getAllItems();
     $wh_data = new Model_WarehousesData();
     $wh_data->form_values = array('reporting_start_date' => $params['year'] . "-" . $params['month'] . "-01", 'warehouse_id' => $params['wh_id']);
     $data_rs = $wh_data->isReportExists();
     $result = array();
     if (!$data_rs) {
         foreach ($items as $item) {
             $ips = $this->_em->getRepository("ItemPackSizes")->find($item['pkId']);
             $str_sql = "SELECT REPgetTransWHData(4,'" . $params['month'] . "','" . $params['year'] . "','" . $item['pkId'] . "','" . $params['wh_id'] . "') from DUAL";
             echo $str_sql;
             exit;
             $row = $this->_em->getConnection()->executeQuery($str_sql);
             $rs = $row->fetch();
             $result[$item['pkId']] = $rs[0] == NULL ? 0 : $rs[0] * $ips->getNumberOfDoses();
         }
     }
     echo json_encode($result);
 }
コード例 #5
0
 public function provinceAction()
 {
     $auth = App_Auth::getInstance();
     $role_id = $auth->getRoleId();
     $this->view->level = 2;
     $this->view->province = $this->_identity->getProvinceId();
     $province = $this->_request->getParam("combo1", 1);
     if (!empty($province) && $province != 'null') {
         $this->view->province = $province;
     }
     $campaign = new Model_Campaigns();
     $location = new Model_Locations();
     $location->form_values = array("province_id" => $province);
     $dists = $location->districtLocations();
     foreach ($dists as $dist) {
         $arr_dist[] = $dist['pk_id'];
     }
     $campaign->form_values = array("districts" => implode(",", $arr_dist));
     $this->view->campaigns = $campaign->getCampaignsByDistrict();
     $this->view->provinces = $location->getProvincesName();
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllItems();
     // Default Filters for IM
     $this->view->item = 6;
     $this->view->date = Zend_Registry::get('report_month');
     // Default Filters for Campaign
     $this->view->camp = 23;
     $this->view->user_role = $role_id;
     $this->view->prov = $this->_identity->getProvinceId();
     $r = $this->_request->getParam("ri_btn", '');
     if ($r == 'ri') {
         $this->view->r = $r;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $i = $this->_request->getParam("im_btn", '');
     if ($i == 'im') {
         $this->view->i = $i;
         $this->view->item = $this->_request->getParam("items", '');
         $this->view->date = $this->_request->getParam("date", '');
         $this->view->period = $this->_request->getParam("period", '');
     }
     $c = $this->_request->getParam("camp_btn", '');
     if ($c == 'camp') {
         $this->view->c = $c;
         $this->view->camp = $this->_request->getParam("camp", '');
         $this->view->prov = $this->_request->getParam("prov", '');
     }
     $role_resource = new Model_RoleResources();
     $role_resource->form_values = array('type_id' => 3, 'role_id' => $role_id);
     $dashboards = $role_resource->getRoleResourcesByType();
     $this->view->dashboards = $dashboards;
     $this->view->ri = 472;
     $this->view->im = 330;
     $this->view->campaign = 333;
     $period = new Model_Period();
     $time_intervals = $period->getTimeIntervals();
     $this->view->time_intervals = $time_intervals;
     $this->view->quarter = Model_Period::QUARTER;
     $this->view->halfyear = Model_Period::HALFYEAR;
     $this->view->annual = Model_Period::ANNUAL;
     $base_url = Zend_Registry::get('baseurl');
     $this->view->inlineScript()->appendFile($base_url . '/js/all_level_area_combo.js');
 }
コード例 #6
0
 public function getItemListAction()
 {
     $items = new Model_ItemPackSizes();
     $items_list = $items->getAllItems();
     echo Zend_Json::encode($items_list);
 }
コード例 #7
0
 /**
  * Routine Immunization Dashlet Late
  */
 public function wastagesRateAction()
 {
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllItems();
     $wh_data = new Model_WarehousesData();
     $params["date"] = "2014-05";
     $params["item"] = 6;
     $wh_data->form_values = $params;
     $xmlstore = $wh_data->wastagesRate();
     $this->view->xmlstore = $xmlstore;
     $this->view->date = $params["date"];
     $this->view->item = $params["item"];
 }