/** * */ public function reactivateAction() { $id = $this->getRequest()->getParam('id'); $quarantine = QuarantineQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the Quarantine with id {$id}")); try { $this->getQuarantineCatalog()->beginTransaction(); $this->getQuarantineCatalog()->update($quarantine); $this->getQuarantineCatalog()->commit(); $this->setFlash('ok', $this->i18n->_("Se reactivo correctamente el Quarantine")); } catch (Exception $e) { $this->getQuarantineCatalog()->rollBack(); $this->setFlash('error', $this->i18n->_($e->getMessage())); } $this->_redirect('quarantine/list'); }
public function claimControlAction() { $id = $this->getRequest()->getParam('id'); $line = $this->getRequest()->getParam('line'); $warehouseEntry = WarehouseEntranceQuery::create()->findByPK($id); $warehouseEntryProduct = WarehouseEntranceProductQuery::create()->whereAdd(WarehouseEntranceProduct::ID_WAREHOUSE_ENTRANCE, $id)->whereAdd(WarehouseEntranceProduct::ID_WAREHOUSE_ENTRANCE_PRODUCT, $line)->findOne(); $purchaseOrder = PurchaseOrderQuery::create()->findByPK($warehouseEntryProduct->getIdPurchaseOrder()); $product = ProductQuery::create()->findByPK($warehouseEntryProduct->getIdProduct()); $folioImport = FolioImportQuery::create()->findByPK($warehouseEntry->getIdFolioImport()); $booking = BookingQuery::create()->whereAdd(Booking::ID_FOLIO_IMPORT, $folioImport->getIdFolioImport())->findOne(); $freight = $booking->getIncreasableFreight() + $booking->getIncreasableInsurance(); $quarantine = QuarantineQuery::create()->whereAdd(Quarantine::ID_WAREHOUSE_ENTRANCE_PRODUCT, $warehouseEntryProduct->getIndex())->find()->count(); if ($quarantine) { $quarantineQuery = QuarantineQuery::create()->whereAdd(Quarantine::ID_WAREHOUSE_ENTRANCE_PRODUCT, $warehouseEntryProduct->getIndex())->findOne(); $items = $quarantineQuery->getDestruction() + $quarantineQuery->getOtherCode() + $quarantineQuery->getSecond(); $total = $items + $quarantineQuery->getPpv() + $quarantineQuery->getMissing(); $freight = $freight / $total; $totalRejected = $items * $warehouseEntryProduct->getPrice() + $items * $freight; } else { } $warehouseEntryInfo['total_rejected'] = $totalRejected; $warehouseEntryInfo['id_warehouse_entrance'] = $warehouseEntry->getIdWarehouseEntrance(); $warehouseEntryInfo['id_warehouse_entrance_product'] = $line; $warehouseEntryInfo['folio'] = $warehouseEntryProduct->getFolioWarehouse(); $warehouseEntryInfo['reception_date'] = $warehouseEntry->getArrivalDate(); $warehouseEntryInfo['supplier'] = $purchaseOrder->getIdSupplier(); $warehouseEntryInfo['folio_import'] = $folioImport->getFolio(); $warehouseEntryInfo['purchase_order'] = $purchaseOrder->getIdPurchaseOrder(); $warehouseEntryInfo['doc_num'] = $purchaseOrder->getSapDocumentNumber(); $warehouseEntryInfo['code'] = 'pendiente'; $warehouseEntryInfo['item_code'] = $product->getItemCode(); $warehouseEntryInfo['item_name'] = $product->getItemName(); $warehouseEntryInfo['commentaries'] = $warehouseEntry->getComments(); $warehouseEntryInfo['currency'] = $purchaseOrder->getIdCurrency(); if (WarehouseEntranceFileQuery::create()->whereAdd(WarehouseEntranceFile::ID_WAREHOUSE_ENTRANCE, $id)->count()) { $this->view->claimReportDocument = true; } $this->view->contentTitle = $this->i18n->_('Claim Control'); $this->view->onsubmit = "warehouse-entrance/save-claim-control"; $this->getCatalog('FolioimportCatalog')->beginTransaction(); $claimReport = $this->getClaimReport($warehouseEntryProduct->getIdWarehouseEntrance(), $warehouseEntryProduct->getIdWarehouseEntranceProduct()); $this->getCatalog('FolioimportCatalog')->commit(); $warehouseEntryInfo['status'] = $claimReport->getStatus(); $this->view->status = $this->getClaimControlStatus(); $this->view->claimReport = $claimReport->toArray(); $this->view->warehouseEntranceInfo = $warehouseEntryInfo; $this->view->open = WarehouseEntranceClaimReport::$Status['Open']; $this->view->accept = WarehouseEntranceClaimReport::$Status['Accepted']; $this->view->partiallyAccept = WarehouseEntranceClaimReport::$Status['Partially Accepted']; $this->view->reject = WarehouseEntranceClaimReport::$Status['Rejected']; $this->view->cancel = WarehouseEntranceClaimReport::$Status['Cancelled']; }