Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

129 lines
7.4KB

  1. <?php
  2. ?>
  3. <div class="document-download">
  4. <div id="block-addresses">
  5. <div class="producer">
  6. <?php if(strlen($producer->logo)) : ?>
  7. <div class="logo"><?= $producer->getHtmlLogo() ; ?></div>
  8. <?php endif; ?>
  9. <div class="address"><?= $producer->getFullAddress(true) ; ?></div>
  10. </div>
  11. <div class="user">
  12. <?= $document->user->getFullAddress(true) ; ?>
  13. </div>
  14. </div>
  15. <div id="block-infos-document">
  16. <div class="date">
  17. Le <?= strftime('%d %B %Y', strtotime($document->date)) ?>
  18. </div>
  19. <div class="reference">
  20. <?php if(strlen($document->reference)) : ?>
  21. <?= $document->getType(); ?> N°<?= $document->reference ; ?>
  22. <?php else: ?>
  23. <div class="block-is-draft"><?= $document->getType(); ?> non validé<?= ($document->getType() == 'Facture') ? 'e' : '' ?></div>
  24. <?php endif; ?>
  25. </div>
  26. <div class="name">
  27. <strong>Libellé : </strong><?= $document->name ; ?>
  28. </div>
  29. </div>
  30. <div id="block-products">
  31. <?php if(count($document->orders) > 0) : ?>
  32. <table class="table table-bordered">
  33. <thead>
  34. <tr>
  35. <th class="align-left">Produit</th>
  36. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  37. <?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?>
  38. <th>Prix unitaire</th>
  39. <?php else: ?>
  40. <th>Prix unitaire HT</th>
  41. <?php endif; ?>
  42. <?php endif; ?>
  43. <th>Quantité</th>
  44. <th>Unité</th>
  45. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  46. <?php if(GlobalParam::getCurrentProducer()->taxRate->value == 0): ?>
  47. <th>Prix</th>
  48. <?php else: ?>
  49. <th>TVA</th>
  50. <th>Prix HT</th>
  51. <?php endif; ?>
  52. <?php endif; ?>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. <?php foreach($document->getProductsOrders() as $product): ?>
  57. <?php foreach($product as $productOrder): ?>
  58. <tr>
  59. <td class="align-left"><?= Html::encode($productOrder->product->name) ?></td>
  60. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  61. <td class="align-center"><?= Price::format($productOrder->getPrice()) ?></td>
  62. <?php endif; ?>
  63. <td class="align-center"><?= $productOrder->quantity ?></td>
  64. <td class="align-center"><?= Product::strUnit($productOrder->unit, 'wording') ?></td>
  65. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  66. <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
  67. <td class="align-center"><?= $productOrder->taxRate->value * 100 ?> %</td>
  68. <?php endif; ?>
  69. <td class="align-center"><?= Price::format($productOrder->getPrice() * $productOrder->quantity) ?></td>
  70. <?php endif; ?>
  71. </tr>
  72. <?php endforeach; ?>
  73. <?php endforeach; ?>
  74. <?php if(Yii::$app->controller->getClass() != 'DeliveryNote'): ?>
  75. <?php if(GlobalParam::getCurrentProducer()->taxRate->value != 0): ?>
  76. <tr>
  77. <td class="align-right" colspan="5"><strong>Total HT</strong></td>
  78. <td class="align-center"><?= Price::format($document->getAmount()) ?></td>
  79. </tr>
  80. <tr>
  81. <td class="align-right" colspan="5"><strong>TVA</strong></td>
  82. <td class="align-center"><?= Price::format($document->getAmountWithTax() - $document->getAmount()) ?></td>
  83. </tr>
  84. <tr>
  85. <td class="align-right" colspan="5"><strong>Total TTC</strong></td>
  86. <td class="align-center"><?= Price::format($document->getAmountWithTax()) ?></td>
  87. </tr>
  88. <?php else: ?>
  89. <tr>
  90. <td class="align-right" colspan="4">
  91. <strong>Total</strong><br />
  92. TVA non applicable
  93. </td>
  94. <td class="align-center"><?= Price::format($document->getAmount()) ?></td>
  95. </tr>
  96. <?php endif; ?>
  97. <?php endif; ?>
  98. </tbody>
  99. </table>
  100. <?php else : ?>
  101. <div id="block-no-product">
  102. <strong>Aucun produit</strong>
  103. </div>
  104. <?php endif; ?>
  105. </div>
  106. <?php if(strlen($document->comment)): ?>
  107. <div class="block-infos">
  108. <strong>Commentaire</strong><br />
  109. <?= Html::encode($document->comment) ?>
  110. </div>
  111. <?php endif; ?>
  112. <?php
  113. $fieldProducerDocumentInfo = 'document_infos_'.str_replace('deliverynote','delivery_note',strtolower($document->getClass())) ; ?>
  114. <?php if(strlen($producer->$fieldProducerDocumentInfo)): ?>
  115. <div class="block-infos">
  116. <strong>Informations</strong><br />
  117. <?= nl2br(Html::encode($producer->$fieldProducerDocumentInfo)) ?>
  118. </div>
  119. <?php endif; ?>
  120. </div>