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.

275 lines
14 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. %>
  27. <%setLang(user.context_lang)%>
  28. <%
  29. initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
  30. %>
  31. <div class="act_as_table data_table">
  32. <div class="act_as_row labels">
  33. <div class="act_as_cell">${_('Chart of Account')}</div>
  34. <div class="act_as_cell">${_('Fiscal Year')}</div>
  35. <div class="act_as_cell">
  36. %if filter_form(data) == 'filter_date':
  37. ${_('Dates Filter')}
  38. %else:
  39. ${_('Periods Filter')}
  40. %endif
  41. </div>
  42. <div class="act_as_cell">${_('Accounts Filter')}</div>
  43. <div class="act_as_cell">${_('Partners Filter')}</div>
  44. <div class="act_as_cell">${_('Target Moves')}</div>
  45. <div class="act_as_cell">${_('Initial Balance')}</div>
  46. </div>
  47. <div class="act_as_row">
  48. <div class="act_as_cell">${ chart_account.name }</div>
  49. <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
  50. <div class="act_as_cell">
  51. ${_('From:')}
  52. %if filter_form(data) == 'filter_date':
  53. ${formatLang(start_date, date=True) if start_date else u'' }
  54. %else:
  55. ${start_period.name if start_period else u''}
  56. %endif
  57. ${_('To:')}
  58. %if filter_form(data) == 'filter_date':
  59. ${ formatLang(stop_date, date=True) if stop_date else u'' }
  60. %else:
  61. ${stop_period.name if stop_period else u'' }
  62. %endif
  63. </div>
  64. <div class="act_as_cell">
  65. %if accounts(data):
  66. ${', '.join([account.code for account in accounts(data)])}
  67. %else:
  68. ${_('All')}
  69. %endif
  70. </div>
  71. <div class="act_as_cell">${display_partner_account(data)}</div>
  72. <div class="act_as_cell">${ display_target_move(data) }</div>
  73. <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</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 Filter:')}&nbsp;${formatLang(params['start'], date=True) }&nbsp;-&nbsp;${formatLang(params['stop'], date=True) }
  83. %elif params['comparison_filter'] == 'filter_period':
  84. ${_('Periods Filter:')}&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:')} ${ initial_balance_text[params['initial_balance_mode']] }</div>
  90. </div>
  91. </div>
  92. %endfor
  93. %for current_account in objects:
  94. <%
  95. partners_order = current_account.partners_order
  96. # do not display accounts without partners
  97. if not partners_order:
  98. continue
  99. comparisons = current_account.comparisons
  100. all_comparison_lines = [comp['partners_amounts'][partner_id[1]] for partner_id in partners_order for comp in comparisons]
  101. if not current_account.balance and not any([line.get('balance') for line in all_comparison_lines]):
  102. continue
  103. current_partner_amounts = current_account.partners_amounts
  104. total_initial_balance = 0.0
  105. total_debit = 0.0
  106. total_credit = 0.0
  107. total_balance = 0.0
  108. if comparison_mode in ('single', 'multiple'):
  109. comparison_total = {}
  110. for i, comp in enumerate(comparisons):
  111. comparison_total[i] = {'balance': 0.0}
  112. %>
  113. <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 690px;">${current_account.code} - ${current_account.name}</div>
  114. <div class="act_as_table list_table">
  115. <div class="act_as_thead">
  116. <div class="act_as_row labels">
  117. ## code
  118. <div class="act_as_cell first_column" style="width: 20px;">${_('Code / Ref')}</div>
  119. ## account name
  120. <div class="act_as_cell" style="width: 80px;">${_('Account / Partner Name')}</div>
  121. %if comparison_mode == 'no_comparison':
  122. %if initial_balance_mode:
  123. ## initial balance
  124. <div class="act_as_cell amount" style="width: 30px;">${_('Initial Balance')}</div>
  125. %endif
  126. ## debit
  127. <div class="act_as_cell amount" style="width: 30px;">${_('Debit')}</div>
  128. ## credit
  129. <div class="act_as_cell amount" style="width: 30px;">${_('Credit')}</div>
  130. %endif
  131. ## balance
  132. <div class="act_as_cell amount" style="width: 30px;">
  133. %if comparison_mode == 'no_comparison' or not fiscalyear:
  134. ${_('Balance')}
  135. %else:
  136. ${_('Balance %s') % (fiscalyear.name,)}
  137. %endif
  138. </div>
  139. %if comparison_mode in ('single', 'multiple'):
  140. %for index in range(nb_comparison):
  141. <div class="act_as_cell amount" style="width: 30px;">
  142. %if comp_params[index]['comparison_filter'] == 'filter_year' and comp_params[index].get('fiscalyear', False):
  143. ${_('Balance %s') % (comp_params[index]['fiscalyear'].name,)}
  144. %else:
  145. ${_('Balance C%s') % (index + 1,)}
  146. %endif
  147. </div>
  148. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  149. <div class="act_as_cell amount" style="width: 30px;">${_('Difference')}</div>
  150. <div class="act_as_cell amount" style="width: 30px;">${_('% Difference')}</div>
  151. %endif
  152. %endfor
  153. %endif
  154. </div>
  155. </div>
  156. <div class="act_as_tbody">
  157. %for (partner_code_name, partner_id, partner_ref, partner_name) in partners_order:
  158. <%
  159. partner = current_partner_amounts.get(partner_id, {})
  160. all_comparison_lines = [comp['partners_amounts'][partner_id] for comp in comparisons if comp['partners_amounts'].get(partner_id)]
  161. if not partner.get('balance') and not any([line.get('balance') for line in all_comparison_lines]):
  162. continue
  163. total_initial_balance += partner.get('init_balance', 0.0)
  164. total_debit += partner.get('debit', 0.0)
  165. total_credit += partner.get('credit', 0.0)
  166. total_balance += partner.get('balance', 0.0)
  167. %>
  168. <div class="act_as_row lines">
  169. <div class="act_as_cell first_column">${partner_ref if partner_ref else ''}</div>
  170. <div class="act_as_cell">${partner_name if partner_name else _('Unallocated') }</div>
  171. %if comparison_mode == 'no_comparison':
  172. %if initial_balance_mode:
  173. <div class="act_as_cell amount">${formatLang(partner.get('init_balance', 0.0)) | amount}</div>
  174. %endif
  175. <div class="act_as_cell amount">${formatLang(partner.get('debit', 0.0)) | amount}</div>
  176. <div class="act_as_cell amount">${formatLang(partner.get('credit', 0.0)) | amount}</div>
  177. %endif
  178. <div class="act_as_cell amount">${formatLang(partner['balance'] if partner else 0.0) | amount}</div>
  179. %if comparison_mode in ('single', 'multiple'):
  180. %for i, comp in enumerate(comparisons):
  181. <%
  182. comp_partners = comp['partners_amounts']
  183. balance = diff = percent_diff = 0
  184. if comp_partners.get(partner_id):
  185. balance = comp_partners[partner_id]['balance']
  186. diff = comp_partners[partner_id]['diff']
  187. percent_diff = comp_partners[partner_id]['percent_diff']
  188. comparison_total[i]['balance'] += balance
  189. %>
  190. <div class="act_as_cell amount">${formatLang(balance) | amount}</div>
  191. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  192. <div class="act_as_cell amount">${formatLang(diff) | amount}</div>
  193. <div class="act_as_cell amount">
  194. %if percent_diff is False:
  195. ${ '-' }
  196. %else:
  197. ${int(round(percent_diff)) | amount} &#37;
  198. %endif
  199. </div>
  200. %endif
  201. %endfor
  202. %endif
  203. </div>
  204. %endfor
  205. </div>
  206. <div class="act_as_tfoot" style="margin-top:5px;">
  207. <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
  208. ## code
  209. <div class="act_as_cell first_column">${current_account.code}</div>
  210. ## account name
  211. <div class="act_as_cell">${current_account.name}</div>
  212. %if comparison_mode == 'no_comparison':
  213. %if initial_balance_mode:
  214. ## opening balance
  215. <div class="act_as_cell amount">${formatLang(total_initial_balance) | amount}</div>
  216. %endif
  217. ## debit
  218. <div class="act_as_cell amount">${formatLang(total_debit) | amount}</div>
  219. ## credit
  220. <div class="act_as_cell amount">${formatLang(total_credit and total_credit * -1 or 0.0) | amount}</div>
  221. %endif
  222. ## balance
  223. <div class="act_as_cell amount">${formatLang(total_balance) | amount}</div>
  224. %if comparison_mode in ('single', 'multiple'):
  225. %for i, comp in enumerate(comparisons):
  226. <%
  227. comp_account = comp['account']
  228. diffs = compute_diff(total_balance, comparison_total[i]['balance'])
  229. %>
  230. <div class="act_as_cell amount">${formatLang(comparison_total[i]['balance']) | amount}</div>
  231. %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
  232. <div class="act_as_cell amount">${formatLang(diffs['diff']) | amount}</div>
  233. <div class="act_as_cell amount">
  234. %if diffs['percent_diff'] is False:
  235. ${ '-' }
  236. %else:
  237. ${int(round(diffs['percent_diff'])) | amount} &#37;
  238. %endif
  239. </div>
  240. %endif
  241. %endfor
  242. %endif
  243. </div>
  244. </div>
  245. </div>
  246. %endfor
  247. </body>
  248. </html>