Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

152 lines
8.8KB

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