You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

211 lines
10 KiB

  1. ## -*- coding: utf-8 -*-
  2. <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <style type="text/css">
  6. ${css}
  7. .list_table .act_as_row {
  8. margin-top: 10px;
  9. margin-bottom: 10px;
  10. font-size:10px;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15. <%!
  16. def amount(text):
  17. return text.replace('-', '&#8209;') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
  18. %>
  19. <%def name="format_amount(amount, display_option=None)">
  20. <%
  21. output = amount
  22. if display_option == 'normal':
  23. output = amount
  24. elif display_option == 'round':
  25. output = u"%.0f" % round(amount)
  26. elif display_option == 'kilo':
  27. if amount:
  28. output = u"%.2fK" % (amount / 1000,)
  29. %>
  30. ${output}
  31. </%def>
  32. <%setLang(user.lang)%>
  33. <div class="act_as_table data_table">
  34. <div class="act_as_row labels">
  35. <div class="act_as_cell">${_('Chart of Account')}</div>
  36. <div class="act_as_cell">${_('Fiscal Year')}</div>
  37. <div class="act_as_cell">
  38. %if filter_form(data) == 'filter_date':
  39. ${_('Dates')}
  40. %else:
  41. ${_('Periods')}
  42. %endif
  43. </div>
  44. <div class="act_as_cell">${_('Displayed Accounts')}</div>
  45. <div class="act_as_cell">${_('Target Moves')}</div>
  46. <div class="act_as_cell">${_('Initial Balance')}</div>
  47. </div>
  48. <div class="act_as_row">
  49. <div class="act_as_cell">${ chart_account.name }</div>
  50. <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
  51. <div class="act_as_cell">
  52. ${_('From:')}
  53. %if filter_form(data) == 'filter_date':
  54. ${formatLang(start_date, date=True) if start_date else u'' }
  55. %else:
  56. ${start_period.name if start_period else u''}
  57. %endif
  58. ${_('To:')}
  59. %if filter_form(data) == 'filter_date':
  60. ${ formatLang(stop_date, date=True) if stop_date else u'' }
  61. %else:
  62. ${stop_period.name if stop_period else u'' }
  63. %endif
  64. </div>
  65. <div class="act_as_cell">
  66. %if accounts(data):
  67. ${', '.join([account.code for account in accounts(data)])}
  68. %else:
  69. ${_('All')}
  70. %endif
  71. </div>
  72. <div class="act_as_cell">${ display_target_move(data) }</div>
  73. <div class="act_as_cell">${ _('Yes') if initial_balance else _('No') }</div>
  74. </div>
  75. </div>
  76. %for index, params in enumerate(comp_params):
  77. <div class="act_as_table data_table">
  78. <div class="act_as_row">
  79. <div class="act_as_cell">${_('Comparison %s') % (index + 1,)} (${"C%s" % (index + 1,)})</div>
  80. <div class="act_as_cell">
  81. %if params['comparison_filter'] == 'filter_date':
  82. ${_('Dates : ')}&nbsp;${formatLang(params['start'], date=True) }&nbsp;-&nbsp;${formatLang(params['stop'], date=True) }
  83. %elif params['comparison_filter'] == 'filter_period':
  84. ${_('Periods : ')}&nbsp;${params['start'].name}&nbsp;-&nbsp;${params['stop'].name}
  85. %else:
  86. ${_('Fiscal Year : ')}&nbsp;${params['fiscalyear'].name}
  87. %endif
  88. </div>
  89. <div class="act_as_cell">${_('Initial Balance:')} ${ _('Yes') if params['initial_balance'] else _('No') }</div>
  90. </div>
  91. </div>
  92. %endfor
  93. <div class="act_as_table list_table" style="margin-top: 20px;">
  94. <div class="act_as_thead">
  95. <div class="act_as_row labels">
  96. ## account name
  97. <div class="act_as_cell" style="width: 80px;">${_('Account')}</div>
  98. %if comparison_mode == 'no_comparison':
  99. %if initial_balance:
  100. ## initial balance
  101. <div class="act_as_cell amount" style="width: 30px;">${_('Initial Balance')}</div>
  102. %endif
  103. ## debit
  104. <div class="act_as_cell amount" style="width: 30px;">${_('Debit')}</div>
  105. ## credit
  106. <div class="act_as_cell amount" style="width: 30px;">${_('Credit')}</div>
  107. %endif
  108. ## balance
  109. <div class="act_as_cell amount" style="width: 30px;">
  110. %if comparison_mode == 'no_comparison' or not fiscalyear:
  111. ${_('Balance')}
  112. %else:
  113. ${_('Balance %s') % (fiscalyear.name,)}
  114. %endif
  115. </div>
  116. %if comparison_mode in ('single', 'multiple'):
  117. %for index in range(nb_comparison):
  118. <div class="act_as_cell amount" style="width: 30px;">
  119. %if comp_params[index]['comparison_filter'] == 'filter_year' and comp_params[index].get('fiscalyear', False):
  120. ${_('Balance %s') % (comp_params[index]['fiscalyear'].name,)}
  121. %else:
  122. ${_('Balance C%s') % (index + 1,)}
  123. %endif
  124. </div>
  125. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  126. <div class="act_as_cell amount" style="width: 30px;">${_('Difference')}</div>
  127. <div class="act_as_cell amount" style="width: 30px;">${_('% Difference')}</div>
  128. %endif
  129. %endfor
  130. %endif
  131. </div>
  132. </div>
  133. <div class="act_as_tbody">
  134. %for account_at in objects:
  135. <%
  136. current_account = account_at['current']
  137. level = current_account['level']
  138. %>
  139. %if level_print(data, level): ## how to manage levels?
  140. <%
  141. styles = []
  142. if level_bold(data, level):
  143. styles.append('font-weight: bold;')
  144. else:
  145. styles.append('font-weight: normal;')
  146. if level_italic(data, level):
  147. styles.append('font-style: italic;')
  148. else:
  149. styles.append('font-style: normal;')
  150. if level_underline(data, level):
  151. styles.append('text-decoration: underline;')
  152. else:
  153. styles.append('text-decoration: none;')
  154. if level_uppercase(data, level):
  155. styles.append('text-transform: uppercase;')
  156. else:
  157. styles.append('font-decoration: none;')
  158. styles.append("font-size: %spx;" % (level_size(data, level),))
  159. %>
  160. <div class="act_as_row lines ${"account_level_%s" % (current_account['level'])}" styles="${' '.join(styles)}">
  161. ## account name
  162. <div class="act_as_cell" style="padding-left: ${current_account.get('level', 0) * 5}px; ${' '.join(styles)}">${current_account['name']}</div>
  163. %if comparison_mode == 'no_comparison':
  164. %if initial_balance:
  165. ## opening balance
  166. <div class="act_as_cell amount" style="${' '.join(styles)}">${format_amount(current_account['init_balance'], numbers_display(data)) | amount}</div>
  167. %endif
  168. ## debit
  169. <div class="act_as_cell amount" style="${' '.join(styles)}">${format_amount(current_account['debit'], numbers_display(data)) | amount}</div>
  170. ## credit
  171. <div class="act_as_cell amount" style="${' '.join(styles)}">${format_amount(current_account['credit'] * -1, numbers_display(data)) if current_account['credit'] else 0.0 | amount}</div>
  172. %endif
  173. ## balance
  174. <div class="act_as_cell amount" style="${' '.join(styles)}">${format_amount(current_account['balance'], numbers_display(data)) | amount}</div>
  175. %if comparison_mode in ('single', 'multiple'):
  176. %for comp_account in account_at['comparisons']:
  177. <div class="act_as_cell amount" style="${' '.join(styles)}">${format_amount(comp_account['balance'], numbers_display(data)) | amount}</div>
  178. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  179. <div class="act_as_cell amount" style="${' '.join(styles)}">${format_amount(comp_account['diff'], numbers_display(data)) | amount}</div>
  180. <div class="act_as_cell amount" style="${' '.join(styles)}">
  181. %if comp_account['percent_diff'] is False:
  182. ${ '-' }
  183. %else:
  184. ${comp_account['percent_diff'] | amount} &#37;
  185. %endif
  186. </div>
  187. %endif
  188. %endfor
  189. %endif
  190. </div>
  191. %endif
  192. %endfor
  193. </div>
  194. </div>
  195. </body>
  196. </html>