コード例 #1
0
 /**
  *
  * @param PurchaseOrderEntry $purchaseOrderEntry
  * @return float $total
  */
 private function getPurchaseOrderEntryVolume(PurchaseOrderEntry $purchaseOrderEntry)
 {
     $quantity = $purchaseOrderEntry->getQuantity();
     $masterCartonParts = ProductQuery::create()->findByPK($purchaseOrderEntry->getIdProduct())->getMcParts();
     $masterCartonVolume = ProductQuery::create()->findByPK($purchaseOrderEntry->getIdProduct())->getVolume();
     $masterCartons = ceil($quantity / $masterCartonParts);
     $total = $masterCartonVolume * $masterCartons;
     // 		echo '<pre>';
     // 		echo $quantity. '<br>';
     // 		echo $masterCartonParts. '<br>';
     // 		echo $masterCartonVolume. '<br>';
     // 		echo $total;
     // 		die;
     // 		echo $quantity . ' / ' . $masterCartonParts . ' = ' . $total . '<br>';
     return $total;
 }
コード例 #2
0
 /**
  * 
  * 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();
 }