X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=report%2Ftemplates%2Faccount_report_profit_loss.mako;fp=report%2Ftemplates%2Faccount_report_profit_loss.mako;h=9e1f4bd248490bba2d856c03967c1a7c1ffa7f3c;hb=cddef38e342c880228694525c45df3f7dd8c2148;hp=0000000000000000000000000000000000000000;hpb=bffd331c220385010fe9abad9e228fc2004a293a;p=burette%2Faccount_financial_report_webkit.git diff --git a/report/templates/account_report_profit_loss.mako b/report/templates/account_report_profit_loss.mako new file mode 100644 index 0000000..9e1f4bd --- /dev/null +++ b/report/templates/account_report_profit_loss.mako @@ -0,0 +1,211 @@ +## -*- coding: utf-8 -*- + + + + + + + <%! + + def amount(text): + return text.replace('-', '‑') # replace by a non-breaking hyphen (it will not word-wrap between hyphen and numbers) + %> + + <%def name="format_amount(amount, display_option=None)"> + <% + output = amount + if display_option == 'normal': + output = amount + elif display_option == 'round': + output = u"%.0f" % round(amount) + elif display_option == 'kilo': + if amount: + output = u"%.2fK" % (amount / 1000,) + %> + ${output} + + + <%setLang(user.lang)%> + +
+
+
${_('Chart of Account')}
+
${_('Fiscal Year')}
+
+ %if filter_form(data) == 'filter_date': + ${_('Dates')} + %else: + ${_('Periods')} + %endif +
+
${_('Displayed Accounts')}
+
${_('Target Moves')}
+
${_('Initial Balance')}
+
+
+
${ chart_account.name }
+
${ fiscalyear.name if fiscalyear else '-' }
+
+ ${_('From:')} + %if filter_form(data) == 'filter_date': + ${formatLang(start_date, date=True) if start_date else u'' } + %else: + ${start_period.name if start_period else u''} + %endif + ${_('To:')} + %if filter_form(data) == 'filter_date': + ${ formatLang(stop_date, date=True) if stop_date else u'' } + %else: + ${stop_period.name if stop_period else u'' } + %endif +
+
+ %if accounts(data): + ${', '.join([account.code for account in accounts(data)])} + %else: + ${_('All')} + %endif +
+
${ display_target_move(data) }
+
${ _('Yes') if initial_balance else _('No') }
+
+
+ + %for index, params in enumerate(comp_params): +
+
+
${_('Comparison %s') % (index + 1,)} (${"C%s" % (index + 1,)})
+
+ %if params['comparison_filter'] == 'filter_date': + ${_('Dates : ')} ${formatLang(params['start'], date=True) } - ${formatLang(params['stop'], date=True) } + %elif params['comparison_filter'] == 'filter_period': + ${_('Periods : ')} ${params['start'].name} - ${params['stop'].name} + %else: + ${_('Fiscal Year : ')} ${params['fiscalyear'].name} + %endif +
+
${_('Initial Balance:')} ${ _('Yes') if params['initial_balance'] else _('No') }
+
+
+ %endfor + +
+ +
+
+ ## account name +
${_('Account')}
+ %if comparison_mode == 'no_comparison': + %if initial_balance: + ## initial balance +
${_('Initial Balance')}
+ %endif + ## debit +
${_('Debit')}
+ ## credit +
${_('Credit')}
+ %endif + ## balance +
+ %if comparison_mode == 'no_comparison' or not fiscalyear: + ${_('Balance')} + %else: + ${_('Balance %s') % (fiscalyear.name,)} + %endif +
+ %if comparison_mode in ('single', 'multiple'): + %for index in range(nb_comparison): +
+ %if comp_params[index]['comparison_filter'] == 'filter_year' and comp_params[index].get('fiscalyear', False): + ${_('Balance %s') % (comp_params[index]['fiscalyear'].name,)} + %else: + ${_('Balance C%s') % (index + 1,)} + %endif +
+ %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data +
${_('Difference')}
+
${_('% Difference')}
+ %endif + %endfor + %endif +
+
+ +
+ %for account_at in objects: + <% + current_account = account_at['current'] + level = current_account['level'] + %> + %if level_print(data, level): ## how to manage levels? + <% + styles = [] + if level_bold(data, level): + styles.append('font-weight: bold;') + else: + styles.append('font-weight: normal;') + + if level_italic(data, level): + styles.append('font-style: italic;') + else: + styles.append('font-style: normal;') + + if level_underline(data, level): + styles.append('text-decoration: underline;') + else: + styles.append('text-decoration: none;') + + if level_uppercase(data, level): + styles.append('text-transform: uppercase;') + else: + styles.append('font-decoration: none;') + + styles.append("font-size: %spx;" % (level_size(data, level),)) + + %> +
+ ## account name +
${current_account['name']}
+ %if comparison_mode == 'no_comparison': + %if initial_balance: + ## opening balance +
${format_amount(current_account['init_balance'], numbers_display(data)) | amount}
+ %endif + ## debit +
${format_amount(current_account['debit'], numbers_display(data)) | amount}
+ ## credit +
${format_amount(current_account['credit'] * -1, numbers_display(data)) if current_account['credit'] else 0.0 | amount}
+ %endif + ## balance +
${format_amount(current_account['balance'], numbers_display(data)) | amount}
+ + %if comparison_mode in ('single', 'multiple'): + %for comp_account in account_at['comparisons']: +
${format_amount(comp_account['balance'], numbers_display(data)) | amount}
+ %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data +
${format_amount(comp_account['diff'], numbers_display(data)) | amount}
+
+ %if comp_account['percent_diff'] is False: + ${ '-' } + %else: + ${comp_account['percent_diff'] | amount} % + %endif +
+ %endif + %endfor + %endif +
+ %endif + %endfor +
+
+ +