Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

213 Zeilen
9.5KB

  1. <?php
  2. use common\helpers\Price;
  3. use domain\Order\Order\Order;
  4. use yii\helpers\Html;
  5. $producerModule = $this->getProducerModule();
  6. $userModule = $this->getUserModule();
  7. $documentModule = $this->getDocumentModule();
  8. $orderModule = $this->getOrderModule();
  9. $isDocumentDeliveryNote = $documentModule->getSolver()->isDocumentDeliveryNote($document);
  10. $displayPrices = !$isDocumentDeliveryNote || ($isDocumentDeliveryNote && $producerModule->getConfig('document_display_prices_delivery_note'));
  11. $displayProductDescription = $producerModule->getConfig('document_display_product_description');
  12. $documentPriceDecimals = (int) $producerModule->getConfig('option_document_price_decimals');
  13. ?>
  14. <div class="document-download">
  15. <div id="block-addresses">
  16. <div class="producer">
  17. <?php if (strlen($producer->logo)) : ?>
  18. <?php $optionDocumentWidthLogo = $producerModule->getSolver()->getConfig('option_document_width_logo'); ?>
  19. <div class="logo" style="width: <?= $optionDocumentWidthLogo ?: 100; ?>px;">
  20. <img src="<?= $producerModule->getUrlLogo($producer) ?>"/>
  21. </div>
  22. <?php endif; ?>
  23. <div class="address">
  24. <?= $producerModule->getFullAddressAsHtml($producer); ?>
  25. </div>
  26. <?php if (strlen($producer->document_infos_top)): ?>
  27. <div class="infos-top">
  28. <?= nl2br(Html::encode($producer->document_infos_top)) ?>
  29. </div>
  30. <?php endif; ?>
  31. </div>
  32. <div class="user">
  33. <?php if ($document->address && strlen($document->address) > 0): ?>
  34. <?= nl2br($document->address) ?>
  35. <?php else: ?>
  36. <?= $userModule->getFullAddress($document->user, true); ?>
  37. <?php endif; ?>
  38. </div>
  39. </div>
  40. <?php if($documentModule->getSolver()->isStatusDraft($document)): ?>
  41. <div class="block-is-draft">
  42. <?= $documentModule->getType($document); ?> non
  43. validé<?= ($documentModule->getType($document) == 'Facture') ? 'e' : '' ?></div>
  44. <?php endif; ?>
  45. <div id="block-infos-document">
  46. <div class="type">
  47. <strong><?= $documentModule->getType($document); ?></strong>
  48. </div>
  49. <div class="date">
  50. <strong>Date : </strong>
  51. <?= strftime('%d %B %Y', strtotime($document->date)) ?>
  52. </div>
  53. <?php if (strlen($document->reference)) : ?>
  54. <div class="reference">
  55. <strong>Référence : </strong>
  56. <?= $document->reference; ?>
  57. </div>
  58. <?php endif; ?>
  59. <div class="name">
  60. <strong>Libellé : </strong>
  61. <?= $document->name; ?>
  62. </div>
  63. <?php if (strlen($document->comment)): ?>
  64. <div class="comment">
  65. <br>
  66. <strong>Commentaire</strong><br>
  67. <?= Html::encode($document->comment) ?>
  68. </div>
  69. <?php endif; ?>
  70. </div>
  71. <div id="block-products">
  72. <?php if (count($document->orders) > 0) : ?>
  73. <table class="table table-bordered">
  74. <thead>
  75. <tr>
  76. <th class="align-left">Produit</th>
  77. <?php if ($displayPrices): ?>
  78. <?php if ($producer->taxRate->value == 0): ?>
  79. <th>Prix unitaire</th>
  80. <?php else: ?>
  81. <th>Prix unitaire HT</th>
  82. <?php endif; ?>
  83. <?php endif; ?>
  84. <th>Quantité</th>
  85. <?php if ($displayPrices): ?>
  86. <?php if ($producer->taxRate->value == 0): ?>
  87. <th>Prix</th>
  88. <?php else: ?>
  89. <th>TVA</th>
  90. <th>Prix HT</th>
  91. <?php endif; ?>
  92. <?php endif; ?>
  93. </tr>
  94. </thead>
  95. <tbody>
  96. <?php if ($producerModule->isDocumentDisplayOrders($document)): ?>
  97. <?php foreach ($document->orders as $order): ?>
  98. <tr>
  99. <td>
  100. <strong><?= $orderModule->getOrderUsername($order); ?></strong>
  101. <?php if ($order->distribution): ?>
  102. le <?= date('d/m/Y', strtotime($order->distribution->date)) ?>
  103. <?php endif; ?>
  104. </td>
  105. <?php if ($displayPrices): ?>
  106. <td class="align-center"></td>
  107. <?php endif; ?>
  108. <td></td>
  109. <?php if ($displayPrices): ?>
  110. <?php if ($producer->taxRate->value != 0): ?>
  111. <td class="align-center"></td>
  112. <?php endif; ?>
  113. <td class="align-center"></td>
  114. <?php endif; ?>
  115. </tr>
  116. <?php foreach ($order->productOrder as $productOrder): ?>
  117. <?= $this->render('_download_product_line', [
  118. 'producer' => $producer,
  119. 'document' => $document,
  120. 'productOrder' => $productOrder,
  121. 'displayOrders' => true,
  122. 'displayPrices' => $displayPrices,
  123. 'displayProductDescription' => $displayProductDescription,
  124. 'documentPriceDecimals' => $documentPriceDecimals
  125. ]) ?>
  126. <?php endforeach; ?>
  127. <?php endforeach; ?>
  128. <?php else: ?>
  129. <?php foreach ($documentModule->getProductsOrders($document, true) as $product): ?>
  130. <?php foreach ($product as $productOrder): ?>
  131. <?= $this->render('_download_product_line', [
  132. 'producer' => $producer,
  133. 'document' => $document,
  134. 'productOrder' => $productOrder,
  135. 'displayPrices' => $displayPrices,
  136. 'displayProductDescription' => $displayProductDescription,
  137. 'documentPriceDecimals' => $documentPriceDecimals
  138. ]) ?>
  139. <?php endforeach; ?>
  140. <?php endforeach; ?>
  141. <?php endif; ?>
  142. <?php if ($displayPrices): ?>
  143. <?php $typeAmount = $documentModule->isInvoicePrice($document) ? Order::INVOICE_AMOUNT_TOTAL : Order::AMOUNT_TOTAL; ?>
  144. <?php if ($producer->taxRate->value != 0): ?>
  145. <tr>
  146. <td class="align-right" colspan="4"><strong>Total HT</strong></td>
  147. <td class="align-center">
  148. <?= Price::format($documentModule->getAmount($document, $typeAmount)); ?>
  149. </td>
  150. </tr>
  151. <?php
  152. $taxRateArray = $this-> getTaxRateModule()->findTaxRatesAsArray();
  153. foreach ($documentModule->getTotalVatArray($document, $typeAmount) as $idTaxRate => $totalVat): ?>
  154. <tr>
  155. <td class="align-right" colspan="4">
  156. <strong>TVA <?= $taxRateArray[$idTaxRate]->value * 100 ?> %</strong></td>
  157. <td class="align-center">
  158. <?= Price::format($totalVat); ?>
  159. </td>
  160. </tr>
  161. <?php endforeach; ?>
  162. <tr>
  163. <td class="align-right" colspan="4">
  164. <strong>Total TTC</strong>
  165. </td>
  166. <td class="align-center">
  167. <?= Price::format($documentModule->getAmountWithTax($document, $typeAmount)) ?>
  168. </td>
  169. </tr>
  170. <?php else: ?>
  171. <tr>
  172. <td class="align-right" colspan="3">
  173. <strong>Total</strong><br/>
  174. TVA non applicable
  175. </td>
  176. <td class="align-center">
  177. <?= Price::format($documentModule->getAmount($document, $typeAmount)) ?>
  178. </td>
  179. </tr>
  180. <?php endif; ?>
  181. <?php endif; ?>
  182. </tbody>
  183. </table>
  184. <?php else : ?>
  185. <div id="block-no-product">
  186. <strong>Aucun produit</strong>
  187. </div>
  188. <?php endif; ?>
  189. </div>
  190. <?php
  191. $fieldProducerDocumentInfo = 'document_infos_' . str_replace('deliverynote', 'delivery_note', strtolower($documentModule->getClass($document))); ?>
  192. <?php if (strlen($producer->$fieldProducerDocumentInfo)): ?>
  193. <div class="block-infos">
  194. <strong>Informations générales</strong><br/>
  195. <?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?>
  196. </div>
  197. <?php endif; ?>
  198. </div>