Advertisement
Guest User

Untitled

a guest
Dec 1st, 2020
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. <div class="tab-pane" id="graph">
  2. {% set JanAmount = 0 %} {% set FebAmount = 0 %} {% set MarAmount = 0 %} {% set AprAmount = 0 %} {% set MaiAmount = 0 %} {% set JunAmount = 0 %} {% set JulAmount = 0 %}
  3. {% set AugAmount = 0 %} {% set SepAmount = 0 %} {% set OktAmount = 0 %} {% set NovAmount = 0 %} {% set DecAmount = 0 %}
  4.  
  5. {% set nJanAmount = 0 %} {% set nFebAmount = 0 %} {% set nMarAmount = 0 %} {% set nAprAmount = 0 %} {% set nMaiAmount = 0 %} {% set nJunAmount = 0 %} {% set nJulAmount = 0 %}
  6. {% set nAugAmount = 0 %} {% set nSepAmount = 0 %} {% set nOktAmount = 0 %} {% set nNovAmount = 0 %} {% set nDecAmount = 0 %}
  7.  
  8. {% set datum = current_user.cwmon %}
  9. {% set yeahrNow = datum|date('Y') %}
  10. {% set monthNow = datum|date('Y') %}
  11.  
  12. {% for statement in statements %}
  13. {% set month = env.getFormattedDatetime(statements.date)|date('n') %}
  14. {% set yeahr = env.getFormattedDatetime(statements.date)|date('Y') %}
  15.  
  16. {% if yeahr == yeahrNow and month == 1 %}
  17. {% if statement.amount > 0 %}
  18. {% set JanAmount = JanAmount + statement.amount %}
  19. {% elseif statement.amount < 0 %}
  20. {% set nJanAmount = nJanAmount - statement.amount %}
  21. {% endif %}
  22.  
  23. {% elseif yeahr == yeahrNow and month == 2 %}
  24. {% if statement.amount > 0 %}
  25. {% set FebAmount = FebAmount + statement.amount %}
  26. {% elseif statement.amount < 0 %}
  27. {% set nFebAmount = nFebAmount - statement.amount %}
  28. {% endif %}
  29. </br>
  30. <a>{{ month }}</a> <a>{{ yeahr }}</a>
  31.  
  32. {% elseif yeahr == yeahrNow and month == 3 %}
  33. {% if statement.amount > 0 %}
  34. {% set MarAmount = MarAmount + statement.amount %}
  35. {% elseif statement.amount < 0 %}
  36. {% set nMarAmount = nMarAmount - statement.amount %}
  37. {% endif %}
  38.  
  39. {% elseif yeahr == yeahrNow and month == 4 %}
  40. {% if statement.amount > 0 %}
  41. {% set AprAmount = AprAmount + statement.amount %}
  42. {% elseif statement.amount < 0 %}
  43. {% set nAprAmount = nAprAmount - statement.amount %}
  44. {% endif %}
  45.  
  46. {% elseif yeahr == yeahrNow and month == 5 %}
  47. {% if statement.amount > 0 %}
  48. {% set MaiAmount = MaiAmount + statement.amount %}
  49. {% elseif statement.amount < 0 %}
  50. {% set nMaiAmount = nMaiAmount - statement.amount %}
  51. {% endif %}
  52.  
  53. {% elseif yeahr == yeahrNow and month == 6 %}
  54. {% if statement.amount > 0 %}
  55. {% set JunAmount = JunAmount + statement.amount %}
  56. {% elseif statement.amount < 0 %}
  57. {% set nJunAmount = nJunAmount - statement.amount %}
  58. {% endif %}
  59.  
  60. {% elseif yeahr == yeahrNow and month == 7 %}
  61. {% if statement.amount > 0 %}
  62. {% set JulAmount = JulAmount + statement.amount %}
  63. {% elseif statement.amount < 0 %}
  64. {% set nJulAmount = nJulAmount - statement.amount %}
  65. {% endif %}
  66.  
  67. {% elseif yeahr == yeahrNow and month == 8 %}
  68. {% if statement.amount > 0 %}
  69. {% set AugAmount = AugAmount + statement.amount %}
  70. {% elseif statement.amount < 0 %}
  71. {% set nAugAmount = nAugAmount - statement.amount %}
  72. {% endif %}
  73.  
  74. {% elseif yeahr == yeahrNow and month == 9 %}
  75. {% if statement.amount > 0 %}
  76. {% set SepAmount = SepAmount + statement.amount %}
  77. {% elseif statement.amount < 0 %}
  78. {% set nSepAmount = nSepAmount - statement.amount %}
  79. {% endif %}
  80.  
  81. {% elseif yeahr == yeahrNow and month == 10 %}
  82. {% if statement.amount > 0 %}
  83. {% set OktAmount = OktAmount + statement.amount %}
  84. {% elseif statement.amount < 0 %}
  85. {% set nOktAmount = nOktAmount - statement.amount %}
  86. {% endif %}
  87.  
  88. {% elseif yeahr == yeahrNow and month == 11 %}
  89. {% if statement.amount > 0 %}
  90. {% set NovAmount = NovAmount + statement.amount %}
  91. {% elseif statement.amount < 0 %}
  92. {% set nNovAmount = nNovAmount - statement.amount %}
  93. {% endif %}
  94.  
  95. {% elseif yeahr == yeahrNow and month == 12 %}
  96. {% if statement.amount > 0 %}
  97. {% set DecAmount = DecAmount + statement.amount %}
  98. {% elseif statement.amount < 0 %}
  99. {% set nDecAmount = nDecAmount - statement.amount %}
  100. {% endif %}
  101.  
  102. {% endif %}
  103.  
  104. {% endfor %}
  105.  
  106.  
  107.  
  108. <canvas id="financeChart"></canvas>
  109. <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js" integrity="sha512-d9xgZrVZpmmQlfonhQUvTR7lMPtO7NkZMkA0ABN3PHCbKA5nqylQ/yWlFAyY6hYgdF1Qh6nYiuADWwKB4C2WSw==" crossorigin="anonymous"></script>
  110. <script>
  111. var pJan = '{{ JanAmount }}';
  112. var pFeb = '{{ FebAmount }}';
  113. var pMar = '{{ MarAmount }}';
  114. var pApr = '{{ AprAmount }}';
  115. var pMai = '{{ MaiAmount }}';
  116. var pJun = '{{ JunAmount }}';
  117. var pJul = '{{ JulAmount }}';
  118. var pAug = '{{ AugAmount }}';
  119. var pSep = '{{ SepAmount }}';
  120. var pOct = '{{ OktAmount }}';
  121. var pNov = '{{ NovAmount }}';
  122. var pDez = '{{ DecAmount }}';
  123.  
  124. var nJan = '{{ nJanAmount }}';
  125. var nFeb = '{{ nFebAmount }}';
  126. var nMar = '{{ nMarAmount }}';
  127. var nApr = '{{ nAprAmount }}';
  128. var nMai = '{{ nMaiAmount }}';
  129. var nJun = '{{ nJunAmount }}';
  130. var nJul = '{{ nJulAmount }}';
  131. var nAug = '{{ nAugAmount }}';
  132. var nSep = '{{ nSepAmount }}';
  133. var nOct = '{{ nOktAmount }}';
  134. var nNov = '{{ nNovAmount }}';
  135. var nDez = '{{ nDecAmount }}';
  136.  
  137. //alert(pNov);
  138. //alert(nNov);
  139.  
  140. var financeChartObject = document.getElementById('financeChart');
  141. var chart = new Chart(financeChartObject, {
  142. type: 'bar',
  143. data: {
  144. labels: ["Januar","Februar", "März", "April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],
  145. datasets: [{
  146. label: "Einkommen",
  147. backgroundColor: 'rgba(65,105,255,0.4)',
  148. borderColor: 'rgba(65,105,255,1)',
  149. data: [pJan, pFeb, pMar, pApr, pMai, pJun, pJul, pAug, pSep, pOct, pNov, pDez]
  150. },{
  151. label: "Ausgaben",
  152. fill: true,
  153. backgroundColor: 'rgba(255,0,0,0.4)',
  154. borderColor: 'rgba(255,0,0,1)',
  155. data: [nJan, nFeb, nMar, nApr, nMai, nJun, nJul, nAug, nSep, nOct, nNov, nDez]
  156. }]
  157. }
  158. });
  159.  
  160. </script>
  161. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement