Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Invoice.php
Go to the documentation of this file.
1 <?php
7 
12 
26 {
30  const STATE_OPEN = 1;
31 
32  const STATE_PAID = 2;
33 
34  const STATE_CANCELED = 3;
37  const CAPTURE_ONLINE = 'online';
38 
39  const CAPTURE_OFFLINE = 'offline';
40 
41  const NOT_CAPTURE = 'not_capture';
42 
43  const REPORT_DATE_TYPE_ORDER_CREATED = 'order_created';
44 
45  const REPORT_DATE_TYPE_INVOICE_CREATED = 'invoice_created';
46 
52  protected $entityType = 'invoice';
53 
57  protected static $_states;
58 
62  protected $_order;
63 
69  protected $_rounders = [];
70 
74  protected $_saveBeforeDestruct = false;
75 
79  protected $_eventPrefix = 'sales_order_invoice';
80 
84  protected $_eventObject = 'invoice';
85 
91  protected $_wasPayCalled = false;
92 
96  protected $_invoiceConfig;
97 
101  protected $_orderFactory;
102 
107 
112 
117 
122 
139  public function __construct(
140  \Magento\Framework\Model\Context $context,
141  \Magento\Framework\Registry $registry,
142  \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory,
144  \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig,
145  \Magento\Sales\Model\OrderFactory $orderFactory,
146  \Magento\Framework\Math\CalculatorFactory $calculatorFactory,
147  \Magento\Sales\Model\ResourceModel\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory,
148  \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory,
149  \Magento\Sales\Model\ResourceModel\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory,
150  \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
151  \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
152  array $data = []
153  ) {
154  $this->_invoiceConfig = $invoiceConfig;
155  $this->_orderFactory = $orderFactory;
156  $this->_calculatorFactory = $calculatorFactory;
157  $this->_invoiceItemCollectionFactory = $invoiceItemCollectionFactory;
158  $this->_invoiceCommentFactory = $invoiceCommentFactory;
159  $this->_commentCollectionFactory = $commentCollectionFactory;
160  parent::__construct(
161  $context,
162  $registry,
163  $extensionFactory,
165  $resource,
166  $resourceCollection,
167  $data
168  );
169  }
170 
176  protected function _construct()
177  {
178  $this->_init(\Magento\Sales\Model\ResourceModel\Order\Invoice::class);
179  }
180 
187  public function loadByIncrementId($incrementId)
188  {
189  $ids = $this->getCollection()->addAttributeToFilter('increment_id', $incrementId)->getAllIds();
190 
191  if (!empty($ids)) {
192  reset($ids);
193  $this->load(current($ids));
194  }
195  return $this;
196  }
197 
203  public function getConfig()
204  {
205  return $this->_invoiceConfig;
206  }
207 
213  public function getStore()
214  {
215  return $this->getOrder()->getStore();
216  }
217 
224  public function setOrder(\Magento\Sales\Model\Order $order)
225  {
226  $this->_order = $order;
227  $this->setOrderId($order->getId())->setStoreId($order->getStoreId());
228  return $this;
229  }
230 
236  public function getOrder()
237  {
238  if (!$this->_order instanceof \Magento\Sales\Model\Order) {
239  $this->_order = $this->_orderFactory->create()->load($this->getOrderId());
240  }
241  return $this->_order->setHistoryEntityName($this->entityType);
242  }
243 
249  public function getEntityType()
250  {
251  return $this->entityType;
252  }
253 
259  public function getBillingAddress()
260  {
261  return $this->getOrder()->getBillingAddress();
262  }
263 
269  public function getShippingAddress()
270  {
271  return $this->getOrder()->getShippingAddress();
272  }
273 
279  public function isCanceled()
280  {
281  return $this->getState() == self::STATE_CANCELED;
282  }
283 
289  public function canCapture()
290  {
291  return $this->getState() != self::STATE_CANCELED &&
292  $this->getState() != self::STATE_PAID &&
293  $this->getOrder()->getPayment()->canCapture();
294  }
295 
301  public function canVoid()
302  {
303  if ($this->getState() == self::STATE_PAID) {
304  if ($this->getCanVoidFlag() === null) {
305  return (bool)$this->getOrder()->getPayment()->canVoid();
306  }
307  }
308  return (bool)$this->getCanVoidFlag();
309  }
310 
316  public function canCancel()
317  {
318  return $this->getState() == self::STATE_OPEN;
319  }
320 
326  public function canRefund()
327  {
328  if ($this->getState() != self::STATE_PAID) {
329  return false;
330  }
331  if (abs($this->getBaseGrandTotal() - $this->getBaseTotalRefunded()) < .0001) {
332  return false;
333  }
334  return true;
335  }
336 
342  public function capture()
343  {
344  $this->getOrder()->getPayment()->capture($this);
345  if ($this->getIsPaid()) {
346  $this->pay();
347  }
348  return $this;
349  }
350 
356  public function pay()
357  {
358  if ($this->_wasPayCalled) {
359  return $this;
360  }
361  $this->_wasPayCalled = true;
362 
363  $this->setState(self::STATE_PAID);
364 
365  $order = $this->getOrder();
366  $order->getPayment()->pay($this);
367  $totalPaid = $this->getGrandTotal();
368  $baseTotalPaid = $this->getBaseGrandTotal();
369  $invoiceList = $order->getInvoiceCollection();
370  // calculate all totals
371  if (count($invoiceList->getItems()) > 1) {
372  $totalPaid += $order->getTotalPaid();
373  $baseTotalPaid += $order->getBaseTotalPaid();
374  }
375  $order->setTotalPaid($totalPaid);
376  $order->setBaseTotalPaid($baseTotalPaid);
377  $this->_eventManager->dispatch('sales_order_invoice_pay', [$this->_eventObject => $this]);
378  return $this;
379  }
380 
386  public function wasPayCalled()
387  {
388  return $this->_wasPayCalled;
389  }
390 
396  public function void()
397  {
398  $this->getOrder()->getPayment()->void($this);
399  $this->cancel();
400  return $this;
401  }
402 
408  public function cancel()
409  {
410  if (!$this->canCancel()) {
411  return $this;
412  }
413  $order = $this->getOrder();
414  $order->getPayment()->cancelInvoice($this);
415  foreach ($this->getAllItems() as $item) {
416  $item->cancel();
417  }
418 
422  $order->setTotalInvoiced($order->getTotalInvoiced() - $this->getGrandTotal());
423  $order->setBaseTotalInvoiced($order->getBaseTotalInvoiced() - $this->getBaseGrandTotal());
424 
425  $order->setSubtotalInvoiced($order->getSubtotalInvoiced() - $this->getSubtotal());
426  $order->setBaseSubtotalInvoiced($order->getBaseSubtotalInvoiced() - $this->getBaseSubtotal());
427 
428  $order->setTaxInvoiced($order->getTaxInvoiced() - $this->getTaxAmount());
429  $order->setBaseTaxInvoiced($order->getBaseTaxInvoiced() - $this->getBaseTaxAmount());
430 
431  $order->setDiscountTaxCompensationInvoiced(
432  $order->getDiscountTaxCompensationInvoiced() - $this->getDiscountTaxCompensationAmount()
433  );
434  $order->setBaseDiscountTaxCompensationInvoiced(
435  $order->getBaseDiscountTaxCompensationInvoiced() - $this->getBaseDiscountTaxCompensationAmount()
436  );
437 
438  $order->setShippingTaxInvoiced($order->getShippingTaxInvoiced() - $this->getShippingTaxAmount());
439  $order->setBaseShippingTaxInvoiced($order->getBaseShippingTaxInvoiced() - $this->getBaseShippingTaxAmount());
440 
441  $order->setShippingInvoiced($order->getShippingInvoiced() - $this->getShippingAmount());
442  $order->setBaseShippingInvoiced($order->getBaseShippingInvoiced() - $this->getBaseShippingAmount());
443 
444  $order->setDiscountInvoiced($order->getDiscountInvoiced() - $this->getDiscountAmount());
445  $order->setBaseDiscountInvoiced($order->getBaseDiscountInvoiced() - $this->getBaseDiscountAmount());
446  $order->setBaseTotalInvoicedCost($order->getBaseTotalInvoicedCost() - $this->getBaseCost());
447 
448  if ($this->getState() == self::STATE_PAID) {
449  $order->setTotalPaid($order->getTotalPaid() - $this->getGrandTotal());
450  $order->setBaseTotalPaid($order->getBaseTotalPaid() - $this->getBaseGrandTotal());
451  }
452  $this->setState(self::STATE_CANCELED);
453  $order->setState(\Magento\Sales\Model\Order::STATE_PROCESSING)
454  ->setStatus($order->getConfig()->getStateDefaultStatus(\Magento\Sales\Model\Order::STATE_PROCESSING));
455  $this->_eventManager->dispatch('sales_order_invoice_cancel', [$this->_eventObject => $this]);
456  return $this;
457  }
458 
464  public function collectTotals()
465  {
466  foreach ($this->getConfig()->getTotalModels() as $model) {
467  $model->collect($this);
468  }
469  return $this;
470  }
471 
480  public function roundPrice($price, $type = 'regular', $negative = false)
481  {
482  if ($price) {
483  if (!isset($this->_rounders[$type])) {
484  $this->_rounders[$type] = $this->_calculatorFactory->create(['scope' => $this->getStore()]);
485  }
486  $price = $this->_rounders[$type]->deltaRound($price, $negative);
487  }
488  return $price;
489  }
490 
496  public function getItemsCollection()
497  {
498  if (!$this->hasData(InvoiceInterface::ITEMS)) {
499  $this->setItems($this->_invoiceItemCollectionFactory->create()->setInvoiceFilter($this->getId()));
500 
501  if ($this->getId()) {
502  foreach ($this->getItems() as $item) {
503  $item->setInvoice($this);
504  }
505  }
506  }
507  return $this->getItems();
508  }
509 
513  public function getAllItems()
514  {
515  $items = [];
516  foreach ($this->getItemsCollection() as $item) {
517  if (!$item->isDeleted()) {
518  $items[] = $item;
519  }
520  }
521  return $items;
522  }
523 
528  public function getItemById($itemId)
529  {
530  foreach ($this->getItemsCollection() as $item) {
531  if ($item->getId() == $itemId) {
532  return $item;
533  }
534  }
535  return false;
536  }
537 
542  public function addItem(\Magento\Sales\Model\Order\Invoice\Item $item)
543  {
544  $item->setInvoice($this)->setParentId($this->getId())->setStoreId($this->getStoreId());
545 
546  if (!$item->getId()) {
547  $this->getItemsCollection()->addItem($item);
548  }
549  return $this;
550  }
551 
557  public static function getStates()
558  {
559  if (null === static::$_states) {
560  static::$_states = [
561  self::STATE_OPEN => __('Pending'),
562  self::STATE_PAID => __('Paid'),
563  self::STATE_CANCELED => __('Canceled'),
564  ];
565  }
566  return static::$_states;
567  }
568 
575  public function getStateName($stateId = null)
576  {
577  if ($stateId === null) {
578  $stateId = $this->getState();
579  }
580 
581  if (null === static::$_states) {
582  static::getStates();
583  }
584  if (isset(static::$_states[$stateId])) {
585  return static::$_states[$stateId];
586  }
587  return __('Unknown State');
588  }
589 
599  public function register()
600  {
601  if ($this->getId()) {
602  throw new \Magento\Framework\Exception\LocalizedException(__('We cannot register an existing invoice'));
603  }
604 
605  foreach ($this->getAllItems() as $item) {
606  if ($item->getQty() > 0) {
607  $item->register();
608  } else {
609  $item->isDeleted(true);
610  }
611  }
612 
613  $order = $this->getOrder();
614  $captureCase = $this->getRequestedCaptureCase();
615  if ($this->canCapture()) {
616  if ($captureCase) {
617  if ($captureCase == self::CAPTURE_ONLINE) {
618  $this->capture();
619  } elseif ($captureCase == self::CAPTURE_OFFLINE) {
620  $this->setCanVoidFlag(false);
621  $this->pay();
622  }
623  }
624  } elseif (!$order->getPayment()->getMethodInstance()->isGateway() || $captureCase == self::CAPTURE_OFFLINE) {
625  if (!$order->getPayment()->getIsTransactionPending()) {
626  $this->setCanVoidFlag(false);
627  $this->pay();
628  }
629  }
630 
631  $order->setTotalInvoiced($order->getTotalInvoiced() + $this->getGrandTotal());
632  $order->setBaseTotalInvoiced($order->getBaseTotalInvoiced() + $this->getBaseGrandTotal());
633 
634  $order->setSubtotalInvoiced($order->getSubtotalInvoiced() + $this->getSubtotal());
635  $order->setBaseSubtotalInvoiced($order->getBaseSubtotalInvoiced() + $this->getBaseSubtotal());
636 
637  $order->setTaxInvoiced($order->getTaxInvoiced() + $this->getTaxAmount());
638  $order->setBaseTaxInvoiced($order->getBaseTaxInvoiced() + $this->getBaseTaxAmount());
639 
640  $order->setDiscountTaxCompensationInvoiced(
641  $order->getDiscountTaxCompensationInvoiced() + $this->getDiscountTaxCompensationAmount()
642  );
643  $order->setBaseDiscountTaxCompensationInvoiced(
644  $order->getBaseDiscountTaxCompensationInvoiced() + $this->getBaseDiscountTaxCompensationAmount()
645  );
646 
647  $order->setShippingTaxInvoiced($order->getShippingTaxInvoiced() + $this->getShippingTaxAmount());
648  $order->setBaseShippingTaxInvoiced($order->getBaseShippingTaxInvoiced() + $this->getBaseShippingTaxAmount());
649 
650  $order->setShippingInvoiced($order->getShippingInvoiced() + $this->getShippingAmount());
651  $order->setBaseShippingInvoiced($order->getBaseShippingInvoiced() + $this->getBaseShippingAmount());
652 
653  $order->setDiscountInvoiced($order->getDiscountInvoiced() + $this->getDiscountAmount());
654  $order->setBaseDiscountInvoiced($order->getBaseDiscountInvoiced() + $this->getBaseDiscountAmount());
655  $order->setBaseTotalInvoicedCost($order->getBaseTotalInvoicedCost() + $this->getBaseCost());
656 
657  $state = $this->getState();
658  if (null === $state) {
659  $this->setState(self::STATE_OPEN);
660  }
661 
662  $this->_eventManager->dispatch(
663  'sales_order_invoice_register',
664  [$this->_eventObject => $this, 'order' => $order]
665  );
666  return $this;
667  }
668 
674  public function isLast()
675  {
676  foreach ($this->getAllItems() as $item) {
677  if (!$item->isLast()) {
678  return false;
679  }
680  }
681  return true;
682  }
683 
693  public function addComment($comment, $notify = false, $visibleOnFront = false)
694  {
695  if (!$comment instanceof \Magento\Sales\Model\Order\Invoice\Comment) {
696  $comment = $this->_invoiceCommentFactory->create()->setComment(
697  $comment
698  )->setIsCustomerNotified(
699  $notify
700  )->setIsVisibleOnFront(
701  $visibleOnFront
702  );
703  }
704  $comment->setInvoice($this)->setStoreId($this->getStoreId())->setParentId($this->getId());
705  if (!$comment->getId()) {
706  $this->getCommentsCollection()->addItem($comment);
707  }
708  $this->_hasDataChanges = true;
709  return $this;
710  }
711 
716  public function getCommentsCollection($reload = false)
717  {
718  if (!$this->hasData(InvoiceInterface::COMMENTS) || $reload) {
719  $comments = $this->_commentCollectionFactory->create()->setInvoiceFilter($this->getId())
720  ->setCreatedAtOrder();
721 
722  $this->setComments($comments);
727  $this->getComments()->load();
728 
729  if ($this->getId()) {
730  foreach ($this->getComments() as $comment) {
731  $comment->setInvoice($this);
732  }
733  }
734  }
735  return $this->getComments();
736  }
737 
743  public function reset()
744  {
745  $this->unsetData();
746  $this->_origData = null;
747  $this->setItems(null);
748  $this->setComments(null);
749  $this->_order = null;
750  $this->_saveBeforeDestruct = false;
751  $this->_wasPayCalled = false;
752  return $this;
753  }
754 
760  protected function _beforeSave()
761  {
762  return parent::_beforeSave();
763  }
764 
770  protected function _afterSave()
771  {
772  return parent::_afterSave();
773  }
774 
780  public function getItems()
781  {
782  if ($this->getData(InvoiceInterface::ITEMS) === null && $this->getId()) {
783  $collection = $this->_invoiceItemCollectionFactory->create()->setInvoiceFilter($this->getId());
784  foreach ($collection as $item) {
785  $item->setInvoice($this);
786  }
787  $this->setData(InvoiceInterface::ITEMS, $collection->getItems());
788  }
789  return $this->getData(InvoiceInterface::ITEMS);
790  }
791 
797  public function getComments()
798  {
799  if ($this->getData(InvoiceInterface::COMMENTS) === null && $this->getId()) {
800  $collection = $this->_commentCollectionFactory->create()->setInvoiceFilter($this->getId());
801  foreach ($collection as $comment) {
802  $comment->setInvoice($this);
803  }
804  $this->setData(InvoiceInterface::COMMENTS, $collection->getItems());
805  }
806  return $this->getData(InvoiceInterface::COMMENTS);
807  }
808 
809  //@codeCoverageIgnoreStart
810 
816  public function getIncrementId()
817  {
818  return $this->getData('increment_id');
819  }
820 
826  public function getBaseTotalRefunded()
827  {
829  }
830 
836  public function getDiscountDescription()
837  {
839  }
840 
844  public function setItems($items)
845  {
846  return $this->setData(InvoiceInterface::ITEMS, $items);
847  }
848 
854  public function getBaseCurrencyCode()
855  {
857  }
858 
864  public function getBaseDiscountAmount()
865  {
867  }
868 
874  public function getBaseGrandTotal()
875  {
877  }
878 
885  {
887  }
888 
894  public function getBaseShippingAmount()
895  {
897  }
898 
905  {
907  }
908 
914  public function getBaseShippingInclTax()
915  {
917  }
918 
924  public function getBaseShippingTaxAmount()
925  {
927  }
928 
934  public function getBaseSubtotal()
935  {
937  }
938 
944  public function getBaseSubtotalInclTax()
945  {
947  }
948 
954  public function getBaseTaxAmount()
955  {
957  }
958 
964  public function getBaseToGlobalRate()
965  {
967  }
968 
974  public function getBaseToOrderRate()
975  {
977  }
978 
984  public function getBillingAddressId()
985  {
987  }
988 
994  public function getCanVoidFlag()
995  {
997  }
998 
1004  public function getCreatedAt()
1005  {
1006  return $this->getData(InvoiceInterface::CREATED_AT);
1007  }
1008 
1012  public function setCreatedAt($createdAt)
1013  {
1014  return $this->setData(InvoiceInterface::CREATED_AT, $createdAt);
1015  }
1016 
1022  public function getDiscountAmount()
1023  {
1025  }
1026 
1032  public function getEmailSent()
1033  {
1034  return $this->getData(InvoiceInterface::EMAIL_SENT);
1035  }
1036 
1042  public function getGlobalCurrencyCode()
1043  {
1045  }
1046 
1052  public function getGrandTotal()
1053  {
1054  return $this->getData(InvoiceInterface::GRAND_TOTAL);
1055  }
1056 
1063  {
1065  }
1066 
1072  public function getIsUsedForRefund()
1073  {
1075  }
1076 
1082  public function getOrderCurrencyCode()
1083  {
1085  }
1086 
1092  public function getOrderId()
1093  {
1094  return $this->getData(InvoiceInterface::ORDER_ID);
1095  }
1096 
1102  public function getShippingAddressId()
1103  {
1105  }
1106 
1112  public function getShippingAmount()
1113  {
1115  }
1116 
1123  {
1125  }
1126 
1132  public function getShippingInclTax()
1133  {
1135  }
1136 
1142  public function getShippingTaxAmount()
1143  {
1145  }
1146 
1152  public function getState()
1153  {
1154  return $this->getData(InvoiceInterface::STATE);
1155  }
1156 
1162  public function getStoreCurrencyCode()
1163  {
1165  }
1166 
1172  public function getStoreId()
1173  {
1174  return $this->getData(InvoiceInterface::STORE_ID);
1175  }
1176 
1182  public function getStoreToBaseRate()
1183  {
1185  }
1186 
1192  public function getStoreToOrderRate()
1193  {
1195  }
1196 
1202  public function getSubtotal()
1203  {
1204  return $this->getData(InvoiceInterface::SUBTOTAL);
1205  }
1206 
1212  public function getSubtotalInclTax()
1213  {
1215  }
1216 
1222  public function getTaxAmount()
1223  {
1224  return $this->getData(InvoiceInterface::TAX_AMOUNT);
1225  }
1226 
1232  public function getTotalQty()
1233  {
1234  return $this->getData(InvoiceInterface::TOTAL_QTY);
1235  }
1236 
1242  public function getTransactionId()
1243  {
1245  }
1246 
1253  public function setTransactionId($transactionId)
1254  {
1255  return $this->setData(InvoiceInterface::TRANSACTION_ID, $transactionId);
1256  }
1257 
1263  public function getUpdatedAt()
1264  {
1265  return $this->getData(InvoiceInterface::UPDATED_AT);
1266  }
1267 
1271  public function setComments($comments)
1272  {
1274  }
1275 
1279  public function setUpdatedAt($timestamp)
1280  {
1281  return $this->setData(InvoiceInterface::UPDATED_AT, $timestamp);
1282  }
1283 
1287  public function setStoreId($id)
1288  {
1289  return $this->setData(InvoiceInterface::STORE_ID, $id);
1290  }
1291 
1295  public function setBaseGrandTotal($amount)
1296  {
1298  }
1299 
1304  {
1306  }
1307 
1311  public function setTaxAmount($amount)
1312  {
1314  }
1315 
1319  public function setBaseTaxAmount($amount)
1320  {
1322  }
1323 
1327  public function setStoreToOrderRate($rate)
1328  {
1330  }
1331 
1336  {
1338  }
1339 
1344  {
1346  }
1347 
1351  public function setBaseToOrderRate($rate)
1352  {
1354  }
1355 
1359  public function setGrandTotal($amount)
1360  {
1362  }
1363 
1367  public function setShippingAmount($amount)
1368  {
1370  }
1371 
1375  public function setSubtotalInclTax($amount)
1376  {
1378  }
1379 
1384  {
1386  }
1387 
1391  public function setStoreToBaseRate($rate)
1392  {
1394  }
1395 
1400  {
1402  }
1403 
1407  public function setTotalQty($qty)
1408  {
1409  return $this->setData(InvoiceInterface::TOTAL_QTY, $qty);
1410  }
1411 
1415  public function setBaseToGlobalRate($rate)
1416  {
1418  }
1419 
1423  public function setSubtotal($amount)
1424  {
1425  return $this->setData(InvoiceInterface::SUBTOTAL, $amount);
1426  }
1427 
1431  public function setBaseSubtotal($amount)
1432  {
1434  }
1435 
1439  public function setDiscountAmount($amount)
1440  {
1442  }
1443 
1447  public function setBillingAddressId($id)
1448  {
1450  }
1451 
1455  public function setIsUsedForRefund($isUsedForRefund)
1456  {
1457  return $this->setData(InvoiceInterface::IS_USED_FOR_REFUND, $isUsedForRefund);
1458  }
1459 
1463  public function setOrderId($id)
1464  {
1465  return $this->setData(InvoiceInterface::ORDER_ID, $id);
1466  }
1467 
1471  public function setEmailSent($emailSent)
1472  {
1473  return $this->setData(InvoiceInterface::EMAIL_SENT, $emailSent);
1474  }
1475 
1479  public function setCanVoidFlag($canVoidFlag)
1480  {
1481  return $this->setData(InvoiceInterface::CAN_VOID_FLAG, $canVoidFlag);
1482  }
1483 
1487  public function setState($state)
1488  {
1489  return $this->setData(InvoiceInterface::STATE, $state);
1490  }
1491 
1495  public function setShippingAddressId($id)
1496  {
1498  }
1499 
1503  public function setStoreCurrencyCode($code)
1504  {
1506  }
1507 
1511  public function setOrderCurrencyCode($code)
1512  {
1514  }
1515 
1519  public function setBaseCurrencyCode($code)
1520  {
1522  }
1523 
1527  public function setGlobalCurrencyCode($code)
1528  {
1530  }
1531 
1535  public function setIncrementId($id)
1536  {
1537  return $this->setData(InvoiceInterface::INCREMENT_ID, $id);
1538  }
1539 
1544  {
1546  }
1547 
1552  {
1554  }
1555 
1560  {
1562  }
1563 
1568  {
1570  }
1571 
1575  public function setShippingInclTax($amount)
1576  {
1578  }
1579 
1584  {
1586  }
1587 
1592  {
1594  }
1595 
1600  {
1602  }
1603 
1609  public function getExtensionAttributes()
1610  {
1611  return $this->_getExtensionAttributes();
1612  }
1613 
1620  public function setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceExtensionInterface $extensionAttributes)
1621  {
1622  return $this->_setExtensionAttributes($extensionAttributes);
1623  }
1624 
1625  //@codeCoverageIgnoreEnd
1626 }
__construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, AttributeValueFactory $customAttributeFactory, \Magento\Sales\Model\Order\Invoice\Config $invoiceConfig, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\Math\CalculatorFactory $calculatorFactory, \Magento\Sales\Model\ResourceModel\Order\Invoice\Item\CollectionFactory $invoiceItemCollectionFactory, \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory, \Magento\Sales\Model\ResourceModel\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource=null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection=null, array $data=[])
Definition: Invoice.php:139
setExtensionAttributes(\Magento\Sales\Api\Data\InvoiceExtensionInterface $extensionAttributes)
Definition: Invoice.php:1620
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
setDiscountDescription($description)
Definition: Invoice.php:1599
$id
Definition: fieldset.phtml:14
_setExtensionAttributes(\Magento\Framework\Api\ExtensionAttributesInterface $extensionAttributes)
addComment($comment, $notify=false, $visibleOnFront=false)
Definition: Invoice.php:693
$order
Definition: order.php:55
addItem(\Magento\Sales\Model\Order\Invoice\Item $item)
Definition: Invoice.php:542
__()
Definition: __.php:13
$resource
Definition: bulk.php:12
$price
$amount
Definition: order.php:14
$type
Definition: item.phtml:13
setShippingDiscountTaxCompensationAmount($amount)
Definition: Invoice.php:1559
roundPrice($price, $type='regular', $negative=false)
Definition: Invoice.php:480
getCommentsCollection($reload=false)
Definition: Invoice.php:716
setOrder(\Magento\Sales\Model\Order $order)
Definition: Invoice.php:224
setTransactionId($transactionId)
Definition: Invoice.php:1253
setIsUsedForRefund($isUsedForRefund)
Definition: Invoice.php:1455
$code
Definition: info.phtml:12
$items