71 \
Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
73 \
Magento\Sales\Model\
Order\ItemFactory $orderItemFactory,
87 $this->_orderItemFactory = $orderItemFactory;
120 return $this->
getData(self::INVOICE);
131 $this->_orderItem =
$item;
143 if ($this->_orderItem ===
null) {
147 $this->_orderItem = $this->_orderItemFactory->create()->load($this->
getOrderItemId());
163 return $this->
setData(self::QTY, $qty);
171 public function register()
178 $orderItem->setDiscountTaxCompensationInvoiced(
181 $orderItem->setBaseDiscountTaxCompensationInvoiced(
205 $orderItem->setDiscountTaxCompensationInvoiced(
208 $orderItem->setBaseDiscountTaxCompensationInvoiced(
233 $rowTotalInclTax =
$orderItem->getRowTotalInclTax();
234 $baseRowTotalInclTax =
$orderItem->getBaseRowTotalInclTax();
237 $availableQty = $orderItemQty -
$orderItem->getQtyInvoiced();
238 $rowTotal =
$invoice->roundPrice($rowTotal / $availableQty * $this->
getQty());
239 $baseRowTotal =
$invoice->roundPrice($baseRowTotal / $availableQty * $this->
getQty(),
'base');
245 if ($rowTotalInclTax && $baseRowTotalInclTax) {
247 $invoice->roundPrice($rowTotalInclTax / $orderItemQty * $this->getQty(),
'including')
250 $invoice->roundPrice($baseRowTotalInclTax / $orderItemQty * $this->getQty(),
'including_base')
263 if ((
string)(
double)$this->
getQty() == (
string)(
double)$this->
getOrderItem()->getQtyToInvoice()) {
setBaseDiscountTaxCompensationAmount($amount)
setDiscountAmount($amount)
_getExtensionAttributes()
setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceItemExtensionInterface $extensionAttributes)
getDiscountTaxCompensationAmount()
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
const DISCOUNT_TAX_COMPENSATION_AMOUNT
setOrderItem(\Magento\Sales\Model\Order\Item $item)
setRowTotalInclTax($amount)
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
setDiscountTaxCompensationAmount($amount)
setAdditionalData($additionalData)
setInvoice(\Magento\Sales\Api\Data\InvoiceInterface $invoice)
const BASE_ROW_TOTAL_INCL_TAX
const BASE_DISCOUNT_TAX_COMPENSATION_AMOUNT
setBaseDiscountAmount($amount)
const BASE_PRICE_INCL_TAX
setBaseRowTotalInclTax($amount)
getData($key='', $index=null)
setDescription($description)
setData($key, $value=null)
getBaseDiscountTaxCompensationAmount()
const BASE_DISCOUNT_AMOUNT
setBasePriceInclTax($amount)
setBaseTaxAmount($amount)
if(!isset($_GET['name'])) $name