[IMP] Deprecating RML reporting for surveys, will be replaced by a qweb-based one
bzr revid: rim@openerp.com-20131022131935-7zww5gzvhg32p412
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# # -*- encoding: utf-8 -*-
|
||||
# ##############################################################################
|
||||
# #
|
||||
# # OpenERP, Open Source Management Solution
|
||||
# # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# # $Id$
|
||||
# #
|
||||
# # This program is free software: you can redistribute it and/or modify
|
||||
# # it under the terms of the GNU Affero General Public License as published by
|
||||
# # the Free Software Foundation, either version 3 of the License, or
|
||||
# # (at your option) any later version.
|
||||
# #
|
||||
# # This program is distributed in the hope that it will be useful,
|
||||
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# # GNU Affero General Public License for more details.
|
||||
# #
|
||||
# # You should have received a copy of the GNU Affero General Public License
|
||||
# # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import survey_analysis_report
|
||||
import survey_form
|
||||
import survey_browse_response
|
||||
# import survey_analysis_report
|
||||
# import survey_form
|
||||
# import survey_browse_response
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,385 +1,385 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# # -*- encoding: utf-8 -*-
|
||||
# ##############################################################################
|
||||
# #
|
||||
# # OpenERP, Open Source Management Solution
|
||||
# # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# # $Id$
|
||||
# #
|
||||
# # This program is free software: you can redistribute it and/or modify
|
||||
# # it under the terms of the GNU Affero General Public License as published by
|
||||
# # the Free Software Foundation, either version 3 of the License, or
|
||||
# # (at your option) any later version.
|
||||
# #
|
||||
# # This program is distributed in the hope that it will be useful,
|
||||
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# # GNU Affero General Public License for more details.
|
||||
# #
|
||||
# # You should have received a copy of the GNU Affero General Public License
|
||||
# # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import time
|
||||
# import time
|
||||
|
||||
import openerp
|
||||
from openerp import tools
|
||||
from openerp.report import report_sxw
|
||||
from openerp.report.interface import report_rml
|
||||
from openerp.tools import to_xml
|
||||
# import openerp
|
||||
# from openerp import tools
|
||||
# from openerp.report import report_sxw
|
||||
# from openerp.report.interface import report_rml
|
||||
# from openerp.tools import to_xml
|
||||
|
||||
class survey_analysis(report_rml):
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
registry = openerp.registry(cr.dbname)
|
||||
surv_obj = registry['survey']
|
||||
user_obj = registry['res.users']
|
||||
rml_obj=report_sxw.rml_parse(cr, uid, surv_obj._name,context)
|
||||
company=user_obj.browse(cr,uid,[uid],context)[0].company_id
|
||||
# class survey_analysis(report_rml):
|
||||
# def create(self, cr, uid, ids, datas, context):
|
||||
# registry = openerp.registry(cr.dbname)
|
||||
# surv_obj = registry['survey']
|
||||
# user_obj = registry['res.users']
|
||||
# rml_obj=report_sxw.rml_parse(cr, uid, surv_obj._name,context)
|
||||
# company=user_obj.browse(cr,uid,[uid],context)[0].company_id
|
||||
|
||||
rml ="""<document filename="Survey Analysis Report.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Survey Analysis" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
|
||||
<pageTemplate>
|
||||
<frame id="first" x1="1.3cm" y1="1.5cm" width="18.4cm" height="26.5cm"/>
|
||||
<pageGraphics>
|
||||
<fill color="black"/>
|
||||
<stroke color="black"/>
|
||||
<setFont name="DejaVu Sans" size="8"/>
|
||||
<drawString x="1.3cm" y="28.3cm"> """+to_xml(rml_obj.formatLang(time.strftime("%Y-%m-%d %H:%M:%S"),date_time=True))+"""</drawString>
|
||||
<setFont name="DejaVu Sans Bold" size="10"/>
|
||||
<drawString x="9.8cm" y="28.3cm">"""+ to_xml(company.name) +"""</drawString>
|
||||
<stroke color="#000000"/>
|
||||
<lines>1.3cm 28.1cm 20cm 28.1cm</lines>
|
||||
</pageGraphics>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table3">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="2,-1"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table4">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table5">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_heading">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table_head_2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="answer_right" alignment="RIGHT" fontName="helvetica" fontSize="09.0" leftIndent="2.0"/>
|
||||
<paraStyle name="Standard1" fontName="helvetica-bold" alignment="RIGHT" fontSize="09.0"/>
|
||||
<paraStyle name="Standard" alignment="LEFT" fontName="Helvetica-Bold" fontSize="11.0"/>
|
||||
<paraStyle name="header1" fontName="Helvetica" fontSize="11.0"/>
|
||||
<paraStyle name="response" fontName="Helvetica-oblique" fontSize="9.5"/>
|
||||
<paraStyle name="response-bold" fontName="Helvetica-bold" fontSize="9" alignment="RIGHT" />
|
||||
<paraStyle name="page" fontName="helvetica" fontSize="11.0" leftIndent="0.0"/>
|
||||
<paraStyle name="question" fontName="helvetica-boldoblique" fontSize="10.0" leftIndent="3.0"/>
|
||||
<paraStyle name="answer_bold" fontName="Helvetica-Bold" fontSize="09.0" leftIndent="2.0"/>
|
||||
<paraStyle name="answer" fontName="helvetica" fontSize="09.0" leftIndent="2.0"/>
|
||||
<paraStyle name="Title" fontName="helvetica" fontSize="20.0" leading="15" spaceBefore="6.0" spaceAfter="6.0" alignment="CENTER"/>
|
||||
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="terp_default_Center_heading" fontName="Helvetica-bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
"""
|
||||
# rml ="""<document filename="Survey Analysis Report.pdf">
|
||||
# <template pageSize="(595.0,842.0)" title="Survey Analysis" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
|
||||
# <pageTemplate>
|
||||
# <frame id="first" x1="1.3cm" y1="1.5cm" width="18.4cm" height="26.5cm"/>
|
||||
# <pageGraphics>
|
||||
# <fill color="black"/>
|
||||
# <stroke color="black"/>
|
||||
# <setFont name="DejaVu Sans" size="8"/>
|
||||
# <drawString x="1.3cm" y="28.3cm"> """+to_xml(rml_obj.formatLang(time.strftime("%Y-%m-%d %H:%M:%S"),date_time=True))+"""</drawString>
|
||||
# <setFont name="DejaVu Sans Bold" size="10"/>
|
||||
# <drawString x="9.8cm" y="28.3cm">"""+ to_xml(company.name) +"""</drawString>
|
||||
# <stroke color="#000000"/>
|
||||
# <lines>1.3cm 28.1cm 20cm 28.1cm</lines>
|
||||
# </pageGraphics>
|
||||
# </pageTemplate>
|
||||
# </template>
|
||||
# <stylesheet>
|
||||
# <blockTableStyle id="Table1">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="Table2">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="Table3">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,0" stop="2,-1"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="Table4">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="Table5">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="Table_heading">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="Table_head_2">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <initialize>
|
||||
# <paraStyle name="all" alignment="justify"/>
|
||||
# </initialize>
|
||||
# <paraStyle name="answer_right" alignment="RIGHT" fontName="helvetica" fontSize="09.0" leftIndent="2.0"/>
|
||||
# <paraStyle name="Standard1" fontName="helvetica-bold" alignment="RIGHT" fontSize="09.0"/>
|
||||
# <paraStyle name="Standard" alignment="LEFT" fontName="Helvetica-Bold" fontSize="11.0"/>
|
||||
# <paraStyle name="header1" fontName="Helvetica" fontSize="11.0"/>
|
||||
# <paraStyle name="response" fontName="Helvetica-oblique" fontSize="9.5"/>
|
||||
# <paraStyle name="response-bold" fontName="Helvetica-bold" fontSize="9" alignment="RIGHT" />
|
||||
# <paraStyle name="page" fontName="helvetica" fontSize="11.0" leftIndent="0.0"/>
|
||||
# <paraStyle name="question" fontName="helvetica-boldoblique" fontSize="10.0" leftIndent="3.0"/>
|
||||
# <paraStyle name="answer_bold" fontName="Helvetica-Bold" fontSize="09.0" leftIndent="2.0"/>
|
||||
# <paraStyle name="answer" fontName="helvetica" fontSize="09.0" leftIndent="2.0"/>
|
||||
# <paraStyle name="Title" fontName="helvetica" fontSize="20.0" leading="15" spaceBefore="6.0" spaceAfter="6.0" alignment="CENTER"/>
|
||||
# <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
# <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
# <paraStyle name="terp_default_Center_heading" fontName="Helvetica-bold" fontSize="9.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
# <paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
# </stylesheet>
|
||||
# <images/>
|
||||
# """
|
||||
|
||||
if datas.has_key('form') and datas['form']['survey_ids']:
|
||||
ids = datas['form']['survey_ids']
|
||||
# if datas.has_key('form') and datas['form']['survey_ids']:
|
||||
# ids = datas['form']['survey_ids']
|
||||
|
||||
for survey in surv_obj.browse(cr, uid, ids):
|
||||
rml += """<story>
|
||||
<para style="Title">Answers Summary</para>
|
||||
<para style="Standard"><font></font></para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="280.0,100.0,120.0" style="Table_heading">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Survey Title </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Total Started Survey </para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_tblheader_General_Centre">Total Completed Survey </para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<blockTable colWidths="280.0,100.0,120.0" style="Table_head_2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + to_xml(tools.ustr(survey.title)) + """</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + str(survey.tot_start_survey) + """</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">""" + str(survey.tot_comp_survey) + """</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>"""
|
||||
for page in survey.page_ids:
|
||||
rml += """ <blockTable colWidths="500" style="Table4">
|
||||
<tr>
|
||||
<td><para style="page">Page :- """ + to_xml(tools.ustr(page.title)) + """</para></td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
for que in page.question_ids:
|
||||
rml +="""<blockTable colWidths="500" style="Table5">
|
||||
<tr>
|
||||
<td><para style="question">""" + to_xml(tools.ustr(que.question)) + """</para></td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
cols_widhts = []
|
||||
# for survey in surv_obj.browse(cr, uid, ids):
|
||||
# rml += """<story>
|
||||
# <para style="Title">Answers Summary</para>
|
||||
# <para style="Standard"><font></font></para>
|
||||
# <para style="P2">
|
||||
# <font color="white"> </font>
|
||||
# </para>
|
||||
# <blockTable colWidths="280.0,100.0,120.0" style="Table_heading">
|
||||
# <tr>
|
||||
# <td>
|
||||
# <para style="terp_tblheader_General_Centre">Survey Title </para>
|
||||
# </td>
|
||||
# <td>
|
||||
# <para style="terp_tblheader_General_Centre">Total Started Survey </para>
|
||||
# </td>
|
||||
# <td>
|
||||
# <para style="terp_tblheader_General_Centre">Total Completed Survey </para>
|
||||
# </td>
|
||||
# </tr>
|
||||
# </blockTable>
|
||||
# <blockTable colWidths="280.0,100.0,120.0" style="Table_head_2">
|
||||
# <tr>
|
||||
# <td>
|
||||
# <para style="terp_default_Centre_8">""" + to_xml(tools.ustr(survey.title)) + """</para>
|
||||
# </td>
|
||||
# <td>
|
||||
# <para style="terp_default_Centre_8">""" + str(survey.tot_start_survey) + """</para>
|
||||
# </td>
|
||||
# <td>
|
||||
# <para style="terp_default_Centre_8">""" + str(survey.tot_comp_survey) + """</para>
|
||||
# </td>
|
||||
# </tr>
|
||||
# </blockTable>
|
||||
# <para style="P2">
|
||||
# <font color="white"> </font>
|
||||
# </para>"""
|
||||
# for page in survey.page_ids:
|
||||
# rml += """ <blockTable colWidths="500" style="Table4">
|
||||
# <tr>
|
||||
# <td><para style="page">Page :- """ + to_xml(tools.ustr(page.title)) + """</para></td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
# for que in page.question_ids:
|
||||
# rml +="""<blockTable colWidths="500" style="Table5">
|
||||
# <tr>
|
||||
# <td><para style="question">""" + to_xml(tools.ustr(que.question)) + """</para></td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
# cols_widhts = []
|
||||
|
||||
if que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans']:
|
||||
cols_widhts.append(200)
|
||||
for col in range(0, len(que.column_heading_ids) + 1):
|
||||
cols_widhts.append(float(300 / (len(que.column_heading_ids) + 1)))
|
||||
colWidths = ",".join(map(tools.ustr, cols_widhts))
|
||||
matrix_ans = [(0,'')]
|
||||
# if que.type in ['matrix_of_choices_only_one_ans','matrix_of_choices_only_multi_ans']:
|
||||
# cols_widhts.append(200)
|
||||
# for col in range(0, len(que.column_heading_ids) + 1):
|
||||
# cols_widhts.append(float(300 / (len(que.column_heading_ids) + 1)))
|
||||
# colWidths = ",".join(map(tools.ustr, cols_widhts))
|
||||
# matrix_ans = [(0,'')]
|
||||
|
||||
for col in que.column_heading_ids:
|
||||
if col.title not in matrix_ans:
|
||||
matrix_ans.append((col.id,col.title))
|
||||
rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
|
||||
for mat_col in range(0, len(matrix_ans)):
|
||||
rml+="""<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
|
||||
rml += """<td><para style="response-bold">Answer Count</para></td>
|
||||
</tr>"""
|
||||
last_col = cols_widhts[-1]
|
||||
# for col in que.column_heading_ids:
|
||||
# if col.title not in matrix_ans:
|
||||
# matrix_ans.append((col.id,col.title))
|
||||
# rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
|
||||
# for mat_col in range(0, len(matrix_ans)):
|
||||
# rml+="""<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
|
||||
# rml += """<td><para style="response-bold">Answer Count</para></td>
|
||||
# </tr>"""
|
||||
# last_col = cols_widhts[-1]
|
||||
|
||||
for ans in que.answer_choice_ids:
|
||||
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %s", (ans.id,))
|
||||
tot_res = cr.fetchone()[0]
|
||||
cr.execute("select count(id) ,sra.column_id from survey_response_answer sra where sra.answer_id=%s group by sra.column_id", (ans.id,))
|
||||
calc_res = cr.dictfetchall()
|
||||
for mat_col in range(1, len(matrix_ans)):
|
||||
percantage = 0.0
|
||||
cal_count = 0
|
||||
for cal in calc_res:
|
||||
if cal['column_id'] == matrix_ans[mat_col][0]:
|
||||
cal_count = cal['count']
|
||||
if tot_res:
|
||||
percantage = round(float(cal_count)*100 / tot_res,2)
|
||||
if percantage:
|
||||
rml += """<td color="#FFF435"><para style="answer_bold">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
|
||||
else:
|
||||
rml += """<td color="#FFF435"><para style="answer">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
|
||||
rml += """<td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td>
|
||||
</tr>"""
|
||||
rml += """</blockTable>"""
|
||||
# for ans in que.answer_choice_ids:
|
||||
# rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
# cr.execute("select count(id) from survey_response_answer sra where sra.answer_id = %s", (ans.id,))
|
||||
# tot_res = cr.fetchone()[0]
|
||||
# cr.execute("select count(id) ,sra.column_id from survey_response_answer sra where sra.answer_id=%s group by sra.column_id", (ans.id,))
|
||||
# calc_res = cr.dictfetchall()
|
||||
# for mat_col in range(1, len(matrix_ans)):
|
||||
# percantage = 0.0
|
||||
# cal_count = 0
|
||||
# for cal in calc_res:
|
||||
# if cal['column_id'] == matrix_ans[mat_col][0]:
|
||||
# cal_count = cal['count']
|
||||
# if tot_res:
|
||||
# percantage = round(float(cal_count)*100 / tot_res,2)
|
||||
# if percantage:
|
||||
# rml += """<td color="#FFF435"><para style="answer_bold">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
|
||||
# else:
|
||||
# rml += """<td color="#FFF435"><para style="answer">""" + tools.ustr(percantage) +"% (" + tools.ustr(cal_count) + """)</para></td>"""
|
||||
# rml += """<td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td>
|
||||
# </tr>"""
|
||||
# rml += """</blockTable>"""
|
||||
|
||||
if que.is_comment_require:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''",(que.id,))
|
||||
tot_res = cr.fetchone()[0]
|
||||
rml += """<blockTable colWidths=" """+ str(500 - last_col) +"," + str(last_col) + """ " style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
<td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
# if que.is_comment_require:
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''",(que.id,))
|
||||
# tot_res = cr.fetchone()[0]
|
||||
# rml += """<blockTable colWidths=" """+ str(500 - last_col) +"," + str(last_col) + """ " style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
# <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
|
||||
elif que.type in['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'multiple_textboxes','date_and_time','date','multiple_textboxes_diff_type']:
|
||||
rml += """<blockTable colWidths="240.0,210,50.0" style="Table1">"""
|
||||
rml += """ <tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="terp_default_Center_heading">Answer Percentage</para></td>
|
||||
<td> <para style="response-bold">Answer Count</para></td>
|
||||
</tr>"""
|
||||
# elif que.type in['multiple_choice_only_one_ans', 'multiple_choice_multiple_ans', 'multiple_textboxes','date_and_time','date','multiple_textboxes_diff_type']:
|
||||
# rml += """<blockTable colWidths="240.0,210,50.0" style="Table1">"""
|
||||
# rml += """ <tr>
|
||||
# <td> <para style="Standard"> </para></td>
|
||||
# <td> <para style="terp_default_Center_heading">Answer Percentage</para></td>
|
||||
# <td> <para style="response-bold">Answer Count</para></td>
|
||||
# </tr>"""
|
||||
|
||||
for ans in que.answer_choice_ids:
|
||||
progress = ans.average * 7 / 100
|
||||
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
|
||||
<td>
|
||||
<illustration>
|
||||
<stroke color="lightslategray"/>
|
||||
<rect x="0.1cm" y="-0.45cm" width="7.2 cm" height="0.5cm" fill="no" stroke="yes" round="0.1cm"/>
|
||||
"""
|
||||
if progress:
|
||||
rml += """<fill color="lightsteelblue"/>
|
||||
<rect x="0.2cm" y="-0.35cm" width='""" + tools.ustr(str(float(progress)) +'cm') + """' height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>"""
|
||||
rml += """
|
||||
<fill color="black"/>
|
||||
<setFont name="Helvetica" size="9"/>
|
||||
<drawString x="3.2cm" y="-0.30cm">""" + tools.ustr(ans.average) + """%</drawString></illustration>
|
||||
</td>
|
||||
<td><para style="answer_right">""" + tools.ustr(ans.response) + """</para></td></tr>"""
|
||||
rml += """</blockTable>"""
|
||||
# for ans in que.answer_choice_ids:
|
||||
# progress = ans.average * 7 / 100
|
||||
# rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
|
||||
# <td>
|
||||
# <illustration>
|
||||
# <stroke color="lightslategray"/>
|
||||
# <rect x="0.1cm" y="-0.45cm" width="7.2 cm" height="0.5cm" fill="no" stroke="yes" round="0.1cm"/>
|
||||
# """
|
||||
# if progress:
|
||||
# rml += """<fill color="lightsteelblue"/>
|
||||
# <rect x="0.2cm" y="-0.35cm" width='""" + tools.ustr(str(float(progress)) +'cm') + """' height="0.3cm" fill="yes" stroke="no" round="0.1cm"/>"""
|
||||
# rml += """
|
||||
# <fill color="black"/>
|
||||
# <setFont name="Helvetica" size="9"/>
|
||||
# <drawString x="3.2cm" y="-0.30cm">""" + tools.ustr(ans.average) + """%</drawString></illustration>
|
||||
# </td>
|
||||
# <td><para style="answer_right">""" + tools.ustr(ans.response) + """</para></td></tr>"""
|
||||
# rml += """</blockTable>"""
|
||||
|
||||
if que.is_comment_require:
|
||||
# if que.make_comment_field:
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
|
||||
# tot_res = cr.fetchone()[0]
|
||||
# tot_avg = 0.00
|
||||
# if que.tot_resp:
|
||||
# tot_avg = round(float(tot_res * 100)/ que.tot_resp,2)
|
||||
# rml+="""<blockTable colWidths="280.0,120,100.0" style="Table1"><tr><td><para style="answer">""" +to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
# <td><para style="answer">""" + str(tot_avg) + """%</para></td>
|
||||
# <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
# else:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
|
||||
tot_res = cr.fetchone()[0]
|
||||
rml += """<blockTable colWidths="450.0,50.0" style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
<td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
# if que.is_comment_require:
|
||||
# # if que.make_comment_field:
|
||||
# # cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
|
||||
# # tot_res = cr.fetchone()[0]
|
||||
# # tot_avg = 0.00
|
||||
# # if que.tot_resp:
|
||||
# # tot_avg = round(float(tot_res * 100)/ que.tot_resp,2)
|
||||
# # rml+="""<blockTable colWidths="280.0,120,100.0" style="Table1"><tr><td><para style="answer">""" +to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
# # <td><para style="answer">""" + str(tot_avg) + """%</para></td>
|
||||
# # <td><para style="answer">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
# # else:
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %s and comment != ''", (que.id,))
|
||||
# tot_res = cr.fetchone()[0]
|
||||
# rml += """<blockTable colWidths="450.0,50.0" style="Table1"><tr><td><para style="answer_right">""" + to_xml(tools.ustr(que.comment_label)) + """</para></td>
|
||||
# <td><para style="answer_right">""" + tools.ustr(tot_res) + """</para></td></tr></blockTable>"""
|
||||
|
||||
elif que.type in['single_textbox']:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and single_text!=''",(que.id,))
|
||||
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response-bold">Answer Count</para></td>
|
||||
</tr>
|
||||
<tr><td><para style="answer"></para></td>
|
||||
<td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
|
||||
</blockTable>"""
|
||||
# elif que.type in['single_textbox']:
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %s and single_text!=''",(que.id,))
|
||||
# rml += """<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
# <tr>
|
||||
# <td> <para style="Standard"> </para></td>
|
||||
# <td> <para style="response-bold">Answer Count</para></td>
|
||||
# </tr>
|
||||
# <tr><td><para style="answer"></para></td>
|
||||
# <td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
|
||||
# </blockTable>"""
|
||||
|
||||
elif que.type in['comment']:
|
||||
cr.execute("select count(id) from survey_response_line where question_id = %s and comment !=''", (que.id,))
|
||||
rml += """<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response-bold">Answer Count</para></td>
|
||||
</tr>
|
||||
<tr><td><para style="answer"></para></td>
|
||||
<td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
|
||||
</blockTable>"""
|
||||
# elif que.type in['comment']:
|
||||
# cr.execute("select count(id) from survey_response_line where question_id = %s and comment !=''", (que.id,))
|
||||
# rml += """<blockTable colWidths="400.0,100.0" style="Table1">
|
||||
# <tr>
|
||||
# <td> <para style="Standard"> </para></td>
|
||||
# <td> <para style="response-bold">Answer Count</para></td>
|
||||
# </tr>
|
||||
# <tr><td><para style="answer"></para></td>
|
||||
# <td><para style="answer_right">""" + tools.ustr(cr.fetchone()[0]) + """ </para></td></tr>
|
||||
# </blockTable>"""
|
||||
|
||||
elif que.type in['rating_scale']:
|
||||
cols_widhts.append(200)
|
||||
for col in range(0,len(que.column_heading_ids) + 2):
|
||||
cols_widhts.append(float(300 / (len(que.column_heading_ids) + 2)))
|
||||
colWidths = ",".join(map(tools.ustr, cols_widhts))
|
||||
matrix_ans = [(0,'')]
|
||||
# elif que.type in['rating_scale']:
|
||||
# cols_widhts.append(200)
|
||||
# for col in range(0,len(que.column_heading_ids) + 2):
|
||||
# cols_widhts.append(float(300 / (len(que.column_heading_ids) + 2)))
|
||||
# colWidths = ",".join(map(tools.ustr, cols_widhts))
|
||||
# matrix_ans = [(0,'')]
|
||||
|
||||
for col in que.column_heading_ids:
|
||||
if col.title not in matrix_ans:
|
||||
matrix_ans.append((col.id,col.title))
|
||||
rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
|
||||
for mat_col in range(0,len(matrix_ans)):
|
||||
rml += """<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
|
||||
rml += """<td><para style="response-bold">Rating Average</para></td>
|
||||
<td><para style="response-bold">Answer Count</para></td>
|
||||
</tr>"""
|
||||
# for col in que.column_heading_ids:
|
||||
# if col.title not in matrix_ans:
|
||||
# matrix_ans.append((col.id,col.title))
|
||||
# rml += """<blockTable colWidths=" """ + colWidths + """ " style="Table1"><tr>"""
|
||||
# for mat_col in range(0,len(matrix_ans)):
|
||||
# rml += """<td><para style="response">""" + to_xml(tools.ustr(matrix_ans[mat_col][1])) + """</para></td>"""
|
||||
# rml += """<td><para style="response-bold">Rating Average</para></td>
|
||||
# <td><para style="response-bold">Answer Count</para></td>
|
||||
# </tr>"""
|
||||
|
||||
for ans in que.answer_choice_ids:
|
||||
rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
res_count = 0
|
||||
rating_weight_sum = 0
|
||||
for mat_col in range(1, len(matrix_ans)):
|
||||
cr.execute("select count(sra.answer_id) from survey_response_line sr, survey_response_answer sra\
|
||||
where sr.id = sra.response_line_id and sra.answer_id = %s and sra.column_id ='%s'", (ans.id,matrix_ans[mat_col][0]))
|
||||
tot_res = cr.fetchone()[0]
|
||||
cr.execute("select count(sra.answer_id),sqc.rating_weight from survey_response_line sr, survey_response_answer sra ,\
|
||||
survey_question_column_heading sqc where sr.id = sra.response_line_id and \
|
||||
sqc.question_id = sr.question_id and sra.answer_id = %s and sqc.title ='%s'\
|
||||
group by sra.answer_id,sqc.rating_weight", (ans.id,matrix_ans[mat_col][1]))
|
||||
col_weight = cr.fetchone()
|
||||
# for ans in que.answer_choice_ids:
|
||||
# rml += """<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
# res_count = 0
|
||||
# rating_weight_sum = 0
|
||||
# for mat_col in range(1, len(matrix_ans)):
|
||||
# cr.execute("select count(sra.answer_id) from survey_response_line sr, survey_response_answer sra\
|
||||
# where sr.id = sra.response_line_id and sra.answer_id = %s and sra.column_id ='%s'", (ans.id,matrix_ans[mat_col][0]))
|
||||
# tot_res = cr.fetchone()[0]
|
||||
# cr.execute("select count(sra.answer_id),sqc.rating_weight from survey_response_line sr, survey_response_answer sra ,\
|
||||
# survey_question_column_heading sqc where sr.id = sra.response_line_id and \
|
||||
# sqc.question_id = sr.question_id and sra.answer_id = %s and sqc.title ='%s'\
|
||||
# group by sra.answer_id,sqc.rating_weight", (ans.id,matrix_ans[mat_col][1]))
|
||||
# col_weight = cr.fetchone()
|
||||
|
||||
if not col_weight:
|
||||
col_weight= (0,0)
|
||||
elif not col_weight[1]:
|
||||
col_weight = (col_weight[0],0)
|
||||
res_count = col_weight[0]
|
||||
# if not col_weight:
|
||||
# col_weight= (0,0)
|
||||
# elif not col_weight[1]:
|
||||
# col_weight = (col_weight[0],0)
|
||||
# res_count = col_weight[0]
|
||||
|
||||
if tot_res and res_count:
|
||||
rating_weight_sum += int(col_weight[1]) * tot_res
|
||||
tot_per = round((float(tot_res) * 100) / int(res_count), 2)
|
||||
else:
|
||||
tot_per = 0.0
|
||||
if tot_res:
|
||||
rml += """<td><para style="answer_bold">""" + tools.ustr(tot_per) + "%(" + tools.ustr(tot_res) + """)</para></td>"""
|
||||
else:
|
||||
rml += """<td><para style="answer">""" + tools.ustr(tot_per)+"%(" + tools.ustr(tot_res) + """)</para></td>"""
|
||||
# if tot_res and res_count:
|
||||
# rating_weight_sum += int(col_weight[1]) * tot_res
|
||||
# tot_per = round((float(tot_res) * 100) / int(res_count), 2)
|
||||
# else:
|
||||
# tot_per = 0.0
|
||||
# if tot_res:
|
||||
# rml += """<td><para style="answer_bold">""" + tools.ustr(tot_per) + "%(" + tools.ustr(tot_res) + """)</para></td>"""
|
||||
# else:
|
||||
# rml += """<td><para style="answer">""" + tools.ustr(tot_per)+"%(" + tools.ustr(tot_res) + """)</para></td>"""
|
||||
|
||||
percantage = 0.00
|
||||
if res_count:
|
||||
percantage = round((float(rating_weight_sum)/res_count), 2)
|
||||
rml += """<td><para style="answer_right">""" + tools.ustr(percantage) + """</para></td>
|
||||
<td><para style="answer_right">""" + tools.ustr(res_count) + """</para></td></tr>"""
|
||||
rml += """</blockTable>"""
|
||||
# percantage = 0.00
|
||||
# if res_count:
|
||||
# percantage = round((float(rating_weight_sum)/res_count), 2)
|
||||
# rml += """<td><para style="answer_right">""" + tools.ustr(percantage) + """</para></td>
|
||||
# <td><para style="answer_right">""" + tools.ustr(res_count) + """</para></td></tr>"""
|
||||
# rml += """</blockTable>"""
|
||||
|
||||
elif que.type in['numerical_textboxes']:
|
||||
rml += """<blockTable colWidths="240.0,20,100.0,70,70.0" style="Table1">
|
||||
<tr>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="response">Answer Average</para></td>
|
||||
<td> <para style="response">Answer Total</para></td>
|
||||
<td> <para style="response-bold">Answer Count</para></td>
|
||||
</tr>"""
|
||||
for ans in que.answer_choice_ids:
|
||||
cr.execute("select answer from survey_response_answer where answer_id=%s group by answer", (ans.id,))
|
||||
tot_res = cr.dictfetchall()
|
||||
total = 0
|
||||
for tot in tot_res:
|
||||
total += int(tot['answer'])
|
||||
per = 0.00
|
||||
# elif que.type in['numerical_textboxes']:
|
||||
# rml += """<blockTable colWidths="240.0,20,100.0,70,70.0" style="Table1">
|
||||
# <tr>
|
||||
# <td> <para style="Standard"> </para></td>
|
||||
# <td> <para style="Standard"> </para></td>
|
||||
# <td> <para style="response">Answer Average</para></td>
|
||||
# <td> <para style="response">Answer Total</para></td>
|
||||
# <td> <para style="response-bold">Answer Count</para></td>
|
||||
# </tr>"""
|
||||
# for ans in que.answer_choice_ids:
|
||||
# cr.execute("select answer from survey_response_answer where answer_id=%s group by answer", (ans.id,))
|
||||
# tot_res = cr.dictfetchall()
|
||||
# total = 0
|
||||
# for tot in tot_res:
|
||||
# total += int(tot['answer'])
|
||||
# per = 0.00
|
||||
|
||||
if len(tot_res):
|
||||
per = round((float(total) / len(tot_res)),2)
|
||||
rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
|
||||
<td> <para style="Standard"> </para></td>
|
||||
<td> <para style="answer">""" + tools.ustr(per) +"""</para></td>
|
||||
<td><para style="answer">""" + tools.ustr(total) + """</para></td>
|
||||
<td><para style="answer_right">""" + tools.ustr(len(tot_res)) + """</para></td></tr>"""
|
||||
rml+="""</blockTable>"""
|
||||
# if len(tot_res):
|
||||
# per = round((float(total) / len(tot_res)),2)
|
||||
# rml+="""<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
|
||||
# <td> <para style="Standard"> </para></td>
|
||||
# <td> <para style="answer">""" + tools.ustr(per) +"""</para></td>
|
||||
# <td><para style="answer">""" + tools.ustr(total) + """</para></td>
|
||||
# <td><para style="answer_right">""" + tools.ustr(len(tot_res)) + """</para></td></tr>"""
|
||||
# rml+="""</blockTable>"""
|
||||
|
||||
rml +="""<blockTable colWidths="300,100,100.0" style="Table3">
|
||||
<tr>
|
||||
<td><para style="Standard1"></para></td>
|
||||
<td><para style="Standard1">Answered Question</para></td>
|
||||
<td><para style="Standard1">""" + tools.ustr(que.tot_resp) + """</para></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><para style="Standard1"></para></td>
|
||||
<td><para style="Standard1">Skipped Questions</para></td>
|
||||
<td><para style="Standard1">""" + tools.ustr(que.tot_resp - survey.tot_start_survey) + """</para></td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
rml += """</story>"""
|
||||
# rml +="""<blockTable colWidths="300,100,100.0" style="Table3">
|
||||
# <tr>
|
||||
# <td><para style="Standard1"></para></td>
|
||||
# <td><para style="Standard1">Answered Question</para></td>
|
||||
# <td><para style="Standard1">""" + tools.ustr(que.tot_resp) + """</para></td>
|
||||
# </tr>
|
||||
# <tr>
|
||||
# <td><para style="Standard1"></para></td>
|
||||
# <td><para style="Standard1">Skipped Questions</para></td>
|
||||
# <td><para style="Standard1">""" + tools.ustr(que.tot_resp - survey.tot_start_survey) + """</para></td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
# rml += """</story>"""
|
||||
|
||||
rml += """</document>"""
|
||||
report_type = datas.get('report_type', 'pdf')
|
||||
create_doc = self.generators[report_type]
|
||||
self.internal_header=True
|
||||
pdf = create_doc(rml, title=self.title)
|
||||
# rml += """</document>"""
|
||||
# report_type = datas.get('report_type', 'pdf')
|
||||
# create_doc = self.generators[report_type]
|
||||
# self.internal_header=True
|
||||
# pdf = create_doc(rml, title=self.title)
|
||||
|
||||
return (pdf, report_type)
|
||||
# return (pdf, report_type)
|
||||
|
||||
survey_analysis('report.survey.analysis', 'survey','','')
|
||||
# survey_analysis('report.survey.analysis', 'survey','','')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+386
-386
@@ -1,416 +1,416 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# # -*- encoding: utf-8 -*-
|
||||
# ##############################################################################
|
||||
# #
|
||||
# # OpenERP, Open Source Management Solution
|
||||
# # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# # $Id$
|
||||
# #
|
||||
# # This program is free software: you can redistribute it and/or modify
|
||||
# # it under the terms of the GNU Affero General Public License as published by
|
||||
# # the Free Software Foundation, either version 3 of the License, or
|
||||
# # (at your option) any later version.
|
||||
# #
|
||||
# # This program is distributed in the hope that it will be useful,
|
||||
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# # GNU Affero General Public License for more details.
|
||||
# #
|
||||
# # You should have received a copy of the GNU Affero General Public License
|
||||
# # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# #
|
||||
# ##############################################################################
|
||||
|
||||
import openerp
|
||||
from openerp import tools
|
||||
from openerp.report.interface import report_rml
|
||||
from openerp.tools import to_xml
|
||||
import lxml
|
||||
from lxml.html.clean import Cleaner
|
||||
cleaner = Cleaner(style=True, links=False, add_nofollow=True, page_structure=True, safe_attrs_only=True)
|
||||
# import openerp
|
||||
# from openerp import tools
|
||||
# from openerp.report.interface import report_rml
|
||||
# from openerp.tools import to_xml
|
||||
# import lxml
|
||||
# from lxml.html.clean import Cleaner
|
||||
# cleaner = Cleaner(style=True, links=False, add_nofollow=True, page_structure=True, safe_attrs_only=True)
|
||||
|
||||
|
||||
class survey_form(report_rml):
|
||||
def create(self, cr, uid, ids, datas, context):
|
||||
_divide_columns_for_matrix = 0.7
|
||||
_display_ans_in_rows = 5
|
||||
_pageSize = ('29.7cm','21.1cm')
|
||||
if datas.has_key('form') and datas['form'].get('orientation','') == 'vertical':
|
||||
if datas['form'].get('paper_size','') == 'letter':
|
||||
_pageSize = ('21.6cm','27.9cm')
|
||||
elif datas['form'].get('paper_size','') == 'legal':
|
||||
_pageSize = ('21.6cm','35.6cm')
|
||||
elif datas['form'].get('paper_size','') == 'a4':
|
||||
_pageSize = ('21.1cm','29.7cm')
|
||||
elif datas.has_key('form') and datas['form'].get('orientation','') == 'horizontal':
|
||||
if datas['form'].get('paper_size','') == 'letter':
|
||||
_pageSize = ('27.9cm','21.6cm')
|
||||
elif datas['form'].get('paper_size','') == 'legal':
|
||||
_pageSize = ('35.6cm','21.6cm')
|
||||
elif datas['form'].get('paper_size','') == 'a4':
|
||||
_pageSize = ('29.7cm','21.1cm')
|
||||
# class survey_form(report_rml):
|
||||
# def create(self, cr, uid, ids, datas, context):
|
||||
# _divide_columns_for_matrix = 0.7
|
||||
# _display_ans_in_rows = 5
|
||||
# _pageSize = ('29.7cm','21.1cm')
|
||||
# if datas.has_key('form') and datas['form'].get('orientation','') == 'vertical':
|
||||
# if datas['form'].get('paper_size','') == 'letter':
|
||||
# _pageSize = ('21.6cm','27.9cm')
|
||||
# elif datas['form'].get('paper_size','') == 'legal':
|
||||
# _pageSize = ('21.6cm','35.6cm')
|
||||
# elif datas['form'].get('paper_size','') == 'a4':
|
||||
# _pageSize = ('21.1cm','29.7cm')
|
||||
# elif datas.has_key('form') and datas['form'].get('orientation','') == 'horizontal':
|
||||
# if datas['form'].get('paper_size','') == 'letter':
|
||||
# _pageSize = ('27.9cm','21.6cm')
|
||||
# elif datas['form'].get('paper_size','') == 'legal':
|
||||
# _pageSize = ('35.6cm','21.6cm')
|
||||
# elif datas['form'].get('paper_size','') == 'a4':
|
||||
# _pageSize = ('29.7cm','21.1cm')
|
||||
|
||||
_frame_width = tools.ustr(_pageSize[0])
|
||||
_frame_height = tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.90))+'cm'
|
||||
_tbl_widths = tools.ustr(float(_pageSize[0].replace('cm','')) - float(2.10))+'cm'
|
||||
# _frame_width = tools.ustr(_pageSize[0])
|
||||
# _frame_height = tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.90))+'cm'
|
||||
# _tbl_widths = tools.ustr(float(_pageSize[0].replace('cm','')) - float(2.10))+'cm'
|
||||
|
||||
rml="""<document filename="Survey Form.pdf">
|
||||
<template pageSize="("""+_pageSize[0]+""","""+_pageSize[1]+""")" title='Survey Form' author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20" >
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="0.0cm" y1="1.0cm" width='"""+_frame_width+"""' height='"""+_frame_height+"""'/>
|
||||
<pageGraphics>
|
||||
<lineMode width="1.0"/>
|
||||
<lines>1.0cm """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) + 'cm' + """ """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) + 'cm' + """</lines>
|
||||
<lines>1.0cm """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) +'cm'+ """ 1.0cm 1.00cm</lines>
|
||||
<lines>""" + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm' + """ """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00)) + 'cm' + """ 1.00cm</lines>
|
||||
<lines>1.0cm 1.00cm """ + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" 1.00cm</lines>"""
|
||||
# rml="""<document filename="Survey Form.pdf">
|
||||
# <template pageSize="("""+_pageSize[0]+""","""+_pageSize[1]+""")" title='Survey Form' author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20" >
|
||||
# <pageTemplate id="first">
|
||||
# <frame id="first" x1="0.0cm" y1="1.0cm" width='"""+_frame_width+"""' height='"""+_frame_height+"""'/>
|
||||
# <pageGraphics>
|
||||
# <lineMode width="1.0"/>
|
||||
# <lines>1.0cm """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) + 'cm' + """ """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) + 'cm' + """</lines>
|
||||
# <lines>1.0cm """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00)) +'cm'+ """ 1.0cm 1.00cm</lines>
|
||||
# <lines>""" + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm' + """ """ + tools.ustr(float(_pageSize[1].replace('cm','')) - float(1.00))+'cm'+""" """+tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00)) + 'cm' + """ 1.00cm</lines>
|
||||
# <lines>1.0cm 1.00cm """ + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00))+'cm'+""" 1.00cm</lines>"""
|
||||
|
||||
if datas.has_key('form') and datas['form']['page_number']:
|
||||
rml +="""
|
||||
<fill color="gray"/>
|
||||
<setFont name="Helvetica" size="10"/>
|
||||
<drawRightString x='""" + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00)) + 'cm' + """' y="0.6cm">Page : <pageNumber/> </drawRightString>"""
|
||||
rml +="""</pageGraphics>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="ans_tbl">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="tbl_white">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="tbl_gainsboro">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
<blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="ans_tbl_white">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="ans_tbl_gainsboro">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
<blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="page_tbl">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
|
||||
<blockBackground colorName="gray" start="0,0" stop="-1,-1"/>
|
||||
<blockTextColor colorName="white" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="title_tbl">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
|
||||
<blockBackground colorName="black" start="0,0" stop="-1,-1"/>
|
||||
<blockTextColor colorName="white" start="0,0" stop="0,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="question_tbl">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="note_table">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="tbl">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="response" fontName="Helvetica-oblique" fontSize="9.5"/>
|
||||
<paraStyle name="page" fontName="helvetica-bold" fontSize="15.0" leftIndent="0.0" textColor="white"/>
|
||||
<paraStyle name="title" fontName="helvetica-bold" fontSize="18.0" leading="15" leftIndent="0.0" textColor="white"/>
|
||||
<paraStyle name="question" fontName="helvetica-boldoblique" fontSize="10.0" leftIndent="3.0"/>
|
||||
<paraStyle name="answer" fontName="helvetica" fontSize="09.0" leftIndent="0.0"/>
|
||||
<paraStyle name="descriptive_text" fontName="helvetica" fontSize="10.0" leftIndent="0.0"/>
|
||||
<paraStyle name="answer_left" alignment="LEFT" fontName="helvetica-bold" fontSize="8.0" leftIndent="0.0"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="comment" fontName="Helvetica" fontSize="14.0" leading="50" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
<paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="12" spaceBefore="0.0" spaceAfter="1.0"/>
|
||||
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
</stylesheet>
|
||||
<story>"""
|
||||
surv_obj = openerp.registry(cr.dbname)['survey']
|
||||
for survey in surv_obj.browse(cr,uid,ids):
|
||||
rml += """
|
||||
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
|
||||
<tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
|
||||
</blockTable>"""
|
||||
if survey.note:
|
||||
rml += """
|
||||
<para style="P2"></para>
|
||||
<blockTable colWidths='"""+_tbl_widths+"""' style="note_table">
|
||||
<tr><td><para style="descriptive_text">""" + to_xml(tools.ustr(survey.note)) + """</para><para style="P2"><font></font></para></td></tr>
|
||||
</blockTable>"""
|
||||
# if datas.has_key('form') and datas['form']['page_number']:
|
||||
# rml +="""
|
||||
# <fill color="gray"/>
|
||||
# <setFont name="Helvetica" size="10"/>
|
||||
# <drawRightString x='""" + tools.ustr(float(_pageSize[0].replace('cm','')) - float(1.00)) + 'cm' + """' y="0.6cm">Page : <pageNumber/> </drawRightString>"""
|
||||
# rml +="""</pageGraphics>
|
||||
# </pageTemplate>
|
||||
# </template>
|
||||
# <stylesheet>
|
||||
# <blockTableStyle id="ans_tbl">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="tbl_white">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="tbl_gainsboro">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
# <blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="ans_tbl_white">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="ans_tbl_gainsboro">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
|
||||
# <blockBackground colorName="gainsboro" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="page_tbl">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
|
||||
# <blockBackground colorName="gray" start="0,0" stop="-1,-1"/>
|
||||
# <blockTextColor colorName="white" start="0,0" stop="0,0"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="title_tbl">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="1,-1"/>
|
||||
# <blockBackground colorName="black" start="0,0" stop="-1,-1"/>
|
||||
# <blockTextColor colorName="white" start="0,0" stop="0,0"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="question_tbl">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#8f8f8f" start="0,-1" stop="1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="note_table">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# </blockTableStyle>
|
||||
# <blockTableStyle id="tbl">
|
||||
# <blockAlignment value="LEFT"/>
|
||||
# <blockValign value="TOP"/>
|
||||
# <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEBEFORE" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
# <lineStyle kind="LINEAFTER" colorName="#777777" start="0,0" stop="-1,-1"/>
|
||||
# </blockTableStyle>
|
||||
# <initialize>
|
||||
# <paraStyle name="all" alignment="justify"/>
|
||||
# </initialize>
|
||||
# <paraStyle name="response" fontName="Helvetica-oblique" fontSize="9.5"/>
|
||||
# <paraStyle name="page" fontName="helvetica-bold" fontSize="15.0" leftIndent="0.0" textColor="white"/>
|
||||
# <paraStyle name="title" fontName="helvetica-bold" fontSize="18.0" leading="15" leftIndent="0.0" textColor="white"/>
|
||||
# <paraStyle name="question" fontName="helvetica-boldoblique" fontSize="10.0" leftIndent="3.0"/>
|
||||
# <paraStyle name="answer" fontName="helvetica" fontSize="09.0" leftIndent="0.0"/>
|
||||
# <paraStyle name="descriptive_text" fontName="helvetica" fontSize="10.0" leftIndent="0.0"/>
|
||||
# <paraStyle name="answer_left" alignment="LEFT" fontName="helvetica-bold" fontSize="8.0" leftIndent="0.0"/>
|
||||
# <paraStyle name="P2" fontName="Helvetica" fontSize="14.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
# <paraStyle name="comment" fontName="Helvetica" fontSize="14.0" leading="50" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
# <paraStyle name="P1" fontName="Helvetica" fontSize="9.0" leading="12" spaceBefore="0.0" spaceAfter="1.0"/>
|
||||
# <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
# <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||
# </stylesheet>
|
||||
# <story>"""
|
||||
# surv_obj = openerp.registry(cr.dbname)['survey']
|
||||
# for survey in surv_obj.browse(cr,uid,ids):
|
||||
# rml += """
|
||||
# <blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
|
||||
# <tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
|
||||
# </blockTable>"""
|
||||
# if survey.note:
|
||||
# rml += """
|
||||
# <para style="P2"></para>
|
||||
# <blockTable colWidths='"""+_tbl_widths+"""' style="note_table">
|
||||
# <tr><td><para style="descriptive_text">""" + to_xml(tools.ustr(survey.note)) + """</para><para style="P2"><font></font></para></td></tr>
|
||||
# </blockTable>"""
|
||||
|
||||
seq = 0
|
||||
for page in survey.page_ids:
|
||||
seq += 1
|
||||
rml += """
|
||||
<blockTable colWidths='"""+_tbl_widths+"""' style="page_tbl">
|
||||
<tr><td><para style="page">"""+ tools.ustr(seq) + """. """ + to_xml(tools.ustr(page.title)) + """</para><para style="P2"><font></font></para></td></tr>
|
||||
</blockTable>"""
|
||||
if page.note:
|
||||
rml += """<para style="P2"></para><blockTable colWidths='"""+_tbl_widths+"""' style="note_table">
|
||||
<tr><td><para style="descriptive_text">""" + to_xml(tools.ustr(page.note or '')) + """</para></td></tr>
|
||||
</blockTable>"""
|
||||
# seq = 0
|
||||
# for page in survey.page_ids:
|
||||
# seq += 1
|
||||
# rml += """
|
||||
# <blockTable colWidths='"""+_tbl_widths+"""' style="page_tbl">
|
||||
# <tr><td><para style="page">"""+ tools.ustr(seq) + """. """ + to_xml(tools.ustr(page.title)) + """</para><para style="P2"><font></font></para></td></tr>
|
||||
# </blockTable>"""
|
||||
# if page.note:
|
||||
# rml += """<para style="P2"></para><blockTable colWidths='"""+_tbl_widths+"""' style="note_table">
|
||||
# <tr><td><para style="descriptive_text">""" + to_xml(tools.ustr(page.note or '')) + """</para></td></tr>
|
||||
# </blockTable>"""
|
||||
|
||||
for que in page.question_ids:
|
||||
cols_widhts = []
|
||||
rml += """
|
||||
<para style="P2"><font></font></para>
|
||||
<blockTable colWidths='"""+_tbl_widths+"""' style="question_tbl">
|
||||
<tr><td><para style="question">""" + to_xml(tools.ustr(que.question)) + """</para></td></tr>
|
||||
</blockTable>
|
||||
<para style="P2"><font></font></para>"""
|
||||
if que.descriptive_text:
|
||||
style = (que.type in ['descriptive_text']) and ' style="ans_tbl" ' or ""
|
||||
descriptive_text = lxml.etree.tostring(
|
||||
cleaner.clean_html(
|
||||
lxml.html.fromstring(que.descriptive_text)))
|
||||
rml += """
|
||||
<blockTable colWidths=" """ + _tbl_widths + """ " """ + style + """>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="descriptive_text">""" + descriptive_text + """</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
if que.type not in ['descriptive_text']:
|
||||
rml += """<para style="P2"><font></font></para>"""
|
||||
# for que in page.question_ids:
|
||||
# cols_widhts = []
|
||||
# rml += """
|
||||
# <para style="P2"><font></font></para>
|
||||
# <blockTable colWidths='"""+_tbl_widths+"""' style="question_tbl">
|
||||
# <tr><td><para style="question">""" + to_xml(tools.ustr(que.question)) + """</para></td></tr>
|
||||
# </blockTable>
|
||||
# <para style="P2"><font></font></para>"""
|
||||
# if que.descriptive_text:
|
||||
# style = (que.type in ['descriptive_text']) and ' style="ans_tbl" ' or ""
|
||||
# descriptive_text = lxml.etree.tostring(
|
||||
# cleaner.clean_html(
|
||||
# lxml.html.fromstring(que.descriptive_text)))
|
||||
# rml += """
|
||||
# <blockTable colWidths=" """ + _tbl_widths + """ " """ + style + """>
|
||||
# <tr>
|
||||
# <td>
|
||||
# <para style="descriptive_text">""" + descriptive_text + """</para>
|
||||
# </td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
# if que.type not in ['descriptive_text']:
|
||||
# rml += """<para style="P2"><font></font></para>"""
|
||||
|
||||
if que.type in ['descriptive_text']:
|
||||
continue
|
||||
# if que.type in ['descriptive_text']:
|
||||
# continue
|
||||
|
||||
elif que.type in ['multiple_choice_multiple_ans','multiple_choice_only_one_ans']:
|
||||
answer = []
|
||||
for ans in que.answer_choice_ids:
|
||||
answer.append(to_xml(tools.ustr((ans.answer))))
|
||||
# elif que.type in ['multiple_choice_multiple_ans','multiple_choice_only_one_ans']:
|
||||
# answer = []
|
||||
# for ans in que.answer_choice_ids:
|
||||
# answer.append(to_xml(tools.ustr((ans.answer))))
|
||||
|
||||
def divide_list(lst, n):
|
||||
return [lst[i::n] for i in range(n)]
|
||||
# def divide_list(lst, n):
|
||||
# return [lst[i::n] for i in range(n)]
|
||||
|
||||
divide_list = divide_list(answer,_display_ans_in_rows)
|
||||
for lst in divide_list:
|
||||
if que.type == 'multiple_choice_multiple_ans':
|
||||
if len(lst)<>0 and len(lst)<>int(round(float(len(answer))/_display_ans_in_rows,0)):
|
||||
lst.append('')
|
||||
if not lst:
|
||||
del divide_list[divide_list.index(lst):]
|
||||
for divide in divide_list:
|
||||
a = _divide_columns_for_matrix*len(divide)
|
||||
b = float(_tbl_widths.replace('cm','')) - float(a)
|
||||
cols_widhts = []
|
||||
# divide_list = divide_list(answer,_display_ans_in_rows)
|
||||
# for lst in divide_list:
|
||||
# if que.type == 'multiple_choice_multiple_ans':
|
||||
# if len(lst)<>0 and len(lst)<>int(round(float(len(answer))/_display_ans_in_rows,0)):
|
||||
# lst.append('')
|
||||
# if not lst:
|
||||
# del divide_list[divide_list.index(lst):]
|
||||
# for divide in divide_list:
|
||||
# a = _divide_columns_for_matrix*len(divide)
|
||||
# b = float(_tbl_widths.replace('cm','')) - float(a)
|
||||
# cols_widhts = []
|
||||
|
||||
for div in range(0,len(divide)):
|
||||
cols_widhts.append(float(a/len(divide)))
|
||||
cols_widhts.append(float(b/len(divide)))
|
||||
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
colWidths = colWidths +'cm'
|
||||
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
|
||||
<tr>"""
|
||||
for div in range(0,len(divide)):
|
||||
if divide[div] != '':
|
||||
if que.type == 'multiple_choice_multiple_ans':
|
||||
rml += """
|
||||
<td>
|
||||
<illustration>
|
||||
<rect x="0.1cm" y="-0.4cm" width="0.5 cm" height="0.5cm" fill="no" stroke="yes"/>
|
||||
</illustration>
|
||||
</td>
|
||||
<td><para style="answer">""" + divide[div] + """</para></td>"""
|
||||
else:
|
||||
rml += """
|
||||
<td>
|
||||
<illustration>
|
||||
<circle x="0.3cm" y="-0.18cm" radius="0.23 cm" fill="no" stroke="yes"/>
|
||||
</illustration>
|
||||
</td>
|
||||
<td><para style="answer">""" + divide[div] + """</para></td>"""
|
||||
else:
|
||||
rml += """
|
||||
<td></td>
|
||||
<td></td>"""
|
||||
rml += """
|
||||
</tr></blockTable>"""
|
||||
# for div in range(0,len(divide)):
|
||||
# cols_widhts.append(float(a/len(divide)))
|
||||
# cols_widhts.append(float(b/len(divide)))
|
||||
# colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
# colWidths = colWidths +'cm'
|
||||
# rml+="""<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
|
||||
# <tr>"""
|
||||
# for div in range(0,len(divide)):
|
||||
# if divide[div] != '':
|
||||
# if que.type == 'multiple_choice_multiple_ans':
|
||||
# rml += """
|
||||
# <td>
|
||||
# <illustration>
|
||||
# <rect x="0.1cm" y="-0.4cm" width="0.5 cm" height="0.5cm" fill="no" stroke="yes"/>
|
||||
# </illustration>
|
||||
# </td>
|
||||
# <td><para style="answer">""" + divide[div] + """</para></td>"""
|
||||
# else:
|
||||
# rml += """
|
||||
# <td>
|
||||
# <illustration>
|
||||
# <circle x="0.3cm" y="-0.18cm" radius="0.23 cm" fill="no" stroke="yes"/>
|
||||
# </illustration>
|
||||
# </td>
|
||||
# <td><para style="answer">""" + divide[div] + """</para></td>"""
|
||||
# else:
|
||||
# rml += """
|
||||
# <td></td>
|
||||
# <td></td>"""
|
||||
# rml += """
|
||||
# </tr></blockTable>"""
|
||||
|
||||
elif que.type in ['matrix_of_choices_only_one_ans','rating_scale','matrix_of_choices_only_multi_ans']:
|
||||
if len(que.column_heading_ids):
|
||||
cols_widhts.append(float(_tbl_widths.replace('cm',''))/float(2.0))
|
||||
for col in que.column_heading_ids:
|
||||
cols_widhts.append(float((float(_tbl_widths.replace('cm',''))/float(2.0))/len(que.column_heading_ids)))
|
||||
else:
|
||||
cols_widhts.append(float(_tbl_widths.replace('cm','')))
|
||||
# elif que.type in ['matrix_of_choices_only_one_ans','rating_scale','matrix_of_choices_only_multi_ans']:
|
||||
# if len(que.column_heading_ids):
|
||||
# cols_widhts.append(float(_tbl_widths.replace('cm',''))/float(2.0))
|
||||
# for col in que.column_heading_ids:
|
||||
# cols_widhts.append(float((float(_tbl_widths.replace('cm',''))/float(2.0))/len(que.column_heading_ids)))
|
||||
# else:
|
||||
# cols_widhts.append(float(_tbl_widths.replace('cm','')))
|
||||
|
||||
tmp = 0.0
|
||||
sum = 0.0
|
||||
i = 0
|
||||
if que.comment_column:
|
||||
for col in cols_widhts:
|
||||
if i == 0:
|
||||
cols_widhts[i] = cols_widhts[i]/2.0
|
||||
tmp = cols_widhts[i]
|
||||
sum += col
|
||||
i += 1
|
||||
cols_widhts.append(round(tmp,2))
|
||||
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
colWidths = colWidths+'cm'
|
||||
matrix_ans = ['',]
|
||||
# tmp = 0.0
|
||||
# sum = 0.0
|
||||
# i = 0
|
||||
# if que.comment_column:
|
||||
# for col in cols_widhts:
|
||||
# if i == 0:
|
||||
# cols_widhts[i] = cols_widhts[i]/2.0
|
||||
# tmp = cols_widhts[i]
|
||||
# sum += col
|
||||
# i += 1
|
||||
# cols_widhts.append(round(tmp,2))
|
||||
# colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
# colWidths = colWidths+'cm'
|
||||
# matrix_ans = ['',]
|
||||
|
||||
for col in que.column_heading_ids:
|
||||
if col.title not in matrix_ans:
|
||||
matrix_ans.append(col.title)
|
||||
if que.comment_column:
|
||||
matrix_ans.append(tools.ustr(que.column_name))
|
||||
rml+="""<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl"><tr>"""
|
||||
# for col in que.column_heading_ids:
|
||||
# if col.title not in matrix_ans:
|
||||
# matrix_ans.append(col.title)
|
||||
# if que.comment_column:
|
||||
# matrix_ans.append(tools.ustr(que.column_name))
|
||||
# rml+="""<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl"><tr>"""
|
||||
|
||||
for mat_col in matrix_ans:
|
||||
rml += """<td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
|
||||
rml += """</tr></blockTable>"""
|
||||
i = 0
|
||||
for ans in que.answer_choice_ids:
|
||||
if i%2 != 0:
|
||||
style='ans_tbl_white'
|
||||
else:
|
||||
style='ans_tbl_gainsboro'
|
||||
i += 1
|
||||
rml += """
|
||||
<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'>
|
||||
<tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
rec_width = float((sum-tmp)*10+100)
|
||||
value = ""
|
||||
# for mat_col in matrix_ans:
|
||||
# rml += """<td><para style="response">""" + to_xml(tools.ustr(mat_col)) + """</para></td>"""
|
||||
# rml += """</tr></blockTable>"""
|
||||
# i = 0
|
||||
# for ans in que.answer_choice_ids:
|
||||
# if i%2 != 0:
|
||||
# style='ans_tbl_white'
|
||||
# else:
|
||||
# style='ans_tbl_gainsboro'
|
||||
# i += 1
|
||||
# rml += """
|
||||
# <blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'>
|
||||
# <tr><td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>"""
|
||||
# rec_width = float((sum-tmp)*10+100)
|
||||
# value = ""
|
||||
|
||||
if que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
|
||||
value = """ <fill color="white"/>
|
||||
<circle x="0.35cm" y="-0.18cm" radius="0.25 cm" fill="yes" stroke="yes"/>"""
|
||||
else:
|
||||
value = """ <fill color="white"/>
|
||||
<rect x="0.1cm" y="-0.4cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>"""
|
||||
for mat_col in range(1,len(matrix_ans)):
|
||||
if matrix_ans[mat_col] == que.column_name:
|
||||
if mat_col == 1:
|
||||
rml += """
|
||||
<td><para style="answer_left">""" + to_xml(tools.ustr(que.column_name)) + """</para></td>"""
|
||||
else:
|
||||
rml += """<td></td>"""
|
||||
else:
|
||||
rml += """<td><illustration>""" + value + """</illustration></td>"""
|
||||
rml += """</tr></blockTable>"""
|
||||
# if que.type in ['matrix_of_choices_only_one_ans','rating_scale']:
|
||||
# value = """ <fill color="white"/>
|
||||
# <circle x="0.35cm" y="-0.18cm" radius="0.25 cm" fill="yes" stroke="yes"/>"""
|
||||
# else:
|
||||
# value = """ <fill color="white"/>
|
||||
# <rect x="0.1cm" y="-0.4cm" width="0.5 cm" height="0.5cm" fill="yes" stroke="yes" round="0.1cm"/>"""
|
||||
# for mat_col in range(1,len(matrix_ans)):
|
||||
# if matrix_ans[mat_col] == que.column_name:
|
||||
# if mat_col == 1:
|
||||
# rml += """
|
||||
# <td><para style="answer_left">""" + to_xml(tools.ustr(que.column_name)) + """</para></td>"""
|
||||
# else:
|
||||
# rml += """<td></td>"""
|
||||
# else:
|
||||
# rml += """<td><illustration>""" + value + """</illustration></td>"""
|
||||
# rml += """</tr></blockTable>"""
|
||||
|
||||
elif que.type in ['multiple_textboxes', 'numerical_textboxes', 'date_and_time','date','multiple_textboxes_diff_type']:
|
||||
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
|
||||
cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
|
||||
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
colWidths = tools.ustr(colWidths) + 'cm'
|
||||
for ans in que.answer_choice_ids:
|
||||
rml += """<para style="P1"></para>
|
||||
<blockTable colWidths=" """+ colWidths + """ " style="ans_tbl">
|
||||
<tr>
|
||||
<td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
|
||||
<td>
|
||||
<illustration>
|
||||
<rect x="0.0cm" y="-0.5cm" width='""" + tools.ustr(str(cols_widhts[0] - 0.3) + "cm") + """' height="0.6cm" fill="no" stroke="yes"/>
|
||||
</illustration>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
# elif que.type in ['multiple_textboxes', 'numerical_textboxes', 'date_and_time','date','multiple_textboxes_diff_type']:
|
||||
# cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
|
||||
# cols_widhts.append(float(_tbl_widths.replace('cm',''))/2)
|
||||
# colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
# colWidths = tools.ustr(colWidths) + 'cm'
|
||||
# for ans in que.answer_choice_ids:
|
||||
# rml += """<para style="P1"></para>
|
||||
# <blockTable colWidths=" """+ colWidths + """ " style="ans_tbl">
|
||||
# <tr>
|
||||
# <td><para style="answer">""" + to_xml(tools.ustr(ans.answer)) + """</para></td>
|
||||
# <td>
|
||||
# <illustration>
|
||||
# <rect x="0.0cm" y="-0.5cm" width='""" + tools.ustr(str(cols_widhts[0] - 0.3) + "cm") + """' height="0.6cm" fill="no" stroke="yes"/>
|
||||
# </illustration>
|
||||
# </td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
|
||||
elif que.type in ['comment']:
|
||||
cols_widhts.append(float(_tbl_widths.replace('cm','')))
|
||||
inner_Widths = []
|
||||
for width in cols_widhts:
|
||||
inner_Widths.append(width - 0.6)
|
||||
# elif que.type in ['comment']:
|
||||
# cols_widhts.append(float(_tbl_widths.replace('cm','')))
|
||||
# inner_Widths = []
|
||||
# for width in cols_widhts:
|
||||
# inner_Widths.append(width - 0.6)
|
||||
|
||||
colWidths = "cm,".join(map(tools.ustr, cols_widhts)) + 'cm'
|
||||
InnerWidths = "cm,".join(map(tools.ustr, inner_Widths)) + 'cm'
|
||||
# colWidths = "cm,".join(map(tools.ustr, cols_widhts)) + 'cm'
|
||||
# InnerWidths = "cm,".join(map(tools.ustr, inner_Widths)) + 'cm'
|
||||
|
||||
rml += """<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
|
||||
<tr>
|
||||
<td><para style="comment"><font color="white"> </font></para>
|
||||
<illustration>
|
||||
<rect x="0.1cm" y="0.3cm" width='""" + InnerWidths + """' height="1.5cm" fill="no" stroke="yes"/>
|
||||
</illustration>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
# rml += """<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
|
||||
# <tr>
|
||||
# <td><para style="comment"><font color="white"> </font></para>
|
||||
# <illustration>
|
||||
# <rect x="0.1cm" y="0.3cm" width='""" + InnerWidths + """' height="1.5cm" fill="no" stroke="yes"/>
|
||||
# </illustration>
|
||||
# </td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
|
||||
elif que.type in ['single_textbox']:
|
||||
cols_widhts.append(float(_tbl_widths.replace('cm','')))
|
||||
inner_Widths = []
|
||||
for width in cols_widhts:
|
||||
inner_Widths.append(width - 0.7)
|
||||
# elif que.type in ['single_textbox']:
|
||||
# cols_widhts.append(float(_tbl_widths.replace('cm','')))
|
||||
# inner_Widths = []
|
||||
# for width in cols_widhts:
|
||||
# inner_Widths.append(width - 0.7)
|
||||
|
||||
colWidths = "cm,".join(map(tools.ustr, cols_widhts)) + 'cm'
|
||||
InnerWidths = "cm,".join(map(tools.ustr, inner_Widths)) + 'cm'
|
||||
# colWidths = "cm,".join(map(tools.ustr, cols_widhts)) + 'cm'
|
||||
# InnerWidths = "cm,".join(map(tools.ustr, inner_Widths)) + 'cm'
|
||||
|
||||
rml += """<para style="P2"><font color="white"> </font></para>
|
||||
<blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
|
||||
<tr>
|
||||
<td>
|
||||
<illustration>
|
||||
<rect x="0.2cm" y="0.3cm" width='""" + InnerWidths + """' height="0.6cm" fill="no" stroke="yes"/>
|
||||
</illustration>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>"""
|
||||
# rml += """<para style="P2"><font color="white"> </font></para>
|
||||
# <blockTable colWidths=" """ + colWidths + """ " style="ans_tbl">
|
||||
# <tr>
|
||||
# <td>
|
||||
# <illustration>
|
||||
# <rect x="0.2cm" y="0.3cm" width='""" + InnerWidths + """' height="0.6cm" fill="no" stroke="yes"/>
|
||||
# </illustration>
|
||||
# </td>
|
||||
# </tr>
|
||||
# </blockTable>"""
|
||||
|
||||
elif que.type in ['table']:
|
||||
tbl_width = float(_tbl_widths.replace('cm',''))
|
||||
for i in range(0,len(que.column_heading_ids)):
|
||||
cols_widhts.append(tbl_width/float(len(que.column_heading_ids)))
|
||||
colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
colWidths = colWidths+'cm'
|
||||
rml += """<blockTable colWidths=" """ + colWidths + """ " style="tbl"><tr>"""
|
||||
for col in que.column_heading_ids:
|
||||
rml+="""<td><para style="terp_tblheader_Details">""" + to_xml(tools.ustr(col.title)) + """</para></td>"""
|
||||
rml += """</tr></blockTable>"""
|
||||
i = 0
|
||||
for r in range(0,que.no_of_rows):
|
||||
if i%2 != 0:
|
||||
style = 'tbl_white'
|
||||
else:
|
||||
style = 'tbl_gainsboro'
|
||||
i += 1
|
||||
rml += """<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'><tr>"""
|
||||
for c in que.column_heading_ids:
|
||||
rml += """
|
||||
<td><para style="terp_default_9"><font color="white"> </font></para></td>"""
|
||||
rml += """</tr></blockTable>"""
|
||||
# elif que.type in ['table']:
|
||||
# tbl_width = float(_tbl_widths.replace('cm',''))
|
||||
# for i in range(0,len(que.column_heading_ids)):
|
||||
# cols_widhts.append(tbl_width/float(len(que.column_heading_ids)))
|
||||
# colWidths = "cm,".join(map(tools.ustr, cols_widhts))
|
||||
# colWidths = colWidths+'cm'
|
||||
# rml += """<blockTable colWidths=" """ + colWidths + """ " style="tbl"><tr>"""
|
||||
# for col in que.column_heading_ids:
|
||||
# rml+="""<td><para style="terp_tblheader_Details">""" + to_xml(tools.ustr(col.title)) + """</para></td>"""
|
||||
# rml += """</tr></blockTable>"""
|
||||
# i = 0
|
||||
# for r in range(0,que.no_of_rows):
|
||||
# if i%2 != 0:
|
||||
# style = 'tbl_white'
|
||||
# else:
|
||||
# style = 'tbl_gainsboro'
|
||||
# i += 1
|
||||
# rml += """<blockTable colWidths=" """ + colWidths + """ " style='"""+style+"""'><tr>"""
|
||||
# for c in que.column_heading_ids:
|
||||
# rml += """
|
||||
# <td><para style="terp_default_9"><font color="white"> </font></para></td>"""
|
||||
# rml += """</tr></blockTable>"""
|
||||
|
||||
if datas.has_key('form') and not datas['form']['without_pagebreak']:
|
||||
rml += """<pageBreak/>"""
|
||||
elif not datas.has_key('form'):
|
||||
rml += """<pageBreak/>"""
|
||||
else:
|
||||
rml += """<para style="P2"><font></font></para>"""
|
||||
# if datas.has_key('form') and not datas['form']['without_pagebreak']:
|
||||
# rml += """<pageBreak/>"""
|
||||
# elif not datas.has_key('form'):
|
||||
# rml += """<pageBreak/>"""
|
||||
# else:
|
||||
# rml += """<para style="P2"><font></font></para>"""
|
||||
|
||||
rml += """</story></document>"""
|
||||
report_type = datas.get('report_type', 'pdf')
|
||||
create_doc = self.generators[report_type]
|
||||
pdf = create_doc(rml, title=self.title)
|
||||
return (pdf, report_type)
|
||||
# rml += """</story></document>"""
|
||||
# report_type = datas.get('report_type', 'pdf')
|
||||
# create_doc = self.generators[report_type]
|
||||
# pdf = create_doc(rml, title=self.title)
|
||||
# return (pdf, report_type)
|
||||
|
||||
survey_form('report.survey.form', 'survey','','')
|
||||
# survey_form('report.survey.form', 'survey','','')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
Reference in New Issue
Block a user