選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

163 行
9.4KB

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