예제 #1
0
def __to_pdf(tempFile, breakdown, building, begin_ts, end_ts):
    doc = SimpleDocTemplate(tempFile, pagesize=landscape(A4), leftMargin=MARGIN,
                            rightMargin=MARGIN, topMargin=MARGIN,
                            bottomMargin=MARGIN,
                            title=u'Lista de întreținere %s' % building.name,
                            author='www.habitam.ro')
    flowables = []
    sc_title_style = ParagraphStyle(name='staircase_title', alignment=TA_CENTER)
                         
    for sc in building.apartment_groups():
        if sc == building:
            continue
        sc_title = Paragraph(u'Lista de întreținere scara %s' % 
                             sc.name, sc_title_style)
        data = __list_data(sc, breakdown, building.services())
    
        table = Table(data, repeatRows=1)
        table.setStyle(TableStyle([
                        ('FONT', (0, 0), (-1, 0), 'Helvetica-Bold'),
                        ('VALIGN', (0, 0), (0, -1), 'TOP'),
                        ('FONTSIZE', (0, 0), (-1, -1), __FONT_SIZE__),
                        ('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black),
                        ('BOX', (0, 0), (-1, -1), 0.25, colors.black)
                       ]))

        flowables.extend([Spacer(1, .5 * cm), sc_title,
                          Spacer(1, cm), table,
                          Spacer(1, .5 * cm), signatures(__FONT_SIZE__),
                          PageBreak()])
    
    doc.habitam_building = building
    doc.habitam_month = begin_ts.strftime('%B %Y')
    doc.habitam_display = date.today().strftime('%d %B %Y')
    doc.build(flowables, onFirstPage=__list_format, onLaterPages=__list_format)
예제 #2
0
def __to_pdf(temp, data):
    doc = SimpleDocTemplate(temp, pagesize=landscape(A4), leftMargin=MARGIN,
                            rightMargin=MARGIN, topMargin=MARGIN,
                            bottomMargin=MARGIN,
                            title=u'Situația activ/pasiv pentru %s' % data['building'].name,
                            author='www.habitam.ro')
     
    flowables = [Spacer(1, 6 * cm), __format_data(data), Spacer(1, cm), signatures()]
    doc.habitam_data = data    
    doc.build(flowables, onFirstPage=__balance_format, onLaterPages=__balance_format)