X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;ds=sidebyside;f=report%2Ftemplates%2Faccount_report_partner_balance.mako;fp=report%2Ftemplates%2Faccount_report_partner_balance.mako;h=8e2cad7f4e39bb57920a85b45af41f8c64757d61;hb=cddef38e342c880228694525c45df3f7dd8c2148;hp=0000000000000000000000000000000000000000;hpb=bffd331c220385010fe9abad9e228fc2004a293a;p=burette%2Faccount_financial_report_webkit.git diff --git a/report/templates/account_report_partner_balance.mako b/report/templates/account_report_partner_balance.mako new file mode 100644 index 0000000..8e2cad7 --- /dev/null +++ b/report/templates/account_report_partner_balance.mako @@ -0,0 +1,291 @@ +## -*- 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 display_line(all_comparison_lines): + return any([line.get('balance') for line in all_comparison_lines]) + %> + + <%setLang(user.lang)%> + + <% + initial_balance_text = {'initial_balance': _('Computed'), 'opening_balance': _('Opening Entries'), False: _('No')} + %> + +
+
+
${_('Chart of Account')}
+
${_('Fiscal Year')}
+
+ %if filter_form(data) == 'filter_date': + ${_('Dates Filter')} + %else: + ${_('Periods Filter')} + %endif +
+
${_('Accounts Filter')}
+
${_('Partners Filter')}
+
${_('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_partner_account(data)}
+
${ display_target_move(data) }
+
${ initial_balance_text[initial_balance_mode] }
+
+
+ + %for index, params in enumerate(comp_params): +
+
+
${_('Comparison %s') % (index + 1,)} (${"C%s" % (index + 1,)})
+
+ %if params['comparison_filter'] == 'filter_date': + ${_('Dates Filter:')} ${formatLang(params['start'], date=True) } - ${formatLang(params['stop'], date=True) } + %elif params['comparison_filter'] == 'filter_period': + ${_('Periods Filter:')} ${params['start'].name} - ${params['stop'].name} + %else: + ${_('Fiscal Year :')} ${params['fiscalyear'].name} + %endif +
+
${ _('Initial Balance:')} ${ initial_balance_text[params['initial_balance_mode']] }
+
+
+ %endfor + + %for current_account in objects: + <% + partners_order = current_account.partners_order + + # do not display accounts without partners + if not partners_order: + continue + + comparisons = current_account.comparisons + + # in multiple columns mode, we do not want to print accounts without any rows + if comparison_mode in ('single', 'multiple'): + all_comparison_lines = [comp['partners_amounts'][partner_id[1]] + for partner_id in partners_order + for comp in comparisons] + if not display_line(all_comparison_lines): + continue + + current_partner_amounts = current_account.partners_amounts + + total_initial_balance = 0.0 + total_debit = 0.0 + total_credit = 0.0 + total_balance = 0.0 + if comparison_mode in ('single', 'multiple'): + comparison_total = {} + for i, comp in enumerate(comparisons): + comparison_total[i] = {'balance': 0.0} + %> + +
${current_account.code} - ${current_account.name}
+ +
+ +
+
+ ## account name +
${_('Account / Partner Name')}
+ ## code +
${_('Code / Ref')}
+ %if comparison_mode == 'no_comparison': + %if initial_balance_mode: + ## 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 (partner_code_name, partner_id, partner_ref, partner_name) in partners_order: + <% + partner = current_partner_amounts.get(partner_id, {}) + + # in single mode, we have to display all the partners + # even if their balance is 0.0 because the initial balance + # should match with the previous year closings + + # in multiple columns mode, we do not want to print partners + # which have a balance at 0.0 in each comparison column + if comparison_mode in ('single', 'multiple'): + all_comparison_lines = [comp['partners_amounts'][partner_id] + for comp in comparisons + if comp['partners_amounts'].get(partner_id)] + if not display_line(all_comparison_lines): + continue + + total_initial_balance += partner.get('init_balance', 0.0) + total_debit += partner.get('debit', 0.0) + total_credit += partner.get('credit', 0.0) + total_balance += partner.get('balance', 0.0) + %> +
+
${partner_name if partner_name else _('Unallocated') }
+
${partner_ref if partner_ref else ''}
+ %if comparison_mode == 'no_comparison': + %if initial_balance_mode: +
${formatLang(partner.get('init_balance', 0.0)) | amount}
+ %endif +
${formatLang(partner.get('debit', 0.0)) | amount}
+
${formatLang(partner.get('credit', 0.0)) | amount}
+ %endif +
${formatLang(partner['balance'] if partner else 0.0) | amount}
+ + %if comparison_mode in ('single', 'multiple'): + %for i, comp in enumerate(comparisons): + <% + comp_partners = comp['partners_amounts'] + balance = diff = percent_diff = 0 + if comp_partners.get(partner_id): + balance = comp_partners[partner_id]['balance'] + diff = comp_partners[partner_id]['diff'] + percent_diff = comp_partners[partner_id]['percent_diff'] + comparison_total[i]['balance'] += balance + %> +
${formatLang(balance) | amount}
+ %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data +
${formatLang(diff) | amount}
+
+ %if percent_diff is False: + ${ '-' } + %else: + ${int(round(percent_diff)) | amount} % + %endif +
+ %endif + %endfor + %endif +
+ %endfor + +
+
+
+ ## account name +
${current_account.name}
+ ## code +
${current_account.code}
+ %if comparison_mode == 'no_comparison': + %if initial_balance_mode: + ## opening balance +
${formatLang(total_initial_balance) | amount}
+ %endif + ## debit +
${formatLang(total_debit) | amount}
+ ## credit +
${formatLang(total_credit and total_credit * -1 or 0.0) | amount}
+ %endif + ## balance +
${formatLang(total_balance) | amount}
+ + %if comparison_mode in ('single', 'multiple'): + %for i, comp in enumerate(comparisons): + <% + comp_account = comp['account'] + diffs = compute_diff(total_balance, comparison_total[i]['balance']) + %> +
${formatLang(comparison_total[i]['balance']) | amount}
+ %if comparison_mode == 'single': ## no diff in multiple comparisons because it shows too data +
${formatLang(diffs['diff']) | amount}
+
+ %if diffs['percent_diff'] is False: + ${ '-' } + %else: + ${int(round(diffs['percent_diff'])) | amount} % + %endif +
+ %endif + %endfor + %endif +
+
+
+ + %endfor + + +