Browse Source

[ADD] Se agrega reporte de cinco columnas


			
			
				6.0
			
			
		
Humberto Arocha 12 years ago
parent
commit
d30fcabd9e
  1. 158
      account_financial_report/report/balance_full_5_cols.rml
  2. 12
      account_financial_report/report/parser.py
  3. 11
      account_financial_report/view/report.xml
  4. 6
      account_financial_report/wizard/wizard.py

158
account_financial_report/report/balance_full_5_cols.rml

@ -0,0 +1,158 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(21.59cm,27.94cm)" title="Test" author="Martin Simon" allowSplitting="20" showBoundary="0">
<pageTemplate id="first">
<frame id="first" x1="0.5cm" y1="1.0cm" width="20.5cm" height="23cm"/>
<pageGraphics>
<setFont name="Helvetica" size="9"/>
<!--
<image x="1.0cm" y="25.0cm" height="2.5cm" width="9.6cm">[[company.logo and company.logo or removeParentNode('image')]]</image>
<drawString x="1.0cm" y="24.5cm">[[company.logo and removeParentNode('para') or company.name]]</drawString>
-->
<place x="-3.5cm" y="22.50cm" width="19cm" height="5.0cm">
<blockTable colWidths="9.6cm,9.4cm" style="TITLE">
<tr>
<td><para style="TOP_TITLE"></para></td>
<td><para style="TITLE_CENTER_NAME">
<font>[[ (company.name and company.name or 'NOMBRE DE COMPANIA NO DISPONIBLE')]]</font>
<font>[[ company.partner_id.vat and ('- %s-%s-%s'%(company.partner_id.vat[2:3],company.partner_id.vat[3:11],company.partner_id.vat[11:12])) or '' ]]</font>
</para></td>
</tr>
<tr>
<td><para style="TOP_TITLE"></para></td>
<td><para style="TITLE_CENTER">[[ get_informe_text(data['form']) ]]</para></td>
</tr>
<tr>
<td><para style="TOP_TITLE"></para></td>
<td><para style="TITLE_CENTER">[[data['form'] and (' (Expresado en %s)'%( exchange_name(data['form']))) or '']]</para></td>
</tr>
<tr>
<td><para style="TOP_TITLE"></para></td>
<td><para style="TITLE_CENTER">[[data['form'] and get_month(data['form']) or '']]</para></td>
</tr>
</blockTable>
</place>
<drawRightString x="192mm" y="5mm">[[ get_informe_text(data['form']) ]] / Pág.: <pageNumber/>-<pageCount/> </drawRightString>
</pageGraphics>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="TITLE">
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="BODY">
<blockValign value="TOP"/>
<blockAlignment value="RIGHT"/>
<blockTopPadding length="1.0"/>
<blockBottomPadding length="1.0"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,1" stop="-1,-1" thickness='0.25'/>
</blockTableStyle>
<blockTableStyle id="BODY_STRIKE">
<blockValign value="TOP"/>
<blockAlignment value="RIGHT"/>
<blockTopPadding length="1.0"/>
<blockBottomPadding length="1.0"/>
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,1" stop="-1,-1" thickness='0.5'/>
</blockTableStyle>
<blockTableStyle id="TOP_TABLE">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#FFFFFF" start="0,-1" stop="0,-1" thickness='0.25'/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle
name="TITLE_LEFT_ALIGN"
fontName="Helvetica-Bold"
fontSize="6.0"
leading="10"
alignment="RIGHT"
spaceBefore="0.0"
spaceAfter="0.0"/>
<paraStyle name="TOP_TITLE" fontName="Helvetica-Bold" fontSize="7" leftIndent="0.0" alignment="LEFT"/>
<paraStyle name="TITLES" fontName="Helvetica-Bold" fontSize="6.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="TITLE_CENTER" fontName="Helvetica-Bold" fontSize="7" leading="10" leftIndent="0.0" alignment="CENTER"/>
<paraStyle name="TITLE_CENTER_NAME" fontName="Helvetica-Bold" fontSize="12" leading="13" leftIndent="0.0" alignment="CENTER"/>
<paraStyle name="TITLE" alignment="CENTER" fontName="Helvetica" fontSize="18.0" leading="20" spaceBefore="-3.0" textColor="black"/>
</stylesheet>
<images/>
<story>
<para>[[setLang(user.context_lang)]]</para>
<blockTable colWidths="2.5cm,6.0cm,2.5cm,2.5cm,2.5cm,2.5cm,2.5cm" style="BODY" repeatRows="1">
<tr noRowsplits="1">
<td>
<para style="TITLE_LEFT_ALIGN">
<font>Code</font>
</para>
</td>
<td>
<para style="TITLES">ACCOUNT</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">INIT. BAL.</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">DEBIT</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">CREDIT</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">YTD</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">END. BAL.</para>
</td>
</tr>
<tr>
<td>
<para style="TITLE_LEFT_ALIGN">[[ repeatIn(lines(data['form']), 'a') ]]
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<i>[[a['label']==True and a['code'] or '' ]]</i>
</para>
</td>
<td>
<para style="TITLES">
<font>[[ ((a['total'] and not a['label']) and setTag('para','para',{'alignment':"RIGHT"}) or (a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}))) or removeParentNode('font') ]]</font>
<font>[[ a['type']=='view' and a['name'].upper() or a['name'].title() ]]</font>
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(a['balanceinit'] and a['balanceinit'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font>
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(a['debit'], digits=2, grouping=True) or '']]</font>
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(a['credit'], digits=2, grouping=True) or '']]</font>
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(a['ytd'] and a['ytd'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font>
</para>
</td>
<td>
<para style="TITLE_LEFT_ALIGN">
<font>[[ a['type']&lt;&gt;'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]]</font>
<font>[[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']]</font>
</para>
</td>
</tr>
</blockTable>
</story>
</document>

12
account_financial_report/report/parser.py

@ -293,6 +293,7 @@ class account_balance(report_sxw.rml_parse):
tot_bin = 0.0 tot_bin = 0.0
tot_deb = 0.0 tot_deb = 0.0
tot_crd = 0.0 tot_crd = 0.0
tot_ytd = 0.0
tot_eje = 0.0 tot_eje = 0.0
elif form['columns'] == 'thirteen': elif form['columns'] == 'thirteen':
tot_bal1 = 0.0 tot_bal1 = 0.0
@ -313,6 +314,7 @@ class account_balance(report_sxw.rml_parse):
result_acc = [] result_acc = []
tot = {} tot = {}
print 'TIPO DE INFORME ',form['inf_type']
if form['columns'] == 'thirteen': if form['columns'] == 'thirteen':
period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)],order='date_start asc') period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)],order='date_start asc')
@ -348,6 +350,7 @@ class account_balance(report_sxw.rml_parse):
'balanceinit': self.exchange(i), 'balanceinit': self.exchange(i),
'debit': self.exchange(d), 'debit': self.exchange(d),
'credit': self.exchange(c), 'credit': self.exchange(c),
'ytd': self.exchange(d-c),
'balance': self.exchange(b), 'balance': self.exchange(b),
}) })
@ -469,6 +472,7 @@ class account_balance(report_sxw.rml_parse):
tot_bin += res['balanceinit'] tot_bin += res['balanceinit']
tot_deb += res['debit'] tot_deb += res['debit']
tot_crd += res['credit'] tot_crd += res['credit']
tot_ytd += res['ytd']
tot_eje += res['balance'] tot_eje += res['balance']
if form['columns'] == 'thirteen': if form['columns'] == 'thirteen':
@ -502,6 +506,7 @@ class account_balance(report_sxw.rml_parse):
'balanceinit': tot_bin, 'balanceinit': tot_bin,
'debit': tot_deb, 'debit': tot_deb,
'credit': tot_crd, 'credit': tot_crd,
'ytd': tot_ytd,
'balance': tot_eje, 'balance': tot_eje,
}) })
if form['columns'] == 'thirteen': if form['columns'] == 'thirteen':
@ -521,6 +526,7 @@ class account_balance(report_sxw.rml_parse):
bal13 = tot_bal13,)) bal13 = tot_bal13,))
result_acc.append(res2) result_acc.append(res2)
print 100 * 'FIN '
return result_acc return result_acc
report_sxw.report_sxw('report.afr.1cols', report_sxw.report_sxw('report.afr.1cols',
@ -541,6 +547,12 @@ report_sxw.report_sxw('report.afr.4cols',
parser=account_balance, parser=account_balance,
header=False) header=False)
report_sxw.report_sxw('report.afr.5cols',
'wizard.report',
'account_financial_report/report/balance_full_5_cols.rml',
parser=account_balance,
header=False)
report_sxw.report_sxw('report.afr.13cols', report_sxw.report_sxw('report.afr.13cols',
'wizard.report', 'wizard.report',
'account_financial_report/report/balance_full_13_cols.rml', 'account_financial_report/report/balance_full_13_cols.rml',

11
account_financial_report/view/report.xml

@ -35,6 +35,17 @@
header="False" header="False"
/> />
<report
auto="False"
id="5_col_report"
menu="True"
model="wizard.report"
name="afr.5cols"
rml="account_financial_report/report/balance_full_5_cols.rml"
string="Balance 5 Columnas"
header="False"
/>
<report <report
auto="False" auto="False"
id="13_col_report" id="13_col_report"

6
account_financial_report/wizard/wizard.py

@ -47,7 +47,7 @@ class wizard_report(osv.osv_memory):
'tot_check': fields.boolean('Show Total'), 'tot_check': fields.boolean('Show Total'),
'lab_str': fields.char('Description', size= 128), 'lab_str': fields.char('Description', size= 128),
'inf_type': fields.selection([('bgen','Balance Sheet'),('IS','Income Statement'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas'),('bml','Libro Mayor Legal')],'Tipo Informe',required=True), 'inf_type': fields.selection([('bgen','Balance Sheet'),('IS','Income Statement'),('bcom','Balance Comprobacion'),('edogp','Estado Ganancias y Perdidas'),('bml','Libro Mayor Legal')],'Tipo Informe',required=True),
'columns': fields.selection([('one','End. Balance'),('two','Debit | Credit'),('four',' Init. Balance | Debit | Credit | End. Balance'),('thirteen','12 Months | YTD')],'Column Number',required=True),
'columns': fields.selection([('one','End. Balance'),('two','Debit | Credit'),('four','Init. | Dr. | Cr. | End.'),('five','Init. | Dr. | Cr. | YTD | End.'),('thirteen','12 Months | YTD')],'Column Number',required=True),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all values for this report to be expressed in this secondary currency."), 'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all values for this report to be expressed in this secondary currency."),
} }
@ -60,7 +60,7 @@ class wizard_report(osv.osv_memory):
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c), 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.invoice', context=c),
'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid), 'fiscalyear': lambda self, cr, uid, c: self.pool.get('account.fiscalyear').find(cr, uid),
'display_account': lambda *a:'bal_mov', 'display_account': lambda *a:'bal_mov',
'columns': lambda *a:'four',
'columns': lambda *a:'five',
} }
def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None): def onchange_filter(self,cr,uid,ids,fiscalyear,filters,context=None):
@ -152,6 +152,8 @@ class wizard_report(osv.osv_memory):
name = 'afr.2cols' name = 'afr.2cols'
if data['form']['columns'] == 'four': if data['form']['columns'] == 'four':
name = 'afr.4cols' name = 'afr.4cols'
if data['form']['columns'] == 'five':
name = 'afr.5cols'
if data['form']['columns'] == 'thirteen': if data['form']['columns'] == 'thirteen':
name = 'afr.13cols' name = 'afr.13cols'

Loading…
Cancel
Save