changed report indicator of account_report
bzr revid: nch@tinyerp.com-20090602134759-8f165yz18093nfky
This commit is contained in:
@@ -73,13 +73,6 @@ import tools
|
||||
import os
|
||||
|
||||
|
||||
parents = {
|
||||
'tr':1,
|
||||
'li':1,
|
||||
'story': 0,
|
||||
'section': 0
|
||||
}
|
||||
|
||||
class accounting_report_indicator(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
@@ -91,6 +84,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||
'lines':self.lines,
|
||||
'getarray':self.getarray,
|
||||
'gettree':self.gettree,
|
||||
'getarray_head':self.getarray_head,
|
||||
})
|
||||
self.count = 0
|
||||
self.treecount = 0
|
||||
@@ -98,61 +92,8 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||
self.header_name = []
|
||||
self.header_val = []
|
||||
self.main_dict = {}
|
||||
|
||||
def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[],data=''):
|
||||
self._node.data = ''
|
||||
node = self._find_parent(self._node, nodes_parent or parents)
|
||||
ns = node.nextSibling
|
||||
#start
|
||||
if (not name in ['array','array_header']):
|
||||
return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False)
|
||||
|
||||
array_header = eval(data,{'year':'Fiscal Year','periods':'Periods'})
|
||||
# value = [array_header]
|
||||
value = []
|
||||
value.extend(self.header_name)
|
||||
|
||||
if name=='array':
|
||||
type = ['float']*len(self.header_name)
|
||||
else:
|
||||
type = ['lable'] * (len(self.header_name))
|
||||
|
||||
width = [438/float(len(value))]*(len(value))
|
||||
|
||||
if not lst:
|
||||
lst.append(1)
|
||||
for ns in node.childNodes :
|
||||
if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td :
|
||||
width_str = ns._attrs['colWidths'].nodeValue
|
||||
ns.removeAttribute('colWidths')
|
||||
# total_td = td * len(value)
|
||||
|
||||
if not width:
|
||||
for v in value:
|
||||
width.append(30)
|
||||
for v in range(len(width)):
|
||||
width_str +=',%d'%width[v]
|
||||
|
||||
ns.setAttribute('colWidths',width_str)
|
||||
|
||||
child_list = ns.childNodes
|
||||
for child in child_list:
|
||||
if child.nodeName=='tr':
|
||||
lc = child.childNodes[1]
|
||||
i=0
|
||||
for v in value:
|
||||
newnode = lc.cloneNode(1)
|
||||
if type[i] == 'float':
|
||||
t1="[[ '%.2f' % " + "%s['%s'] ]]"%(name,v)
|
||||
if type[i] == 'lable':
|
||||
t1="%s"%(v)
|
||||
else:
|
||||
t1="[[ %s['%s'] ]]"%(name,v)
|
||||
newnode.childNodes[1].lastChild.data = t1
|
||||
child.appendChild(newnode)
|
||||
newnode=False
|
||||
i+=1
|
||||
return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False)
|
||||
#
|
||||
|
||||
def lines(self,data):
|
||||
res={}
|
||||
@@ -193,12 +134,30 @@ class accounting_report_indicator(report_sxw.rml_parse):
|
||||
result.append(res)
|
||||
return result
|
||||
|
||||
def getarray_head(self,data,object,array_header=''):
|
||||
self.getgraph(data,object,intercall=True)
|
||||
self.header_val=[str(x) for x in self.header_val]
|
||||
if data['select_base'] == 'year':
|
||||
year = [1,2,3,4,5,6,7,8]
|
||||
temp_head = [str(x) for x in self.header_name]
|
||||
head_dict = dict(zip(year,temp_head))
|
||||
else:
|
||||
temp_head = [str(x[0:3]) for x in self.header_name]
|
||||
head_dict = dict(zip(temp_head,temp_head))
|
||||
print "head_dict",head_dict
|
||||
return [head_dict]
|
||||
|
||||
def getarray(self,data,object,array_header=''):
|
||||
res={}
|
||||
result=[]
|
||||
self.getgraph(data,object,intercall=True)
|
||||
self.header_val=[str(x) for x in self.header_val]
|
||||
temp_dict=zip(self.header_name,self.header_val)
|
||||
self.header_val = [str(x) for x in self.header_val]
|
||||
if data['select_base'] == 'year':
|
||||
year = [1,2,3,4,5,6,7,8]
|
||||
temp_dict = zip(year,self.header_val)
|
||||
else:
|
||||
temp_head = [str(x[0:3]) for x in self.header_name]
|
||||
temp_dict = zip(temp_head,self.header_val)
|
||||
res=dict(temp_dict)
|
||||
array_header = eval(array_header,{'year':'Fiscal Year','periods':'Periods'})
|
||||
res[array_header]=object['name']
|
||||
|
||||
@@ -81,101 +81,93 @@
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<blockTable colWidths="520.0" style="Standard_Outline">
|
||||
<blockTable colWidths="520.0" style="Standard_Outline">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_header_Centre">Indicators</para>
|
||||
</td>
|
||||
<td><para style="terp_header_Centre">Indicators</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="264.0,264.0" style="Table2">
|
||||
</blockTable>
|
||||
<blockTable colWidths="264.0,264.0" style="Table2">
|
||||
<tr>
|
||||
<td><para style="P14">[[ company.name ]]</para></td>
|
||||
<td><para style="P4">Currency: <font face="Times-Roman" size="11.0">[[ company.currency_id.name]]</font></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P4"><font color="white"> </font></para>
|
||||
<para style="P1">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<blockTable colWidths="528.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P14">[[ company.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Currency: <font face="Times-Roman" size="11.0">[[ company.currency_id.name]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<para style="P6">Name</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P1">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||
<blockTable colWidths="528.0" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6">Name</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P3"><seqReset/></para>
|
||||
<section>
|
||||
<para style="P1">[[ repeatIn(lines(data['form']),'o')]]</para>
|
||||
<blockTable colWidths="528.0" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11"><font>[['.....'*(o['level']) ]][[ setTag('font','font',{'color':'white'}) ]]</font><b>(<seq/>)</b> [[ o['type']=='view' and setTag('para','para',{'fontName':'Helvetica-Bold','fontSize':'10.5'}) ]][[ o['name'] ]] ([[ o['code'] ]])</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P1">[[ o['disp_tree'] and setTag('para','image',{'file':gettree(data['form'],o)}) or removeParentNode('para') ]]</para>
|
||||
<para style="P1">[[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'215.00','file':getgraph(data['form'],o)}) or removeParentNode('para') ]]</para>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="528.0" repeatRows="1" style="Table7">
|
||||
<tr><td>
|
||||
<para style="P5"><font>[['..........'*(o['level']) ]][[ setTag('font','font',{'color':'white'}) ]]</font><b>Expression :</b> [[ o['expression'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="528.0" repeatRows="1" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5"> <font>[['..........'*(o['level']) ]][[ setTag('font','font',{'color':'white'}) ]]</font> [[ format(o['note']) or removeParentNode('blockTable') ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<pageBreak/>
|
||||
<para style="P10">
|
||||
<u>Tabular Summary</u>
|
||||
</para>
|
||||
<section>
|
||||
<para style="P13">[[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array_header',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]]</para>
|
||||
<blockTable colWidths="0.00,90.00" style="Table4">
|
||||
</blockTable>
|
||||
<para style="P3"><font color="white"> </font></para>
|
||||
<para style="P3"><seqReset/></para>
|
||||
<section>
|
||||
<para style="P1">[[ repeatIn(lines(data['form']),'o')]]</para>
|
||||
<blockTable colWidths="528.0" style="Table7">
|
||||
<tr>
|
||||
<td><para style="P11"><font color="white">[['.....'*(o['level']) ]]</font><font>[[ o['type']=='view' and setTag('para','para',{'fontName':'Helvetica-Bold','fontSize':'10.5'}) ]]</font>(<seq/>)<font>[[ o['name'] ]] ([[ o['code'] ]])</font></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P1">[[ o['disp_tree'] and setTag('para','image',{'file':gettree(data['form'],o)}) or removeParentNode('para') ]]</para>
|
||||
<para style="P1">[[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'215.00','file':getgraph(data['form'],o)}) or removeParentNode('para') ]]</para>
|
||||
<para style="P3"><font color="white"> </font></para>
|
||||
<blockTable colWidths="528.0" repeatRows="1" style="Table7">
|
||||
<tr>
|
||||
<td><para style="P5"><font color="white">[['..........' *(o['level']) ]]</font><b>Expression :</b>[[ o['expression'] ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="528.0" repeatRows="1" style="Table7">
|
||||
<tr>
|
||||
<td><para style="P5"> <font color="white">[['..........'*(o['level']) ]]</font> <font>[[ format(o['note']) or removeParentNode('blockTable') ]]</font></para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<pageBreak/>
|
||||
<para style="P10"><u>Tabular Summary</u></para>
|
||||
<section>
|
||||
<para style="P13">[[ repeatIn(getarray_head(data['form'],o,array_header=data['form']['select_base']),'array_header')]]</para>
|
||||
<blockTable colWidths="90,36,36,36,36,36,36,36,36,36,36,36,36" style="Table4">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3"> </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">Indicators</para>
|
||||
</td>
|
||||
<td><para style="P3">Indicators</para></td>
|
||||
<td><para style="P3">[[ array_header['Jan'] or '' ]][[ array_header[1] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Feb'] or '' ]][[ array_header[2] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Mar'] or '' ]][[ array_header[3] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Apr'] or '' ]][[ array_header[4] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['May'] or '' ]][[ array_header[5] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Jun'] or '' ]][[ array_header[6] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Jul'] or '' ]][[ array_header[7] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Aug'] or '' ]][[ array_header[8] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Sep'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Oct'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Nov'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array_header['Dec'] or '' ]]</para></td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
<section>
|
||||
</section>
|
||||
<section>
|
||||
<para style="P1">[[ repeatIn(lines(data['form']),'obj')]]</para>
|
||||
<para style="P13">[[ repeatIn(getarray(data['form'],obj,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]]</para>
|
||||
<blockTable colWidths="0.00,90.00" style="Table3">
|
||||
<section>
|
||||
<para style="P13">[[ repeatIn(getarray(data['form'],obj,array_header=data['form']['select_base']),'array')]]</para>
|
||||
<blockTable colWidths="90,36,36,36,36,36,36,36,36,36,36,36,36" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9"> </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P5"><font>[['.....'*(obj['level']) ]][[ setTag('font','font',{'color':'white'}) ]]</font>[[ obj['code'] ]]</para>
|
||||
</td>
|
||||
<td><para style="P5"><font color="white">[['.....'*(obj['level']) ]]</font><font>[[ obj['code'] ]]</font></para></td>
|
||||
<td><para style="P3">[[ array['Jan'] or '' ]][[ array[1] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Feb'] or '' ]][[ array[2] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Mar'] or '' ]][[ array[3] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Apr'] or '' ]][[ array[4] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['May'] or '' ]][[ array[5] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Jun'] or '' ]][[ array[6] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Jul'] or '' ]][[ array[7] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Aug'] or '' ]][[ array[8] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Sep'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Oct'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Nov'] or '' ]]</para></td>
|
||||
<td><para style="P3">[[ array['Dec'] or '' ]]</para></td>
|
||||
</tr>
|
||||
|
||||
</blockTable>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user