コード例 #1
0
 def fill_part_of_grid(self, side, current_filter, index_begin, title, sign_value=None, with_third=False):
     data_line, total1, total2, _totalb = convert_query_to_account(self.filter & current_filter, self.lastfilter & current_filter, sign_value=sign_value, with_third=with_third)
     add_cell_in_grid(self.grid, index_begin, side, get_spaces(5) + '{[u]}%s{[/u]}' % title)
     line_idx = index_begin + 1
     line_idx = fill_grid(self.grid, line_idx, side, data_line)
     add_cell_in_grid(self.grid, line_idx, side, '')
     line_idx += 1
     return line_idx, total1, total2
コード例 #2
0
    def fill_body(self):
        line__tresor, total1_tresor, total2_tresor = self.fill_part_of_grid('left', Q(account__code__regex=current_system_account().get_cash_mask()), 0, _('Tresory'))
        line__capital, total1_capital, total2_capital = self.fill_part_of_grid('right', Q(account__type_of_account=2), 0, _('Provision and advance'))
        line_idx = max(line__tresor, line__capital)
        add_item_in_grid(self.grid, line_idx, 'left', (_('total'), total1_tresor, total2_tresor, None), get_spaces(5) + "{[u]}%s{[/u]}")
        add_item_in_grid(self.grid, line_idx, 'right', (_('total'), total1_capital, total2_capital, None), get_spaces(5) + "{[u]}%s{[/u]}")
        add_cell_in_grid(self.grid, line_idx + 1, 'left', '')
        add_cell_in_grid(self.grid, line_idx + 1, 'right', '')

        last_ids = []
        try:
            last_ids.append(EntryAccount.objects.filter(year=self.item).order_by('-id')[0].id)
        except IndexError:
            last_ids.append(0)
        if self.item.last_fiscalyear is not None:
            try:
                last_ids.append(EntryAccount.objects.filter(year=self.item.last_fiscalyear).order_by('-id')[0].id)
            except IndexError:
                last_ids.append(0)
        current_filter = Q(account__type_of_account__in=(ChartsAccount.TYPE_ASSET, ChartsAccount.TYPE_LIABILITY)) & ~Q(account__code__regex=current_system_account().get_cash_mask())
        current_filter &= (~Q(entry__year__status=2) | ~(Q(entry__journal=Journal.DEFAULT_OTHER) & Q(entry__id__in=tuple(last_ids))))
        line__creance, total1_creance, total2_creance = self.fill_part_of_grid('left', current_filter, line_idx + 2, _('Créance'), sign_value=-1, with_third=True)
        line__dette, total1_dette, total2_dette = self.fill_part_of_grid('right', current_filter, line_idx + 2, _('Dettes'), sign_value=1, with_third=True)
        line_idx = max(line__creance, line__dette)
        add_item_in_grid(self.grid, line_idx, 'left', (_('total'), total1_creance, total2_creance, None), get_spaces(5) + "{[u]}%s{[/u]}")
        add_item_in_grid(self.grid, line_idx, 'right', (_('total'), total1_dette, total2_dette, None), get_spaces(5) + "{[u]}%s{[/u]}")
        add_cell_in_grid(self.grid, line_idx + 1, 'left', '')
        add_cell_in_grid(self.grid, line_idx + 1, 'right', '')
        add_item_in_grid(self.grid, line_idx + 2, 'left', (_('total'), total1_tresor + total1_creance, total2_tresor + total2_creance, None), get_spaces(5) + "{[b]}%s{[/b]}")
        add_item_in_grid(self.grid, line_idx + 2, 'right', (_('total'), total1_capital + total1_dette, total2_capital + total2_dette, None), get_spaces(5) + "{[b]}%s{[/b]}")
