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.

131 lines
7.5KB

  1. <?php
  2. ?>
  3. <div class="document-download">
  4. <div id="block-addresses">
  5. <div class="producer">
  6. <?php if(strlen($producer->logo)) : ?>
  7. <div class="logo">
  8. <img style="max-height: 80px;" src="<?= $producer->getUrlLogo() ?>" />
  9. </div>
  10. <?php endif; ?>
  11. <div class="address"><?= $producer->getFullAddress(true) ; ?></div>
  12. </div>
  13. <div class="user">
  14. <?= $document->user->getFullAddress(true) ; ?>
  15. </div>
  16. </div>
  17. <div id="block-infos-document">
  18. <div class="date">
  19. Le <?= strftime('%d %B %Y', strtotime($document->date)) ?>
  20. </div>
  21. <div class="reference">
  22. <?php if(strlen($document->reference)) : ?>
  23. <?= $document->getType(); ?> N°<?= $document->reference ; ?>
  24. <?php else: ?>
  25. <div class="block-is-draft"><?= $document->getType(); ?> non validé<?= ($document->getType() == 'Facture') ? 'e' : '' ?></div>
  26. <?php endif; ?>
  27. </div>
  28. <div class="name">
  29. <strong>Libellé : </strong><?= $document->name ; ?>
  30. </div>
  31. </div>
  32. <div id="block-products">
  33. <?php if(count($document->orders) > 0) : ?>
  34. <table class="table table-bordered">
  35. <thead>
  36. <tr>
  37. <th class="align-left">Produit</th>
  38. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  39. <?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?>
  40. <th>Prix unitaire</th>
  41. <?php else: ?>
  42. <th>Prix unitaire HT</th>
  43. <?php endif; ?>
  44. <?php endif; ?>
  45. <th>Quantité</th>
  46. <th>Unité</th>
  47. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  48. <?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?>
  49. <th>Prix</th>
  50. <?php else: ?>
  51. <th>TVA</th>
  52. <th>Prix HT</th>
  53. <?php endif; ?>
  54. <?php endif; ?>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. <?php foreach($document->getProductsOrders() as $product): ?>
  59. <?php foreach($product as $productOrder): ?>
  60. <tr>
  61. <td class="align-left"><?= Html::encode($productOrder->product->name) ?></td>
  62. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  63. <td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td>
  64. <?php endif; ?>
  65. <td class="align-center"><?= $productOrder->quantity ?></td>
  66. <td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td>
  67. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  68. <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
  69. <td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td>
  70. <?php endif; ?>
  71. <td class="align-center"><?= Price::format($productOrder->getPrice() * $productOrder->quantity) ?></td>
  72. <?php endif; ?>
  73. </tr>
  74. <?php endforeach; ?>
  75. <?php endforeach; ?>
  76. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  77. <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
  78. <tr>
  79. <td class="align-right" colspan="5"><strong>Total HT</strong></td>
  80. <td class="align-center"><?= Price::format($document->getAmount()) ?></td>
  81. </tr>
  82. <tr>
  83. <td class="align-right" colspan="5"><strong>TVA</strong></td>
  84. <td class="align-center"><?= Price::format($document->getAmountWithTax() - $document->getAmount()) ?></td>
  85. </tr>
  86. <tr>
  87. <td class="align-right" colspan="5"><strong>Total TTC</strong></td>
  88. <td class="align-center"><?= Price::format($document->getAmountWithTax()) ?></td>
  89. </tr>
  90. <?php else: ?>
  91. <tr>
  92. <td class="align-right" colspan="4">
  93. <strong>Total</strong><br />
  94. TVA non applicable
  95. </td>
  96. <td class="align-center"><?= Price::format($document->getAmount()) ?></td>
  97. </tr>
  98. <?php endif; ?>
  99. <?php endif; ?>
  100. </tbody>
  101. </table>
  102. <?php else : ?>
  103. <div id="block-no-product">
  104. <strong>Aucun produit</strong>
  105. </div>
  106. <?php endif; ?>
  107. </div>
  108. <?php if(strlen($document->comment)): ?>
  109. <div class="block-infos">
  110. <strong>Commentaire</strong><br />
  111. <?= Html::encode($document->comment) ?>
  112. </div>
  113. <?php endif; ?>
  114. <?php
  115. $fieldProducerDocumentInfo = 'document_infos_'.str_replace('deliverynote','delivery_note',strtolower($document->getClass())) ; ?>
  116. <?php if(strlen($producer->$fieldProducerDocumentInfo)): ?>
  117. <div class="block-infos">
  118. <strong>Informations</strong><br />
  119. <?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?>
  120. </div>
  121. <?php endif; ?>
  122. </div>