public function claimControlAction() { $id = $this->getRequest()->getParam('id'); $claimReport = WarehouseEntranceClaimReportQuery::create()->findByPK($id); $idWarehouseEntrance = $claimReport->getIdWarehouseEntrance(); $line = $claimReport->getIdWarehouseEntranceProduct(); if (!empty($idWarehouseEntrance)) { $redirect = "warehouse-entrance/claim-control/line/{$line}/id/{$idWarehouseEntrance}"; $this->_redirect($redirect); } $quantity = $claimReport->getGood() + $claimReport->getRejected() + $claimReport->getMissing(); $freight = $claimReport->getLandedCost(); $totalRejected = ($claimReport->getRejected() + $claimReport->getMissing()) * $claimReport->getPrice() + ($claimReport->getRejected() + $claimReport->getMissing()) * $freight; $claimReportArray = $claimReport->toArray(); $claimReportArray['total_rejected'] = $totalRejected; if (SapSupplierQuery::create()->whereAdd(SapSupplier::ID_SUPPLIER, $claimReport->getIdSupplier())->find()->count()) { $supplier = SapSupplierQuery::create()->findByPK($claimReport->getIdSupplier()); } else { $supplier = new SapSupplier(); } $claimReportArray['supplier'] = $supplier->getSupplierCardCodeWithCardName(); if (ClaimReportFileQuery::create()->whereAdd(ClaimReportFile::ID_WAREHOUSE_ENTRANCE_CLAIM_REPORT, $id)->find()->count()) { $this->view->claimReportDocument = ClaimReportFileQuery::create()->whereAdd(ClaimReportFile::ID_WAREHOUSE_ENTRANCE_CLAIM_REPORT, $id)->findOne()->getIdWarehouseEntranceClaimReport(); } $this->view->contentTitle = $this->i18n->_('Claim Control'); $this->view->onsubmit = "warehouse-entrance-claim-report/save-claim-control"; $this->view->status = $this->getClaimControlStatus(); $this->view->claimReport = $claimReportArray; $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']; }
public function getCompanyName() { if (SapSupplierQuery::create()->whereAdd(SapSupplier::ID_SUPPLIER, $this->getCustomerNumber())->find()->count()) { $supplier = SapSupplierQuery::create()->findByPK($this->getCustomerNumber()); } else { $supplier = new SapSupplier(); } return $supplier->getSupplierCardCodeWithCardName(); }