def genAveSingleReportT(self, tname): aves = model.getAves() global fileloader, env t = fileloader.load(env, "t_" + tname + ".html") html = t.render(aves=aves) saveUnicode("gen_" + tname + "_report.html", html) os.system("start " + "gen_" + tname + "_report.html")
def genAveSingleReportT(self,tname): aves=model.getAves() global fileloader,env t=fileloader.load(env,"t_"+tname+".html") html=t.render(aves=aves) saveUnicode("gen_"+tname+"_report.html",html) os.system("start "+"gen_"+tname+"_report.html")
def report1(): class MyFamilyReport(Report): title = 'NCS_CS' class band_detail(DetailBand): height = 0.7 * cm elements = [ ObjectValue(expression='name', left=0.5 * cm), ObjectValue(expression='c', left=3.5 * cm, get_value=lambda instance: "%.5f" % instance.c), ObjectValue(expression='s', left=6.5 * cm, get_value=lambda instance: "%.5f" % instance.s), ObjectValue(expression='user', left=9.5 * cm), ObjectValue(expression='mdate', left=12.5 * cm), ] borders = {'bottom': True} class band_page_header(ReportBand): height = 1.3 * cm elements = [ SystemField(expression='%(report_title)s', top=0.1 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER }), SystemField( expression=u'Page %(page_number)d of %(page_count)d', top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), Label(text="Name", top=0.8 * cm, left=0.5 * cm), Label(text="c", top=0.8 * cm, left=3.5 * cm), Label(text="s", top=0.8 * cm, left=6.5 * cm), Label(text="user", top=0.8 * cm, left=9.5 * cm), Label(text="time", top=0.8 * cm, left=12.5 * cm), ] borders = {'all': True} class band_page_footer(ReportBand): height = 0.5 * cm elements = [ Label(text='Geraldo Reports', top=0.1 * cm), SystemField( expression='Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s', top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'top': True} from geraldo.generators import PDFGenerator my_report = MyFamilyReport(queryset=model.getAves()) my_report.generate_by(PDFGenerator, filename='gen_aves.pdf')
def genAveSingleReportTonly(self, tname): aves = model.getAves() template = initpath + tname + '.xml' factory = ReportFactory() factory.render_template(template_file=template, aves=aves) # print dir(factory) factory.render_document("gen_" + tname + ".pdf") factory.cleanup()
def genOneAveReportT(self, id, tname): aves = model.getAves() template = initpath + tname + '.xml' factory = ReportFactory() #bh=range(1,len(ave.singles)+1) factory.render_template(template_file=template, aves=aves) factory.render_document("gen_" + tname + ".pdf") factory.cleanup() os.system("start " + "gen_" + tname + ".pdf")
def main(): aves=model.getAves() doc3 = MakeExample3(aves=aves) DR = PyRTF.Renderer() DR.Write( doc3, OpenFile( 'gen_SingleAve' ) ) cmd=r'"%s%s.rtf"' %(initpath,'gen_SingleAve') #start "I:\Aptana Studio 3 Workspace\ncs_report\src\gen_singleave.rtf" #os.system(cmd) os.spawnl(os.P_NOWAIT,os.environ['COMSPEC'],"/C "+cmd)
def genAveSingleReportTonly(self,tname): aves=model.getAves() template = initpath+tname+'.xml' factory = ReportFactory() factory.render_template( template_file=template, aves=aves) # print dir(factory) factory.render_document("gen_"+tname+".pdf") factory.cleanup()
def genOneAveReportT(self,id,tname): aves=model.getAves() template = initpath+tname+'.xml' factory = ReportFactory() #bh=range(1,len(ave.singles)+1) factory.render_template( template_file=template, aves=aves) factory.render_document("gen_"+tname+".pdf") factory.cleanup() os.system("start "+"gen_"+tname+".pdf")
def loadData(self): aves=model.getAves() names =["sampleid","name","c","s","cstd","sstd","num","mdate","user"] m1 = len(aves) if m1 > 0: n1 = len(names) self.grid1.setRowCount(m1); self.grid1.setColumnCount(n1); for j in range(n1): for i in range(m1): #print aves[i]. #cmdstr="print aves[i]."+names[j] cmdstr="self.grid1.setItem(i, j, QTableWidgetItem(unicode(aves[i]."+names[j]+")))" exec(cmdstr) #grid.setItem(i, j, QTableWidgetItem(unicode(aves[i][j]))) else: n1 = len(names) self.grid1.setRowCount(0); self.grid1.setColumnCount(n1); self.grid1.setHorizontalHeaderLabels(names)
def loadData(self): aves=model.getAves() names =["sampleid","name","c","s","cstd","sstd","mdate","user"] m1 = len(aves) if m1 > 0: n1 = len(names) self.grid1.setRowCount(m1); self.grid1.setColumnCount(n1); for j in range(n1): for i in range(m1): #print aves[i]. #cmdstr="print aves[i]."+names[j] cmdstr="self.grid1.setItem(i, j, QTableWidgetItem(unicode(aves[i]."+names[j]+")))" exec(cmdstr) #grid.setItem(i, j, QTableWidgetItem(unicode(aves[i][j]))) else: n1 = len(names) self.grid1.setRowCount(0); self.grid1.setColumnCount(n1); self.grid1.setHorizontalHeaderLabels(names)
def report1(): class MyFamilyReport(Report): title = 'NCS_CS' class band_detail(DetailBand): height = 0.7*cm elements = [ ObjectValue(expression='name', left=0.5*cm), ObjectValue(expression='c', left=3.5*cm,get_value=lambda instance: "%.5f" % instance.c), ObjectValue(expression='s', left=6.5*cm,get_value=lambda instance: "%.5f" % instance.s), ObjectValue(expression='user', left=9.5*cm), ObjectValue(expression='mdate', left=12.5*cm), ] borders = {'bottom': True} class band_page_header(ReportBand): height = 1.3*cm elements = [ SystemField(expression='%(report_title)s', top=0.1*cm, left=0, width=BAND_WIDTH, style={'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER}), SystemField(expression=u'Page %(page_number)d of %(page_count)d', top=0.1*cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), Label(text="Name", top=0.8*cm, left=0.5*cm), Label(text="c", top=0.8*cm, left=3.5*cm), Label(text="s", top=0.8*cm, left=6.5*cm), Label(text="user", top=0.8*cm, left=9.5*cm), Label(text="time", top=0.8*cm, left=12.5*cm), ] borders = {'all': True} class band_page_footer(ReportBand): height = 0.5*cm elements = [ Label(text='Geraldo Reports', top=0.1*cm), SystemField(expression='Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s', top=0.1*cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'top': True} from geraldo.generators import PDFGenerator my_report = MyFamilyReport(queryset=model.getAves()) my_report.generate_by(PDFGenerator, filename='gen_aves.pdf')
def genAveSingleReportTonly(self, tname): aves = model.getAves() global fileloader, env t = fileloader.load(env, "t_" + tname + ".html") html = t.render(aves=aves) return html
def genAveSingleReportT(self,tname): aves=model.getAves() t=MyExcel(tname) t.render(aves=aves)
def genAveSingleReportTonly(self,tname): aves=model.getAves() global fileloader,env t=fileloader.load(env,"t_"+tname+".html") html=t.render(aves=aves) return html
def report2(): class MyFamilyReport(Report): title = 'NCS_CS' class band_detail(DetailBand): height = 0.7*cm elements = [ ObjectValue(expression='name', left=0.5*cm), ObjectValue(expression='c', left=3.5*cm,get_value=lambda instance: "%.5f" % instance.c), ObjectValue(expression='s', left=6.5*cm,get_value=lambda instance: "%.5f" % instance.s), ObjectValue(expression='user', left=9.5*cm), ObjectValue(expression='mdate', left=12.5*cm), ] borders = {'top': True,'bottom':.3} class band_page_header(ReportBand): height = 1.3*cm elements = [ SystemField(expression='%(report_title)s', top=0.1*cm, left=0, width=BAND_WIDTH, style={'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER}), SystemField(expression=u'Page %(page_number)d of %(page_count)d', top=0.1*cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), Label(text="Name", top=0.8*cm, left=0.5*cm), Label(text="c", top=0.8*cm, left=3.5*cm), Label(text="s", top=0.8*cm, left=6.5*cm), Label(text="user", top=0.8*cm, left=9.5*cm), Label(text="time", top=0.8*cm, left=12.5*cm), ] #borders = {'all': True} class band_page_footer(ReportBand): height = 0.5*cm elements = [ Label(text='Geraldo Reports', top=0.1*cm), SystemField(expression='Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s', top=0.1*cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'top': True} subreports = [ SubReport( queryset_string = '%(object)s.singles', # band_header = ReportBand( # height=0.9*cm, # elements=[ # Label(text='id', top=0.2*cm, left=0.2*cm, style={'fontName': 'Helvetica-Bold'}), # Label(text='name', top=0.2*cm, left=4*cm, style={'fontName': 'Helvetica-Bold'}), # ], # ), band_detail = ReportBand( height=0.5*cm, # This is a new attribute to force the band width # width = 6*cm, # # This attribute forces a distance at right and bottom sides of the band # margin_right = 0.2*cm, # margin_bottom = 0.2*cm, # # With this attribute as True, the band will try to align in # # the same line # display_inline = True, elements=[ ObjectValue(attribute_name='c', left=3.5*cm,get_value=lambda instance: "%.5f" % instance.c), ObjectValue(attribute_name='s', left=6.5*cm,get_value=lambda instance: "%.5f" % instance.s), ], #borders={'all': True}, ), # band_footer = ReportBand( # height=0.9*cm, # elements=[ # ObjectValue(attribute_name='id', top=0.2*cm, left=4*cm,\ # action=FIELD_ACTION_COUNT, display_format='%s permissions found', # style={'fontName': 'Helvetica-Bold'}), # ], # ), ), ] from geraldo.generators import PDFGenerator my_report = MyFamilyReport(queryset=model.getAves()) my_report.generate_by(PDFGenerator, filename='gen_aves.pdf')
def report2(): class MyFamilyReport(Report): title = 'NCS_CS' class band_detail(DetailBand): height = 0.7 * cm elements = [ ObjectValue(expression='name', left=0.5 * cm), ObjectValue(expression='c', left=3.5 * cm, get_value=lambda instance: "%.5f" % instance.c), ObjectValue(expression='s', left=6.5 * cm, get_value=lambda instance: "%.5f" % instance.s), ObjectValue(expression='user', left=9.5 * cm), ObjectValue(expression='mdate', left=12.5 * cm), ] borders = {'top': True, 'bottom': .3} class band_page_header(ReportBand): height = 1.3 * cm elements = [ SystemField(expression='%(report_title)s', top=0.1 * cm, left=0, width=BAND_WIDTH, style={ 'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER }), SystemField( expression=u'Page %(page_number)d of %(page_count)d', top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), Label(text="Name", top=0.8 * cm, left=0.5 * cm), Label(text="c", top=0.8 * cm, left=3.5 * cm), Label(text="s", top=0.8 * cm, left=6.5 * cm), Label(text="user", top=0.8 * cm, left=9.5 * cm), Label(text="time", top=0.8 * cm, left=12.5 * cm), ] #borders = {'all': True} class band_page_footer(ReportBand): height = 0.5 * cm elements = [ Label(text='Geraldo Reports', top=0.1 * cm), SystemField( expression='Printed in %(now:%Y, %b %d)s at %(now:%H:%M)s', top=0.1 * cm, width=BAND_WIDTH, style={'alignment': TA_RIGHT}), ] borders = {'top': True} subreports = [ SubReport( queryset_string='%(object)s.singles', # band_header = ReportBand( # height=0.9*cm, # elements=[ # Label(text='id', top=0.2*cm, left=0.2*cm, style={'fontName': 'Helvetica-Bold'}), # Label(text='name', top=0.2*cm, left=4*cm, style={'fontName': 'Helvetica-Bold'}), # ], # ), band_detail=ReportBand( height=0.5 * cm, # This is a new attribute to force the band width # width = 6*cm, # # This attribute forces a distance at right and bottom sides of the band # margin_right = 0.2*cm, # margin_bottom = 0.2*cm, # # With this attribute as True, the band will try to align in # # the same line # display_inline = True, elements=[ ObjectValue( attribute_name='c', left=3.5 * cm, get_value=lambda instance: "%.5f" % instance.c), ObjectValue( attribute_name='s', left=6.5 * cm, get_value=lambda instance: "%.5f" % instance.s), ], #borders={'all': True}, ), # band_footer = ReportBand( # height=0.9*cm, # elements=[ # ObjectValue(attribute_name='id', top=0.2*cm, left=4*cm,\ # action=FIELD_ACTION_COUNT, display_format='%s permissions found', # style={'fontName': 'Helvetica-Bold'}), # ], # ), ), ] from geraldo.generators import PDFGenerator my_report = MyFamilyReport(queryset=model.getAves()) my_report.generate_by(PDFGenerator, filename='gen_aves.pdf')