Browse Source

[IMP] We have now QTRs Reports again :-)

pull/7/merge
Humberto Arocha 11 years ago
parent
commit
26491fc7ed
  1. 91
      account_financial_report/report/parser.py

91
account_financial_report/report/parser.py

@ -390,8 +390,6 @@ class account_balance(report_sxw.rml_parse):
l = []
a = 0
#~ period_ids = p
elif form['columns'] == 'thirteen':
period_ids = period_obj.search(self.cr, self.uid, [(
'fiscalyear_id', '=', fiscalyear.id), ('special', '=', False)], order='date_start asc')
@ -536,6 +534,87 @@ class account_balance(report_sxw.rml_parse):
else:
all_account_period[period_ids[p_act]] = all_account
elif form['columns'] == 'qtr':
for p_act in range(5):
if p_act == 4:
form['periods'] = period_ids
else:
form['periods'] = p[p_act]
if form['inf_type'] == 'IS':
ctx_to_use = _ctx_end(self.context.copy())
else:
ctx_i = _ctx_init(self.context.copy())
ctx_to_use = _ctx_end(self.context.copy())
account_black = account_obj.browse(
self.cr, self.uid, account_black_ids, ctx_to_use)
if form['inf_type'] == 'BS':
account_black_init = account_obj.browse(
self.cr, self.uid, account_black_ids, ctx_i)
#~ Negros
dict_black = {}
for i in account_black:
black_data = {}
black_data['obj'] = i
black_data['debit'] = i.debit
black_data['credit'] = i.credit
black_data['balance'] = i.balance
if form['inf_type'] == 'BS':
black_data['balanceinit'] = 0.0
dict_black[i.id] = black_data
if form['inf_type'] == 'BS':
for i in account_black_init:
dict_black[i.id]['balanceinit'] = i.balance
#########################
#~ No negros
dict_not_black = {}
for i in account_not_black:
not_black_data = {}
not_black_data['obj'] = i
not_black_data['debit'] = 0.0
not_black_data['credit'] = 0.0
not_black_data['balance'] = 0.0
if form['inf_type'] == 'BS':
not_black_data['balanceinit'] = 0.0
dict_not_black[i.id] = not_black_data
###########################
all_account = dict_black.copy(
) # se hace una copia, porque se modificara
print "##################"
for i in dict_not_black:
print dict_not_black[i].get('obj').name, dict_not_black[i].get('debit')
for acc_id in account_not_black_ids:
print dict_not_black[acc_id].get('obj').name
acc_childs = dict_not_black[acc_id].get('obj').child_id
for child_id in acc_childs:
dict_not_black[acc_id]['debit'] += all_account[
child_id.id].get('debit')
dict_not_black[acc_id]['credit'] += all_account[
child_id.id].get('credit')
dict_not_black[acc_id]['balance'] += all_account[
child_id.id].get('balance')
if form['inf_type'] == 'BS':
dict_not_black[acc_id]['balanceinit'] += all_account[
child_id.id].get('balanceinit')
all_account[acc_id] = dict_not_black[acc_id]
print "##################"
for i in all_account:
print all_account[i].get('obj').name, all_account[i].get('debit')
if p_act == 4:
all_account_period['all'] = all_account
else:
all_account_period[p_act] = all_account
# pdb.set_trace()
# print "periodo 1 #######################"
# for i in all_account_period.get(1):
@ -580,7 +659,7 @@ class account_balance(report_sxw.rml_parse):
if form['inf_type'] == 'IS':
d, c, b = map(z, [
all_account_period[p_id].get(id).get('debit'), all_account_period[p_id].get(id).get('credit'), all_account_period[p_id].get(id).get('balance')])
all_account_period[pn-1][id]['debit'], all_account_period[pn-1][id]['credit'], all_account_period[pn-1][id]['balance']])
res.update({
'dbr%s' % pn: self.exchange(d),
'cdr%s' % pn: self.exchange(c),
@ -588,7 +667,7 @@ class account_balance(report_sxw.rml_parse):
})
else:
i, d, c = map(z, [
all_account_period[p_id].get(id).get('balanceinit'), all_account_period[p_id].get(id).get('debit'), all_account_period[p_id].get(id).get('credit')])
all_account_period[pn-1][id]['balanceinit'], all_account_period[pn-1][id]['debit'], all_account_period[pn-1][id]['credit']])
b = z(i+d-c)
res.update({
'dbr%s' % pn: self.exchange(d),
@ -600,7 +679,7 @@ class account_balance(report_sxw.rml_parse):
if form['inf_type'] == 'IS':
d, c, b = map(z, [
all_account_period['all'].get(id).get('debit', 0.0), all_account_period['all'].get(id).get('credit', 0.0), all_account_period['all'].get(id).get('balance', 0.0)])
all_account_period['all'][id]['debit'], all_account_period['all'][id]['credit'], all_account_period['all'][id]['balance']])
res.update({
'dbr5': self.exchange(d),
'cdr5': self.exchange(c),
@ -608,7 +687,7 @@ class account_balance(report_sxw.rml_parse):
})
else:
i, d, c = map(z, [
all_account_period['all'].get(id).get('balanceinit', 0.0), all_account_period['all'].get(id).get('debit', 0.0), all_account_period['all'].get(id).get('credit', 0.0)])
all_account_period['all'][id]['balanceinit'], all_account_period['all'][id]['debit'], all_account_period['all'][id]['credit']])
b = z(i+d-c)
res.update({
'dbr5': self.exchange(d),

Loading…
Cancel
Save