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.

290 lines
15 KiB

  1. <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <style type="text/css">
  5. ${css}
  6. .list_table .act_as_row {
  7. margin-top: 10px;
  8. margin-bottom: 10px;
  9. font-size:10px;
  10. }
  11. .account_line {
  12. font-weight: bold;
  13. font-size: 15px;
  14. background-color:#F0F0F0;
  15. }
  16. .account_line .act_as_cell {
  17. height: 30px;
  18. vertical-align: bottom;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <%!
  24. def amount(text):
  25. return text.replace('-', '&#8209;') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
  26. def display_line(all_comparison_lines):
  27. return any([line.get('balance') for line in all_comparison_lines])
  28. %>
  29. <%setLang(user.context_lang)%>
  30. <%
  31. initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
  32. %>
  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 Filter')}
  40. %else:
  41. ${_('Periods Filter')}
  42. %endif
  43. </div>
  44. <div class="act_as_cell">${_('Accounts Filter')}</div>
  45. <div class="act_as_cell">${_('Partners Filter')}</div>
  46. <div class="act_as_cell">${_('Target Moves')}</div>
  47. <div class="act_as_cell">${_('Initial Balance')}</div>
  48. </div>
  49. <div class="act_as_row">
  50. <div class="act_as_cell">${ chart_account.name }</div>
  51. <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
  52. <div class="act_as_cell">
  53. ${_('From:')}
  54. %if filter_form(data) == 'filter_date':
  55. ${formatLang(start_date, date=True) if start_date else u'' }
  56. %else:
  57. ${start_period.name if start_period else u''}
  58. %endif
  59. ${_('To:')}
  60. %if filter_form(data) == 'filter_date':
  61. ${ formatLang(stop_date, date=True) if stop_date else u'' }
  62. %else:
  63. ${stop_period.name if stop_period else u'' }
  64. %endif
  65. </div>
  66. <div class="act_as_cell">
  67. %if accounts(data):
  68. ${', '.join([account.code for account in accounts(data)])}
  69. %else:
  70. ${_('All')}
  71. %endif
  72. </div>
  73. <div class="act_as_cell">${display_partner_account(data)}</div>
  74. <div class="act_as_cell">${ display_target_move(data) }</div>
  75. <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
  76. </div>
  77. </div>
  78. %for index, params in enumerate(comp_params):
  79. <div class="act_as_table data_table">
  80. <div class="act_as_row">
  81. <div class="act_as_cell">${_('Comparison %s') % (index + 1,)} (${"C%s" % (index + 1,)})</div>
  82. <div class="act_as_cell">
  83. %if params['comparison_filter'] == 'filter_date':
  84. ${_('Dates Filter:')}&nbsp;${formatLang(params['start'], date=True) }&nbsp;-&nbsp;${formatLang(params['stop'], date=True) }
  85. %elif params['comparison_filter'] == 'filter_period':
  86. ${_('Periods Filter:')}&nbsp;${params['start'].name}&nbsp;-&nbsp;${params['stop'].name}
  87. %else:
  88. ${_('Fiscal Year :')}&nbsp;${params['fiscalyear'].name}
  89. %endif
  90. </div>
  91. <div class="act_as_cell">${ _('Initial Balance:')} ${ initial_balance_text[params['initial_balance_mode']] }</div>
  92. </div>
  93. </div>
  94. %endfor
  95. %for current_account in objects:
  96. <%
  97. partners_order = current_account.partners_order
  98. # do not display accounts without partners
  99. if not partners_order:
  100. continue
  101. comparisons = current_account.comparisons
  102. # in multiple columns mode, we do not want to print accounts without any rows
  103. if comparison_mode in ('single', 'multiple'):
  104. all_comparison_lines = [comp['partners_amounts'][partner_id[1]]
  105. for partner_id in partners_order
  106. for comp in comparisons]
  107. if not display_line(all_comparison_lines):
  108. continue
  109. current_partner_amounts = current_account.partners_amounts
  110. total_initial_balance = 0.0
  111. total_debit = 0.0
  112. total_credit = 0.0
  113. total_balance = 0.0
  114. if comparison_mode in ('single', 'multiple'):
  115. comparison_total = {}
  116. for i, comp in enumerate(comparisons):
  117. comparison_total[i] = {'balance': 0.0}
  118. %>
  119. <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 690px;">${current_account.code} - ${current_account.name}</div>
  120. <div class="act_as_table list_table">
  121. <div class="act_as_thead">
  122. <div class="act_as_row labels">
  123. ## account name
  124. <div class="act_as_cell" style="width: 80px;">${_('Account / Partner Name')}</div>
  125. ## code
  126. <div class="act_as_cell first_column" style="width: 20px;">${_('Code / Ref')}</div>
  127. %if comparison_mode == 'no_comparison':
  128. %if initial_balance_mode:
  129. ## initial balance
  130. <div class="act_as_cell amount" style="width: 30px;">${_('Initial Balance')}</div>
  131. %endif
  132. ## debit
  133. <div class="act_as_cell amount" style="width: 30px;">${_('Debit')}</div>
  134. ## credit
  135. <div class="act_as_cell amount" style="width: 30px;">${_('Credit')}</div>
  136. %endif
  137. ## balance
  138. <div class="act_as_cell amount" style="width: 30px;">
  139. %if comparison_mode == 'no_comparison' or not fiscalyear:
  140. ${_('Balance')}
  141. %else:
  142. ${_('Balance %s') % (fiscalyear.name,)}
  143. %endif
  144. </div>
  145. %if comparison_mode in ('single', 'multiple'):
  146. %for index in range(nb_comparison):
  147. <div class="act_as_cell amount" style="width: 30px;">
  148. %if comp_params[index]['comparison_filter'] == 'filter_year' and comp_params[index].get('fiscalyear', False):
  149. ${_('Balance %s') % (comp_params[index]['fiscalyear'].name,)}
  150. %else:
  151. ${_('Balance C%s') % (index + 1,)}
  152. %endif
  153. </div>
  154. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  155. <div class="act_as_cell amount" style="width: 30px;">${_('Difference')}</div>
  156. <div class="act_as_cell amount" style="width: 30px;">${_('% Difference')}</div>
  157. %endif
  158. %endfor
  159. %endif
  160. </div>
  161. </div>
  162. <div class="act_as_tbody">
  163. %for (partner_code_name, partner_id, partner_ref, partner_name) in partners_order:
  164. <%
  165. partner = current_partner_amounts.get(partner_id, {})
  166. # in single mode, we have to display all the partners
  167. # even if their balance is 0.0 because the initial balance
  168. # should match with the previous year closings
  169. # in multiple columns mode, we do not want to print partners
  170. # which have a balance at 0.0 in each comparison column
  171. if comparison_mode in ('single', 'multiple'):
  172. all_comparison_lines = [comp['partners_amounts'][partner_id]
  173. for comp in comparisons
  174. if comp['partners_amounts'].get(partner_id)]
  175. if not display_line(all_comparison_lines):
  176. continue
  177. total_initial_balance += partner.get('init_balance', 0.0)
  178. total_debit += partner.get('debit', 0.0)
  179. total_credit += partner.get('credit', 0.0)
  180. total_balance += partner.get('balance', 0.0)
  181. %>
  182. <div class="act_as_row lines">
  183. <div class="act_as_cell">${partner_name if partner_name else _('Unallocated') }</div>
  184. <div class="act_as_cell first_column">${partner_ref if partner_ref else ''}</div>
  185. %if comparison_mode == 'no_comparison':
  186. %if initial_balance_mode:
  187. <div class="act_as_cell amount">${formatLang(partner.get('init_balance', 0.0)) | amount}</div>
  188. %endif
  189. <div class="act_as_cell amount">${formatLang(partner.get('debit', 0.0)) | amount}</div>
  190. <div class="act_as_cell amount">${formatLang(partner.get('credit', 0.0)) | amount}</div>
  191. %endif
  192. <div class="act_as_cell amount">${formatLang(partner['balance'] if partner else 0.0) | amount}</div>
  193. %if comparison_mode in ('single', 'multiple'):
  194. %for i, comp in enumerate(comparisons):
  195. <%
  196. comp_partners = comp['partners_amounts']
  197. balance = diff = percent_diff = 0
  198. if comp_partners.get(partner_id):
  199. balance = comp_partners[partner_id]['balance']
  200. diff = comp_partners[partner_id]['diff']
  201. percent_diff = comp_partners[partner_id]['percent_diff']
  202. comparison_total[i]['balance'] += balance
  203. %>
  204. <div class="act_as_cell amount">${formatLang(balance) | amount}</div>
  205. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  206. <div class="act_as_cell amount">${formatLang(diff) | amount}</div>
  207. <div class="act_as_cell amount">
  208. %if percent_diff is False:
  209. ${ '-' }
  210. %else:
  211. ${int(round(percent_diff)) | amount} &#37;
  212. %endif
  213. </div>
  214. %endif
  215. %endfor
  216. %endif
  217. </div>
  218. %endfor
  219. </div>
  220. <div class="act_as_tfoot" style="margin-top:5px;">
  221. <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
  222. ## account name
  223. <div class="act_as_cell">${current_account.name}</div>
  224. ## code
  225. <div class="act_as_cell first_column">${current_account.code}</div>
  226. %if comparison_mode == 'no_comparison':
  227. %if initial_balance_mode:
  228. ## opening balance
  229. <div class="act_as_cell amount">${formatLang(total_initial_balance) | amount}</div>
  230. %endif
  231. ## debit
  232. <div class="act_as_cell amount">${formatLang(total_debit) | amount}</div>
  233. ## credit
  234. <div class="act_as_cell amount">${formatLang(total_credit and total_credit * -1 or 0.0) | amount}</div>
  235. %endif
  236. ## balance
  237. <div class="act_as_cell amount">${formatLang(total_balance) | amount}</div>
  238. %if comparison_mode in ('single', 'multiple'):
  239. %for i, comp in enumerate(comparisons):
  240. <%
  241. comp_account = comp['account']
  242. diffs = compute_diff(total_balance, comparison_total[i]['balance'])
  243. %>
  244. <div class="act_as_cell amount">${formatLang(comparison_total[i]['balance']) | amount}</div>
  245. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  246. <div class="act_as_cell amount">${formatLang(diffs['diff']) | amount}</div>
  247. <div class="act_as_cell amount">
  248. %if diffs['percent_diff'] is False:
  249. ${ '-' }
  250. %else:
  251. ${int(round(diffs['percent_diff'])) | amount} &#37;
  252. %endif
  253. </div>
  254. %endif
  255. %endfor
  256. %endif
  257. </div>
  258. </div>
  259. </div>
  260. %endfor
  261. </body>
  262. </html>