public function init()
 {
     //Generate VVM Type Combo
     $vvmtypes = new Model_VvmTypes();
     $result3 = $vvmtypes->getAll();
     $this->_list["vvm_type_id"][''] = 'Select';
     foreach ($result3 as $vvmtype) {
         $this->_list["vvm_type_id"][$vvmtype['pk_id']] = $vvmtype['vvm_type_name'];
     }
     $item_pack_sizes = new Model_ItemPackSizes();
     $result1 = $item_pack_sizes->getAllManageItems();
     $this->_list["product_id"][''] = 'Select';
     if ($result1 && count($result1) > 0) {
         foreach ($result1 as $whs) {
             $this->_list["product_id"][$whs['pkId']] = $whs['itemName'];
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "batch":
             case "production_date":
             case "expiry_date":
             case "unit_price":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     $item_pack_sizes = new Model_ItemPackSizes();
     $result1 = $item_pack_sizes->getAllManageItems();
     $this->_list["product"][''] = 'Select';
     if ($result1 && count($result1) > 0) {
         foreach ($result1 as $whs) {
             $this->_list["product"][$whs['pkId']] = $whs['itemName'];
         }
     }
     $physical_stock_taking = new Model_PhysicalStockTaking();
     $result2 = $physical_stock_taking->getAllDescripiton();
     $this->_list["description"][''] = 'Select';
     if ($result2 && count($result2) > 0) {
         foreach ($result2 as $whs) {
             $this->_list["description"][$whs->getPkId()] = $whs->getDescription() . " - " . $whs->getFromDate()->format("d M Y") . " - " . $whs->getToDate()->format("d M Y");
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "from_date":
             case "to_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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");
         }
     }
 }
 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");
         }
     }
 }
 public function init()
 {
     $item_pack_sizes = new Model_ItemPackSizes();
     $result1 = $item_pack_sizes->getAllManageItems();
     $this->_list["product"][''] = 'Select';
     if ($result1 && count($result1) > 0) {
         foreach ($result1 as $whs) {
             $this->_list["product"][$whs['pkId']] = $whs['itemName'];
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "from_date":
             case "to_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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");
         }
         if (in_array($col, array_keys($this->_radio))) {
             $this->addElement("radio", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_radio[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag")->removeDecorator("<br>");
         }
     }
 }
 public function init()
 {
     //Generate WareHouses Combo
     $warehouse = new Model_Warehouses();
     $result1 = $warehouse->getSupplierWarehouses();
     foreach ($result1 as $wh) {
         $this->_list["from_warehouse_id"][$wh['pk_id']] = $wh['warehouse_name'];
     }
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_childlist["item_pack_size_id"][''] = "Select";
     if ($result) {
         $item_id = $result[0]->getPkId();
         foreach ($result as $row) {
             $this->_childlist["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate VVM Type Combo
     $vvmtypes = new Model_VvmTypes();
     $result3 = $vvmtypes->getAll();
     $this->_childlist["vvm_type_id"][''] = 'Select';
     foreach ($result3 as $vvmtype) {
         $this->_childlist["vvm_type_id"][$vvmtype['pk_id']] = $vvmtype['vvm_type_name'];
     }
     //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["stakeholder_activity_id"][$stk_activity['pkId']] = $stk_activity['activity'];
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "reference_number":
             case "description":
                 $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 "expected_arrival_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "transaction_number":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //Generate month Combo
     $this->_list["month"][''] = 'Select';
     $this->_list["month"]['01'] = 'January';
     $this->_list["month"]['02'] = 'February';
     $this->_list["month"]['03'] = 'March';
     $this->_list["month"]['04'] = 'April';
     $this->_list["month"]['05'] = 'May';
     $this->_list["month"]['06'] = 'June';
     $this->_list["month"]['07'] = 'July';
     $this->_list["month"]['08'] = 'August';
     $this->_list["month"]['09'] = 'September';
     $this->_list["month"]['10'] = 'October';
     $this->_list["month"]['11'] = 'November';
     $this->_list["month"]['12'] = 'December';
     //Generate year Combo
     $this->_list["year"][''] = 'Select';
     //        for ($y = 2013; $y <= date("Y"); $y++) {
     //            $this->_list["year"][$y] = $y;
     //        }
     $this->_list["year"][date("Y")] = date("Y");
     //Generate Province/Region Combo
     $locations = new Model_Locations();
     $result = $locations->getAllProvinces();
     if ($result) {
         $this->_list["province_region"][''] = "Select";
         foreach ($result as $row) {
             $this->_list["province_region"][$row['pkId']] = $row['locationName'];
         }
     }
     //Generate Antigen(items) Combo
     $item_pack_sizes = new Model_ItemPackSizes();
     $result2 = $item_pack_sizes->getAllVaccines();
     foreach ($result2 as $item) {
         $this->_list["product"][''] = 'Select';
         $this->_list["product"][$item['pkId']] = $item['itemName'];
     }
     foreach ($this->_fields as $col => $name) {
         //            switch ($col) {
         //
         //                case "year":
         //                    $this->addElement("text", $col, array(
         //                        "attribs" => array("class" => "form-control", 'readonly' => 'true', 'style' => 'position: relative; z-index: 100000;'),
         //                        "allowEmpty" => false,
         //                        "filters" => array("StringTrim", "StripTags"),
         //                        "validators" => array(),
         //                        "value" => date("Y")
         //                    ));
         //                    $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         //                    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(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     $transaction_types = new Model_TransactionTypes();
     $result = $transaction_types->getAdjusmentTypes();
     foreach ($result as $trans) {
         $this->_list["adjustment_type"][''] = 'Select';
         $this->_list["adjustment_type"][$trans['pkId']] = $trans['transactionTypeName'];
     }
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_childlist["item_id"][''] = "Select";
     if ($result) {
         $item_id = $result[0]->getPkId();
         foreach ($result as $row) {
             $this->_childlist["item_id"][$row->getPkId()] = $row->getItemName();
         }
     }
     //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["stakeholder_activity_id"][$stk_activity['pkId']] = $stk_activity['activity'];
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "adjustment_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => date("d/m/Y")));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "ref_no":
             case "transaction_reference":
             case "comments":
                 $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 "reference_number":
             case "description":
                 $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 "transaction_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     $transaction_types = new Model_TransactionTypes();
     $result = $transaction_types->getAdjusmentTypes();
     foreach ($result as $trans) {
         $this->_list["adjustment_type"][''] = 'Select';
         $this->_list["adjustment_type"][$trans['pkId']] = $trans['transactionTypeName'];
     }
     $item_pack_sizes = new Model_ItemPackSizes();
     $result1 = $item_pack_sizes->getAllManageItems();
     $this->_list["product"][''] = 'Select';
     if ($result1 && count($result1) > 0) {
         foreach ($result1 as $whs) {
             $this->_list["product"][$whs['pkId']] = $whs['itemName'];
         }
     }
     $this->_list["vvm_stage"][""] = "NA";
     $this->_list["old_vvm"][""] = "NA";
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "item_unit_id":
                 $this->addElement("hidden", $col);
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "adjustment_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array(), "value" => date("d/m/Y")));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
             case "available":
             case "quantity":
             case "ref_no":
             case "transaction_reference":
             case "comments":
                 $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;
             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");
         }
     }
 }
 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'];
             }
         }
     }
 }
