import string
from reportlab import platypus
from reportlab.platypus import SimpleDocTemplate, Table, TableStyle
from reportlab.platypus import *
from reportlab.platypus.paragraph import Paragraph
from reportlab.platypus.doctemplate import *
from reportlab.lib.styles import PropertySet, getSampleStyleSheet
from stripogram import html2text, html2safehtml
import reportlab.lib.colors
import PIL.Image
def preformat(msg) :
msg = string.replace(msg, "&", "&")
msg = string.replace(msg, ">", ">")
return string.replace(msg, "<", "<")
def getDataForWeeklyReport(self, data):
datalist=[]
style=getSampleStyleSheet()['Normal']
style.fontSize=8
try:
res=self.SQL_RetrieveOneWeeklyReport(ReportID=data)
except: return None
## Get the total number of results in this run
fields2index={}
fieldNames=res._schema.items()
for rowno in range (len(res)):
T0=[]
T1=[]
T2=[]
for i in range(len(fieldNames)):
fields2index[fieldNames[i][0]]=fieldNames[i][1]
StatusColor=res[rowno][fields2index['StatusColor']]
StatusDescription=res[rowno][fields2index['StatusDescription']]
ColorCode=res[rowno][fields2index['ColorCode']]
Description=res[rowno][fields2index['Description']]
Ended=res[rowno][fields2index['Ended']]
ProjName=res[rowno][fields2index['ProjName']]
ProjManager=res[rowno][fields2index['ProjManager']]
TestManager=res[rowno][fields2index['TestManager']]
TestPhase=res[rowno][fields2index['TestPhase']]
ExecutiveSummary=res[rowno][fields2index['ExecutiveSummary']]
ANCAMP=res[rowno][fields2index['ANCAMP']]
T0.append(StatusColor)
T0.append(ColorCode)
T0.append(Paragraph(preformat(StatusDescription), style))
T0.append(Paragraph(preformat(Description), style))
datalist.append(T0)
T1.append(Paragraph('Progress Report Period Ended', style))
T1.append(Paragraph(preformat(str(Ended)), style))
T1.append(Paragraph('Project Name', style))
T1.append(Paragraph(preformat(ProjName)))
datalist.append(T1)
T2.append(Paragraph('Project Manager', style))
T2.append(Paragraph(preformat(ProjManager)))
T2.append(Paragraph('Test Manager', style))
T2.append(Paragraph(preformat(TestManager)))
T2.append(Paragraph('Test Phase', style))
T2.append(Paragraph(preformat(TestPhase)))
datalist.append(T2)
return datalist