cms.compte.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. ?>
  27. <div class="bd-callout bd-callout-info">
  28. <h4>Note</h4>
  29. <p>La dernier import des données du compte a été réalisée le <span class="fw-bold"><?php echo core::convertDate(banque::lastRecord(core::getGet("id"))) ?></span> et à cette même date le solde était de <span class="fw-bold"><?php echo banque::getEuro($etatCompte["solde"]) ?></span></p>
  30. </div>
  31. <div>
  32. <table
  33. id="table"
  34. class="table-striped table-hover table-sm"
  35. data-toggle="table"
  36. data-page-size="25"
  37. data-pagination="true"
  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-url="<?php echo $jsonTarget ?>">
  45. <thead>
  46. <tr>
  47. <th data-sortable="true" data-field="num" data-width="20">#</th>
  48. <th data-sortable="true" data-field="date" data-filter-control="input" data-width="160">Date</th>
  49. <th data-sortable="true" data-field="label" data-filter-control="input">Label</th>
  50. <th data-sortable="true" data-formatter="dataFormatter" data-field="debit" data-filter-control="input" data-width="150" data-footer-formatter="debitFormatter">Débit</th>
  51. <th data-sortable="true" data-formatter="dataFormatter" data-field="credit" data-filter-control="input" data-width="150" data-footer-formatter="creditFormatter">Crédit</th>
  52. <th data-sortable="true" data-formatter="dataFormatter" data-field="solde" data-filter-control="input" data-width="150">Solde</th>
  53. </tr>
  54. </thead>
  55. </table>
  56. </div>
  57. <script>
  58. let euro = Intl.NumberFormat('de-DE', {
  59. style: 'currency',
  60. currency: 'EUR',
  61. });
  62. function dataFormatter(value) {
  63. return euro.format(value);
  64. }
  65. function debitFormatter(data) {
  66. var total = 0;
  67. data.forEach(function (row) {
  68. total += parseFloat(row.debit);
  69. });
  70. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  71. }
  72. function creditFormatter(data) {
  73. var total = 0;
  74. data.forEach(function (row) {
  75. total += parseFloat(row.credit);
  76. });
  77. return parseFloat(total) === 0 ? euro.format(0.00) : euro.format(total.toFixed(2));
  78. }
  79. </script>