cms.compte.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. $jsonTarget = "/json.php?file=banque-lignes-".core::getGet("id");
  3. if(debug::isFile("debug")){
  4. debug::log(debug::getBadge($jsonTarget, "OUVRIR LE JSON : ".$jsonTarget), "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"><?php icon::getFont(["icon" => "bi bi-file-earmark-plus"]) ?> 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"],
  22. "arbo" => array(
  23. "Comptes bancaires" => NULL,
  24. $banque["label"] => "/compte-". core::getGet("id") .".html")
  25. ));
  26. $callout = [
  27. "type" => "info",
  28. "h4" => "Note",
  29. "p" => "La dernier import des données du compte a été réalisée le <span class=\"fw-bold\">" . core::convertDate(banque::lastRecord(core::getGet("id"))) . "</span> et à cette même date le solde était de <span class=\"fw-bold\">" . banque::getEuro($etatCompte["solde"]) . "</span>",
  30. ];
  31. callout::print($callout);
  32. ?>
  33. <div>
  34. <table
  35. id="table"
  36. class="table-striped table-hover table-sm"
  37. data-toggle="table"
  38. data-show-footer="true"
  39. data-buttons-align="left"
  40. data-filter-control="true"
  41. data-flat="true"
  42. data-sort-name="num"
  43. data-sort-order="desc"
  44. data-show-export="true"
  45. data-pagination="true"
  46. data-page-size="25"
  47. data-page-list="[25, 50, 100, 250, all]"
  48. data-url="<?php echo $jsonTarget ?>">
  49. <thead>
  50. <tr>
  51. <th data-sortable="true" data-field="num" data-width="20">#</th>
  52. <th data-sortable="true" data-field="date" data-filter-control="input" data-width="160">Date</th>
  53. <th data-sortable="true" data-field="label" data-filter-control="input">Label</th>
  54. <th data-sortable="true" data-formatter="dataFormatter" data-field="debit" data-filter-control="input" data-width="150" data-footer-formatter="debitFormatter">Débit</th>
  55. <th data-sortable="true" data-formatter="dataFormatter" data-field="credit" data-filter-control="input" data-width="150" data-footer-formatter="creditFormatter">Crédit</th>
  56. <th data-sortable="true" data-formatter="dataFormatter" data-field="solde" data-filter-control="input" data-width="150">Solde</th>
  57. </tr>
  58. </thead>
  59. </table>
  60. </div>
  61. <script>
  62. let euro = Intl.NumberFormat('de-DE', {
  63. style: 'currency',
  64. currency: 'EUR',
  65. });
  66. function dataFormatter(value) {
  67. return euro.format(value);
  68. }
  69. function debitFormatter(data) {
  70. var total = 0;
  71. data.forEach(function (row) {
  72. total += parseFloat(row.debit);
  73. });
  74. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  75. }
  76. function creditFormatter(data) {
  77. var total = 0;
  78. data.forEach(function (row) {
  79. total += parseFloat(row.credit);
  80. });
  81. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  82. }
  83. </script>