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