/** * * @return array */ public function editAction() { $id = $this->getRequest()->getParam('id'); $productionTimePrintingTechniques = ProductionTimePrintingTechniqueQuery::create()->findByPKOrThrow($id, $this->i18n->_("Not exists the ProductionTimePrintingTechnique with id {$id}")); $this->view->setTpl("Form"); $this->view->productionTime = $productiontimeQuery = ProductionTimePrintingTechniqueQuery::create()->innerJoinProductPrintingArea()->findByPKOrThrow($id, $this->i18n->_("No exists Production Time Printing Technique")); $this->view->printingArea = $printingArea = ProductPrintingAreaQuery::create()->findByPKOrElse($productiontimeQuery->getIdProductPrintingArea(), new ProductPrintingArea()); $this->view->product = ProductQuery::create()->findOneOrElse($printingArea->getIdProduct(), new Product()); $this->view->technique = PrintingTechniqueQuery::create()->findByPKOrElse($productiontimeQuery->getIdPrintingTechnique(), new PrintingTechnique()); $this->view->size = $size = PrintingSizeQuery::create()->findByPKOrElse($printingArea->getIdPrintingSize(), new \Application\Model\Bean\PrintingSize()); // die(print_r($productiontimeQuery)); }
/** * * @return array */ public function editAction() { $id = $this->getRequest()->getParam('id_product'); if (ProductPriceListQuery::create()->whereAdd(ProductPriceList::ID_PRODUCT, $id)->count()) { $productPriceList = ProductPriceListQuery::create()->whereAdd(ProductPriceList::ID_PRODUCT, $id)->findOneOrElse($id, new ProductPriceList()); } else { $productPriceList = new ProductPriceList(); $productPriceList->setIdProduct($id); } $product = ProductQuery::create()->findByPK($id); $products = ProductQuery::create()->whereAdd(Product::ITEM_CODE, $product->getKeyMother(), ProductQuery::LIKE)->find(); $productPriceListHistoryArray = array(); while ($p = $products->read()) { for ($i = 1; $i <= 12; $i++) { $productPriceListHistoryQuery = ProductPriceListHistoryQuery::create()->whereAdd(ProductPriceListHistory::ITEMCODE, $p->getItemCode())->whereAdd(ProductPriceListHistory::PRICELIST, $i)->whereAdd(ProductPriceListHistory::PRICE, '0.0', ProductPriceListHistoryQuery::NOT_EQUAL)->orderBy(ProductPriceListHistory::LOGINSTANCE, ProductPriceListHistoryQuery::DESC)->findByPage(1, 10); $j = 0; while ($productPriceListHistory = $productPriceListHistoryQuery->read()) { $productPriceListHistoryArray[$p->getItemCode()][$i][$j]['price'] = $productPriceListHistory->getPrice(); $productPriceListHistoryArray[$p->getItemCode()][$i][$j]['date'] = $productPriceListHistory->getUpdateDate(); $j++; } } } // echo '<pre>'; // print_r($productPriceList); // die; $productPrintingArea = ProductPrintingAreaQuery::create()->whereAdd(ProductPrintingArea::ID_PRODUCT, $product->getKeyMother())->findOne(); $printingTechnique = ProductionTimePrintingTechniqueQuery::create()->whereAdd(ProductionTimePrintingTechnique::ID_PRODUCT_PRINTING_AREA, $productPrintingArea->getIdProductPrintingArea())->getFavorite()->findOne(); $rangeAndVolume = RangeAndVolumeQuery::create()->whereAdd(RangeAndVolume::RANGE, $product->getCost(), RangeAndVolumeQuery::GREATER_THAN)->orderBy(RangeAndVolume::RANGE, RangeAndVolumeQuery::ASC)->findOne(); $technique = PrintingTechniqueQuery::create()->findByPK($printingTechnique->getIdPrintingTechnique()); $size = PrintingSizeQuery::create()->findByPK($productPrintingArea->getIdPrintingSize()); $printingPrice = PrintingTechniqueSizeQuery::create()->whereAdd(PrintingTechniqueSize::ID_PRINTING_SIZE, $size->getIdPrintingSize())->whereAdd(PrintingTechniqueSize::ID_PRINTING_TECHNIQUE, $technique->getIdPrintingTechnique())->findOne(); $salesParameters = SalesParameterQuery::create()->find(); $this->view->id_product = $id; $this->view->contentTitle = $this->i18n->_('Edit Product Price List'); $this->view->products = $products->toArray(); $this->view->priceListHistory = $productPriceListHistoryArray; $this->view->productPrintingArea = $productPrintingArea->toArray(); $this->view->printingTechnique = $printingTechnique->toArray(); $this->view->rangeAndVolume = $rangeAndVolume->toArray(); $this->view->technique = $technique->getAbbreviation(); $this->view->size = $size->getName(); $this->view->printingPrice = $printingPrice->getPrice(); $this->view->statuses = Product::$StatusFullName; $this->view->onsubmit = $this->getBaseUrl() . "/product-price-list/update"; $this->view->freightFactor = $salesParameters->getByPK(SalesParameter::$SalesParameters['FreightFactorAndPromptPayment'])->getValue(); if (!$productPriceList->getExchangeRateUsdToPesos()) { $productPriceList->setExchangeRateUsdToPesos($salesParameters->getByPK(SalesParameter::$SalesParameters['ExchangeRate'])->getValue()); } if (!$productPriceList->getExchangeRateEurToUsd()) { $productPriceList->setExchangeRateEurToUsd($salesParameters->getByPK(SalesParameter::$SalesParameters['ExchangeRateEurtoUsd'])->getValue()); } if (!$productPriceList->getMarginEximagen()) { $productPriceList->setMarginEximagen($salesParameters->getByPK(SalesParameter::$SalesParameters['EximagenRange'])->getValue()); } /** * * @todo cambiar estos valores */ $result = $this->getLandedCost($id, $productPriceList); if (!$result['result']) { $this->setFlash('warning', $this->i18n->_('You must edit the Product before the Product Printing List') . $result['message']); $this->_redirect('product/list'); } $landedCost = $result['result']; $this->view->productPriceList = $productPriceList->toArray(); // $this->view->priceHistory = $this->getPriceHistoryAsCombo($id); $this->view->landedCost = $landedCost; $this->view->landedCostInfo = $this->getValuesUsedForLandedCost($id, $productPriceList); $url = $this->generateUrl('price-list', 'update', compact('id')); $this->view->form = $form; $this->view->setTpl("New"); }
/** * * @return array */ public function editAction() { $idProduct = $this->getRequest()->getParam('id_product'); $product = ProductQuery::create()->findByPK($idProduct); $productPrintingAreas = ProductPrintingAreaQuery::create()->whereAdd(ProductPrintingArea::ID_PRODUCT, $product->getKeyMother())->find(); while ($productPrintingArea = $productPrintingAreas->read()) { $idPrintingArea = $productPrintingArea->getIdProductPrintingArea(); if (ProductPrintingAreaFileQuery::create()->whereAdd(ProductPrintingAreaFile::ID_PRODUCT_PRINTING_AREA, $productPrintingArea->getIdProductPrintingArea())->whereAdd(ProductPrintingAreaFile::DOCUMENT_TYPE, ProductPrintingAreaFile::$DocumentType['image_one'])->count()) { $files[$idPrintingArea]['image_one'] = ProductPrintingAreaFileQuery::create()->whereAdd(ProductPrintingAreaFile::ID_PRODUCT_PRINTING_AREA, $productPrintingArea->getIdProductPrintingArea())->whereAdd(ProductPrintingAreaFile::DOCUMENT_TYPE, ProductPrintingAreaFile::$DocumentType['image_one'])->findOne()->getContent(); } if (ProductPrintingAreaFileQuery::create()->whereAdd(ProductPrintingAreaFile::ID_PRODUCT_PRINTING_AREA, $productPrintingArea->getIdProductPrintingArea())->whereAdd(ProductPrintingAreaFile::DOCUMENT_TYPE, ProductPrintingAreaFile::$DocumentType['image_two'])->count()) { $files[$idPrintingArea]['image_two'] = ProductPrintingAreaFileQuery::create()->whereAdd(ProductPrintingAreaFile::ID_PRODUCT_PRINTING_AREA, $productPrintingArea->getIdProductPrintingArea())->whereAdd(ProductPrintingAreaFile::DOCUMENT_TYPE, ProductPrintingAreaFile::$DocumentType['image_two'])->findOne()->getContent(); } $productTechniques[$idPrintingArea] = ProductionTimePrintingTechniqueQuery::create()->whereAdd(ProductionTimePrintingTechnique::ID_PRODUCT_PRINTING_AREA, $idPrintingArea)->find()->toArray(); } $onsubmit = 'product-printing-area/update'; $this->view->idProduct = $productPrintingAreas->getOne()->getIdProduct(); $this->view->idEShop = $productPrintingAreas->getOne()->getIdEShop(); $this->view->urlLogoNet = $productPrintingAreas->getOne()->getUrlLogoNet(); $this->view->areas = $productPrintingAreas->toArray(); $this->view->productTechniques = $productTechniques; $this->view->contentTitle = $this->i18n->_('Edit Product Printing Area '); $this->view->files = $files; $this->view->onsubmit = $onsubmit; $this->view->product = $product->toArray(); $this->view->sizes = PrintingSizeQuery::create()->find()->toCombo('All'); $this->view->techniques = PrintingTechniqueQuery::create()->find()->toCombo('All'); $this->view->setTpl("New"); }
/** * */ public function getListResultsAction() { $fields = $this->getRequest()->getParams(); $printingTechniques = PrintingTechniqueQuery::create()->filter($fields)->page($fields['page'], $this->getMaxPerPage())->find(); while ($printingTechnique = $printingTechniques->read()) { $printingTechnique->setName(utf8_encode($printingTechnique->getName())); } die(json_encode($printingTechniques->toArray())); }
/** * * @return array */ public function newAction() { $id = $this->getRequest()->getParam('id_printing_technique'); $url = $this->generateUrl('printing-technique-extra-day', 'create'); $this->view->contentTitle = $this->i18n->_('New Printing Technique Extra Days Registry'); $extraDay = new PrintingTechniqueExtraDay(); $extraDay->setIdPrintingTechnique($id); $this->view->technique = PrintingTechniqueQuery::create()->findByPK($id)->toArray(); $this->view->extraDay = $extraDay->toArray(); $this->view->onsubmit = $this->getBaseUrl() . '/printing-technique-extra-day/create'; }