您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

206 行
9.7KB

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