Example #1
0
 /**
  * @author Jose luis
  * @return array $colors
  */
 private function getDefaultShipping()
 {
     $query = FreightFareQuery::create()->addColumn('FreightFare.' . FreightFare::ID_FREIGHT_FARE)->addColumn('FreightFare.' . FreightFare::ID_TRANSIT)->addColumn('FreightType.' . FreightType::NAME)->innerJoinFreightType()->actives()->fetchAll();
     $array[''] = $this->i18n->_('Select a Freight Fare');
     foreach ($query as $value) {
         $id = $value['id_freight_fare'];
         $array[$id] = $value['name'] . ' - ' . $value['id_transit'];
     }
     return $array;
 }
Example #2
0
 /**
  * @return json
  */
 public function getListResultsAction()
 {
     $params = $this->getRequest()->getParams();
     $freightFare = FreightFareQuery::create()->filter($params)->page($params['page'], $this->getMaxPerPage())->find();
     die(json_encode($freightFare->toArray()));
 }
Example #3
0
 /**
  * 
  */
 public function getListResultsAction()
 {
     $storage = $this->getStorageService();
     $params = $this->getRequest()->getParams();
     $page = $params['page'];
     $productQuery = ProductQuery::create()->useFileCache()->filter($params);
     $colors = ColorQuery::create()->find();
     $brands = BrandQuery::create()->find();
     $productCollection = $productQuery->find();
     $freightFareCollection = FreightFareQuery::create()->find();
     $freightTypeCollection = FreightTypeQuery::create()->find();
     $customsTariffCodeCollection = CustomsTariffCodeQuery::create()->find();
     $incotermCollection = IncotermQuery::create()->useFileCache()->find();
     $products = $productQuery->findByPage($page, $this->getMaxPerPage());
     // 		if (!$productStorage)
     // 			$storage->saveValue($productQuery->find(), 'products');
     $productPrintingArea = ProductPrintingAreaQuery::create()->addColumn(ProductPrintingArea::ID_PRODUCT)->whereAdd(ProductPrintingArea::ID_PRODUCT, $products->getKeyMother(), ProductPrintingAreaQuery::IN)->fetchCol();
     //
     $arrayProducts = array();
     while ($products->valid()) {
         $product = $products->read();
         $hasPrintingArea = in_array($product->getKeyMother(), $productPrintingArea) ? 1 : 0;
         $arrayProducts[$product->getIndex()] = $product->toArrayForList() + array("has_printing_area" => $hasPrintingArea);
     }
     die(json_encode($arrayProducts));
 }
Example #4
0
 private function getEditInformation($parentKey)
 {
     $items = ProductQuery::create()->whereAdd(Product::ITEM_CODE, $parentKey, BaseQuery::LIKE)->find();
     $leadTime = $items->current()->getLeadTime();
     $freightFareId = $items->current()->getDefaultFreightFare();
     if ($freightFareId > 0) {
         $freightFareQuery = Application\Query\FreightFareQuery::create()->findByPKOrElse($freightFareId, new Application\Model\Bean\FreightFare());
         $freightFare = $freightFareQuery->getIdTransit() . '-' . $freightFareQuery->getTt();
     } else {
         $freightFare = $this->i18n->_('Not Available');
     }
     $totalVim = $items->getTotalVim();
     $products = $items->map(function (Product $product) use($totalVim) {
         return array($product->getItemCode() => array('itemCode' => $product->getItemCode(), 'itemName' => $product->getItemName(), 'idColor' => $product->getIdColor(), 'status' => $product->getStatus(), 'vim' => $product->getIndividualVim(), 'vimPercent' => $product->getPercentVim($totalVim), 'targetPrice' => $product->getCost(), 'buy1' => $buy = $product->getCost() * $product->getIndividualVim(), 'buy4' => $buy * 4, 'buy6' => $buy * 6));
     });
     $data = array('products' => $products, 'leadTime' => $leadTime, 'freightFare' => $freightFare);
     return $data;
 }