コード例 #3
0
ファイル: views_report.py プロジェクト: julienM77/syndic
 def fill_body(self):
     line_idx = 0
     total1 = 0
     total2 = 0
     totalb = [0]
     revenue_account = Params.getvalue(
         "condominium-exceptional-revenue-account")
     for classloaditem in Set.objects.filter(type_load=1, is_active=True):
         current_request = Q(account__code__regex=current_system_account().
                             get_expence_mask())
         current_request |= Q(account__code__regex=current_system_account(
         ).get_revenue_mask()) & ~Q(account__code=revenue_account)
         current_request &= Q(costaccounting__setcost__set=classloaditem)
         query_budget = [
             ~Q(code=revenue_account)
             & Q(cost_accounting=classloaditem.current_cost_accounting)
             & Q(year=self.item)
         ]
         line__current_dep, subtotal1, subtotal2, subtotalb = self.fill_part_of_grid(
             current_request,
             query_budget,
             line_idx,
             six.text_type(classloaditem),
             sign_value=False)
         total_call = classloaditem.get_total_calloffund(self.item)
         add_cell_in_grid(self.grid, line__current_dep - 1, 'calloffund',
                          "{[u]}%s{[/u]}" % format_devise(total_call, 5))
         add_cell_in_grid(
             self.grid, line__current_dep - 1, 'result',
             "{[u]}%s{[/u]}" % format_devise(total_call - subtotal1, 5))
         line_idx = line__current_dep + 1
         total1 += subtotal1
         total2 += subtotal2
         totalb[0] += subtotalb[0]
     add_cell_in_grid(self.grid, line_idx, 'design',
                      get_spaces(5) + "{[b]}%s{[/b]}" % _('total'))
     add_cell_in_grid(self.grid, line_idx, 'year_n',
                      "{[b]}%s{[/b]}" % format_devise(total1, 5))
     add_cell_in_grid(self.grid, line_idx, 'budget_n',
                      "{[b]}%s{[/b]}" % format_devise(totalb[0], 5))
コード例 #4
0
ファイル: views_report.py プロジェクト: julienM77/syndic
 def fill_body(self):
     line_idx = 0
     total1 = 0
     total2 = 0
     totalb = [0, 0, 0]
     revenue_account = Params.getvalue(
         "condominium-current-revenue-account")
     initial_filter = self.filter
     initial_lastfilter = self.lastfilter
     for classloaditem in Set.objects.filter(type_load=0, is_active=True):
         current_costaccounting = classloaditem.setcost_set.filter(
             year=self.item).first().cost_accounting
         current_request = Q(account__code__regex=current_system_account().
                             get_expence_mask())
         current_request |= Q(account__code__regex=current_system_account(
         ).get_revenue_mask()) & ~Q(account__code=revenue_account)
         if initial_filter is not None:
             self.filter = initial_filter & Q(
                 costaccounting_id=current_costaccounting.id)
         if initial_lastfilter is not None:
             self.lastfilter = initial_lastfilter & Q(
                 costaccounting_id=current_costaccounting.
                 last_costaccounting_id)
         query_budget = [
             ~Q(code=revenue_account)
             & Q(cost_accounting=current_costaccounting)
         ]
         if self.next_year is not None:
             set_cost = classloaditem.setcost_set.filter(
                 year=self.next_year).first()
             if set_cost is None:
                 set_cost = classloaditem.create_new_cost(
                     year=self.next_year)
             query_budget.append(~Q(code=revenue_account) & Q(
                 cost_accounting=set_cost.cost_accounting))
         if self.next_year_again is not None:
             set_cost = classloaditem.setcost_set.filter(
                 year=self.next_year_again).first()
             if set_cost is None:
                 set_cost = classloaditem.create_new_cost(
                     year=self.next_year_again)
             query_budget.append(~Q(code=revenue_account) & Q(
                 cost_accounting=set_cost.cost_accounting))
         line__current_dep, subtotal1, subtotal2, subtotalb = self.fill_part_of_grid(
             current_request,
             query_budget,
             line_idx,
             six.text_type(classloaditem),
             sign_value=False)
         line_idx = line__current_dep + 1
         total1 += subtotal1
         total2 += subtotal2
         totalb[0] += subtotalb[0]
         if self.next_year is not None:
             totalb[1] += subtotalb[1]
         if self.next_year_again is not None:
             totalb[2] += subtotalb[2]
     add_cell_in_grid(self.grid, line_idx, 'design',
                      get_spaces(5) + "{[b]}%s{[/b]}" % _('total'))
     add_cell_in_grid(self.grid, line_idx, 'year_n',
                      "{[b]}%s{[/b]}" % format_devise(total1, 5))
     add_cell_in_grid(self.grid, line_idx, 'budget_n',
                      "{[b]}%s{[/b]}" % format_devise(totalb[0], 5))
     if self.item.last_fiscalyear is not None:
         add_cell_in_grid(self.grid, line_idx, 'year_n_1',
                          "{[b]}%s{[/b]}" % format_devise(total2, 5))
     if self.next_year is not None:
         add_cell_in_grid(self.grid, line_idx, 'budget_n1',
                          "{[b]}%s{[/b]}" % format_devise(totalb[1], 5))
     if self.next_year_again is not None:
         add_cell_in_grid(self.grid, line_idx, 'budget_n2',
                          "{[b]}%s{[/b]}" % format_devise(totalb[2], 5))
