cms.compte.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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-page-size="25"
  39. data-pagination="true"
  40. data-show-footer="true"
  41. data-buttons-align="left"
  42. data-filter-control="true"
  43. data-flat="true"
  44. data-sort-name="num"
  45. data-sort-order="desc"
  46. data-url="<?php echo $jsonTarget ?>">
  47. <thead>
  48. <tr>
  49. <th data-sortable="true" data-field="num" data-width="20">#</th>
  50. <th data-sortable="true" data-field="date" data-filter-control="input" data-width="160">Date</th>
  51. <th data-sortable="true" data-field="label" data-filter-control="input">Label</th>
  52. <th data-sortable="true" data-formatter="dataFormatter" data-field="debit" data-filter-control="input" data-width="150" data-footer-formatter="debitFormatter">Débit</th>
  53. <th data-sortable="true" data-formatter="dataFormatter" data-field="credit" data-filter-control="input" data-width="150" data-footer-formatter="creditFormatter">Crédit</th>
  54. <th data-sortable="true" data-formatter="dataFormatter" data-field="solde" data-filter-control="input" data-width="150">Solde</th>
  55. </tr>
  56. </thead>
  57. </table>
  58. </div>
  59. <script>
  60. let euro = Intl.NumberFormat('de-DE', {
  61. style: 'currency',
  62. currency: 'EUR',
  63. });
  64. function dataFormatter(value) {
  65. return euro.format(value);
  66. }
  67. function debitFormatter(data) {
  68. var total = 0;
  69. data.forEach(function (row) {
  70. total += parseFloat(row.debit);
  71. });
  72. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  73. }
  74. function creditFormatter(data) {
  75. var total = 0;
  76. data.forEach(function (row) {
  77. total += parseFloat(row.credit);
  78. });
  79. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  80. }
  81. </script>