Exemple #1
0
def balance_sheet_table(context, io_model, to_date):
    user_model = context['user']
    activity = context['request'].GET.get('activity')
    activity = validate_activity(activity, raise_404=True)
    entity_slug = context['view'].kwargs.get('entity_slug')

    prepare_context_by_unit(context)

    txs_qs, digest = io_model.digest(activity=activity,
                                     user_model=user_model,
                                     equity_only=False,
                                     entity_slug=entity_slug,
                                     unit_slug=context['unit_slug'],
                                     by_unit=context['by_unit'],
                                     to_date=to_date,
                                     process_groups=True)

    digest['by_unit'] = context['by_unit']
    digest['unit_model'] = context['unit_model']
    digest['unit_slug'] = context['unit_slug']
    return digest
def income_statement_table(context, io_model, from_date, to_date):
    user_model: EntityUnitModel = context['user']
    activity = context['request'].GET.get('activity')
    activity = validate_activity(activity, raise_404=True)
    entity_slug = context['view'].kwargs.get('entity_slug')

    prepare_context_by_unit(context)

    digest = io_model.digest(activity=activity,
                             user_model=user_model,
                             entity_slug=entity_slug,
                             unit_slug=context['unit_slug'],
                             by_unit=context['by_unit'],
                             from_date=from_date,
                             to_date=to_date,
                             equity_only=True,
                             process_groups=True)

    digest['by_unit'] = context['by_unit']
    digest['unit_model'] = context['unit_model']
    digest['unit_slug'] = context['unit_slug']
    return digest