Example #5
0
 private function getPurchaseOrderEntries($idPurchaseOrder)
 {
     $purchaseOrderQuery = PurchaseOrderQuery::create()->findByPK($idPurchaseOrder);
     if ($purchaseOrderQuery) {
         $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $idPurchaseOrder)->find();
         while ($purchaseOrder = $purchaseOrderQuery->read()) {
             $purchaseOrderEntryQuery = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->find();
             $price = 0;
             $cbm = 0;
             $individual_packs = 0;
             $cartons = 0;
             $quantity = 0;
             $weight = 0;
             $valuable = array();
             $j = 0;
             while ($purchaseOrderEntry = $purchaseOrderEntryQuery->read()) {
                 $product = ProductQuery::create()->findByPK($purchaseOrderEntry->getIdProduct());
                 $mcParts = $product->getMcParts();
                 if (!empty($mcParts)) {
                     $cartonsEntry = floor($purchaseOrderEntry->getQuantity() / $product->getMcParts());
                 } else {
                     $this->setFlash('warning', $this->i18n->_("You must edit MC Parts, it cannot be cero."));
                     $this->_redirect('product/edit/id/' . $product->getItemCode());
                 }
                 $volume = $product->getMcFront() * $product->getMcHeight() * $product->getMcDepth() / 1000000;
                 $cbm += $cartonsEntry * $volume;
                 $weight += $cartonsEntry * $product->getMcWeight();
                 $price += $purchaseOrderEntry->getQuantity() * $purchaseOrderEntry->getPrice();
                 $cartons += $cartonsEntry;
                 $quantity += $purchaseOrderEntry->getQuantity();
                 $entry[$j]['id_product'] = $product->getItemCode();
                 $supplier = SapSupplierQuery::create()->findByPK($purchaseOrder->getIdSupplier());
                 if ($supplier) {
                     $entry[$j]['supplier'] = $supplier->getCardCode();
                     $entry[$j]['id_currency'] = $purchaseOrder->getIdCurrency();
                     // 						echo $purchaseOrder->getIdCurrency();die;
                     $entry[$j]['currency_code'] = CurrencyQuery::create()->findByPK($purchaseOrder->getIdCurrency())->getCurrCode();
                     $entry[$j]['currency_name'] = CurrencyQuery::create()->findByPK($purchaseOrder->getIdCurrency())->getCurrName();
                     // 						$entry[$j]['currency_symbol'] = CurrencyQuery::create()->findByPK($supplier->getIdCurrency())->getSymbol();
                 } else {
                     $entry[$j]['supplier'] = $this->i18n->_('Not Available');
                 }
                 $entry[$j]['line'] = $purchaseOrderEntry->getLine();
                 $tariff = CustomsTariffCodeQuery::create()->findByPK($product->getIdCustomsTariffCode());
                 $entry[$j]['tariff_code'] = $tariff->getName();
                 $entry[$j]['tariff_percentage'] = $tariff->getPercent();
                 $entry[$j]['id_purchase_order_entry'] = $purchaseOrderEntry->getIdPurchaseOrderEntry();
                 $entry[$j]['id_purchase_order'] = $purchaseOrder->getIdPurchaseOrder();
                 $entry[$j]['doc_num'] = $purchaseOrder->getSapDocumentNumber();
                 $entry[$j]['num_purchase_order'] = $purchaseOrder->getIdPurchaseOrder();
                 $entry[$j]['invoice_number'] = $purchaseOrder->getInvoiceNumber();
                 $entry[$j]['cartons'] = $purchaseOrderEntry->getCartons();
                 $entry[$j]['carton_parts'] = $purchaseOrderEntry->getCartonParts();
                 $entry[$j]['loose_pieces'] = $purchaseOrderEntry->getLoosePieces();
                 $entry[$j]['total'] = $purchaseOrderEntry->getTotal();
                 $entry[$j]['invoice_total'] = $purchaseOrderEntry->getInvoiceTotal();
                 $entry[$j]['diference'] = $purchaseOrderEntry->getDiference();
                 $entry[$j]['quantity_by_warehouse'] = $purchaseOrderEntry->getQuantityByWarehouse();
                 $entry[$j]['document_number'] = $purchaseOrderEntry->getDocumentNumber();
                 $entry[$j]['item_code'] = $product->getItemCode();
                 $entry[$j]['item_name'] = $product->getItemName();
                 $entry[$j]['price'] = $purchaseOrderEntry->getPrice();
                 $entry[$j]['amount'] = $purchaseOrderEntry->getQuantity() * $purchaseOrderEntry->getPrice();
                 $entry[$j]['cartons'] = $purchaseOrderEntry->getCartons();
                 $entry[$j]['quantity'] = $purchaseOrderEntry->getQuantity();
                 $entry[$j]['weight'] = $product->getMcWeight() * $cartonsEntry;
                 $entry[$j]['volume'] = $volume * $cartonsEntry;
                 if (FreightFareQuery::create()->whereAdd(FreightFare::ID_FREIGHT_FARE, $product->getDefaultFreightFare())->count()) {
                     $idFreightType = FreightFareQuery::create()->findByPK($product->getDefaultFreightFare())->getIdFreightType();
                     $entries[$j]['default_shipping'] = FreightTypeQuery::create()->findByPK($idFreightType)->getName();
                 }
                 $j++;
             }
         }
         return $entry;
     } else {
         return null;
     }
 }
 /**
  *
  * @param string $idProduct
  * @return array
  */
 private function getLandedCost($idProduct, Application\Model\Bean\ProductPriceList $productPriceList, $productPrice = null)
 {
     $product = ProductQuery::create()->findByPK($idProduct);
     if (FreightFareQuery::create()->whereAdd(FreightFare::ID_FREIGHT_FARE, $product->getDefaultFreightFare())->count()) {
         $freightFare = FreightFareQuery::create()->findByPK($product->getDefaultFreightFare());
         $freightType = FreightTypeQuery::create()->findByPK($freightFare->getIdFreightType());
     } else {
         $result['message'] = $this->i18n->_('You must edit the Freight Fare.');
         $result['result'] = false;
         return $result;
     }
     if (CustomsTariffCodeQuery::create()->whereAdd(CustomsTariffCode::CODE, $product->getIdCustomsTariffCode())->count()) {
         $customsTariffCode = CustomsTariffCodeQuery::create()->findByPK($product->getIdCustomsTariffCode());
     } else {
         $result['message'] = $this->i18n->_('You must edit the Customs Code.');
         $result['result'] = false;
         return $result;
     }
     $unit = $freightFare->getUnit();
     $unitCost = $freightFare->getUnitCost();
     $maxLoad = $freightType->getMaxLoad();
     $cbmByCarton = $product->getCbmByCarton();
     if (!$cbmByCarton) {
         $result['message'] = $this->i18n->_('You must edit the Cartons.');
         $result['result'] = false;
         return $result;
     }
     $containerCartons = ceil($maxLoad / $cbmByCarton);
     $containerWeight = $containerCartons * $product->getMcWeight();
     $containerTotalProducts = $containerCartons * $product->getMcParts();
     if (!$containerTotalProducts) {
         $result['message'] = $this->i18n->_('You must edit Master Carton Parts.');
         $result['result'] = false;
         return $result;
     }
     if (!$productPrice) {
         if (!$product->getCost()) {
             $result['message'] = $this->i18n->_('You must edit the Price.');
             $result['result'] = false;
             return $result;
         }
         $productCost = $productPriceList->getProductPriceInUsd() * $containerTotalProducts;
     } else {
         $productCost = $productPrice * $containerTotalProducts;
     }
     switch ($unit) {
         case FreightFare::$Units['CBM']:
             $freightCost = $unitCost * $maxLoad;
             break;
         case FreightFare::$Units['Container']:
             $freightCost = $unitCost;
             break;
         case FreightFare::$Units['KG']:
             $freightCost = $unitCost * $containerWeight;
             break;
     }
     $productCostAndFreightCost = $productCost + $freightCost;
     $igi = $productCostAndFreightCost * $customsTariffCode->getPercent() / 100;
     $dta = $productCostAndFreightCost * 0.8 / 100;
     $iva = ($productCostAndFreightCost + $dta + $igi) * 0.16;
     $totalCostProduct = $productCostAndFreightCost + $igi + $dta + $iva;
     $landedCost = $totalCostProduct / $containerTotalProducts;
     $result['message'] = $this->i18n->_('yep! everything goes well');
     $result['result'] = strval(round($landedCost, 2));
     return $result;
 }
 /**
  *
  * @param unknown_type $idPurchaseOrder
  */
 private function getPurchaseOrderEntries($idPurchaseOrder)
 {
     $purchaseOrderQuery = PurchaseOrderQuery::create()->findByPK($idPurchaseOrder);
     if ($purchaseOrderQuery) {
         $purchaseOrderQuery = PurchaseOrderQuery::create()->whereAdd(PurchaseOrder::ID_PURCHASE_ORDER, $idPurchaseOrder)->find();
         while ($purchaseOrder = $purchaseOrderQuery->read()) {
             $purchaseOrderEntryQuery = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PURCHASE_ORDER, $purchaseOrder->getIdPurchaseOrder())->find();
             $price = 0;
             $cbm = 0;
             $individual_packs = 0;
             $cartons = 0;
             $quantity = 0;
             $weight = 0;
             $valuable = array();
             $j = 0;
             while ($purchaseOrderEntry = $purchaseOrderEntryQuery->read()) {
                 $product = ProductQuery::create()->findByPK($purchaseOrderEntry->getIdProduct());
                 $cartonsEntry = ceil($purchaseOrderEntry->getQuantity() / $product->getMcParts());
                 $volume = $product->getMcFront() * $product->getMcHeight() * $product->getMcDepth() / 1000000;
                 $cbm += $cartonsEntry * $volume;
                 $weight += $cartonsEntry * $product->getMcWeight();
                 $price += $purchaseOrderEntry->getQuantity() * $purchaseOrderEntry->getPrice();
                 $cartons += $cartonsEntry;
                 $quantity += $purchaseOrderEntry->getQuantity();
                 $entry[$j]['id_product'] = $product->getItemCode();
                 $entry[$j]['line'] = $purchaseOrderEntry->getLine();
                 $entry[$j]['id_purchase_order_entry'] = $purchaseOrderEntry->getLine();
                 $entry[$j]['id_purchase_order'] = $purchaseOrder->getIdPurchaseOrder();
                 $entry[$j]['doc_num'] = $purchaseOrder->getSapDocumentNumber();
                 $entry[$j]['cartons'] = $purchaseOrderEntry->getCartons();
                 $entry[$j]['carton_parts'] = $purchaseOrderEntry->getCartonParts();
                 $entry[$j]['loose_pieces'] = $purchaseOrderEntry->getLoosePieces();
                 $entry[$j]['total'] = $purchaseOrderEntry->getTotal();
                 $entry[$j]['invoice_total'] = $purchaseOrderEntry->getInvoiceTotal();
                 $entry[$j]['diference'] = $purchaseOrderEntry->getDiference();
                 $entry[$j]['quantity_by_warehouse'] = $purchaseOrderEntry->getQuantityByWarehouse();
                 $entry[$j]['document_number'] = $purchaseOrderEntry->getDocumentNumber();
                 $entry[$j]['item_code'] = $product->getItemCode();
                 $entry[$j]['item_name'] = $product->getItemName();
                 $entry[$j]['price'] = $purchaseOrderEntry->getPrice();
                 $entry[$j]['amount'] = $purchaseOrderEntry->getAmount();
                 $entry[$j]['cartons'] = $purchaseOrderEntry->getCartons();
                 $entry[$j]['quantity'] = $purchaseOrderEntry->getQuantity();
                 $entry[$j]['weight'] = $product->getMcWeight() * $cartonsEntry;
                 $entry[$j]['volume'] = number_format($volume * $cartonsEntry, 2);
                 if (FreightFareQuery::create()->whereAdd(FreightFare::ID_FREIGHT_FARE, $product->getDefaultFreightFare())->count()) {
                     $idFreightType = FreightFareQuery::create()->findByPK($product->getDefaultFreightFare())->getIdFreightType();
                     $entry[$j]['default_shipping'] = FreightTypeQuery::create()->findByPK($idFreightType)->getName();
                 }
                 $j++;
             }
         }
         return $entry;
     } else {
         return null;
     }
 }
