当前位置: 首页>>代码示例>>PHP>>正文


PHP Creditmemo::getAdjustmentNegative方法代码示例

本文整理汇总了PHP中Magento\Sales\Model\Order\Creditmemo::getAdjustmentNegative方法的典型用法代码示例。如果您正苦于以下问题:PHP Creditmemo::getAdjustmentNegative方法的具体用法?PHP Creditmemo::getAdjustmentNegative怎么用?PHP Creditmemo::getAdjustmentNegative使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Sales\Model\Order\Creditmemo的用法示例。


在下文中一共展示了Creditmemo::getAdjustmentNegative方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 /**
  * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo
  * @return $this
  */
 public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
 {
     $grandTotal = $creditmemo->getGrandTotal();
     $baseGrandTotal = $creditmemo->getBaseGrandTotal();
     $grandTotal += $creditmemo->getAdjustmentPositive();
     $baseGrandTotal += $creditmemo->getBaseAdjustmentPositive();
     $grandTotal -= $creditmemo->getAdjustmentNegative();
     $baseGrandTotal -= $creditmemo->getBaseAdjustmentNegative();
     $creditmemo->setGrandTotal($grandTotal);
     $creditmemo->setBaseGrandTotal($baseGrandTotal);
     $creditmemo->setAdjustment($creditmemo->getAdjustmentPositive() - $creditmemo->getAdjustmentNegative());
     $creditmemo->setBaseAdjustment($creditmemo->getBaseAdjustmentPositive() - $creditmemo->getBaseAdjustmentNegative());
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:18,代码来源:Grand.php

示例2: prepareOrder

 /**
  * Prepare order data for refund
  *
  * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo
  * @return void
  */
 protected function prepareOrder(\Magento\Sales\Model\Order\Creditmemo $creditmemo)
 {
     $order = $creditmemo->getOrder();
     $baseOrderRefund = $this->priceCurrency->round($order->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal());
     $orderRefund = $this->priceCurrency->round($order->getTotalRefunded() + $creditmemo->getGrandTotal());
     $order->setBaseTotalRefunded($baseOrderRefund);
     $order->setTotalRefunded($orderRefund);
     $order->setBaseSubtotalRefunded($order->getBaseSubtotalRefunded() + $creditmemo->getBaseSubtotal());
     $order->setSubtotalRefunded($order->getSubtotalRefunded() + $creditmemo->getSubtotal());
     $order->setBaseTaxRefunded($order->getBaseTaxRefunded() + $creditmemo->getBaseTaxAmount());
     $order->setTaxRefunded($order->getTaxRefunded() + $creditmemo->getTaxAmount());
     $order->setBaseDiscountTaxCompensationRefunded($order->getBaseDiscountTaxCompensationRefunded() + $creditmemo->getBaseDiscountTaxCompensationAmount());
     $order->setDiscountTaxCompensationRefunded($order->getDiscountTaxCompensationRefunded() + $creditmemo->getDiscountTaxCompensationAmount());
     $order->setBaseShippingRefunded($order->getBaseShippingRefunded() + $creditmemo->getBaseShippingAmount());
     $order->setShippingRefunded($order->getShippingRefunded() + $creditmemo->getShippingAmount());
     $order->setBaseShippingTaxRefunded($order->getBaseShippingTaxRefunded() + $creditmemo->getBaseShippingTaxAmount());
     $order->setShippingTaxRefunded($order->getShippingTaxRefunded() + $creditmemo->getShippingTaxAmount());
     $order->setAdjustmentPositive($order->getAdjustmentPositive() + $creditmemo->getAdjustmentPositive());
     $order->setBaseAdjustmentPositive($order->getBaseAdjustmentPositive() + $creditmemo->getBaseAdjustmentPositive());
     $order->setAdjustmentNegative($order->getAdjustmentNegative() + $creditmemo->getAdjustmentNegative());
     $order->setBaseAdjustmentNegative($order->getBaseAdjustmentNegative() + $creditmemo->getBaseAdjustmentNegative());
     $order->setDiscountRefunded($order->getDiscountRefunded() + $creditmemo->getDiscountAmount());
     $order->setBaseDiscountRefunded($order->getBaseDiscountRefunded() + $creditmemo->getBaseDiscountAmount());
     if ($creditmemo->getDoTransaction()) {
         $order->setTotalOnlineRefunded($order->getTotalOnlineRefunded() + $creditmemo->getGrandTotal());
         $order->setBaseTotalOnlineRefunded($order->getBaseTotalOnlineRefunded() + $creditmemo->getBaseGrandTotal());
     } else {
         $order->setTotalOfflineRefunded($order->getTotalOfflineRefunded() + $creditmemo->getGrandTotal());
         $order->setBaseTotalOfflineRefunded($order->getBaseTotalOfflineRefunded() + $creditmemo->getBaseGrandTotal());
     }
     $order->setBaseTotalInvoicedCost($order->getBaseTotalInvoicedCost() - $creditmemo->getBaseCost());
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:38,代码来源:Refund.php


注:本文中的Magento\Sales\Model\Order\Creditmemo::getAdjustmentNegative方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。