/**
  *
  * @param PurchaseOrderEntry $purchaseOrderEntry
  * @return CustomsTariffCode $tariffCode
  */
 private function getPurchaseOrderEntryTariffCode(PurchaseOrderEntry $purchaseOrderEntry)
 {
     $idProduct = $purchaseOrderEntry->getIdProduct();
     $idTariffCode = ProductQuery::create()->findByPK($idProduct)->getIdCustomsTariffCode();
     $tariffCode = CustomsTariffCodeQuery::create()->findByPK($idTariffCode);
     return $tariffCode;
 }
 /**
  * 
  * 
  * @author erick
  * @param PurchaseOrderEntry $purchaseOrderEntry
  * @return \Application\Model\Collection\PurchaseOrderProgrammedPaymentCollection
  */
 public function filterByPurchaseOrderEntry(PurchaseOrderEntry $purchaseOrderEntry)
 {
     return $this->filter(function (PurchaseOrderProgrammedPayment $purchaseOrderPaymentTerm) use($purchaseOrderEntry) {
         return $purchaseOrderPaymentTerm->getIdPurchaseOrderEntry() == $purchaseOrderEntry->getIdPurchaseOrderEntry();
     });
 }
 /**
  * 
  * Calcula la cuota compensatoria por pieza
  * @param ProductAntidumpingDuty $antidumpingDuty
  * @param PurchaseOrderEntry $purchaseOrderEntry
  * @return number
  */
 private function calculateAntidumpingDutyValueByPiece(ProductAntidumpingDuty $antidumpingDuty, PurchaseOrderEntry $purchaseOrderEntry)
 {
     $mxValue = 0;
     switch ($antidumpingDuty->getCurrency()) {
         case Currency::$IdCurrencies['Euro']:
             $mxValue = $antidumpingDuty->getValue() / $this->getEURtoUSD() * $this->getUSDToMXN();
             break;
         case Currency::$IdCurrencies['Dollar']:
             $mxValue = $antidumpingDuty->getValue() * $this->getUSDToMXN();
             break;
         default:
             $mxValue = $antidumpingDuty->getValue();
     }
     return $mxValue * $purchaseOrderEntry->getQuantity();
 }