Example #8
0
 public function zoomInAction()
 {
     if ($this->getRequest()->isPost()) {
         $keyMother = $this->getRequest()->getParam("key_mother");
         $itemCode = $this->getRequest()->getParam("item_code");
         $products = ProductQuery::create()->find();
         $keyMotherProducts = $products->filterByKeyMother($keyMother);
         $restock = RestockQuery::create()->findOne();
         $allRestockEntries = RestockEntryQuery::create()->find();
         $restockEntries = $allRestockEntries->filterByArrayIdProduct($keyMotherProducts->getPrimaryKeys());
         $freightTypes = FreightTypeQuery::create()->actives()->find();
         $restockFinalResultsManager = new RestockFinalResultsManager($allRestockEntries, $products);
         $product = $products->getByPK($itemCode);
         $restockAbcClass = RestockAbcClassQuery::create()->find();
         $freightFares = FreightFareQuery::create()->find();
         $freightFare = $freightFares->getByPK($product->getDefaultFreightFare());
         $fobPort = PortCustomQuery::create()->findByPKOrElse($freightFare->getFobPort(), new PortCustom());
         $fobPortFreightFares = $freightFares->filterByFobPort($fobPort);
         $freightTypeList = $freightTypes->containsIndex($freightFare->getIdFreightType()) ? $freightTypes->getByPK($freightFare->getIdFreightType()) : new FreightType();
         if ($product->getIdSupplier() != "") {
             $supplier = SapSupplierQuery::create()->findByPK($product->getIdSupplier());
         } else {
             $supplier = new SapSupplier();
         }
         $keyMotherInfo["keyMother"] = $product->getKeyMother();
         $keyMotherInfo["PurchaseKeyMother"] = $restockFinalResultsManager->getTotalPurchaseByKeyMother($keyMother);
         $keyMotherInfo["catalog"] = $product->getCodPro();
         $keyMotherInfo["port"] = $fobPort->getName();
         $keyMotherInfo["freightList"] = $freightTypeList->getName();
         $keyMotherInfo["supplier"] = $supplier->getCardCode() . " - " . $supplier->getCardname();
         $keyMotherInfo["supplierPurchase"] = $restockFinalResultsManager->getTotalPurchaseByIdSupplier($supplier->getIdSupplier());
         $keyMotherInfo["fobPortPurchase"] = $restockFinalResultsManager->getTotalByIdFreigthFare($fobPortFreightFares->getPrimaryKeys());
         while ($restockEntries->valid()) {
             $restockEntry = $restockEntries->read();
             $product = $products->getByPK($restockEntry->getIdProduct());
             $restockInfo[$restockEntry->getIndex()]["idRestockEntry"] = $restockEntry->getIdRestockEntry();
             $restockInfo[$restockEntry->getIndex()]["mcParts"] = $product->getMcParts();
             $restockInfo[$restockEntry->getIndex()]["volume"] = $product->getVolume();
             $restockInfo[$restockEntry->getIndex()]["status"] = $product->getStatus();
             $restockInfo[$restockEntry->getIndex()]["itemCode"] = $product->getItemCode();
             $restockInfo[$restockEntry->getIndex()]["name"] = $product->getItemName();
             $restockInfo[$restockEntry->getIndex()]["onStock"] = $restockEntry->getInvRelat();
             $restockInfo[$restockEntry->getIndex()]["VIM"] = $product->getIndividualVim();
             $restockInfo[$restockEntry->getIndex()]["VIMMin"] = $restockEntry->getVimMin();
             $restockInfo[$restockEntry->getIndex()]["VIMMax"] = $restockEntry->getVimMax();
             $restockInfo[$restockEntry->getIndex()]["newQuantityMin"] = $restockEntry->getNewQuantityMin();
             $restockInfo[$restockEntry->getIndex()]["newImportMin"] = $restockEntry->getPriceMin();
             $restockInfo[$restockEntry->getIndex()]["newQuantityMax"] = $restockEntry->getNewQuantityMax();
             $restockInfo[$restockEntry->getIndex()]["newImportMax"] = $restockEntry->getPriceMax();
             $restockInfo[$restockEntry->getIndex()]["coverMin"] = $restockEntry->getMinCoverPercent();
             $restockInfo[$restockEntry->getIndex()]["coverMax"] = $restockEntry->getMaxCoverPercent();
             $restockInfo[$restockEntry->getIndex()]["ABCMin"] = $restockAbcClass->getByPK($restockEntry->getAbcMix())->getName();
             $restockInfo[$restockEntry->getIndex()]["desition"] = $restockEntry->getDesitionName();
             $restockInfo[$restockEntry->getIndex()]["lastFOB"] = $product->getCost();
             $restockInfo[$restockEntry->getIndex()]["targetFOB"] = $restockEntry->getMinTargetPrice();
             $restockInfo[$restockEntry->getIndex()]["quantityPurchase"] = $restockEntry->getPurchaseQuantity();
             $restockInfo[$restockEntry->getIndex()]["importPurchase"] = $restockEntry->getPurchasePrice();
             $restockInfo[$restockEntry->getIndex()]["quantityPercent"] = $restockEntry->getPurchaseQuantityPercernt();
             $restockInfo[$restockEntry->getIndex()]["importPercent"] = $restockEntry->getPurchasePricePercent();
             $restockInfo[$restockEntry->getIndex()]["quantitySetted"] = $restockEntry->getQuantity();
             $restockInfo[$restockEntry->getIndex()]["purchaseSetted"] = $restockFinalResultsManager->getTotalCartonsByIdRestockEntry($restockEntry->getIdRestockEntry());
             $restockInfo[$restockEntry->getIndex()]["importPurchaseSetted"] = $restockFinalResultsManager->getPurchaseSettedByIdRestockEntry($restockEntry->getIdRestockEntry());
             $restockInfo[$restockEntry->getIndex()]["isManual"] = $product->isManual();
             $restockInfo[$restockEntry->getIndex()]["cbm"] = $totalVolume = $restockFinalResultsManager->getTotalVolumeByIdRestockEntry($restockEntry->getIdRestockEntry());
             $restockInfo[$restockEntry->getIndex()]["suggestedFreight"] = implode(" / ", $freightTypes->getSuggestedFreights($totalVolume)->toCombo());
             $restockInfo[$restockEntry->getIndex()]["checked"] = $restockEntry->getChecked();
         }
         $requisitionEntries = RequisitionEntryQuery::create()->whereAdd(RequisitionEntry::ID_PRODUCT, $keyMotherProducts->getPrimaryKeys(), RequisitionEntryQuery::IN)->whereAdd(RequisitionEntry::STATUS, array(RequisitionEntry::$Status["Closed"], RequisitionEntry::$Status["Canceled"], RequisitionEntry::$Status["Inactive"]), RequisitionEntryQuery::NOT_IN)->find()->toArrayForZoomIn();
         $proformaInvoiceEntries = ProformaInvoiceEntryQuery::create()->whereAdd(ProformaInvoiceEntry::ID_PRODUCT, $keyMotherProducts->getPrimaryKeys(), ProformaInvoiceEntryQuery::IN)->whereAdd(ProformaInvoiceEntry::LINE_STATUS, ProformaInvoiceEntry::$LineStatus["Open"])->find()->toArrayForZoomIn();
         $purchaseOrderEntries = PurchaseOrderEntryQuery::create()->whereAdd(PurchaseOrderEntry::ID_PRODUCT, $keyMotherProducts->getPrimaryKeys(), PurchaseOrderEntryQuery::IN)->whereAdd(PurchaseOrderEntry::LINE_STATUS, PurchaseOrderEntry::$LineStatus["Open"])->find()->toArrayForZoomIn();
         $documents = array_merge(array_merge($requisitionEntries, $proformaInvoiceEntries), $purchaseOrderEntries);
         $currencies = CurrencyQuery::create()->find()->toArray();
         die(Zend_Json::encode(array("keyMother" => $keyMotherInfo, "restock" => $restockInfo, "documents" => $documents, "currecies" => $currencies)));
     }
 }
