You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
3.1KB

  1. <?php
  2. use common\helpers\Price;
  3. use domain\Config\Unit\UnitModule;
  4. use domain\Order\ProductOrder\ProductOrderModule;
  5. use domain\Producer\Producer\ProducerModule;
  6. use domain\Product\Product\Product;
  7. use yii\helpers\Html;
  8. $documentModule = $this->getDocumentModule();
  9. $productModule = $this->getProductModule();
  10. $productOrderModule = ProductOrderModule::getInstance();
  11. $producerModule = ProducerModule::getInstance();
  12. $unitModule = UnitModule::getInstance();
  13. ?>
  14. <tr class="<?php if(isset($displayOrders) && $displayOrders): ?>order<?php endif; ?>">
  15. <td class="align-left column-product">
  16. <?php if($productOrder->product): ?>
  17. <?= Html::encode($productOrder->product->name) ?>
  18. <?php endif; ?>
  19. <?php if($productOrder->unit == 'piece' && isset($productOrder->product->weight) && $productOrder->product->weight): ?>
  20. <span class="weight"> / <?= $productOrder->product->weight ?> g</span>
  21. <?php endif; ?>
  22. <?php if($productOrder->product && strlen($productOrder->product->description) && $displayProductDescription): ?>
  23. <br /><small><?= Html::encode($productOrder->product->description) ?></small>
  24. <?php endif; ?>
  25. </td>
  26. <?php
  27. $price = $productOrder->getPrice() ;
  28. if($documentModule->isInvoicePrice($document) && $productOrder->getInvoicePrice()) {
  29. $price = $productOrder->getInvoicePrice() ;
  30. }
  31. ?>
  32. <?php if($displayPrices): ?>
  33. <td class="align-center column-unit-price">
  34. <?php $displayPriceUnitReference = $producerModule->getSolver()->getConfig('option_document_display_price_unit_reference'); ?>
  35. <?php $priceUnitReference = $productOrderModule->getSolver()->getPriceUnitReference($productOrder, true); ?>
  36. <?php $priceUnitReferenceString = Price::format($priceUnitReference, $documentPriceDecimals).' / kg' ?>
  37. <?php if($productOrder->unit == 'piece'): ?>
  38. <?= Price::format($price, $documentPriceDecimals) ?>
  39. <?php if($displayPriceUnitReference && $priceUnitReference): ?>
  40. (<?= $priceUnitReferenceString ?>)
  41. <?php endif; ?>
  42. <?php else: ?>
  43. <?= $priceUnitReferenceString ?>
  44. <?php endif; ?>
  45. </td>
  46. <?php endif; ?>
  47. <td class="align-center column-quantity">
  48. <?= $productOrder->quantity * Product::$unitsArray[$productOrder->unit]['coefficient'] ?>
  49. <?= $unitModule->getSolver()->strUnit($productOrder->unit, 'wording') ?>
  50. </td>
  51. <?php if($displayPrices): ?>
  52. <?php if($producer->taxRate->value != 0): ?>
  53. <td class="align-center column-tax-rate"><?= $productOrder->taxRate->value * 100 ?> %</td>
  54. <?php endif; ?>
  55. <td class="align-center column-price">
  56. <?= Price::format($price * $productOrder->quantity) ?>
  57. </td>
  58. <?php endif; ?>
  59. </tr>