Items.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Sales\Block\Adminhtml\Order\Invoice\View;
  7. /**
  8. * Adminhtml sales item renderer
  9. *
  10. * @api
  11. * @since 100.0.2
  12. */
  13. class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems
  14. {
  15. /**
  16. * Retrieve invoice order
  17. *
  18. * @return \Magento\Sales\Model\Order
  19. */
  20. public function getOrder()
  21. {
  22. return $this->getInvoice()->getOrder();
  23. }
  24. /**
  25. * Retrieve source
  26. *
  27. * @return \Magento\Sales\Model\Order\Invoice
  28. */
  29. public function getSource()
  30. {
  31. return $this->getInvoice();
  32. }
  33. /**
  34. * Retrieve invoice model instance
  35. *
  36. * @return \Magento\Sales\Model\Order\Invoice
  37. */
  38. public function getInvoice()
  39. {
  40. return $this->_coreRegistry->registry('current_invoice');
  41. }
  42. /**
  43. * Retrieve order url
  44. *
  45. * @return string
  46. */
  47. public function getOrderUrl()
  48. {
  49. return $this->getUrl('sales/order/view', ['order_id' => $this->getInvoice()->getOrderId()]);
  50. }
  51. /**
  52. * Retrieve formatted price
  53. *
  54. * @param float $price
  55. * @return string
  56. */
  57. public function formatPrice($price)
  58. {
  59. return $this->getInvoice()->getOrder()->formatPrice($price);
  60. }
  61. }