コード例 #5
0
ファイル: views_report.py プロジェクト: julienM77/syndic
 def fill_part_of_grid(self,
                       current_filter,
                       query_budget,
                       index_begin,
                       title,
                       sign_value=None):
     data_line, total1, total2, totalb = convert_query_to_account(
         self.filter & current_filter,
         self.lastfilter & current_filter,
         query_budget=query_budget,
         sign_value=sign_value)
     add_cell_in_grid(self.grid, index_begin, 'design',
                      get_spaces(5) + '{[u]}%s{[/u]}' % title)
     line_idx = index_begin + 1
     for data_item in data_line:
         add_cell_in_grid(self.grid, line_idx, 'design', data_item[0])
         add_cell_in_grid(self.grid, line_idx, 'year_n',
                          format_devise(data_item[1], 5))
         add_cell_in_grid(self.grid, line_idx, 'budget_n',
                          format_devise(data_item[3], 5))
         if self.next_year is not None:
             add_cell_in_grid(self.grid, line_idx, 'budget_n1',
                              format_devise(data_item[4], 5))
         if self.next_year_again is not None:
             add_cell_in_grid(self.grid, line_idx, 'budget_n2',
                              format_devise(data_item[5], 5))
         if self.item.last_fiscalyear is not None:
             add_cell_in_grid(self.grid, line_idx, 'year_n_1',
                              format_devise(data_item[2], 5))
         line_idx += 1
     add_cell_in_grid(self.grid, line_idx, 'design', '')
     line_idx += 1
     add_cell_in_grid(self.grid, line_idx, 'design',
                      get_spaces(5) + "{[u]}%s{[/u]}" % _('total'))
     add_cell_in_grid(self.grid, line_idx, 'year_n',
                      "{[u]}%s{[/u]}" % format_devise(total1, 5))
     add_cell_in_grid(self.grid, line_idx, 'budget_n',
                      "{[u]}%s{[/u]}" % format_devise(totalb[0], 5))
     if self.next_year is not None:
         add_cell_in_grid(self.grid, line_idx, 'budget_n1',
                          "{[u]}%s{[/u]}" % format_devise(totalb[1], 5))
     if self.next_year_again is not None:
         add_cell_in_grid(self.grid, line_idx, 'budget_n2',
                          "{[u]}%s{[/u]}" % format_devise(totalb[2], 5))
     if self.item.last_fiscalyear is not None:
         add_cell_in_grid(self.grid, line_idx, 'year_n_1',
                          "{[u]}%s{[/u]}" % format_devise(total2, 5))
     line_idx += 1
     add_cell_in_grid(self.grid, line_idx, 'design', '')
     return line_idx, total1, total2, totalb