public function addReport($stockId, $type, $from = NULL) { $stock_master = new Model_StockMaster(); $stock_master->form_values['pk_id'] = $stockId; $stock_master->form_values['from'] = $from; $result = $stock_master->getItemDetailFromStock(); if ($result != FALSE) { foreach ($result as $stockdata) { $tdate = $stockdata['transaction_date']; $product = $stockdata['item_id']; $month = App_Controller_Functions::dateFormat($tdate, "first day of this month", "m"); $year = App_Controller_Functions::dateFormat($tdate, "first day of this month", "Y"); $wh_id = $this->_identity->getWarehouseId(); if ($month == date("m") && $year == date("Y")) { $item = new Model_ItemPackSizes(); $items = $item->getAllItems(); foreach ($items as $one) { $this->form_values['report_month'] = $month; $this->form_values['report_year'] = $year; $this->form_values['item_id'] = $one['pkId']; $this->form_values['warehouse_id'] = $wh_id; $this->form_values['created_by'] = $this->_user_id; $this->adjustStockReport(); } } else { $this->form_values['report_month'] = $month; $this->form_values['report_year'] = $year; $this->form_values['item_id'] = $product; $this->form_values['warehouse_id'] = $wh_id; $this->form_values['created_by'] = $this->_user_id; $this->adjustStockReport(); } } } }
public function init() { $identity = new App_Auth(); $stock_master = new Model_StockMaster(); $wh_id = $identity->getWarehouseId(); $result1 = $stock_master->getUnpickedIssueNo($wh_id); $this->_list["stock_master_id"][''] = "Select Issue No"; if ($result1 != false) { foreach ($result1 as $row) { // $this->_list["make"][$wh['pkId']] = $wh['ccmMakeName']; $this->_list["stock_master_id"][$row['stc_master_pkid']] = $row['transaction_number']; } } foreach ($this->_fields as $col => $name) { switch ($col) { case "stock_master_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; 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, "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("stock_master_id", array_keys($this->_list))) { $this->addElement("select", "stock_master_id", array("attribs" => array("class" => "form-control"), "filters" => array("StringTrim", "StripTags"), "allowEmpty" => true, "required" => false, "registerInArrayValidator" => false, "multiOptions" => $this->_list["stock_master_id"], "validators" => array(array("validator" => "Float", "breakChainOnFailure" => false, "options" => array("messages" => array("notFloat" => $name . " must be a valid option")))))); $this->getElement("stock_master_id")->removeDecorator("Label")->removeDecorator("HtmlTag"); } } }
public function priorityVaccinesDistributionSummary($product_id, $case) { $stock_master = new Model_StockMaster(); $stock_master->form_values = array('product_id' => $product_id, 'case' => $case); $result = $stock_master->priorityVaccinesDistributionSummary(); if (count($result) > 0) { return $result; } else { return false; } }
public function multipleAdjustmentAction() { $stock_master = new Model_StockMaster(); $stock_batch = new Model_StockBatch(); $stock_detail = new Model_StockDetail(); $warehouse_data = new Model_WarehousesData(); $form = new Form_MultipleAdjustment(); $form_values = array(); $temp = array(); $arr_data = array('transaction_number' => "", 'stock_id' => "", 'transaction_date' => date("d/m/Y"), 'warehouse_name' => "", 'success' => $this->_request->success); $form_values['transaction_type_id'] = 2; $form_values['adjustment_type'] = 2; $stock_id = ""; $master_id = ""; if (!empty($this->_request->hdn_stock_id)) { $stock_id = $this->_request->hdn_stock_id; } if (!empty($this->_request->hdn_master_id)) { $master_id = $this->_request->hdn_master_id; } if (!empty($this->_request->warehouse)) { $warehouse_id = $this->_request->warehouse; } if ($this->_request->isPost()) { $em = Zend_Registry::get('doctrine'); $em->getConnection()->beginTransaction(); try { if (!empty($master_id)) { //Start update issue period $array = $this->_request->getParams(); $stock_master->updateStockPeriod($master_id, $array); //End update issue period $transaction_number = $stock_master->updateStockMasterTemp($master_id, $this->_request->comments); $stock_detail->updateStockDetailTemp($master_id); //Save Data in warehouse_data table $warehouse_data->addReport($master_id, 2); /* * Auto Receive for 6th level * $stock_master->autoReceiveData($master_id); */ $this->view->msg = 'Stock has been issued successfully. Your voucher number is '; $this->view->voucher = $transaction_number; $this->view->master_id = $master_id; $em->getConnection()->commit(); } elseif ($form->isValid($this->_request->getPost())) { $editissue = $this->_request->getPost('issueedit'); if ($editissue == "Yes") { $d_id = $this->_request->getPost('detailid'); $obj_stock_detail = $em->getRepository("StockDetail")->find($d_id); $old_batch_id = $obj_stock_detail->getStockBatch()->getPkId(); $data = $form->getValues(); $obj_stock_master = $obj_stock_detail->getStockMaster(); $master_update = false; $arr_date = explode("/", $data['transaction_date']); if (intval($arr_date[1]) . "-" . intval($arr_date[2]) != intval($obj_stock_detail->getStockMaster()->getTransactionDate()->format("m")) . "-" . intval($obj_stock_detail->getStockMaster()->getTransactionDate()->format("Y"))) { $trans = $stock_master->getTransactionNumber(2, $data['transaction_date']); $obj_stock_master->setTransactionNumber($trans['trans_no']); $obj_stock_master->setTransactionCounter($trans['id']); $master_update = true; } $obj_stock_master->setTransactionDate(new \DateTime(App_Controller_Functions::dateToDbFormat($data['transaction_date']))); if (!empty($warehouse_id)) { $to_wh = $em->getRepository("Warehouses")->find($warehouse_id); $obj_stock_master->setToWarehouse($to_wh); $master_update = true; } if ($master_update) { $em->persist($obj_stock_master); $em->flush(); } $qunty = str_replace(",", "", $data['quantity']); $obj_stock_detail->setQuantity("-" . $qunty); $vvms = $this->_em->getRepository("VvmStages")->find($data['vvm_stage']); $obj_stock_detail->setVvmStage($vvms); $stock_b = $em->getRepository("StockBatch")->find($data['number']); $obj_stock_detail->setStockBatch($stock_b); if (!empty($data['item_unit_id'])) { $item_unit = $em->getRepository("ItemUnits")->find($data['item_unit_id']); $obj_stock_detail->setItemUnit($item_unit); } $em->persist($obj_stock_detail); $em->flush(); list($dd, $mm, $yy) = explode("/", $data['transaction_date']); $item_id = $data['item_id']; $wh_id = $this->_identity->getWarehouseId(); $user_id = $this->_userid; $query = "SELECT AdjustQty(" . $data['number'] . "," . $wh_id . ") FROM DUAL"; $str_sql = $em->getConnection()->prepare($query); $str_sql->execute(); $query = "SELECT AdjustQty(" . $old_batch_id . "," . $wh_id . ") FROM DUAL"; $str_sql = $em->getConnection()->prepare($query); $str_sql->execute(); $query = "SELECT REPUpdateData({$mm},{$yy},{$item_id},{$wh_id},{$user_id}) FROM DUAL"; $str_sql = $em->getConnection()->prepare($query); $str_sql->execute(); } else { $temp = $form->getValues(); $data = array_merge($temp, $form_values); $data['warehouse'] = $warehouse_id; if (empty($this->_request->transaction_number)) { $stock_id = $stock_master->addStockMaster($data); } if (isset($data['quantity']) && !empty($data['quantity'])) { $qty = str_replace(",", "", $data['quantity']); } if (isset($data['available_quantity']) && !empty($data['available_quantity'])) { $ava_qty = str_replace(",", "", $data['available_quantity']); } if ((int) $qty > (int) $ava_qty || (int) $qty == (int) $ava_qty) { $data['quantity'] = $ava_qty; $autorun = true; } list($batch_id, $priority) = explode("|", $this->_request->number); $form_values['item_unit_id'] = $this->_request->item_unit_id; $form_values['stock_master_id'] = $stock_id; $form_values['stock_batch_id'] = $batch_id; $data = array_merge($temp, $form_values); $detail_id = $stock_detail->addStockDetail($data); $stock_batch->adjustQuantityByWarehouse($batch_id); if ($autorun == true) { $stock_batch->autoRunningLEFOBatch($form->getValue('item_id')); $stock_batch->form_values['pk_id'] = $batch_id; $stock_batch->form_values['status'] = Model_StockBatch::FINISHED; $stock_batch->changeStatus(); } /* $placement = new Model_Placements(); $placement->form_values['stock_batch_id'] = $batch_id; $placement->form_values['quantity'] = $data['quantity']; $placement->form_values['placement_location_id'] = $data['pick_from']; $placement->form_values['stock_detail_id'] = $detail_id; $placement->addPlacement(); */ } $em->getConnection()->commit(); $this->redirect("/stock/multiple-adjustment"); // For Data Show $temp_stock_list = $stock_master->getTempStocksList(); if ($temp_stock_list != false) { // $form->transaction_number->setValue($temp_stock_list[0]['transaction_number']); $form->transaction_date->setValue(date("d/m/Y h:i A", strtotime($temp_stock_list[0]['transaction_date']))); $form->warehouse_name->setValue($temp_stock_list[0]['to_warehouse']); $form->transaction_reference->setValue($temp_stock_list[0]['transaction_reference']); $form->hdn_to_warehouse_id->setValue($temp_stock_list[0]['to_warehouse_id']); $form->product->setValue($temp_stock_list[0]['to_warehouse_id']); $arr_data['warehouse_name'] = $temp_stock_list[0]['to_warehouse']; // $arr_data['warehouse_name'] = $temp_stock_list[0]['to_warehouse']; $form->activity_id->setValue($temp_stock_list[0]['activity_id']); $arr_data['tempstocks'] = $temp_stock_list; $form->makeFieldReadonly(); } else { $form->transaction_date->setValue(date("d/m/Y h:i A")); } } } catch (Exception $e) { $em->getConnection()->rollback(); $em->close(); App_FileLogger::info($e); switch ($e->getMessage()) { case 'PLCD_QTY_GREATER_THAN_ISSUE_QTY': $this->view->status = false; $this->view->msg = "Issue quantity should not greater than placed quantity!"; break; } } $this->view->form = $form; $this->view->arr_data = $arr_data; if ($this->_request->type == 's') { $this->redirect("/stock/issue-search"); } } $stock_master->form_values = $form_values; $temp_stock = $stock_master->getTempStock(); if ($temp_stock != false) { $arr_data = array_merge($arr_data, $temp_stock); } if (!empty($temp_stock['stock_id'])) { $form->hdn_stock_id->setValue($temp_stock['stock_id']); $form->hdn_master_id->setValue($temp_stock['stock_id']); } elseif (!empty($stockid)) { $form->hdn_stock_id->setValue($stock_id); $form->hdn_master_id->setValue($stock_id); } $this->view->form = $form; $base_url = Zend_Registry::get('baseurl'); switch ($this->_user_level) { case 1: case 2: case 3: $this->view->menu_type = 1; $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos.js'); break; case 4: case 5: case 6: $this->view->menu_type = 2; $this->view->inlineScript()->appendFile($base_url . '/js/level_combos.js'); break; } // Edit Issue Start if (!empty($this->_request->id)) { $detail_id = $this->_request->id; $issue = $this->_em->getRepository("StockDetail")->find($detail_id); $form->transaction_number->setValue($issue->getStockMaster()->getTransactionNumber()); $form->transaction_date->setValue($issue->getStockMaster()->getTransactionDate()->format("d/m/Y h:i A")); $form->warehouse_name->setValue($issue->getStockMaster()->getToWarehouse()->getWarehouseName()); $form->transaction_reference->setValue($issue->getStockMaster()->getTransactionReference()); //$form->activity_id->setValue($issue->getStockMaster()->getStakeholderActivity()->getPkId()); $arr_data['warehouse_name'] = $issue->getStockMaster()->getToWarehouse()->getWarehouseName(); $form->item_id->setValue($issue->getStockBatch()->getItemPackSize()->getPkId()); $form->fillBatchCombo($issue->getStockBatch()->getItemPackSize()->getPkId()); $form->number->setValue($issue->getStockBatch()->getPkId()); $form->vvm_stage->setValue($issue->getVvmStage()); $form->quantity->setValue($issue->getQuantity()); $av_qty = $issue->getStockBatch()->getQuantity() + ABS($issue->getQuantity()); $form->available_quantity->setValue($av_qty); $form->expiry_date->setValue($issue->getStockBatch()->getExpiryDate()->format("d/m/Y")); $this->view->issueedit = true; $this->view->detail_id = $this->_request->id; } // Edit Issue End $this->view->arr_data = $arr_data; $this->view->type = $this->_request->getParam("t", "issue"); $this->view->wh_id = $this->_identity->getWarehouseId(); $this->view->params = array("province" => $this->_identity->getProvinceId(), "district" => $this->_identity->getDistrictId()); $this->view->role = $this->_identity->getRoleId(); }
public function indexAction() { $auth = App_Auth::getInstance(); $role_id = $auth->getRoleId(); $campaign = new Model_Campaigns(); $location = new Model_Locations(); $level = ''; // National Level if ($role_id == 3 || $role_id == 23 || $role_id == 26 || $role_id == 27) { $this->view->level = 1; } // Provincial Level if ($role_id == 4 || $role_id == 23) { $this->view->level = 2; $province = $this->_identity->getProvinceId(); $this->view->province = $province; } // 6 - District Level, 20 - Policy District User if ($role_id == 6 || $role_id == 7 || $role_id == 20 || $role_id == 21 || $role_id == 23) { $this->view->level = 6; $province = $this->_identity->getProvinceId(); $district = $this->_identity->getDistrictId(); $this->view->province = $province; $this->view->district = $district; } // National Campaign if ($role_id == 14 || $role_id == 23) { $province = 1; $this->view->province = $province; $district = 33; $this->view->district = $district; } // Provincial Campaign if ($role_id == 15 || $role_id == 23) { $province = $this->_identity->getUserLocationId(); $this->view->province = $province; } // District Campaign if ($role_id == 16 || $role_id == 23) { $province = $this->_identity->getUserProvinceId(); $district = $this->_identity->getUserLocationId(); $this->view->province = $province; $this->view->district = $district; } if ($role_id == 17 || $role_id == 18 || $role_id == 23 || $role_id == 25 || $role_id == 26 || $role_id == 28 || $role_id == 29) { $province = 1; $district = 33; $this->view->province = $province; $this->view->district = $district; $this->view->level = 1; } /*if ($role_id == 27) { $province = 2; $district = 87; $this->view->province = $province; $this->view->district = $district; $this->view->level = 1; }*/ if ($role_id == 30 || $role_id == 27) { $province = $this->_identity->getProvinceId(); $district = $this->_identity->getDistrictId(); $this->view->province = $province; $this->view->district = $district; $this->view->level = 1; } if ($role_id == 31) { $province = 4; $district = 80; $this->view->province = $province; $this->view->district = $district; $this->view->level = 1; } $sel_lvl = $this->_request->getParam("office"); if (!empty($sel_lvl)) { $level = $sel_lvl; $this->view->level = $level; } $sel_prov = $this->_request->getParam("combo1"); if (!empty($sel_prov)) { $province = $sel_prov; $this->view->province = $province; } if ($role_id == 3 && empty($province)) { $province = 1; $this->view->province = $province; } $sel_dist = $this->_request->getParam("combo2"); if (!empty($sel_dist)) { $district = $sel_dist; $this->view->district = $district; } if ($role_id == 3 && empty($district)) { $district = 33; $this->view->district = $district; } if ($role_id == 4 && empty($district)) { $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 = $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'); if ($role_id == 4 || $role_id == 5 || $role_id == 6 || $role_id == 7) { $stock_master = new Model_StockMaster(); $this->view->pending_receive1 = $stock_master->getPendingReceive(); $this->view->warehouse_name = $auth->getWarehouseName(); } $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 getReceiveVoucherListAction() { $wh_id = $this->_request->getParam('wh_id', ''); $stock_master = new Model_StockMaster(); //$result = $stock_master->getUnplacedReceiveVoucherList($wh_id); $result = $stock_master->getUnplacedVoucherNo($wh_id); echo Zend_Json::encode($result); }
public function uploadReceiveConsignments() { $params = $this->form_values; $wh_id = $params['wh_id']; $rec_id = $params['rec_id']; $batch_no = $params['batch_no']; $qty = str_replace(",", "", $params['qty']); $voucher = $params['voucher']; $consignments_location = $this->_em->getRepository("PipelineConsignmentsPlacements")->findBy(array("pipelineConsignment" => $rec_id)); if (count($consignments_location) > 0) { foreach ($consignments_location as $cl) { $location_id[] = $cl->getPlacementLocation()->getPkId(); } } $str_qry = $this->_em->createQueryBuilder()->select("pc.masterId")->from("PipelineConsignments", "pc")->where("pc.voucherNumber = '" . $voucher . "'")->andWhere("pc.masterId > 0")->andWhere("pc.toWarehouse = " . $wh_id); $stock_master_id = $str_qry->getQuery()->getResult(); if (count($stock_master_id) > 0) { $master_id = $stock_master_id[0]['masterId']; } else { $master_id = 0; } $pipeline_consignments = $this->_em->getRepository("PipelineConsignments")->find($rec_id); /** * Record must exists */ if (count($pipeline_consignments) == 0) { $result_msg = array("message" => "Selected record id {$rec_id} does not exist in pipeline consignments. Please update your data."); App_FileLogger::info($result_msg['message']); return $result_msg; } /** * Check if we need to create new voucher or add detail entry in existing voucher * If 0 then New Voucher * If greater then 0 then Add in Existing voucher */ if ($master_id == 0) { $tr_date = date("d/m/Y"); $obj_master = new Model_StockMaster(); $trans = $obj_master->getTransactionNumber(1, $tr_date, $wh_id); $stock_master = new StockMaster(); $stock_master->setTransactionDate(new DateTime()); $stock_master->setTransactionNumber($trans['trans_no']); $stock_master->setTransactionCounter($trans['id']); $stock_master->setTransactionReference($pipeline_consignments->getReferenceNumber()); $stock_master->setDraft(0); $stock_master->setComments($pipeline_consignments->getDescription()); $type = $this->_em->getRepository("TransactionTypes")->find(1); $stock_master->setTransactionType($type); $stock_master->setFromWarehouse($pipeline_consignments->getFromWarehouse()); $stock_master->setToWarehouse($pipeline_consignments->getToWarehouse()); $stock_master->setParentId(0); $stock_master->setStakeholderActivity($pipeline_consignments->getStakeholderActivity()); $stock_master->setCreatedBy($pipeline_consignments->getCreatedBy()); $stock_master->setCreatedDate(new DateTime(date("Y-m-d H:i:s"))); $this->_em->persist($stock_master); $this->_em->flush(); $master_id = $stock_master->getPkId(); } $array = array("item_id" => $pipeline_consignments->getItemPackSize()->getPkId(), "number" => $batch_no, "wh_id" => $pipeline_consignments->getToWarehouse()->getPkId()); $batch_id = $this->checkBatch($array); /** * Check if Batch exists or not * If 0 then create new batch * If greater then 0 then add quantity in existing batch */ if ($batch_id === 0) { $stock_batch = new StockBatch(); $stock_batch->setNumber(strtoupper($batch_no)); $stock_batch->setExpiryDate($pipeline_consignments->getExpiryDate()); $stock_batch->setQuantity($qty); $stock_batch->setStatus('Stacked'); $stock_batch->setUnitPrice(0); $stock_batch->setProductionDate($pipeline_consignments->getProductionDate()); $stock_batch->setLastUpdate(new DateTime(date("Y-m-d"))); $stock_batch->setItemPackSize($pipeline_consignments->getItemPackSize()); $vvm_type = $this->_em->getRepository("VvmTypes")->find(2); $stock_batch->setVvmType($vvm_type); $stock_batch->setWarehouse($pipeline_consignments->getToWarehouse()); $stock_batch->setStakeholderItemPackSize($pipeline_consignments->getManufacturer()); $this->_em->persist($stock_batch); $this->_em->flush(); $batch_id = $stock_batch->getPkId(); } /* * Add Entry in stock detail against selected master voucher */ $stock_detail = new StockDetail(); $stock_detail->setQuantity($qty); $stock_detail->setTemporary(0); $vvms = $this->_em->getRepository("VvmStages")->find(1); $stock_detail->setVvmStage($vvms); $stock_detail->setIsReceived(1); $stock_detail->setAdjustmentType(1); $stock_master = $this->_em->getRepository("StockMaster")->find($master_id); $stock_detail->setStockMaster($stock_master); $stock_batch = $this->_em->getRepository("StockBatch")->find($batch_id); $stock_detail->setStockBatch($stock_batch); $stock_detail->setItemUnit($pipeline_consignments->getItemPackSize()->getItemUnit()); $this->_em->persist($stock_detail); $this->_em->flush(); if (count($location_id) > 0) { foreach ($location_id as $plac_id) { $plac_loc_id = $this->_em->getRepository("PlacementLocations")->find($plac_id); /* * Add entry in Placement table */ $placements = new Placements(); $placements->setQuantity($qty); $vvms = $this->_em->getRepository("VvmStages")->find(1); $placements->setVvmStage($vvms); $placements->setIsPlaced(1); $placements->setPlacementLocation($plac_loc_id); $placements->setStockBatch($stock_batch); $placements->setStockDetail($stock_detail); $trans_type = $this->_em->getRepository("ListDetail")->find(Model_ListDetail::STOCK_PLACEMENT); $placements->setPlacementTransactionType($trans_type); $placements->setCreatedBy($pipeline_consignments->getCreatedBy()); $placements->setCreatedDate(new DateTime(date("Y-m-d H:i:s"))); $this->_em->persist($placements); $this->_em->flush(); } } /* * Update Received Qty in Future Arrivals table */ //$update_qty = $pipeline_consignments->getReceivedQuantity() + $qty; //if ($update_qty <= $pipeline_consignments->getQuantity()) { $pipeline_consignments->setReceivedQuantity($qty); $pipeline_consignments->setMasterId($master_id); $this->_em->persist($pipeline_consignments); $this->_em->flush(); //} /* * Adjust Batch Quantity By Warehouse */ $this->adjustQuantityByWarehouse($batch_id, $pipeline_consignments->getToWarehouse()->getPkId()); /* * Adjust Warehouse data for selected month and item */ $warehouse_data = new Model_WarehousesData(); $warehouse_data->form_values = array('report_month' => date("m"), 'report_year' => date("Y"), 'item_id' => $pipeline_consignments->getItemPackSize()->getPkId(), 'warehouse_id' => $pipeline_consignments->getToWarehouse()->getPkId(), 'created_by' => $pipeline_consignments->getCreatedBy()->getPkId()); $warehouse_data->adjustStockReport(); $stock_master = $this->_em->getRepository("StockMaster")->find($master_id); return "V" . base64_encode($stock_master->getTransactionNumber() . "|" . $stock_master->getPkId()); }
public function coldChainCapacityProductAction() { $this->_helper->layout->setLayout("layout"); $graphs = new Model_Graphs(); $to_date = $this->_request->getPost('to_date'); if (empty($to_date)) { $to_date = $this->_request->getParam('to_date', date("d/m/Y")); } $graphs->form_values['to_date'] = $to_date; $this->view->to_date = $to_date; $xmlstore1 = $graphs->coldChainCapacityProduct(15); $this->view->xmlstore1 = $xmlstore1; //$xmlstoresummary = $graphs->coldChainCapacityProductSummary(16); //$this->view->xmlstoresummary = $xmlstoresummary; $xmlstore2 = $graphs->coldChainCapacityProduct(16); $this->view->xmlstore2 = $xmlstore2; $this->view->warehousename = $this->_identity->getWarehouseName(); $this->view->data = $graphs->coldChainCapacityProduct(2); $auth = App_Auth::getInstance(); $role_id = $auth->getRoleId(); if ($role_id == 4 || $role_id == 5 || $role_id == 6 || $role_id == 7) { $stock_master = new Model_StockMaster(); $this->view->pending_receive = $stock_master->getPendingReceive(); } $this->view->user_role = $role_id; $this->view->warehousename = $this->_identity->getWarehouseName(); $base_url = Zend_Registry::get("baseurl"); $this->view->inlineScript()->appendFile($base_url . '/js/reports/dashlet/cold-chain-capacity.js'); }
public function deleteIssue($id) { $stock_batch = new Model_StockBatch(); $stock_master = new Model_StockMaster(); $result = $this->getQuantityById($id); $qty = $result['quantity']; $batch_id = $result['stock_batch_id']; $stock_batch->form_values['pk_id'] = $batch_id; $stock_batch->form_values['status'] = Model_StockBatch::RUNNING; $stock_batch->changeStatus(); $del = $this->deleteStockDetail($id); $del = $this->deleteStockDetailPicking($id); $del_master = $stock_master->deleteStockMaster($result['stock_master_id']); $stock_batch->adjustQuantityByWarehouse($batch_id); if ($del) { return true; } else { return FALSE; } }
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; } } }
public function ajaxGetPlacementLocationsAction() { $this->_helper->layout->disableLayout(); $detail_id = $this->_request->id; $p = $this->_request->p; $stock_master = new Model_StockMaster(); $stock_master->form_values['$detail_id'] = $detail_id; $result = $stock_master->getIssueDetail(); $item_category_id = $result['item_category_id']; if ($item_category_id == 1) { $cold_chain_loc = new Model_ColdChain(); $ccm_locations = $cold_chain_loc->getLocationsName(); $this->view->locations = $ccm_locations; } else { $non_ccm_loc = new Model_NonCcmLocations(); $non_ccm_locations = $non_ccm_loc->getLocationsName(); $this->view->locations = $non_ccm_locations; } $this->view->item_cat_id = $item_category_id; $this->view->result = $result; $this->view->p = $p; $this->view->detail_id = $detail_id; }
public function printStockReportAction() { $this->_helper->layout->setLayout('print'); $wh = new Model_Warehouses(); $stock_master = new Model_StockMaster(); $stock_master->form_values = $this->_request->getParams(); $this->view->headTitle("Stock Balance Report"); $this->view->print_title = "Stock Balance Report"; $this->view->month = $this->_request->getParam('month', date("m")); $this->view->year = $this->_request->getParam('year', date("Y")); $this->view->result = $stock_master->getStockReportByDate(); $this->view->username = $this->_identity->getUserName(); $this->view->warehousename = $wh->getWarehouseNameByWarehouseId($this->_request->getParam('warehouse')); }