cms.compte.php 3.3 KB

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