You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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