indexSuccess.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <div class="content-add01">
  2. <div class="heading01"><h1>Liste des factures fournisseurs (<?php echo $pager->getNbResults() ?>)</h1></div>
  3. </div>
  4. <div class="filter">
  5. <div class="filter-left">&nbsp;</div>
  6. <div class="filter-middle">
  7. <?php echo form_tag('@katao_supplier_invoice_filter') ?>
  8. <?php echo select_tag('filter_status', options_for_select(KataoSupplierInvoicePeer::getAllStatuses(), $filter_status, array('include_custom' => '&mdash;&nbsp;Etat&nbsp;&mdash;'))) ?>
  9. <?php echo image_tag('separator02.gif', array('alt' => '')) ?>&nbsp;<?php echo select_tag('filter_supplier', options_for_select(KataoSupplierPeer::getAllSimple(), $filter_supplier, array('include_custom' => '&mdash;&nbsp;Fournisseur&nbsp;&mdash;'))) ?>
  10. <?php echo image_tag('separator02.gif', array('alt' => '')) ?>&nbsp;<?php echo select_tag('filter_period', options_for_select(KataoPeriodPeer::getAll(), $filter_period, array('include_custom' => '&mdash;&nbsp;Période&nbsp;&mdash;'))) ?>
  11. <?php echo submit_tag('', array('class' => 'btn-search', 'title' => 'Filtrer')) ?><div style="float:right"><a href="<?php echo url_for('@katao_supplier_invoice_filter_reset') ?>">[annuler]</a></div>
  12. </form>
  13. </div>
  14. <div class="filter-right">&nbsp;</div>
  15. </div>
  16. <?php if (empty($katao_supplier_invoiceList)): ?>
  17. <p>Aucune facture.</p>
  18. <p><?php echo link_to('Ajouter une facture', '@katao_supplier_invoice_add', array('class' => 'add')) ?></p>
  19. <?php else : ?>
  20. <?php echo link_to('Ajouter une facture', '@katao_supplier_invoice_add', array('class' => 'add')) ?>
  21. <?php echo link_to('Supprimer les factures sélectionnées (' . multiple_action_info_selected('katao_supplier_invoice') . ')', '@katao_supplier_invoice_delete_multiple', array('class' => 'delete', 'confirm' => 'Êtes-vous sûr de vouloir supprimer les factures sélectionnées ?')) ?>
  22. <span class="pdf">Exporter les factures : </span><?php echo link_to('toutes', '@katao_supplier_invoice_export_pdf_all') ?> | <?php echo link_to('sélectionnées (' . multiple_action_info_selected('katao_supplier_invoice') . ')', '@katao_supplier_invoice_export_pdf_selected') ?>
  23. <table class="admin-list">
  24. <tr>
  25. <th nowrap="nowrap" width="1%"><?php echo multiple_action_checkbox_all('katao_supplier_invoice') ?></th>
  26. <th nowrap="nowrap">Réf. <?php echo sort_links($sf_request, 'reference', 'kataoSupplierInvoice/index') ?></th>
  27. <th nowrap="nowrap">Date <?php echo sort_links($sf_request, 'date', 'kataoSupplierInvoice/index') ?></th>
  28. <th nowrap="nowrap">Etat <?php echo sort_links($sf_request, 'status', 'kataoSupplierInvoice/index') ?></th>
  29. <th nowrap="nowrap">Fournisseur <?php echo sort_links($sf_request, 'supplier', 'kataoSupplierInvoice/index') ?></th>
  30. <th nowrap="nowrap">Montant <?php echo sort_links($sf_request, 'total', 'kataoSupplierInvoice/index') ?></th>
  31. <th nowrap="nowrap">Période <?php echo sort_links($sf_request, 'period', 'kataoSupplierInvoice/index') ?></th>
  32. <th nowrap="nowrap" width="1%">Actions</th>
  33. </tr>
  34. <?php foreach ($katao_supplier_invoiceList as/*(KataoSupplierInvoice)*/ $katao_supplier_invoice): ?>
  35. <tr valign="top" class="line">
  36. <td class="center"><?php echo multiple_action_checkbox_line('katao_supplier_invoice', $katao_supplier_invoice->getId()) ?></td>
  37. <td nowrap="nowrap">
  38. <a href="javascript://" onclick="toggleDetails('<?php echo $katao_supplier_invoice->getId() ?>');" title="Détails"><?php echo image_tag('actions/expand.png', array('alt' => 'Détails', 'id' => 'supplier-invoice-icon-' . $katao_supplier_invoice->getId(), 'align' => 'bottom')) ?></a>
  39. <?php echo $katao_supplier_invoice->getReference() ?>
  40. </td>
  41. <td nowrap="nowrap"><?php echo $katao_supplier_invoice->getInvoiceDateStr() ?></td>
  42. <td nowrap="nowrap"><?php echo $katao_supplier_invoice->getStatusStr() ?></td>
  43. <td><?php echo $katao_supplier_invoice->getSupplierName() ?></td>
  44. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($katao_supplier_invoice->getTotalHt() + $katao_supplier_invoice->getTotalTva()) ?></td>
  45. <td nowrap="nowrap"><?php echo $katao_supplier_invoice->getKataoPeriod()->getName() ?></td>
  46. <td nowrap="nowrap">
  47. <?php echo catalyz_link_to_image_tag('@katao_supplier_invoice_export_pdf?id=' . $katao_supplier_invoice->getId(), 'actions/pdf.png', array('title' => 'Exporter en PDF'), array('alt' => 'Exporter en PDF')) ?>
  48. <?php if (KataoSupplierInvoice::STATUS_RECEIVED == $katao_supplier_invoice->getStatus()): ?>
  49. <?php echo catalyz_link_to_image_tag('@katao_supplier_invoice_edit?id=' . $katao_supplier_invoice->getId(), 'actions/edit.png', array('title' => 'Modifier'), array('alt' => 'Modifier')) ?>
  50. <?php echo catalyz_link_to_image_tag('@katao_supplier_invoice_pay?id=' . $katao_supplier_invoice->getId(), 'actions/pay.png', array('title' => 'Payer'), array('alt' => 'Payer')) ?>
  51. <?php endif ?>
  52. <?php echo catalyz_link_to_image_tag('@katao_supplier_invoice_delete?id=' . $katao_supplier_invoice->getId(), 'actions/delete.png', array('title' => 'Supprimer', 'confirm' => 'Êtes-vous sûr de vouloir supprimer cette facture ?'), array('alt' => 'Supprimer')) ?>
  53. </td>
  54. </tr>
  55. <tr valign="top" style="display: none" id="supplier-invoice-details-<?php echo $katao_supplier_invoice->getId() ?>">
  56. <td colspan="9">
  57. <table class="admin-sub-list">
  58. <tr>
  59. <th>Produit</th>
  60. <th nowrap="nowrap" width="1%">Qté</th>
  61. <th nowrap="nowrap" width="1%">P.U. HT</th>
  62. <th nowrap="nowrap" width="1%">Montant HT</th>
  63. <th nowrap="nowrap" width="1%">TVA</th>
  64. </tr>
  65. <?php foreach ($katao_supplier_invoice->getKataoSupplierInvoiceProducts() as/*(KataoSupplierInvoiceProduct)*/ $katao_supplier_invoice_product): ?>
  66. <?php $quantity = $katao_supplier_invoice_product->getQuantity() ?>
  67. <?php $price = $katao_supplier_invoice_product->getProductPriceEuro() ?>
  68. <?php $sub_total = $katao_supplier_invoice_product->getProductPriceTotal() ?>
  69. <tr valign="top">
  70. <td><?php echo $katao_supplier_invoice_product->getProductName() ?></td>
  71. <td nowrap="nowrap" style="text-align:right!important"><?php echo $quantity ?></td>
  72. <td nowrap="nowrap" style="text-align:right!important"><?php echo utils::formatCurrencyEuro($price) ?></td>
  73. <td nowrap="nowrap" style="text-align:right!important"><?php echo utils::formatCurrencyEuro($sub_total) ?></td>
  74. <td nowrap="nowrap" style="text-align:right!important"><?php echo 100 * $katao_supplier_invoice_product->getProductTvaRate() ?>%</td>
  75. </tr>
  76. <?php endforeach ?>
  77. </table>
  78. <?php $tva_rates = array('0.2' => 1, '0.055' => 2, '0' => 0) ?>
  79. <?php $total_by_tva_rate = array('0.2' => 0, '0.055' => 0, '0' => 0) ?>
  80. <table class="admin-sub-list">
  81. <tr valign="top">
  82. <td rowspan="<?php echo count($tva_rates) + 2 ?>" width="97%" style="border:none!important;padding-left:15px">
  83. <p><u>Commande(s) concernée(s)</u> : <?php echo $katao_supplier_invoice->getOrdersStr() ?></p>
  84. <?php if ('' != $katao_supplier_invoice->getComment()): ?>
  85. <p><u>Observations</u> : <?php echo $katao_supplier_invoice->getComment() ?></p>
  86. <?php endif ?>
  87. <?php if (KataoSupplierInvoice::STATUS_PAID == $katao_supplier_invoice->getStatus()): ?>
  88. <p><u>Paiement</u> : le <?php echo CatalyzDate::formatShort($katao_supplier_invoice->getPaymentDate(null)) ?> par <?php echo $katao_supplier_invoice->getPaymentModeStr() ?><?php echo ('' != $katao_supplier_invoice->getPaymentDetails())?sprintf(' (%s)', $katao_supplier_invoice->getPaymentDetails()):'' ?></p>
  89. <?php endif ?>
  90. </td>
  91. <th nowrap="nowrap" width="1%">Taux</th>
  92. <th nowrap="nowrap" width="1%" style="text-align:right!important">Bases HT</th>
  93. <th nowrap="nowrap" width="1%" style="text-align:right!important">Remises HT</th>
  94. <th nowrap="nowrap" width="1%" style="text-align:right!important">Montant</th>
  95. </tr>
  96. <?php $with_taxes_total = 0 ?>
  97. <?php $without_taxes_total = 0 ?>
  98. <?php $tva_total = 0 ?>
  99. <?php foreach ($total_by_tva_rate as $tva_rate => $tva_rate_total): ?>
  100. <?php $getTauxBasesHt = sprintf('getTaux%dBasesHt', $tva_rates[(string)$tva_rate]) ?>
  101. <?php $tva_rate_total = $katao_supplier_invoice->$getTauxBasesHt() ?>
  102. <?php $getTauxDiscountHt = sprintf('getTaux%dDiscountHt', $tva_rates[(string)$tva_rate]) ?>
  103. <?php $tva_rate_discount = $katao_supplier_invoice->$getTauxDiscountHt() ?>
  104. <?php $getTauxAmount = sprintf('getTaux%dAmount', $tva_rates[(string)$tva_rate]) ?>
  105. <?php $total_by_tva_rate2 = $katao_supplier_invoice->$getTauxAmount() ?>
  106. <?php $without_taxes_total += $tva_rate_total ?>
  107. <?php $tva_total += round($tva_rate_total * $tva_rate, 2) ?>
  108. <tr>
  109. <td nowrap="nowrap" style="text-align:right!important"><?php echo 100 * $tva_rate ?>%</td>
  110. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($tva_rate_total) ?></td>
  111. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($tva_rate_discount) ?></td>
  112. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($total_by_tva_rate2) ?></td>
  113. </tr>
  114. <?php endforeach ?>
  115. <tr>
  116. <th>Total</th>
  117. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($katao_supplier_invoice->getReference()?$katao_supplier_invoice->getTotalHt():round($without_taxes_total, 2)) ?></td>
  118. <td>&nbsp;</td>
  119. <td nowrap="nowrap" style="text-align:right!important"><?php echo Utils::formatCurrencyEuro($katao_supplier_invoice->getReference()?$katao_supplier_invoice->getTotalTva():round($tva_total, 2)) ?></td>
  120. </tr>
  121. </table>
  122. </td>
  123. </tr>
  124. <?php endforeach ?>
  125. </table>
  126. <?php echo pager($pager, sprintf('kataoSupplierInvoice/index?sort=%s%s', $sf_request->getParameter('sort', 'date'), $sf_request->hasParameter('desc')?'&desc=on':''), 'katao_supplier_invoice') ?>
  127. <?php endif ?>
  128. <script type="text/javascript" language="JavaScript">
  129. /* <![CDATA[ */
  130. function toggleDetails( id ){
  131. $('supplier-invoice-details-'+id).toggle();
  132. if($('supplier-invoice-details-'+id).visible()) {
  133. $('supplier-supplier-invoice-icon-'+id).src = '<?php echo image_path('actions/collapse.png') ?>';
  134. } else {
  135. $('supplier-supplier-invoice-icon-'+id).src = '<?php echo image_path('actions/expand.png') ?>';
  136. }
  137. }
  138. /* ]]> */
  139. </script>