cms.compte.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light ">
  2. <h2 class="bd-title" id="content">
  3. <span>Etat des comptes</span>
  4. <a href="/?p=compte-upload&add=<?php echo core::getGet("id") ?>" style="position: absolute; right: 0; margin: 38px 40px 0 0;"><button type="submit" class="btn btn-outline-success btn-sm"><span data-feather="plus-square"></span> Charger un CSV</button></a>
  5. </h2>
  6. </header>
  7. <?php
  8. $banque = banque::getInitialCompte(core::getGet("id"));
  9. $etatCompte = banque::getEtatCompte(core::getGet("id"));
  10. echo core::filAriane(array(
  11. "current" => $banque["label"] . " (" . banque::getEuro($etatCompte["solde"]) . " au " . core::convertDate($etatCompte["date"], FALSE). ")",
  12. "arbo" => array(
  13. "Comptes bancaires" => NULL,
  14. $banque["label"] . " (" . banque::getEuro($etatCompte["solde"]) . " au " . core::convertDate($etatCompte["date"], FALSE) . ")" => "/compte-". core::getGet("id") .".html")
  15. ));
  16. //json::create("banque-lignes-".core::getGet("id"));
  17. ?>
  18. <div>
  19. <table
  20. id="table"
  21. class="table-striped table-hover table-sm"
  22. data-toggle="table"
  23. data-page-size="25"
  24. data-pagination="true"
  25. data-show-footer="true"
  26. data-search="true"
  27. data-buttons-align="left"
  28. data-filter-control="true"
  29. data-flat="true"
  30. data-sort-name="num"
  31. data-sort-order="desc"
  32. data-url="/json.php?file=banque-lignes-<?php echo core::getGet("id") ?>">
  33. <thead>
  34. <tr>
  35. <th data-sortable="true" data-field="num" data-width="20">#</th>
  36. <th data-sortable="true" data-field="date" data-filter-control="input" data-width="160">Date</th>
  37. <th data-sortable="true" data-field="label" data-filter-control="input">Label</th>
  38. <th data-sortable="true" data-formatter="dataFormatter" data-field="debit" data-filter-control="input" data-width="150" data-footer-formatter="debitFormatter">Débit</th>
  39. <th data-sortable="true" data-formatter="dataFormatter" data-field="credit" data-filter-control="input" data-width="150" data-footer-formatter="creditFormatter">Crédit</th>
  40. <th data-sortable="true" data-formatter="dataFormatter" data-field="solde" data-filter-control="input" data-width="150">Solde</th>
  41. </tr>
  42. </thead>
  43. </table>
  44. </div>
  45. <script>
  46. let euro = Intl.NumberFormat('de-DE', {
  47. style: 'currency',
  48. currency: 'EUR',
  49. });
  50. function dataFormatter(value) {
  51. return euro.format(value);
  52. }
  53. function debitFormatter(data) {
  54. var total = 0;
  55. data.forEach(function (row) {
  56. total += parseFloat(row.debit);
  57. });
  58. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  59. }
  60. function creditFormatter(data) {
  61. var total = 0;
  62. data.forEach(function (row) {
  63. total += parseFloat(row.credit);
  64. });
  65. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  66. }
  67. </script>