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() { $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() { //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']; } } } }
public function ajaxGetStakeholderActivitiesAction() { $this->_helper->layout->disableLayout(); $sips = new Model_StakeholderActivities(); $sips->form_values['warehouse'] = $this->_request->getParam('warehouse', ''); $result = $sips->getAllStakeholderActivities(); $this->view->result = $result; }
public function init() { /* $current_datetime = new DateTime(); $monthn3_datetime = $current_datetime->modify("-3 months"); echo $monthn3_datetime->format("m")."<br>"; $start_month = $monthn3_datetime->format("m"); $start_year = $monthn3_datetime->format("Y"); $monthp3_datetime = $current_datetime->modify("+9 months"); echo $monthp3_datetime->format("m")."<br>"; $end_month = ceil($monthp3_datetime->format("m")/3); echo $end_month; exit; $end_year = $monthp3_datetime->format("Y"); */ $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() { //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 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"][$stk_activity['pkId']] = $stk_activity['activity']; } } // Generate Status Combo $this->_list["status"]['Received'] = 'Received'; $this->_list["status"]['Pre Shipment Alert'] = 'Pre Shipment Alert'; $this->_list["status"]['PO'] = 'PO'; $this->_list["status"]['Tender'] = 'Tender'; //Generate Products(items) Combo $sips = new Model_StakeholderItemPackSizes(); $sips->form_values['stakeholder_id'] = $stakeholder_id; $result2 = $sips->getAllProductsByStakeholderType(); $this->_list["item_id"][""] = "Select"; if ($result2) { //$item_id = $result2[0]['item_pack_size_id']; foreach ($result2 as $item) { $this->_list["item_id"][$item['item_pack_size_id']] = $item['item_name']; } } $this->_list["vvm_stage"][""] = "NA"; $this->_list["manufacturer_id"][""] = "Select"; //Generate manufacturer Combo /* $stakeholder_items = new Model_Stakeholders(); $stakeholder_items->form_values['item_id'] = $item_id; $associated = $stakeholder_items->getManufacturerByProduct(); if ($associated) { foreach ($associated as $row) { $this->_list["manufacturer_id"][$row['pkId']] = $row['stakeholderName']; } } */ //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']; } //Generate Asset Sub Type Combo $cold_chain = new Model_ColdChain(); $cold_chain->form_values = array('type_id' => '1,3'); $result3 = $cold_chain->getColdchainByAssetType(); $this->_list["cold_chain"][''] = "Select Cold Chain"; foreach ($result3 as $assetsubtype) { $this->_list["cold_chain"][$assetsubtype['pk_id']] = $assetsubtype['asset_name'] . " - " . $assetsubtype['make_name']; } //Generate Campaigns Combo /* $campaigns = new Model_Campaigns(); $result4 = $campaigns->allCampaignsFutureDate(); $this->_list["campaign_id"][''] = "Select"; foreach ($result4 as $campaign_one) { $this->_list["campaign_id"][$campaign_one['pkId']] = $campaign_one['campaignName']; } */ foreach ($this->_fields as $col => $name) { switch ($col) { case "transaction_reference": case "number": case "unit_price": case "quantity": $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 "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; case "shipment_date": case "production_date": case "expiry_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 ($col == "manufacturer_id") { // $attribute_class = "col-md-2 form-control input-small"; //} else { $attribute_class = "form-control"; //} if (in_array($col, array_keys($this->_list))) { $this->addElement("select", $col, array("attribs" => array("class" => "{$attribute_class}"), "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 "hdn_transaction_date": $this->addElement("hidden", $col); $this->getElement($col)->removeDecorator("Label")->removeDecorator("HtmlTag"); break; default: break; } } }