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">
5 <style type="text/css">
8 .list_table .act_as_row {
17 background-color:#F0F0F0;
20 .account_line .act_as_cell {
22 vertical-align: bottom;
30 return text.replace('-', '‑') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers)
32 def display_line(all_comparison_lines):
33 return any([line.get('balance') for line in all_comparison_lines])
36 <%setLang(user.lang)%>
39 initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')}
42 <div class="act_as_table data_table">
43 <div class="act_as_row labels">
44 <div class="act_as_cell">${_('Chart of Account')}</div>
45 <div class="act_as_cell">${_('Fiscal Year')}</div>
46 <div class="act_as_cell">
47 %if filter_form(data) == 'filter_date':
50 ${_('Periods Filter')}
53 <div class="act_as_cell">${_('Accounts Filter')}</div>
54 <div class="act_as_cell">${_('Partners Filter')}</div>
55 <div class="act_as_cell">${_('Target Moves')}</div>
56 <div class="act_as_cell">${_('Initial Balance')}</div>
58 <div class="act_as_row">
59 <div class="act_as_cell">${ chart_account.name }</div>
60 <div class="act_as_cell">${ fiscalyear.name if fiscalyear else '-' }</div>
61 <div class="act_as_cell">
63 %if filter_form(data) == 'filter_date':
64 ${formatLang(start_date, date=True) if start_date else u'' }
66 ${start_period.name if start_period else u''}
69 %if filter_form(data) == 'filter_date':
70 ${ formatLang(stop_date, date=True) if stop_date else u'' }
72 ${stop_period.name if stop_period else u'' }
75 <div class="act_as_cell">
77 ${', '.join([account.code for account in accounts(data)])}
82 <div class="act_as_cell">${display_partner_account(data)}</div>
83 <div class="act_as_cell">${ display_target_move(data) }</div>
84 <div class="act_as_cell">${ initial_balance_text[initial_balance_mode] }</div>
88 %for index, params in enumerate(comp_params):
89 <div class="act_as_table data_table">
90 <div class="act_as_row">
91 <div class="act_as_cell">${_('Comparison %s') % (index + 1,)} (${"C%s" % (index + 1,)})</div>
92 <div class="act_as_cell">
93 %if params['comparison_filter'] == 'filter_date':
94 ${_('Dates Filter:')} ${formatLang(params['start'], date=True) } - ${formatLang(params['stop'], date=True) }
95 %elif params['comparison_filter'] == 'filter_period':
96 ${_('Periods Filter:')} ${params['start'].name} - ${params['stop'].name}
98 ${_('Fiscal Year :')} ${params['fiscalyear'].name}
101 <div class="act_as_cell">${ _('Initial Balance:')} ${ initial_balance_text[params['initial_balance_mode']] }</div>
106 %for current_account in objects:
108 partners_order = current_account.partners_order
110 # do not display accounts without partners
111 if not partners_order:
114 comparisons = current_account.comparisons
116 # in multiple columns mode, we do not want to print accounts without any rows
117 if comparison_mode in ('single', 'multiple'):
118 all_comparison_lines = [comp['partners_amounts'][partner_id[1]]
119 for partner_id in partners_order
120 for comp in comparisons]
121 if not display_line(all_comparison_lines):
124 current_partner_amounts = current_account.partners_amounts
126 total_initial_balance = 0.0
130 if comparison_mode in ('single', 'multiple'):
131 comparison_total = {}
132 for i, comp in enumerate(comparisons):
133 comparison_total[i] = {'balance': 0.0}
136 <div class="account_title bg" style="margin-top: 20px; font-size: 12px; width: 690px;">${current_account.code} - ${current_account.name}</div>
138 <div class="act_as_table list_table">
140 <div class="act_as_thead">
141 <div class="act_as_row labels">
143 <div class="act_as_cell" style="width: 80px;">${_('Account / Partner Name')}</div>
145 <div class="act_as_cell first_column" style="width: 20px;">${_('Code / Ref')}</div>
146 %if comparison_mode == 'no_comparison':
147 %if initial_balance_mode:
149 <div class="act_as_cell amount" style="width: 30px;">${_('Initial Balance')}</div>
152 <div class="act_as_cell amount" style="width: 30px;">${_('Debit')}</div>
154 <div class="act_as_cell amount" style="width: 30px;">${_('Credit')}</div>
157 <div class="act_as_cell amount" style="width: 30px;">
158 %if comparison_mode == 'no_comparison' or not fiscalyear:
161 ${_('Balance %s') % (fiscalyear.name,)}
164 %if comparison_mode in ('single', 'multiple'):
165 %for index in range(nb_comparison):
166 <div class="act_as_cell amount" style="width: 30px;">
167 %if comp_params[index]['comparison_filter'] == 'filter_year' and comp_params[index].get('fiscalyear', False):
168 ${_('Balance %s') % (comp_params[index]['fiscalyear'].name,)}
170 ${_('Balance C%s') % (index + 1,)}
173 %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
174 <div class="act_as_cell amount" style="width: 30px;">${_('Difference')}</div>
175 <div class="act_as_cell amount" style="width: 30px;">${_('% Difference')}</div>
182 <div class="act_as_tbody">
184 %for (partner_code_name, partner_id, partner_ref, partner_name) in partners_order:
186 partner = current_partner_amounts.get(partner_id, {})
188 # in single mode, we have to display all the partners
189 # even if their balance is 0.0 because the initial balance
190 # should match with the previous year closings
192 # in multiple columns mode, we do not want to print partners
193 # which have a balance at 0.0 in each comparison column
194 if comparison_mode in ('single', 'multiple'):
195 all_comparison_lines = [comp['partners_amounts'][partner_id]
196 for comp in comparisons
197 if comp['partners_amounts'].get(partner_id)]
198 if not display_line(all_comparison_lines):
201 total_initial_balance += partner.get('init_balance', 0.0)
202 total_debit += partner.get('debit', 0.0)
203 total_credit += partner.get('credit', 0.0)
204 total_balance += partner.get('balance', 0.0)
206 <div class="act_as_row lines">
207 <div class="act_as_cell">${partner_name if partner_name else _('Unallocated') }</div>
208 <div class="act_as_cell first_column">${partner_ref if partner_ref else ''}</div>
209 %if comparison_mode == 'no_comparison':
210 %if initial_balance_mode:
211 <div class="act_as_cell amount">${formatLang(partner.get('init_balance', 0.0)) | amount}</div>
213 <div class="act_as_cell amount">${formatLang(partner.get('debit', 0.0)) | amount}</div>
214 <div class="act_as_cell amount">${formatLang(partner.get('credit', 0.0)) | amount}</div>
216 <div class="act_as_cell amount">${formatLang(partner['balance'] if partner else 0.0) | amount}</div>
218 %if comparison_mode in ('single', 'multiple'):
219 %for i, comp in enumerate(comparisons):
221 comp_partners = comp['partners_amounts']
222 balance = diff = percent_diff = 0
223 if comp_partners.get(partner_id):
224 balance = comp_partners[partner_id]['balance']
225 diff = comp_partners[partner_id]['diff']
226 percent_diff = comp_partners[partner_id]['percent_diff']
227 comparison_total[i]['balance'] += balance
229 <div class="act_as_cell amount">${formatLang(balance) | amount}</div>
230 %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
231 <div class="act_as_cell amount">${formatLang(diff) | amount}</div>
232 <div class="act_as_cell amount">
233 %if percent_diff is False:
236 ${int(round(percent_diff)) | amount} %
246 <div class="act_as_tfoot" style="margin-top:5px;">
247 <div class="act_as_row labels" style="font-weight: bold; font-size: 11x;">
249 <div class="act_as_cell">${current_account.name}</div>
251 <div class="act_as_cell first_column">${current_account.code}</div>
252 %if comparison_mode == 'no_comparison':
253 %if initial_balance_mode:
255 <div class="act_as_cell amount">${formatLang(total_initial_balance) | amount}</div>
258 <div class="act_as_cell amount">${formatLang(total_debit) | amount}</div>
260 <div class="act_as_cell amount">${formatLang(total_credit and total_credit * -1 or 0.0) | amount}</div>
263 <div class="act_as_cell amount">${formatLang(total_balance) | amount}</div>
265 %if comparison_mode in ('single', 'multiple'):
266 %for i, comp in enumerate(comparisons):
268 comp_account = comp['account']
269 diffs = compute_diff(total_balance, comparison_total[i]['balance'])
271 <div class="act_as_cell amount">${formatLang(comparison_total[i]['balance']) | amount}</div>
272 %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data
273 <div class="act_as_cell amount">${formatLang(diffs['diff']) | amount}</div>
274 <div class="act_as_cell amount">
275 %if diffs['percent_diff'] is False:
278 ${int(round(diffs['percent_diff'])) | amount} %