Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

189 linhas
8.7KB

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