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");
         }
     }
 }
Ejemplo n.º 2
0
 public function getIssueVoucherListAction()
 {
     $wh_id = $this->_request->getParam('wh_id', '');
     $pipeline_consignments = new Model_PipelineConsignments();
     $result = $pipeline_consignments->getPlannedIssueByWh($wh_id);
     // $result = $stock_master->getUnpickedIssueNo($wh_id);
     // $result = $stock_master->getIssueVoucherList($wh_id);
     // $result = $stock_master->getUnpickedIssueNo($wh_id);
     echo Zend_Json::encode($result);
 }
Ejemplo n.º 3
0
 public function ajaxPlannedIssueDetailsAction()
 {
     $this->_helper->layout->disableLayout();
     $id = $this->_request->getParam('id', '');
     $pipeline_consignments = new Model_PipelineConsignments();
     if (!empty($id)) {
         $pipeline_consignments->form_values = array('voucher_number' => $id, 'source' => $this->_identity->getWarehouseId(), 'type' => 2);
         $arr_data = $pipeline_consignments->getBySearch();
         $this->view->voucher_number = $id;
         $this->view->arr_data = $arr_data;
     }
 }
 public function addPipelineConsignments()
 {
     $form_values = $this->form_values;
     $end = $form_values['counter'];
     $furute_arrival = new Model_PipelineConsignments();
     $vouchers = $furute_arrival->getTempraryNumber($form_values['expected_arrival_date'], 1);
     $counter = 0;
     for ($i = 0; $i < $end; $i++) {
         $row = $form_values["rows" . $i];
         if (!empty($row['item_pack_size_id']) && !empty($row['batch_number']) && !empty($row['expiry_date']) && !empty($row['quantity'])) {
             $farr = new PipelineConsignments();
             $farr->setVoucherNumber($vouchers['temp_no']);
             $farr->setTransactionCounter($vouchers['id']);
             $farr->setExpectedArrivalDate(new \DateTime(App_Controller_Functions::dateToDbFormat($form_values['expected_arrival_date'])));
             $farr->setReferenceNumber($form_values['reference_number']);
             $activity = $this->_em->getRepository("StakeholderActivities")->find($form_values['stakeholder_activity_id']);
             $farr->setStakeholderActivity($activity);
             $farr->setDescription($form_values['description']);
             $item_pack_size = $this->_em->getRepository("ItemPackSizes")->find($row['item_pack_size_id']);
             $farr->setItemPackSize($item_pack_size);
             $farr->setBatchNumber($row['batch_number']);
             $farr->setProductionDate(new \DateTime(App_Controller_Functions::dateToDbFormat($row['production_date'])));
             $farr->setExpiryDate(new \DateTime(App_Controller_Functions::dateToDbFormat($row['expiry_date'])));
             $manufacturer = $this->_em->getRepository("StakeholderItemPackSizes")->find($row['manufacturer_id']);
             $farr->setManufacturer($manufacturer);
             $vvm_type = $this->_em->getRepository("VvmTypes")->find($row['vvm_type_id']);
             $farr->setVvmType($vvm_type);
             $farr->setUnitPrice($row['unit_price']);
             $quantity = str_replace(",", "", $row['quantity']);
             $farr->setQuantity($quantity);
             $farr->setReceivedQuantity(0);
             $from_wh = $this->_em->getRepository("Warehouses")->find($form_values['from_warehouse_id']);
             $farr->setFromWarehouse($from_wh);
             $to_wh = $this->_em->getRepository("Warehouses")->find($this->_identity->getWarehouseId());
             $farr->setToWarehouse($to_wh);
             $user = $this->_em->getRepository("Users")->find($this->_user_id);
             $farr->setCreatedBy($user);
             $farr->setCreatedDate(new \DateTime(App_Controller_Functions::dateToDbFormat(date("d/m/Y"))));
             $farr->setMasterId(0);
             $farr->setStatus('Planned');
             $tr_type = $this->_em->getRepository("TransactionTypes")->find(1);
             $farr->setTransactionType($tr_type);
             $this->_em->persist($farr);
             $counter++;
         }
     }
     $this->_em->flush();
     if ($counter >= 1) {
         // Delete Draft entries
         $rs = $this->_em->getRepository('PipelineConsignmentsDraft')->findBy(array('toWarehouse' => $this->_identity->getWarehouseId()));
         foreach ($rs as $ro) {
             $this->_em->remove($ro);
         }
         $this->_em->flush();
         return true;
     }
     return false;
 }