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");
         }
     }
 }
Example #2
0
 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()
 {
     $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 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'];
     }
     // This code gets all the products
     // $item_pack_sizes = new Model_ItemPackSizes();
     // $result2 = $item_pack_sizes->getAllItems();
     // Get adjusted products names
     $stock_master = new Model_StockMaster();
     $result2 = $stock_master->getAdjustedProducts();
     $this->_list["product"][''] = "All";
     foreach ($result2 as $item) {
         $this->_list["product"][$item['pkId']] = $item['itemName'];
     }
     $date_from = date('01/m/Y');
     $date_to = date('d/m/Y');
     foreach ($this->_fields as $col => $name) {
         switch ($col) {
             case "adjustment_no":
                 $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 "adjustment_date":
             case "expiry_date":
                 $this->addElement("text", $col, array("attribs" => array("class" => "form-control", "style" => "position: relative; z-index: 100000;"), "allowEmpty" => false, "filters" => array("StringTrim", "StripTags"), "validators" => array()));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
             case "date_from":
                 $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_from));
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             case "date_to":
                 $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_to));
                 $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;
             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");
         }
     }
     foreach ($this->_hidden as $col => $name) {
         switch ($col) {
             case "hdn_batch_no":
                 $this->addElement("hidden", $col);
                 $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag");
                 break;
             default:
                 break;
         }
     }
 }