Example #9
0
 /**
  * 
  * @throws \Exception
  */
 public function updateData()
 {
     $phpExcel = $this->getPhpExcel();
     $activeSheet = $phpExcel->getActiveSheet();
     $highestColumn = $activeSheet->getHighestColumn();
     $highestRow = $activeSheet->getHighestRow();
     $modifiedFreightFareCollection = new FreightFareCollection();
     $modifiedFreightFareArray = array();
     $originalFreightFaresArray = array();
     if ($highestRow > 1000) {
         throw new \Exception('The file is very big');
     }
     $headers = $activeSheet->rangeToArray('A3:' . $highestColumn . '3');
     if (!$this->validateFile($headers[2])) {
         throw new \Exception('This file does not contain valid content to update the data');
     }
     for ($row = 4; $row <= $highestRow; $row++) {
         $rowArray = $activeSheet->rangeToArray('A' . $row . ':' . $highestColumn . $row);
         $fields = $this->setRowArrayKeys($rowArray[$row - 1]);
         $modifiedFreightFaresArray[] = $fields;
         $originalFreightFaresArray[$fields['ID']] = $fields['ID'];
     }
     $forwarderCollection = ForwarderQuery::create()->find();
     $customPortCollection = PortCustomQuery::create()->find();
     $freightTypeCollection = FreightTypeQuery::create()->find();
     $originalFreightFareCollection = FreightFareQuery::create()->whereAdd(FreightFare::ID_FREIGHT_FARE, $originalFreightFaresArray)->find();
     $modified = 0;
     $created = 0;
     foreach ($modifiedFreightFaresArray as $modifiedFreightFare) {
         $destinationPort = $customPortCollection->getByName($modifiedFreightFare['Destination Port']);
         $fobPort = $customPortCollection->getByName($modifiedFreightFare['FOB Port']);
         $forwarder = $forwarderCollection->getByName($modifiedFreightFare['Forwarder']);
         $freightType = $freightTypeCollection->getByName($modifiedFreightFare['Freight Type']);
         $freightFare = $originalFreightFareCollection->getByPK($modifiedFreightFare['ID']);
         $freightFare->setIdFreightFare($modifiedFreightFare['ID']);
         if ($freightFare instanceof FreightFare) {
             if ($fobPort) {
                 $freightFare->setFobPort($fobPort->getIdPortCustom());
             }
             if ($destinationPort) {
                 $freightFare->setDestinationPort($destinationPort->getIdPortCustom());
             }
             if ($freightType) {
                 $freightFare->setIdFreightType($freightType->getIdFreightType());
             }
             if ($forwarder) {
                 $freightFare->setIdForwarder($forwarder->getIdForwarder());
             }
             $freightFare->setIdTransit($modifiedFreightFare['ID-Transit']);
             $freightFare->setNotes($modifiedFreightFare['Notes']);
             $freightFare->setTt($modifiedFreightFare['Transit Time']);
             $freightFare->setFrecuency($modifiedFreightFare['Frecuency']);
             $freightFare->setGoodThrough($modifiedFreightFare['Good Through']);
             $freightFare->setUnit(FreightFare::$Units[$modifiedFreightFare['Unit']]);
             $freightFare->setUnitCost($modifiedFreightFare['Fare']);
             $freightFare->setPeak($modifiedFreightFare['Peak/Unit']);
             $freightFare->setStatus(FreightFare::$Status[$modifiedFreightFare['Status']]);
             $this->getFreightFareCatalog()->beginTransaction();
             try {
                 $this->getFreightFareCatalog()->update($freightFare);
             } catch (\Exception $e) {
                 throw e;
                 $this->getFreightFareCatalog()->rollBack();
             }
             $this->getFreightFareCatalog()->commit();
             return true;
         } else {
         }
     }
 }