Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

159 rindas
9.2KB

  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. 'document' => $document,
  81. 'productOrder' => $productOrder,
  82. 'displayOrders' => true,
  83. 'displayPrices' => $displayPrices
  84. ]) ?>
  85. <?php endforeach; ?>
  86. <?php endforeach; ?>
  87. <?php else: ?>
  88. <?php foreach($document->getProductsOrders() as $product): ?>
  89. <?php foreach($product as $productOrder): ?>
  90. <?= $this->render('_download_product_line', [
  91. 'document' => $document,
  92. 'productOrder' => $productOrder,
  93. 'displayPrices' => $displayPrices
  94. ]) ?>
  95. <?php endforeach; ?>
  96. <?php endforeach; ?>
  97. <?php endif; ?>
  98. <?php if($displayPrices): ?>
  99. <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
  100. <?php $typeAmount = $document->isInvoicePrice() ? Order::INVOICE_AMOUNT_TOTAL : Order::AMOUNT_TOTAL ; ?>
  101. <tr>
  102. <td class="align-right" colspan="5"><strong>Total HT</strong></td>
  103. <td class="align-center">
  104. <?= Price::format($document->getAmount($typeAmount)); ?>
  105. </td>
  106. </tr>
  107. <tr>
  108. <td class="align-right" colspan="5"><strong>TVA</strong></td>
  109. <td class="align-center"><?= Price::format($document->getAmountWithTax($typeAmount) - $document->getAmount($typeAmount)) ?></td>
  110. </tr>
  111. <tr>
  112. <td class="align-right" colspan="5"><strong>Total TTC</strong></td>
  113. <td class="align-center"><?= Price::format($document->getAmountWithTax($typeAmount)) ?></td>
  114. </tr>
  115. <?php else: ?>
  116. <tr>
  117. <td class="align-right" colspan="4">
  118. <strong>Total</strong><br />
  119. TVA non applicable
  120. </td>
  121. <td class="align-center"><?= Price::format($document->getAmount($typeAmount)) ?></td>
  122. </tr>
  123. <?php endif; ?>
  124. <?php endif; ?>
  125. </tbody>
  126. </table>
  127. <?php else : ?>
  128. <div id="block-no-product">
  129. <strong>Aucun produit</strong>
  130. </div>
  131. <?php endif; ?>
  132. </div>
  133. <?php if(strlen($document->comment)): ?>
  134. <div class="block-infos">
  135. <strong>Commentaire</strong><br />
  136. <?= Html::encode($document->comment) ?>
  137. </div>
  138. <?php endif; ?>
  139. <?php
  140. $fieldProducerDocumentInfo = 'document_infos_'.str_replace('deliverynote','delivery_note',strtolower($document->getClass())) ; ?>
  141. <?php if(strlen($producer->$fieldProducerDocumentInfo)): ?>
  142. <div class="block-infos">
  143. <strong>Informations</strong><br />
  144. <?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?>
  145. </div>
  146. <?php endif; ?>
  147. </div>