Exemple #10
0
 public function init()
 {
     //Generate Products(items) Combo
     $item_pack_sizes = new Model_ItemPackSizes();
     $result2 = $item_pack_sizes->getAllManageItems();
     $this->_list["product"][''] = "Select";
     foreach ($result2 as $item) {
         $this->_list["product"][$item['pkId']] = $item['itemName'];
     }
     foreach ($this->_fields as $col => $name) {
         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");
         }
     }
 }
 public function init()
 {
     //Generate Vehicle Type Combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::VEHICLE_TYPE);
     $result1 = $list->getListDetail();
     $this->_list["vehicle_type_id"][''] = "Select Vehicle Type";
     if ($result1) {
         foreach ($result1 as $row) {
             $this->_list["vehicle_type_id"][$row->getPkId()] = $row->getListValue();
         }
     }
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate Batch Number Combo
     $this->_list["stock_batch_id"][''] = "Select Item First";
     //$date_from = date('Y-m' . '-01');
     //$date_to = date('Y-m-d');
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "vehicle_type_id":
             case "item_pack_size_id":
             case "stock_batch_id":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "date_from":
             case "date_to":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", 'readonly' => 'true'), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $item_pack_size->form_values['item_category'] = '1';
     $result = $item_pack_size->getAllProducts();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row['pkId']] = $row['itemName'];
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "vvm_type_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "vvm_type_name":
                 $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;
             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(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
         if (in_array($col, array_keys($this->_radio))) {
             $this->addElement("radio", $col, array("attribs" => array(), "allowEmpty" => true, 'separator' => '', "filters" => array("StringTrim", "StripTags"), "validators" => array(), "multiOptions" => $this->_radio[$col]));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function init()
 {
     //Generate WareHouses Combo
     $pc = new Model_PipelineConsignments();
     $result1 = $pc->getPipelineToWarehouses();
     $this->_list["to_warehouse_id"][""] = 'Select';
     foreach ($result1 as $wh) {
         $this->_list["to_warehouse_id"][$wh['pkId']] = $wh['warehouseName'];
     }
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_list["item_pack_size_id"][''] = "Select";
     if ($result) {
         $item_id = $result[0]->getPkId();
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
         }
     }
     $date_from = date('01/m/Y');
     $date_to = date('d/m/Y');
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "from_date":
                 $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 "to_date":
                 $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], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function ajaxProductCategoryAction()
 {
     $this->_helper->layout->disableLayout();
     $item_pack_sizes = new Model_ItemPackSizes();
     if (isset($this->_request->item_id) && !empty($this->_request->item_id)) {
         $item_pack_sizes->form_values['pk_id'] = $this->_request->item_id;
         $this->view->category_name = $item_pack_sizes->getProductCategory();
     }
     if (isset($this->_request->quantity) && !empty($this->_request->quantity) && !empty($this->_request->item_id)) {
         $qty = $this->_request->quantity;
         $item_pack_sizes->form_values['pk_id'] = $this->_request->item_id;
         $doses = $item_pack_sizes->getProductDoses();
         $this->view->doses = $doses * $qty . ' Doses';
     }
 }
 public function inventoryManagementReportingAction()
 {
     $this->_helper->layout->setLayout('reports');
     $this->view->report_id = 'SNONREPDIST';
     $this->view->report_title = 'Inventory Management Reporting Report';
     $this->view->actionpage = 'inventory-management-reporting';
     $this->view->parameters = 'TS01IP';
     $this->view->parameter_width = '100%';
     $item_pack_sizes = new Model_ItemPackSizes();
     $locations = new Model_Locations();
     //FOR BCG ITEM
     $item_pack_sizes->form_values = 6;
     $items = $item_pack_sizes->getItemForConsumptionReport();
     $this->view->items = $items;
     //For locations Combo
     $lct = $locations->conusmptionReportLocations();
     $this->view->location = $lct;
     if (!empty($this->_request->from_year_sel) && !empty($this->_request->from_month_sel)) {
         $this->view->from_year_sel = $from_year = $this->_request->from_year_sel;
         $this->view->from_month_sel = $from_month = $this->_request->from_month_sel;
     } else {
         $from_year = date("Y");
         $this->view->from_year_sel = $from_year;
         $this->view->from_month_sel = $from_month = date("m", strtotime("-4 month"));
     }
     if (!empty($this->_request->year_sel) && !empty($this->_request->month_sel)) {
         $this->view->year_sel = $year = $this->_request->year_sel;
         $this->view->month_sel = $month = $this->_request->month_sel;
     } else {
         $year = date("Y");
         if (date('d') > 10) {
             $month = date("m", strtotime("-2 month"));
         } else {
             $month = date("m", strtotime("-2 month"));
         }
         $this->view->year_sel = $year;
         $this->view->month_sel = $month;
     }
     if (isset($this->_request->province) && !empty($this->_request->province)) {
         $this->view->prov_sel = $province = $this->_request->province;
     } else {
         $this->view->prov_sel = $province = 2;
     }
     if (isset($this->_request->district) && !empty($this->_request->district)) {
         $this->view->district_id = $district_id = $this->_request->district;
     } else {
         $this->view->district_id = $district_id = 30;
     }
     if (isset($this->_request->tehsil) && !empty($this->_request->tehsil)) {
         $this->view->tehsil = $this->_request->tehsil;
     } else {
         $this->view->tehsil = 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 = 4;
     }
     if ($this->_request->wh_type == 4) {
         $locations->form_values['pk_id'] = $this->_request->district;
         $this->view->loc_name = "District:" . ' ' . $locations->getLocationName();
     } elseif ($this->_request->wh_type == 5) {
         $locations->form_values['pk_id'] = $this->_request->tehsil;
         $this->view->loc_name = "Tehsil:" . ' ' . $locations->getLocationName();
     } else {
         $this->view->loc_name = "District:" . ' ' . 'Badin';
     }
     $locations->form_values['geo_level_id'] = '4';
     $locations->form_values['province_id'] = $province;
     $district = $locations->getLocationsByLevelByProvinceConsumption();
     $this->view->district = $district;
     $this->view->prov_sel = $province;
     $locations->form_values['dist_id'] = $district_id;
     $locations->form_values['year'] = $year;
     $distrctName = $locations->getLocationForReport();
     $res = $locations->getLocationsForConsumptionReport();
     $this->view->result = $res;
     //FOR Excel File Name
     $reportingDate = $year . '-' . $month . '-01';
     $fileName = 'BCG-Vaccine-Coverage' . $distrctName . '_for_' . date('M-Y', strtotime($reportingDate));
     $this->view->file_name = $fileName;
 }
 public function vlmisAction()
 {
     $salt = '159jboFHjeQK5mc1K0cdSz5';
     $token = sha1(md5($salt . date('Y-m-d')));
     if (!$this->_identity->login('userdashboard', base64_encode(123))) {
         $error = true;
         throw new Exception();
     }
     if ($token != $_GET['token']) {
         $this->view->message = 'Invalid Token';
     }
     $province = isset($_GET['combo1']) ? $_GET['combo1'] : 1;
     $level = isset($_GET['office']) ? $_GET['office'] : 1;
     $role_id = 4;
     $this->view->level = $level;
     $this->view->province = $province;
     $this->_helper->layout->setLayout('vlmis-dashboad');
     $auth = App_Auth::getInstance();
     //$role_id = $auth->getRoleId();
     $campaign = new Model_Campaigns();
     $location = new Model_Locations();
     $location->form_values = array('geo_level_id' => 4, 'province_id' => $province);
     $res = $location->getLocationsByLevelByProvince();
     $district = $res[0]['key'];
     $this->view->district = $district;
     switch ($level) {
         case 1:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
         case 2:
             $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();
             break;
         case 6:
             $campaign->form_values = array("districts" => $district);
             $this->view->campaigns = $campaign->getCampaignsByDistrict();
             break;
         default:
             $this->view->campaigns = $campaign->getAllCampaigns();
             break;
     }
     $this->view->provinces = $location->getProvincesName();
     $item = new Model_ItemPackSizes();
     $this->view->items = $item->getAllItemsByCategoryAndActivity("1", "1");
     // 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 = $province;
     $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->getRoleResourcesByTypeForVlmisDashboard();
     $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');
     $this->view->id = $this->_request->getParam("id", $dashboards[0]->getResource()->getPkId());
     /* if ($role_id == 7) {
        $this->view->province = $this->_identity->getProvinceId();
        $this->renderScript("dashboard/user-tehsil.phtml");
        } */
 }
 public function getConsumptionMos()
 {
     /*
      Yearly Comparision - National
     */
     $monthval = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC");
     $post = $this->form_values;
     $products = $post['products'];
     $yearcomp = $post['yearcomp'];
     $all_provinces = $post['all_provinces'];
     $all_districts = $post['all_districts'];
     $optvals = $post['optvals'];
     $period = new Model_Period();
     $period->form_values = array('id' => $post['period']);
     $months = $period->getPeriodById();
     $location = new Model_Locations();
     $location->form_values['pk_id'] = $all_provinces;
     $location_name = $location->getLocationName();
     $title = "Vaccination vs Stock On Hand (" . $location_name . "-" . $yearcomp[0] . ")";
     for ($k = 0; $k < sizeof($products); $k++) {
         $product_obj = new Model_ItemPackSizes();
         $product_obj->form_values['pk_id'] = $products[$k];
         $product_name = $product_obj->getProductName();
         $xmlstore = "<chart exportEnabled='1' labelDisplay='rotate' slantLabels='1' yAxisMaxValue='100' exportAction='Download' caption='{$product_name} {$title}' exportFileName='" . $title . " - " . date('Y-m-d H:i:s') . " - " . $product_name . "' yAxisName='Doses' numberSuffix='' showValues='1' formatNumberScale='0' theme='fint'>";
         $xmlstore .= "<categories>";
         for ($i = $months->getBeginMonth(); $i <= $months->getEndMonth(); $i++) {
             $month_name = $monthval[$i - 1];
             $xmlstore .= "<category label='{$month_name}' />";
         }
         $xmlstore .= "</categories>";
         $start_date = $yearcomp[0] . '-' . str_pad($months->getBeginMonth(), 2, "0", STR_PAD_LEFT) . "-01";
         $end_date = $yearcomp[0] . '-' . str_pad($months->getEndMonth(), 2, "0", STR_PAD_LEFT) . "-01";
         $sql = "SELECT\n                    summary_provincial.consumption,\n                    summary_provincial.soh_store\n                    FROM\n                    summary_provincial\n                    WHERE\n                    summary_provincial.item_id = '{$products[$k]}' AND\n                    summary_provincial.province_id = {$all_provinces} AND\n                    summary_provincial.stakeholder_id = 1 AND\n                    DATE_FORMAT(summary_provincial.reporting_date,'%Y-%m-%d') BETWEEN '{$start_date}' AND '{$end_date}'";
         $str_sql = $this->_em->getConnection()->prepare($sql);
         $str_sql->execute();
         $rowData = $str_sql->fetchAll();
         $xmlstore .= "<dataset seriesName='Consumption/Vaccination'>";
         foreach ($rowData as $val2) {
             $xmlstore .= "<set value='" . round($val2['consumption']) . "' />";
         }
         $xmlstore .= "</dataset>";
         $xmlstore .= "<dataset seriesName='Stock On Hand(SOH)'>";
         foreach ($rowData as $val2) {
             $xmlstore .= "<set value='" . round($val2['soh_store']) . "' />";
         }
         $xmlstore .= "</dataset>";
         $xmlstore .= "</chart>";
         $xmlstore_array[] = $xmlstore;
     }
     return $xmlstore_array;
 }
 public function checkProductAction()
 {
     $this->_helper->layout->disableLayout();
     $form_values = $this->_request->getPost();
     $item_pack_sizes = new Model_ItemPackSizes();
     $item_pack_sizes->form_values = $form_values;
     $result = $item_pack_sizes->checkProducts();
     $this->view->result = $result;
 }
 public function getItemListAction()
 {
     $items = new Model_ItemPackSizes();
     $items_list = $items->getAllItems();
     echo Zend_Json::encode($items_list);
 }
Exemple #20
0
 public function compGraphOptionGeoDistrict()
 {
     /*
      District
     */
     $monthval = array("JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC");
     $post = $this->form_values;
     $products = $post['products'];
     $year1 = $post['yearcomp'];
     $provinces = $post['all_provinces'];
     $districts = $post['all_districts'];
     $optvals = $post['optvals'];
     $period = new Model_Period();
     $period->form_values = array('id' => $post['period']);
     $months = $period->getPeriodById();
     $rep_option = new Model_ReportOptions();
     $rep_option->form_values = array('stakeholder' => 1, 'report_id' => $post['indicators'], 'report_comp' => $optvals);
     $query = $rep_option->getReportDataSql();
     $title = $query->getReportTitleSql();
     $location = new Model_Locations();
     $loc_name = array();
     if (!empty($provinces)) {
         $location->form_values = array("pk_id" => $provinces);
         $province_name = $location->getLocationName();
     }
     foreach ($districts as $dist_id) {
         $location->form_values = array("pk_id" => $dist_id);
         $loc_name[] = $location->getLocationName();
     }
     $location_name = implode(",", $loc_name);
     for ($k = 0; $k < sizeof($products); $k++) {
         $product_obj = new Model_ItemPackSizes();
         $product_obj->form_values['pk_id'] = $products[$k];
         $product_name = $product_obj->getProductName();
         list($indicator, $compare_options) = explode("-", str_replace("Report", "Graph", str_replace("Province", "Provincial", $title)));
         $graph_caption = $indicator . " of " . $product_name;
         if ($optvals == 1) {
             $graph_subcaption = $compare_options;
         } elseif ($optvals == 2) {
             $graph_subcaption = "Provincial " . $compare_options . " for " . $location_name;
         } elseif ($optvals == 3) {
             $graph_subcaption = "District " . $compare_options . " for " . $location_name;
         } elseif ($optvals == 7) {
             $graph_subcaption = "" . $compare_options . " for " . $location_name;
         } elseif ($optvals == 8) {
             $graph_subcaption = "" . $compare_options . " for " . $province_name . "(" . $location_name . ")";
         }
         $xmlstore = "<chart exportEnabled='1' labelDisplay='rotate' slantLabels='1' yAxisMaxValue='100' exportAction='Download' caption='" . $graph_caption . "' subCaption='" . $graph_subcaption . "' exportFileName='" . $title . " - " . date('Y-m-d H:i:s') . " - " . $location_name . " - " . $product_name . "' yAxisName='Doses' numberSuffix='' showValues='1' formatNumberScale='0' theme='fint'>";
         $xmlstore .= "<categories>";
         for ($i = $months->getBeginMonth(); $i <= $months->getEndMonth(); $i++) {
             $month_name = $monthval[$i - 1];
             $xmlstore .= "<category label='{$month_name}' />";
             for ($j = 0; $j < sizeof($districts); $j++) {
                 $location_obj = new Model_Locations();
                 $location_obj->form_values['product_id'] = $districts[$j];
                 $loc_name = $location_obj->getLocationById();
                 $sql = "select " . str_replace("\$i", $i, $query->getReportDataSql()) . " as xyz  from dual ";
                 $sql = str_replace("\$year1", $year1, $sql);
                 $sql = str_replace("'\$products[\$k]'", "'" . $products[$j] . "'", $sql);
                 $sql = str_replace("\$seluser", 1, $sql);
                 $sql = str_replace("\$provinces[0]", $provinces, $sql);
                 $sql = str_replace("\$dists[\$j]", $districts[$j], $sql);
                 $dbg_sql .= $sql . '<br>';
                 //echo $sql."; ";
                 $str_sql = $this->_em->getConnection()->prepare($sql);
                 $str_sql->execute();
                 $row = $str_sql->fetchAll();
                 if (!empty($row)) {
                     $res = explode('*', $row[0]['xyz']);
                     $row_data = $res[$query->getReportDataPosition()] / 1;
                     $filedata1[$loc_name][$monthval[$i - 1]] = $row_data;
                 }
             }
         }
         //exit;
         //echo "<pre>";
         //print_r($filedata1);
         //exit;
         $xmlstore .= "</categories>";
         foreach ($filedata1 as $key1 => $value1) {
             $xmlstore .= "<dataset seriesName='{$key1}'>";
             foreach ($value1 as $val2) {
                 $xmlstore .= "<set value='" . $val2 . "' />";
             }
             $xmlstore .= "</dataset>";
         }
         $xmlstore .= "</chart>";
         $xmlstore_array[] = $xmlstore;
     }
     //var_dump($xmlstore_array);
     //exit;
     return $xmlstore_array;
 }
 /**
  * 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"];
 }
 public function ajaxGetItemsAction()
 {
     $this->_helper->layout->setLayout("ajax");
     $base_url = Zend_Registry::get('baseurl');
     $this->view->inlineScript()->appendFile($base_url . '/js/iadmin/manage-stakeholders/ajax-get-items.js');
     $this->view->inlineScript()->appendFile($base_url . '/js/jquery.multi-select.min.js');
     $this->view->headLink()->appendStylesheet($base_url . '/common/theme/css/select.css');
     $this->view->headLink()->appendStylesheet($base_url . '/common/theme/css/multiselect.css');
     $this->view->inlineScript()->appendFile($base_url . '/js/select2.min.js');
     if (isset($this->_request->stakeholder_id) && !empty($this->_request->stakeholder_id)) {
         $item_pack_sizes = new Model_ItemPackSizes();
         $item_pack_sizes->form_values['stakeholder_id'] = $this->_request->stakeholder_id;
         $array = $item_pack_sizes->getAllItemsForClusterByStakeholder();
         $this->view->data = $array;
     }
     $item_pack_sizes = new Model_ItemPackSizes();
     $array_1 = $item_pack_sizes->getAllItemsForCluster();
     $this->view->data_district = $array_1;
 }
 public function getConsumptionByUc($dist_id)
 {
     $date = $this->form_values['date'];
     list($yy, $mm) = explode("-", $date);
     if (empty($dist_id)) {
         $dist_id = $this->_identity->getDistrictId();
     }
     $rows = $this->_em->getRepository('Warehouses')->findBy(array('district' => $dist_id));
     $role_id = $rows[0]->getProvince()->getPkId();
     $teh_id = $this->form_values['teh_id'];
     $cache = Zend_Registry::get('cacheManager')->getCache('file');
     $mosucdashlet = "CONSD_{$yy}{$mm}{$dist_id}{$teh_id}" . $this->form_values['item'];
     if (!($result = $cache->load($mosucdashlet))) {
         $em = Zend_Registry::get('doctrine');
         $str_sql_con = "CALL REPgetConsumptionHF('D','" . $yy . "-" . $mm . "-01', {$teh_id}, '" . $this->form_values['item'] . "', 1);";
         $row_consumption = $em->getConnection()->prepare($str_sql_con);
         $row_consumption->execute();
         $result_consumption = $row_consumption->fetchAll();
         $em->getConnection()->close();
         $result = array();
         foreach ($result_consumption as $row) {
             $result[$row['location_name']]['ucName'] = $row['location_name'];
             $result[$row['location_name']]['CONS'] = $row['consumption'];
             $result[$row['location_name']]['target'] = $row['target'];
         }
         $cache->save($result, $mosucdashlet);
     }
     $item_pack_sizes = new Model_ItemPackSizes();
     $item_pack_sizes->form_values['pk_id'] = $this->form_values['item'];
     $item = $item_pack_sizes->getProductName();
     $locations = new Model_Locations();
     $locations->form_values['pk_id'] = $teh_id;
     $tehsil_name = $this->view->location_name = $locations->getLocationName();
     $xmlstore = "<chart labelDisplay='rotate' exportEnabled='1' exportAction='Download' bgColor='white' caption='Vaccination status of {$item}(Doses) in {$tehsil_name} Stores  and EPI centers  during " . ("(" . date('M Y', strtotime($this->form_values['date'])) . ")") . "'\n        exportFileName='Districts Consumption " . date('Y-m-d H:i:s') . "' yAxisName='Doses' showValues='1' formatNumberScale='0' theme='fint'>";
     $xmlstore .= '<categories>';
     foreach ($result as $data) {
         $coverage = ROUND($data['CONS'] / $data['target'] * 100, 1);
         $xmlstore .= '<category label="' . $data[ucName] . ' (' . $coverage . '%)" />';
     }
     $xmlstore .= '</categories>';
     $xmlstore .= "<dataset seriesname='Consumption' color='0075C2'>";
     foreach ($result as $data) {
         $xmlstore .= "<set value='{$data['CONS']}' />";
     }
     $xmlstore .= "</dataset>";
     $xmlstore .= "<dataset seriesname='Target' parentyaxis='S' renderas='Line' color='f8bd19'>";
     foreach ($result as $data) {
         $xmlstore .= "<set value='{$data['target']}' />";
     }
     $xmlstore .= "</dataset>";
     $xmlstore .= "</chart>";
     return $xmlstore;
 }
 public function init()
 {
     $transaction_types = new Model_TransactionTypes();
     $result = $transaction_types->getAdjusmentTypes();
     foreach ($result as $trans) {
         $this->_list["adjustment_type"][''] = 'Select';
         $this->_list["adjustment_type"][$trans['pkId']] = $trans['transactionTypeName'];
     }
     $item_pack_sizes = new Model_ItemPackSizes();
     $result1 = $item_pack_sizes->getAllManageItems();
     $this->_list["product"][''] = 'Select';
     if ($result1 && count($result1) > 0) {
         foreach ($result1 as $whs) {
             $this->_list["product"][$whs['pkId']] = $whs['itemName'];
         }
     }
     $quarter = array(1 => '1st Quarter', 2 => '2nd Quarter', 3 => '3rd Quarter', 4 => '4th Quarter');
     $this->_list["issue_period"][""] = "Select Period";
     for ($y = 2015; $y <= date("Y"); $y++) {
         for ($q = 1; $q <= 4; $q++) {
             switch ($q) {
                 case 1:
                     $key = "01/01/{$y}-01/03/{$y}";
                     break;
                 case 2:
                     $key = "01/04/{$y}-01/06/{$y}";
                     break;
                 case 3:
                     $key = "01/07/{$y}-01/09/{$y}";
                     break;
                 case 4:
                     $key = "01/10/{$y}-01/12/{$y}";
                     break;
             }
             $this->_list["issue_period"][$key] = $quarter[$q] . " - " . $y;
         }
     }
     $this->_list["issue_period"]["custom"] = "Custom";
     //Generate Products(items) Combo
     //$item_pack_sizes = new Model_ItemPackSizes();
     //$items = $item_pack_sizes->getAllWarehouseProducts();
     $this->_list["item_id"][''] = "Select";
     /* if ($items && count($items) > 0) {
        foreach ($items as $item) {
        $this->_list["item_id"][$item['pk_id']] = $item['item_name'];
        }
        } */
     //Generate Purpose(activity_id) combo
     $stk_activities = new Model_StakeholderActivities();
     $result1 = $stk_activities->getAllStakeholderActivities();
     foreach ($result1 as $stk_activity) {
         $this->_list["activity_id"][''] = "Select";
         $this->_list["activity_id"][$stk_activity['pkId']] = $stk_activity['activity'];
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "hdn_transaction_number":
             case "hdn_stock_id":
             case "hdn_province_id":
             case "hdn_district_id":
             case "hdn_warehouse_id":
             case "hdn_available_quantity":
             case "hdn_to_warehouse_id":
             case "hdn_master_id":
             case "hdn_activity_id":
             case "hdn_campaign_id":
             case "hdn_transaction_date":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "transaction_reference":
             case "quantity":
             case "dispatch_by":
             case "issue_from":
             case "issue_to":
                 $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 "expiry_date":
             case "transaction_date":
             case "available_quantity":
             case "transaction_number":
             case "warehouse_name":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "readonly" => "true"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "comments":
                 $this->addElement("textarea", $col, array("attribs" => array("class" => "form-control", "rows" => "2"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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], "validators" => array()));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function ajaxAddMoreLogRowsAction()
 {
     $this->_helper->layout->disableLayout();
     $start = $this->_request->getParam('start');
     $end = $this->_request->getParam('end');
     $item_pack_sizes = new Model_ItemPackSizes();
     $items = $item_pack_sizes->logBookItemPackSize();
     $this->view->items = $items;
     $locations = new Model_Locations();
     $result = $locations->getSindhDistricts();
     $this->view->locations = $result;
     $this->view->start = $start;
     $this->view->end = $end;
 }
 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');
 }
 public function init()
 {
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsByCategory();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate Batch Number Combo
     $stock_batch = new Model_StockBatch();
     $result = $stock_batch->getBatches();
     $this->_list["stock_batch_id"][''] = "Select Stock Batch";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["stock_batch_id"][$row['pkId']] = $row['number'];
         }
     }
     //Generate Location Combo
     $non_ccm_loc = new Model_NonCcmLocations();
     $result = $non_ccm_loc->getLocationsName();
     //  print_r($result);exit;
     $this->_list["location"][''] = "Select Location";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["location"][$row['pkId']] = $row['locationName'];
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "item_pack_size_id":
             case "stock_batch_id":
             case "number":
             case "unallocated_quantity":
             case "total_quantity":
             case "quantity":
             case "estimated_pallet_filled":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "location":
             case "quantity1":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
         foreach ($this->_hidden as $col => $name) {
             switch ($col) {
                 case "placement_location_id":
                 case "itemId":
                 case "batchId":
                     $this->addElement("hidden", $col);
                     $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], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
 }
 public function getConsumptionByUc($dist_id)
 {
     $date = $this->form_values['date'];
     list($yy, $mm) = explode("-", $date);
     if (empty($dist_id)) {
         $dist_id = $this->_identity->getDistrictId();
     }
     $role_id = $this->form_values['province'];
     $teh_id = $this->form_values['teh_id'];
     $cache = Zend_Registry::get('cacheManager')->getCache('file');
     $mosucdashlet = "CONSD_{$yy}{$mm}{$teh_id}" . $this->form_values['item'];
     if (!($result = $cache->load($mosucdashlet))) {
         $em = Zend_Registry::get('doctrine');
         if ($role_id == 2) {
             $str_sql_con = "CALL REPgetConsumptionHF('D','" . $yy . "-" . $mm . "-01', {$teh_id}, '" . $this->form_values['item'] . "', 1);";
         } else {
             $str_sql_con = "CALL REPgetConsumption('D','" . $yy . "-" . $mm . "-01', {$teh_id}, '" . $this->form_values['item'] . "', 1);";
         }
         $row_consumption = $em->getConnection()->prepare($str_sql_con);
         $row_consumption->execute();
         $result_consumption = $row_consumption->fetchAll();
         $em->getConnection()->close();
         $result = array();
         foreach ($result_consumption as $row) {
             $result[$row['location_name']]['ucName'] = $row['location_name'];
             $result[$row['location_name']]['CONS'] = $row['consumption'];
             $result[$row['location_name']]['target'] = $row['target'];
         }
         $cache->save($result, $mosucdashlet);
     }
     //        $str_sql = "SELECT IFNULL(A.CONS,0) as CONS,
     //                    A.ucName,
     //                    ROUND(((((A.population / 100) * B.population_percent_increase_per_year) / 100 * B.child_surviving_percent_per_year)* B.doses_per_year) / 12) AS target
     //            FROM (
     //            SELECT DISTINCT
     //                    IFNULL(REPgetConsumption (" . $mm . "," . $yy . "," . $this->form_values['item'] . ",1,'U',locations.pk_id),0) AS CONS,
     //                    locations.location_name AS ucName,
     //                    (SELECT
     //					IFNULL(location_populations.population,0)
     //				FROM
     //					location_populations
     //				WHERE
     //					location_populations.location_id = locations.pk_id
     //
     //				AND DATE_FORMAT(
     //					location_populations.estimation_date,
     //					'%Y'
     //				) = '$yy'
     //			) AS population
     //            FROM
     //                    pilot_districts
     //            INNER JOIN locations ON pilot_districts.district_id = locations.district_id
     //
     //            WHERE
     //            locations.geo_level_id = 6
     //            AND locations.parent_id = $teh_id ) A,
     //            (
     //                            SELECT
     //                                    item_pack_sizes.item_name,
     //                                    items.population_percent_increase_per_year,
     //                                    items.child_surviving_percent_per_year,
     //                                    items.doses_per_year
     //                            FROM
     //                                    item_pack_sizes
     //                            INNER JOIN items ON item_pack_sizes.item_id = items.pk_id
     //                            WHERE
     //                                    item_pack_sizes.pk_id = 6
     //                    ) B";
     //$row = $this->_em->getConnection()->prepare($str_sql);
     //$row->execute();
     //$result = $row->fetchAll();
     $item_pack_sizes = new Model_ItemPackSizes();
     $item_pack_sizes->form_values['pk_id'] = $this->form_values['item'];
     $item = $item_pack_sizes->getProductName();
     $locations = new Model_Locations();
     $locations->form_values['pk_id'] = $teh_id;
     $tehsil_name = $this->view->location_name = $locations->getLocationName();
     $xmlstore = "<chart labelDisplay='rotate' exportEnabled='1' exportAction='Download' bgColor='white' caption='Consumption status of {$item}(Doses) in {$tehsil_name} Stores  and EPI centers  during " . ("(" . date('M Y', strtotime($this->form_values['date'])) . ")") . "'\n        exportFileName='Districts Consumption " . date('Y-m-d H:i:s') . "' yAxisName='Doses' showValues='1' formatNumberScale='0' theme='fint'>";
     $xmlstore .= '<categories>';
     foreach ($result as $data) {
         $coverage = ROUND($data['CONS'] / $data['target'] * 100, 1);
         $xmlstore .= '<category label="' . $data[ucName] . ' (' . $coverage . '%)" />';
     }
     $xmlstore .= '</categories>';
     $xmlstore .= "<dataset seriesname='Consumption' color='0075C2'>";
     foreach ($result as $data) {
         $xmlstore .= "<set value='{$data['CONS']}' />";
     }
     $xmlstore .= "</dataset>";
     $xmlstore .= "<dataset seriesname='Target' parentyaxis='S' renderas='Line' color='f8bd19'>";
     foreach ($result as $data) {
         $xmlstore .= "<set value='{$data['target']}' />";
     }
     $xmlstore .= "</dataset>";
     $xmlstore .= "</chart>";
     return $xmlstore;
 }
 public function init()
 {
     //Generate Item Combo
     $item_pack_size = new Model_ItemPackSizes();
     $result = $item_pack_size->getItemsAll();
     $this->_list["item_pack_size_id"][''] = "Select Product";
     $this->_list["item_pack_size_id_update"][''] = "Select Product";
     if ($result) {
         foreach ($result as $row) {
             $this->_list["item_pack_size_id"][$row->getPkId()] = $row->getItemName();
             $this->_list["item_pack_size_id_update"][$row->getPkId()] = $row->getItemName();
         }
     }
     //Generate Pack type combo
     $list = new Model_ListDetail();
     $list->form_values = array('listMaster' => Model_ListMaster::packaging_level);
     $result2 = $list->getListDetail();
     $this->_list["packaging_level"][''] = "Select Packaging Level";
     $this->_list["packaging_level_update"][''] = "Select Packaging Level";
     if ($result2) {
         foreach ($result2 as $packagingLevel) {
             $this->_list["packaging_level"][$packagingLevel->getPkId()] = $packagingLevel->getListValue();
             $this->_list["packaging_level_update"][$packagingLevel->getPkId()] = $packagingLevel->getListValue();
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "barcode_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "barcode_ty_id":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "item_gtin":
             case "quantity_per_pack":
             case "volum_per_vial":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "pack_size_description":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "length":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Length"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "width":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Width"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "height":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "placeholder" => "Height"), "allowEmpty" => true, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $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], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option"))))));
             $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "item_pack_size_id_hidden":
             case "stakeholder_id_update_hidden":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }
 public function simpleGraphsAction()
 {
     if ($this->_request->isPost()) {
         $post = $this->_request->getPost();
         $graphs = new Model_Graphs();
         $graphs->form_values = $post;
         $optvals = $post['optvals'];
         if (in_array($optvals, array(9, 10, 11))) {
             $xmlstore = $graphs->simpleGraphOptionYearNational();
         }
         $this->view->xmlstore = $xmlstore;
         //print_r($post);
         $this->view->chart_type = $post['ctype'];
         $this->view->sel_indicator = $post['indicators'];
         $this->view->sel_product = $post['products'];
         $this->view->sel_optvals = $post['optvals'];
         $this->view->sel_period = $post['period'];
         $this->view->sel_year = $post['yearcomp'];
         $this->view->sel_province = $post['all_provinces'];
         $this->view->sel_district = $post['all_districts'];
         if (in_array($optvals, array(10, 11))) {
             $locations = new Model_Locations();
             $locations->form_values = array('parent_id' => 10, 'geo_level_id' => 2);
             $this->view->combo_provinces = $locations->getLocationsByLevel();
         }
         if ($optvals == 11) {
             $location = new Model_Locations();
             $location->form_values = array('province_id' => $post['all_provinces'], 'geo_level_id' => 4);
             $this->view->combo_districts = $location->getLocationsByLevelByProvince();
         }
     } else {
         $this->view->sel_optvals = 9;
     }
     $reports = new Model_Reports();
     $indicators = $reports->getIndicators();
     $this->view->indicators = $indicators;
     $products = new Model_ItemPackSizes();
     $product = $products->getAllItemsNonDil();
     $this->view->product = $product;
     $compare_option = array("Geographical" => array("9" => "National", "10" => "Provincial", "11" => "District"));
     $this->view->compare_option = $compare_option;
     $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;
     $years = array();
     for ($i = 2013; $i <= date("Y"); $i++) {
         $years[] = $i;
     }
     $this->view->years = $years;
     $chart_type = array('Line' => "Line", 'Column3D' => "Bar");
     $this->view->chart_types = $chart_type;
     $this->view->main_heading = "Simple Graphs";
 }