当前位置: 首页>>代码示例>>Python>>正文


Python Table._argW[0]方法代码示例

本文整理汇总了Python中reportlab.platypus.Table._argW[0]方法的典型用法代码示例。如果您正苦于以下问题:Python Table._argW[0]方法的具体用法?Python Table._argW[0]怎么用?Python Table._argW[0]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.platypus.Table的用法示例。


在下文中一共展示了Table._argW[0]方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GenerarListaAsistencia

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
  def GenerarListaAsistencia (self,estudiantes,Curso, paralelo):

    namefile = "ListaAsistencia_%s%s.pdf"%(Curso,paralelo)
    doc = SimpleDocTemplate(namefile, pagesize=letter)
    elements = []
    styleSheet = getSampleStyleSheet()

    titulo = Paragraph('''<b>Escuela Particular Dr. Jaime Aspiazu Seminario </b>''',styleSheet["BodyText"])
    stringCurso = u"<b>Curso: %s año básico, Paralelo: %s</b>"%(Curso,paralelo)
    subtitulo = Paragraph(stringCurso,styleSheet["BodyText"])
    fecha = time.strftime("%d/%m/%y")
    stringfecha = "Fecha: %s"%fecha

    datosHeader = [[titulo],[subtitulo],[stringfecha],[]]
    tablaHeader = Table(datosHeader)
    tablaHeader.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'CENTER'),
                       ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
                       ('TEXTCOLOR',(0,0),(-1,-1),colors.black),
                       ]))

    #este es la etiqueta de la columna de enumeracion
    N = Paragraph('''<b>N</b><super><font color=black>o</font></super>''', styleSheet["BodyText"])

    datosEstudiante = [[N,u"Nómina Estudiantes", "1","2","3","4","5"]]
    cont =1
    for e in estudiantes:
      aux = []
      aux.append(str(cont))
      aux.append(e)
      aux.append(" ")
      aux.append(" ")
      aux.append(" ")
      aux.append(" ")
      aux.append(" ")
      datosEstudiante.append(aux)
      cont= cont + 1


    tablaEstudiante = Table(datosEstudiante)
    nFila = len(datosEstudiante)
    tablaEstudiante.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
                       ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
                       ('TEXTCOLOR',(0,0),(-1,-1),colors.black),
                       ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
                       ('BOX', (0,0), (-1,-1), 0.25, colors.black),
                       ('BACKGROUND',(0,0),(0,nFila),colors.beige),
                       ('BACKGROUND',(0,0),(6,0),colors.beige)
                       ]))
    tablaEstudiante._argW[0]=0.5*inch
    tablaEstudiante._argW[1]=3*inch
    tablaEstudiante._argW[2]=0.5*inch
    tablaEstudiante._argW[3]=0.5*inch
    tablaEstudiante._argW[4]=0.5*inch
    tablaEstudiante._argW[5]=0.5*inch
    tablaEstudiante._argW[6]=0.5*inch

    elements.append(tablaHeader)
    elements.append(tablaEstudiante)
    doc.build(elements)
开发者ID:obayona,项目名称:Proyecto-Bases-de-Datos-Python,代码行数:61,代码来源:GeneradorReporte.py

示例2: partab

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def partab(left,right,tabamt):
	data = [[left,right]]
	t = Table(data)
	t.hAlign = 'LEFT'
	t.setStyle(TableStyle([('LEFTPADDING',(0,0),(1,0),0)]))
	t.setStyle(TableStyle([('TOPPADDING',(0,0),(1,0),0)]))
	t.setStyle(TableStyle([('BOTTOMPADDING',(0,0),(1,0),0)]))
	t.setStyle(TableStyle([('ALIGN',(0,0),(1,0),'LEFT')]))
	t._argW[0]=tabamt
	return t	
开发者ID:codedcolors,项目名称:lflpdf,代码行数:12,代码来源:makesow.py

示例3: new_vehicle_table

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
    def new_vehicle_table(self):
        name = Paragraph('''<b><font color=red>%s</font></b>''' % self.order_data['vehicle_name'],
                         self.styles["Heading2"])
        price = Paragraph('''<font color=green>Price: %s</font>''' % self.order_data['price'], self.styles["Heading2"])

        name_price_data = [
            [name, price]
        ]
        name_price_table = Table(name_price_data)
        name_price_table._argW[0] = 5.8 * inch

        vehicle_data = [
            ["<b>Body Style:</b>", self.order_data['bodyType'], "<b>Transmission:</b>",
             self.order_data['transmission']],
            ["<b>Engine:</b>", self.order_data['engine'], "<b>Stock #:</b>", self.order_data['stock']],
            ["<b>Exterior Colour:</b>", self.order_data['color'], "<b>Mileage:</b>", self.order_data['mileage']],
        ]

        vehicle_table_style = TableStyle([('TEXTCOLOR', (0, 0), (1, 2), colors.blue),
                                          ('GRID', (0, 0), (-1, -1), 0.25, colors.black),
                                          ('BOX', (0, 0), (-1, -1), 0.25, colors.black),
                                          ('BACKGROUND', (0, 0), (3, 0), HexColor('#F2F2F2')),
                                          ('BACKGROUND', (0, 1), (3, 1), HexColor('#fbfbfb')),
                                          ('BACKGROUND', (0, 2), (3, 2), HexColor('#F2F2F2')),
                                          ])
        style = self.styles["BodyText"]
        style.wordWrap = 'CJK'
        new_vehicle_data = [[Paragraph(cell, style) for cell in row] for row in vehicle_data]
        vehicle_table = Table(new_vehicle_data)
        vehicle_table.setStyle(vehicle_table_style)

        self.elements.append(Paragraph("Vehicle Information:", self.styles["Heading1"]))
        self.elements.append(name_price_table)
        self.elements.append(vehicle_table)
        self.elements.append(Paragraph("<u><a href='%s' color='blue'>Open Vehicle in Browser</a></u>" % self.order_data['link'], self.styles["Normal"]))

        self.elements.append(Paragraph("<b>&nbsp;</b>", self.styles["Heading1"]))
开发者ID:waqasraz,项目名称:reportlab_test,代码行数:39,代码来源:views.py

示例4: get_assignment

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]

#.........这里部分代码省略.........
        cell3a.append(Paragraph(
            "%s:" % (_("Vote results")), stylesheet['Heading4']))

        if polls.count() == 1:
            cell3a.append(Paragraph(
                "%s %s" % (polls.count(), _("ballot")), stylesheet['Normal']))
        elif polls.count() > 1:
            cell3a.append(Paragraph(
                "%s %s" % (polls.count(), _("ballots")), stylesheet['Normal']))

        # Add table head row
        headrow = []
        headrow.append(_("Candidates"))
        for poll in polls:
            headrow.append("%s." % poll.get_ballot())
        data_votes.append(headrow)

        # Add result rows
        elected_candidates = list(assignment.elected)
        for candidate, poll_list in vote_results.iteritems():
            row = []

            candidate_string = candidate.clean_name
            if candidate in elected_candidates:
                candidate_string = "* " + candidate_string
            if candidate.name_suffix:
                candidate_string += "\n(%s)" % candidate.name_suffix
            row.append(candidate_string)
            for vote in poll_list:
                if vote is None:
                    row.append('–')
                elif 'Yes' in vote and 'No' in vote and 'Abstain' in vote:
                    row.append(
                        _("Y: %(YES)s\nN: %(NO)s\nA: %(ABSTAIN)s")
                        % {'YES': vote['Yes'], 'NO': vote['No'],
                           'ABSTAIN': vote['Abstain']})
                elif 'Votes' in vote:
                    row.append(vote['Votes'])
                else:
                    pass
            data_votes.append(row)

        # Add valid votes row
        if poll.votesvalid is not None:
            footrow_one = []
            footrow_one.append(_("Valid votes"))
            for poll in polls:
                footrow_one.append(poll.print_votesvalid())
            data_votes.append(footrow_one)

        # Add invalid votes row
        if poll.votesinvalid is not None:
            footrow_two = []
            footrow_two.append(_("Invalid votes"))
            for poll in polls:
                footrow_two.append(poll.print_votesinvalid())
            data_votes.append(footrow_two)

        # Add votes cast row
        if poll.votescast is not None:
            footrow_three = []
            footrow_three.append(_("Votes cast"))
            for poll in polls:
                footrow_three.append(poll.print_votescast())
            data_votes.append(footrow_three)

        table_votes = Table(data_votes)
        table_votes.setStyle(
            TableStyle([
                ('GRID', (0, 0), (-1, -1), 0.5, colors.grey),
                ('VALIGN', (0, 0), (-1, -1), 'TOP'),
                ('LINEABOVE', (0, 0), (-1, 0), 2, colors.black),
                ('LINEABOVE', (0, 1), (-1, 1), 1, colors.black),
                ('LINEBELOW', (0, -1), (-1, -1), 2, colors.black),
                ('ROWBACKGROUNDS', (0, 1), (-1, -1), (colors.white, (.9, .9, .9)))
            ])
        )

        # table
        data = []
        data.append([cell1a, cell1b])
        if polls:
            data.append([cell3a, table_votes])
            data.append(['', '* = ' + _('elected')])
        else:
            data.append([cell2a, cell2b])
        data.append([Spacer(0, 0.2 * cm), ''])
        t = Table(data)
        t._argW[0] = 4.5 * cm
        t._argW[1] = 11 * cm
        t.setStyle(TableStyle([
            ('BOX', (0, 0), (-1, -1), 1, colors.black),
            ('VALIGN', (0, 0), (-1, -1), 'TOP')]))
        story.append(t)
        story.append(Spacer(0, 1 * cm))

        # text
        story.append(
            Paragraph("%s" % assignment.description.replace('\r\n', '<br/>'),
                      stylesheet['Paragraph']))
开发者ID:DerPate,项目名称:OpenSlides,代码行数:104,代码来源:views.py

示例5: ImprimirVentasCreditos

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def ImprimirVentasCreditos(request, fechaI, fechaF):
	
	response = HttpResponse(content_type='application/pdf')
	finicio = datetime.fromtimestamp(int(fechaI) / 1e3)
	ffin = datetime.fromtimestamp(int(fechaF) / 1e3)

	pdf_name = "ventasacredito.pdf" 
	buff = BytesIO()
	
	doc = SimpleDocTemplate(buff,
							pagesize=letter,
							rightMargin=50,
							leftMargin=50,
							topMargin=20,
							bottomMargin=18,
							)
	doc.pagesize = landscape(A4)
	ventas = []

	totales = Venta.objects.filter(fecha__gte = finicio,  fecha__lte = ffin, credito = True , estado = 'ACTIVO').aggregate(precio_total=Sum(F('total')))
	
	ventas.append(Spacer(1, 0.05 * inch))

	header = Paragraph("GRUPOEJ - SRL." , getStyleSheet()['Title'])
	subtitel = Paragraph("Ventas al credito." , getStyleSheet()['Subtitle'])
	ventas.append(header)
	ventas.append(Spacer(1, 0.05 * inch))
	ventas.append(subtitel)
	ventas.append(Spacer(1, 0.05 * inch))
	ventas.append(Paragraph("<para>Fecha Inicio: "+finicio.strftime('%d/%m/%Y')+" &nbsp;&nbsp;&nbsp;"+" Fecha Fin:"+ffin.strftime('%d/%m/%Y')+"</para>", getStyleSheet()['TopicTitle8']))
	ventas.append(Spacer(1, 0.05 * inch))
	ventas.append(Paragraph("DETALLE", getStyleSheet()['TopicTitle10']))
	ventas.append(Spacer(1, 0.1 * inch))
	styles = getSampleStyleSheet()

	headings = ('DNI/RUC', 'CLIENTE', "RESPONSABLE", 'NRO_VENTA','FECHA' ,'TOTAL')
	venta = [(str(v.pedido.cliente.nro_documento), str(v.pedido.cliente.nombres)+"/"+str(v.pedido.cliente.apellidos), str(v.pedido.cliente.responsable), str(v.numero_correlativo)+"-"+str(v.numero_documento), str(v.fecha), str(v.total)) for v in Venta.objects.filter(fecha__gte = finicio,  fecha__lte = ffin, credito = True , estado = 'ACTIVO')]
	data = ([headings] + venta)

	data2 = [[Paragraph(cell, getStyleSheet()['TopicItemq0']) for cell in row] for row in data]
	t=Table(data2)
	style = TableStyle(
		[
			('BACKGROUND', (0, 0), (-1, 0), colors.gray),
			('LINEABOVE', (0,0), (-1,0), 2, colors.green),
			('LINEABOVE', (0,1), (-1,-1), 0.25, colors.black),
			('LINEBELOW', (0,-1), (-1,-1), 2, colors.green),
			('ALIGN', (1,1), (-1,-1), 'CENTER'),
		]
	)

	t.setStyle(style)
	t._argW[0]=0.8*inch
	t._argW[1]=2.8*inch
	t._argW[2]=2.8*inch
	t._argW[3]=0.9*inch
	t._argW[4]=0.9*inch
	t._argW[5]=0.9*inch
	ventas.append(t)
	ventas.append(Paragraph("Total: S/  "+str(totales['precio_total']), getStyleSheet()['TopicTitle8Right']))
	# ventas.append(Paragraph("IGV:___"+str(venta.igv)+" S/", getStyleSheet()['TopicTitle8Right']))
	# ventas.append(Paragraph("Total:__ "+str(venta.total)+" S/", getStyleSheet()['TopicTitle8Right']))
	doc.build(ventas)
	response.write(buff.getvalue())
	buff.close()
	return response
开发者ID:xcarlx,项目名称:ventas,代码行数:68,代码来源:views.py

示例6: generate_assessment_report

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def generate_assessment_report(assess_name, full_marks, module, data, freq, student_list, agg_name):
    filename = assess_name + "_"+module+"_report.pdf"
    fileN = assess_name + "_"+module+"_report"
    logo = os.path.join(os.path.dirname(os.path.abspath(__file__)),"static/reporting/images/cs_header_image.jpg")
    
    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'attachment; filename='+ filename
 
    buffer = BytesIO()
    my_pdf = SimpleDocTemplate(buffer, rightMarging=72, leftMargin=72, topMargin=15, bottomMargin=50)
    
    #container for the pdf elements
    elements = []
    f = Image(logo)
    f.hAlign = 'CENTER'
    f.drawHeight = 1.5*inch
    f.drawWidth = 4 *inch
    elements.append(f)
    
    styles=getSampleStyleSheet()
    styleN = styles["Normal"]
    styleH = styles["Heading1"]
    styleH.alignment = TA_CENTER
    
    elements.append(Paragraph('<h1>'+'Module: '+ module+'</h1>',styleH))
    elements.append(Paragraph('<h3>'+'Assessment: '+ assess_name+'</h3>',styleH))
    if agg_name is not None:
        elements.append(Paragraph('<h3>'+'Aggregator: '+ agg_name+'</h3>',styleH))
    else:
        elements.append(Paragraph('<h3>'+'Aggregator: None '+ '</h3>',styleH))
        
    elements.append(Paragraph('<h3>'+'Full Marks: '+ str(full_marks)+'</h3>',styleH))
    elements.append(Spacer(width=0, height=0.1*cm))
    tdata = [[Paragraph('<b>' + 'Statistics' + '</b>',styleN)
            ]]
    table = Table(tdata, colWidths=None, rowHeights=None)
    table.setStyle(TableStyle([
                                ('GRID',(0,0), (-1,0),1, colors.black),
                                ('BACKGROUND',(0,0),(-1,-1),colors.lightblue)#Give total a grey background)
                              ]))
    table._argW[0]=7.0*inch
    elements.append(table)
    elements.append(Spacer(width=0, height=1*cm))
    
    tdata = [[Paragraph('<b>Class Average</b>',styleN),
              Paragraph('<b>Median</b>',styleN),
              Paragraph('<b>Mode</b>',styleN),
              Paragraph('<b>Standard Deviation</b>',styleN)
            ]]
    table = Table(tdata, colWidths=None, rowHeights=None)
    table.setStyle(TableStyle([
                                ('GRID',(0,0), (-1,-1),1, colors.black)
                              ]))
    table._argW[0]=2.5*inch #Set the size(width) of the first column in the table
    table._argW[1]=1.5*inch
    table._argW[2]=1.5*inch
    table._argW[3]=1.5*inch
    elements.append(table)
    
    tdata = [data[0], data[1], data[2], data[3]],
    table2 = Table(tdata, colWidths=None, rowHeights=None)
    table2.setStyle(TableStyle([
                                ('GRID',(0,0), (-1,-1),1, colors.black)
                              ]))
    #table=Table(tdata, colWidths=80, rowHeights=30)
    table2._argW[0]=2.5*inch #Set the size(width) of the first collumn in the table
    table2._argW[1]=1.5*inch
    table2._argW[2]=1.5*inch
    table2._argW[3]=1.5*inch
    elements.append(table2)
    elements.append(Spacer(width=0, height=1*cm))
    
    tdata = [[Paragraph('<b>' + 'Frequency Analysis' + '</b>',styleN)
            ]]
    table = Table(tdata, colWidths=None, rowHeights=None)
    table.setStyle(TableStyle([
                                ('GRID',(0,0), (-1,0),1, colors.black),
                                ('BACKGROUND',(0,0),(-1,-1),colors.lightblue)#Give total a grey background)
                              ]))
    table._argW[0]=7.0*inch
    elements.append(table)
    elements.append(Spacer(width=0, height=1*cm))
    tdata = [[Paragraph('<b>[0 .. 40)</b>',styleN),
              Paragraph('<b>[40 .. 50)</b>',styleN),
              Paragraph('<b>[50 .. 60)</b>',styleN),
              Paragraph('<b>[60 .. 75)</b>',styleN),
              Paragraph('<b>[75 .. 100]</b>',styleN)
            ]]
    table = Table(tdata, colWidths=None, rowHeights=None)
    table.setStyle(TableStyle([
                                ('GRID',(0,0), (-1,-1),1, colors.black)
                              ]))
    table._argW[0]=1.4*inch #Set the size(width) of the first column in the table
    table._argW[1]=1.4*inch
    table._argW[2]=1.4*inch
    table._argW[3]=1.4*inch
    table._argW[4]=1.4*inch
    elements.append(table)
    
    tdata = [freq[0], freq[1], freq[2], freq[3], freq[4]],
#.........这里部分代码省略.........
开发者ID:fluffels,项目名称:hamster,代码行数:103,代码来源:reporting_api.py

示例7: motion_to_pdf

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]

#.........这里部分代码省略.........
    motion_data.append([cell1a, cell1b])

    # TODO: choose this in workflow
    if motion.state.allow_submitter_edit:
        # Cell for the signature
        cell2a = []
        cell2b = []
        cell2a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" %
                                _("Signature"), stylesheet['Heading4']))
        cell2b.append(Paragraph(42 * "_", stylesheet['Signaturefield']))
        cell2b.append(Spacer(0, 0.1 * cm))
        cell2b.append(Spacer(0, 0.2 * cm))
        motion_data.append([cell2a, cell2b])

    # supporters
    if config['motions_min_supporters']:
        cell3a = []
        cell3b = []
        cell3a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font><seqreset id='counter'>"
                                % _("Supporters"), stylesheet['Heading4']))
        supporters = motion.supporters.all()
        for supporter in supporters:
            cell3b.append(Paragraph("<seq id='counter'/>.&nbsp; %s" % str(supporter),
                                    stylesheet['Normal']))
        cell3b.append(Spacer(0, 0.2 * cm))
        motion_data.append([cell3a, cell3b])

    # Motion state
    cell4a = []
    cell4b = []
    cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("State"),
                            stylesheet['Heading4']))
    cell4b.append(Paragraph(_(motion.state.name), stylesheet['Normal']))
    motion_data.append([cell4a, cell4b])

    # Version number
    if motion.versions.count() > 1:
        version = motion.get_active_version()
        cell5a = []
        cell5b = []
        cell5a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Version"),
                                stylesheet['Heading4']))
        cell5b.append(Paragraph("%s" % version.version_number, stylesheet['Normal']))
        motion_data.append([cell5a, cell5b])

    # voting result
    polls = []
    for poll in motion.polls.all():
        if not poll.has_votes():
            continue
        polls.append(poll)

    if polls:
        cell6a = []
        cell6b = []
        cell6a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" %
                                _("Vote result"), stylesheet['Heading4']))
        ballotcounter = 0
        for poll in polls:
            ballotcounter += 1
            option = poll.get_options()[0]
            yes, no, abstain = (option['Yes'], option['No'], option['Abstain'])
            valid, invalid, votescast = ('', '', '')
            if poll.votesvalid is not None:
                valid = "<br/>%s: %s" % (_("Valid votes"), poll.print_votesvalid())
            if poll.votesinvalid is not None:
                invalid = "<br/>%s: %s" % (_("Invalid votes"), poll.print_votesinvalid())
            if poll.votescast is not None:
                votescast = "<br/>%s: %s" % (_("Votes cast"), poll.print_votescast())
            if len(polls) > 1:
                cell6b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")),
                                        stylesheet['Bold']))
            cell6b.append(Paragraph(
                "%s: %s <br/> %s: %s <br/> %s: %s <br/> %s %s %s" %
                (_("Yes"), yes, _("No"), no, _("Abstention"), abstain, valid, invalid, votescast),
                stylesheet['Normal']))
            cell6b.append(Spacer(0, 0.2 * cm))
        motion_data.append([cell6a, cell6b])

    # Creating Table
    table = Table(motion_data)
    table._argW[0] = 4.5 * cm
    table._argW[1] = 11 * cm
    table.setStyle(TableStyle([('BOX', (0, 0), (-1, -1), 1, colors.black),
                               ('VALIGN', (0, 0), (-1, -1), 'TOP')]))
    pdf.append(table)
    pdf.append(Spacer(0, 1 * cm))

    # motion title
    pdf.append(Paragraph(escape(motion.title), stylesheet['Heading3']))

    # motion text
    convert_html_to_reportlab(pdf, motion.text)
    pdf.append(Spacer(0, 1 * cm))

    # motion reason
    if motion.reason:
        pdf.append(Paragraph(_("Reason") + ":", stylesheet['Heading3']))
        convert_html_to_reportlab(pdf, motion.reason)
    return pdf
开发者ID:munasharma,项目名称:OpenSlides,代码行数:104,代码来源:pdf.py

示例8: genInvoice

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def genInvoice(c , o, ofr , it, se): # canvas , order , offer , item , service
    c.setFont("Times-Roman" , 20)
    c.drawCentredString(2*cm, 27*cm,"Brand")
    c.line(1*cm , 26*cm ,20*cm,26*cm )
    c.drawImage(os.path.join(globalSettings.BASE_DIR , 'static_shared','images' , 'logo.png') , 3*cm , 26.2*cm , 2*cm, 2*cm)
    c.setFont("Times-Roman" , 12)
    c.drawString(5*cm, 27.35*cm , "Contact us : 1800 1234 5678 | [email protected]")
    styles=getSampleStyleSheet()
    sead = se.address # service provide address
    serAddress = '<p><font size=14>%s.</font><font size=10>  34, %s , %s, %s, Pin : %s</font></p>' %(se.name , sead.street , sead.city , sead.state , sead.pincode)
    p = Paragraph( serAddress , styles['Normal'])
    p.wrapOn(c, 15*cm, 1*cm)
    p.drawOn(c, 5*cm, 26.3*cm)
    c.setDash(6,3)
    c.rect(14.4*cm, 27.2*cm, 5.5*cm, 0.6*cm )
    c.drawString(14.5*cm, 27.35*cm , "Invoice # DEL-%s" %(o.pk))
    pSrc = '''
        <font size=10>
            <strong>Order ID: OD%s</strong><br/><br/>
            <strong>Order Date : </strong> %s <br/>
            <strong>Invoice Date : </strong> %s <br/>
            <strong>VAT/TIN : </strong> %s <br/>
            <strong>CST# : </strong> %s <br/>
        </font>
    ''' % (o.pk , o.created.date() , o.created.date() , se.tin , se.tin)
    p = Paragraph( pSrc , styles['Normal'])
    p.wrapOn(c, 6*cm, 5*cm)
    p.drawOn(c, 1*cm, 22.4*cm)
    custAdd = o.address # customer address
    cust = o.user
    pSrc = '''
        <font size=10>
            <strong>Billing Address</strong><br/><br/>
            %s %s<br/>
            %s,<br/>
            %s Pin : %s,<br/>
            %s<br/>
            Phone : %s <br/>
        </font>
    ''' % (cust.first_name , cust.last_name , custAdd.street ,custAdd.city , custAdd.pincode , custAdd.state , o.mobile )
    p = Paragraph( pSrc , styles['Normal'])
    p.wrapOn(c, 6*cm, 5*cm)
    p.drawOn(c, 7.5*cm, 22*cm)
    pSrc = '''
        <font size=10>
            <strong>Shipping Address</strong><br/><br/>
            %s %s<br/>
            %s,<br/>
            %s Pin : %s,<br/>
            %s<br/>
            Phone : %s <br/>
        </font>
    ''' % (cust.first_name , cust.last_name , custAdd.street ,custAdd.city , custAdd.pincode , custAdd.state , o.mobile )
    p = Paragraph( pSrc , styles['Normal'])
    p.wrapOn(c, 6*cm, 5*cm)
    p.drawOn(c, 14*cm, 22*cm)
    c.setDash()
    pHeadProd = Paragraph('<strong>Product</strong>' , styles['Normal'])
    pHeadDetails = Paragraph('<strong>Details</strong>' , styles['Normal'])
    pHeadQty = Paragraph('<strong>Qty</strong>' , styles['Normal'])
    pHeadPrice = Paragraph('<strong>Price</strong>' , styles['Normal'])
    pHeadTax = Paragraph('<strong>Tax</strong>' , styles['Normal'])
    pHeadTotal = Paragraph('<strong>Total</strong>' , styles['Normal'])

    bookingTotal , bookingHrs = getBookingAmount(o)

    pSrc = ''''<strong>%s</strong><br/>(5.00%sCST) <br/><strong>Start : </strong> %s <br/>
        <strong>End : </strong> %s <br/><strong>Booking Hours : </strong> %s Hours <br/>
        ''' %(it.description[0:40] , '%' , o.start.strftime('%Y-%m-%d , %H:%M %p'), o.end.strftime('%Y-%m-%d , %H:%M %p'), bookingHrs)
    pBodyProd = Paragraph('%s <strong>VB%s</strong>' %(it.title , it.pk) , styles['Normal'])
    pBodyTitle = Paragraph( pSrc , styles['Normal'])
    pBodyQty = Paragraph('%s' % (o.quantity) , styles['Normal'])
    pBodyPrice = Paragraph('<strong> %s </strong>/ Hr' % (ofr.rate) , styles['Normal'])

    tax = 0.05*bookingTotal
    pBodyTax = Paragraph('%s' % (tax) , styles['Normal'])
    pBodyTotal = Paragraph('%s' %(bookingTotal) , styles['Normal'])

    pFooterQty = Paragraph('%s' % (o.quantity) , styles['Normal'])
    pFooterTax = Paragraph('%s' %(tax) , styles['Normal'])
    pFooterTotal = Paragraph('%s' % (bookingTotal) , styles['Normal'])
    pFooterGrandTotal = Paragraph('%s' % (bookingTotal) , styles['Normal'])

    data = [[ pHeadProd, pHeadDetails, pHeadPrice , pHeadQty, pHeadTax , pHeadTotal],
            [pBodyProd, pBodyTitle, pBodyPrice, pBodyQty, pBodyTax , pBodyTotal],
            ['', '', '', pFooterQty, pFooterTax , pFooterTotal],
            ['', '', '', 'Grand Total', '' , pFooterGrandTotal]]
    t=Table(data)
    ts = TableStyle([('ALIGN',(1,1),(-2,-2),'RIGHT'),
                ('SPAN',(-3,-1),(-2,-1)),
                ('LINEABOVE',(0,0),(-1,0),0.25,colors.gray),
                ('LINEABOVE',(0,1),(-1,1),0.25,colors.gray),
                ('LINEABOVE',(-3,-2),(-1,-2),0.25,colors.gray),
                ('LINEABOVE',(0,-1),(-1,-1),0.25,colors.gray),
                ('LINEBELOW',(0,-1),(-1,-1),0.25,colors.gray),
            ])
    t.setStyle(ts)
    t._argW[0] = 3*cm
    t._argW[1] = 8*cm
    t._argW[2] = 2*cm
#.........这里部分代码省略.........
开发者ID:pkyad,项目名称:libreERP-main,代码行数:103,代码来源:views.py

示例9: get_application

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def get_application(application, story):
    # application number
    if application.number:
        story.append(Paragraph(_("Application No.")+" %s" % application.number, stylesheet['Heading1']))
    else:
        story.append(Paragraph(_("Application No."), stylesheet['Heading1']))

    
    # submitter
    cell1a = []
    cell1a.append(Spacer(0,0.2*cm))
    cell1a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Submitter"), stylesheet['Heading4']))
    cell1b = []
    cell1b.append(Spacer(0,0.2*cm))
    if application.status == "pub":
        cell1b.append(Paragraph("__________________________________________",stylesheet['Signaturefield']))
        cell1b.append(Spacer(0,0.1*cm))
        cell1b.append(Paragraph("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+unicode(application.submitter.profile), stylesheet['Small']))
        cell1b.append(Spacer(0,0.2*cm))
    else:
        cell1b.append(Paragraph(unicode(application.submitter.profile), stylesheet['Normal']))
    
    # supporters
    cell2a = []
    cell2a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font><seqreset id='counter'>" % _("Supporters"), stylesheet['Heading4']))
    cell2b = []
    for s in application.supporter.all():
        cell2b.append(Paragraph("<seq id='counter'/>.&nbsp; %s" % unicode(s.profile), stylesheet['Signaturefield']))
    if application.status == "pub":
        for x in range(0,application.missing_supporters):
            cell2b.append(Paragraph("<seq id='counter'/>.&nbsp; __________________________________________",stylesheet['Signaturefield']))
    cell2b.append(Spacer(0,0.2*cm))
    
    # status
    note = ""
    for n in application.notes:
        note += "%s " % unicode(n)
    cell3a = []
    cell3a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Status"), stylesheet['Heading4']))
    cell3b = []
    if note != "":
        if application.status == "pub":
            cell3b.append(Paragraph(note, stylesheet['Normal']))
        else:
            cell3b.append(Paragraph("%s | %s" % (application.get_status_display(), note), stylesheet['Normal']))
    else:
        cell3b.append(Paragraph("%s" % application.get_status_display(), stylesheet['Normal']))

    # table
    data = []
    data.append([cell1a,cell1b])
    data.append([cell2a,cell2b])
    data.append([cell3a,cell3b])
    
    # voting results
    if len(application.results) > 0:
        cell4a = []
        cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Vote results"), stylesheet['Heading4']))
        cell4b = []
        ballotcounter = 0
        for result in application.results:
            ballotcounter += 1
            if len(application.results) > 1:
                cell4b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")), stylesheet['Bold']))
            cell4b.append(Paragraph("%s: %s <br/> %s: %s <br/> %s: %s <br/> %s: %s <br/> %s: %s" % (_("Yes"), result[0], _("No"), result[1], _("Abstention"), result[2], _("Invalid"), result[3], _("Votes cast"), result[4]), stylesheet['Normal']))
            cell4b.append(Spacer(0,0.2*cm))
        data.append([cell4a,cell4b])

    t=Table(data)
    t._argW[0]=4.5*cm
    t._argW[1]=11*cm
    t.setStyle(TableStyle([ ('BOX', (0,0), (-1,-1), 1, colors.black),
                            ('VALIGN', (0,0), (-1,-1), 'TOP'),
                          ]))
    story.append(t)
    story.append(Spacer(0,1*cm))
    
    # title
    story.append(Paragraph(application.title, stylesheet['Heading3']))
    # text
    story.append(Paragraph("%s" % application.text.replace('\r\n','<br/>'), stylesheet['Paragraph']))
    # reason
    story.append(Paragraph(_("Reason")+":", stylesheet['Heading3']))
    story.append(Paragraph("%s" % application.reason.replace('\r\n','<br/>'), stylesheet['Paragraph']))
    return story
开发者ID:piratenmv,项目名称:openslides,代码行数:87,代码来源:pdf.py

示例10: Table

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
       ['30', '31', '32', '33', '34', '35'],
       ['40', '41', '42', '43', '44', '45'],
]

#Style the table
t = Table(data,style=[
    ('GRID', (0, 0), (-1, -1), 1, colors.black),
    ('FONTSIZE',(0, 0), (-1, -1), 7),
    #('ALIGN', (0,0), (-1,1), 'LEFT'),
    #('BACKGROUND',(0,2),(-1,-1),colors.green)
    #('LINEABOVE',(0,1),(-1,1),1,colors.rgb2cmyk(1,1,1)),
    #('SPAN',(0,1),(-1,1)),
])

# Fixed column widths
t._argW[0] = 50.8*mm #Perf Mgmt
t._argW[1] = 12.7*mm #Total N
t._argW[2] = 63.5*mm # % Resp
t._argW[3] = 12.7*mm # % Fav
t._argW[4] = 38.1*mm # % Dist
t._argW[5] = 10.922*mm # Mean

c = canvas.Canvas(buffer, pagesize=letter)
t.wrapOn(c, width, height)
t.drawOn(c, *coord(5, 60, mm))
#drawGrid(c)
c.save()

#Write the buffer to disk and close the file
pdf = buffer.getvalue()
file.write(pdf)
开发者ID:johndavidback,项目名称:ReportLabs,代码行数:33,代码来源:GenerateReport.py

示例11: __init__

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
    def __init__(self, ptID, noteNumber):
	self.ptID = ptID
	filename = "/home/mb/Desktop/GECKO/EMR_outputs/%s/Other/bill-%s.pdf" % (self.ptID, EMR_utilities.dateToday('file format'))
	doc = SimpleDocTemplate(filename, pagesize=letter, topMargin=60)
	# container for the 'Flowable' objects
	elements = []
 
	styleSheet = getSampleStyleSheet()

	P0 = Paragraph('Barron Family Medicine', styleSheet['Normal'])
	P2 = Paragraph('1423 S Big Bend Blvd', styleSheet['Normal'])
	P3 = Paragraph('Richmond Heights, MO 63117', styleSheet['Normal'])

	T0 = Paragraph('<para align=RIGHT><font size=16><b>Statement of Charges and Payments</b></para></font>', styleSheet['Normal'])
	T1 = Spacer(1, 12)
	T2 = Paragraph('<para align=RIGHT><b>Date Printed:</b> %s</para>' % EMR_utilities.dateToday(), styleSheet['Normal'])
	T3 = Paragraph('<para align=RIGHT><b>Provider:</b> Michael Barron MD</para>', styleSheet['Normal'])
	T4 = Paragraph('<para align=RIGHT><b>Office Phone:</b> (314) 667-5276</para>', styleSheet['Normal'])

	data = [[[P0, P2, P3], [T0, T1, T2, T3, T4]]]
 
	t=Table(data, style=[('LEFTPADDING', (0,0), (-1,-1), 0),
			     ('RIGHTPADDING', (0,0), (-1,-1), 0),
			     ('VALIGN', (0,0), (-1,-1), 'TOP')])
	t._argW[0]=2.5*inch 
	elements.append(t)

	qry = 'SELECT * FROM demographics WHERE patient_ID = %s;' % self.ptID
	results = EMR_utilities.getDictData(qry)
	elements.append(Spacer(1,12))
	ptext = '<para align=RIGHT><b>Patient:</b> %s %s</para>' % (results['firstname'], results['lastname'])
	elements.append(Paragraph(ptext, styleSheet['Normal']))
	elements.append(Spacer(1,24))
	elements.append(Paragraph('%(firstname)s %(lastname)s' % (results), styleSheet['Normal']))
	elements.append(Paragraph('%(address)s' % results, styleSheet['Normal']))
	elements.append(Paragraph('%(city)s, %(state)s  %(zipcode)s' % results, styleSheet['Normal']))
	elements.append(Spacer(1,36))

	bill_data = [['Service Date', 'Qty', 'Description', 'CPT', 'Amount', 'Patient Balance'],]
	bill_qry = 'SELECT date, units, CPT_code, pt_pmt, 1_ins_pmt, 2_ins_pmt, balance FROM billing WHERE \
		note_number = %s;' % noteNumber
	bill_results = EMR_utilities.getAllDictData(bill_qry)
	balance_due = decimal.Decimal()
	for n in range(len(bill_results)):
	    cpt_qry = 'SELECT proc FROM fee_schedule WHERE cpt_code = "%s";' % bill_results[n]['CPT_code']#finds CPT description
	    cpt_results = EMR_utilities.getData(cpt_qry)
	    try: decimal.Decimal(bill_results[n]['1_ins_pmt'])
	    except decimal.InvalidOperation: bill_results[n]['1_ins_pmt'] = 0
	    try: decimal.Decimal(bill_results[n]['2_ins_pmt'])
	    except decimal.InvalidOperation: bill_results[n]['2_ins_pmt'] = 0 
	    ins_payed = decimal.Decimal(bill_results[n]['1_ins_pmt']) + decimal.Decimal(bill_results[n]['2_ins_pmt'])#primary + secondary
	    mylist = [bill_results[n]['date'],
		      bill_results[n]['units'],
		      cpt_results[0] + '\n   Patient Co-pay\n   Paid by Insurance',
		      bill_results[n]['CPT_code'],
		      '\n' + bill_results[n]['pt_pmt'] + '\n' + str(ins_payed),
		      '\n\n\n' + bill_results[n]['balance']]
	    bill_data.append(mylist)
	    balance_due = balance_due + decimal.Decimal(bill_results[n]['balance'])
	T2 = Table(bill_data, style=[('VALIGN', (0,0), (-1,-1), 'TOP'),
				     ('LEFTPADDING', (0,0), (-1,-1), 0),
			     	     ('RIGHTPADDING', (0,0), (-1,-1), 20),
				     ('LINEABOVE', (0,1), (-1,1), 1, colors.black)])
	T2.hAlign = "LEFT"
	elements.append(T2)

	elements.append(Spacer(1,24))
	elements.append(Paragraph('<para align=RIGHT><font size=14><b>Balance Due: </b>$%s</font>' % balance_due, styleSheet['Normal']))
	mystring = wx.GetTextFromUser("Enter additional notes")
	elements.append(Paragraph('<b>NOTE:</b> %s' % mystring, styleSheet['Normal']))
	elements.append(Spacer(1, 12))
	elements.append(Paragraph('Sincerely,', styleSheet['Normal']))
	
	'''logo = "/home/mb/Dropbox/Office/Signature.png"
	im = Image(logo, 2*inch, 0.75*inch)
	im.hAlign = "LEFT"
	elements.append(im)'''
	elements.append(Spacer(1,36))
	elements.append(Paragraph('Michael Barron MD', styleSheet['Normal']))
	elements.append(Spacer(1,24))
	elements.append(Paragraph('<b>Address Change?</b>   Please write below:', styleSheet['Normal']))
	# write the document to disk
	doc.build(elements)
	os.system("lp %s" % filename)
开发者ID:barronmo,项目名称:gecko_emr,代码行数:86,代码来源:Printer1.py

示例12: get_motion

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
    def get_motion(self, motion, story):
        # Preparing Table
        data = []

        # motion number
        if motion.number:
            story.append(Paragraph(_("Motion No.")+" %s" % motion.number, stylesheet['Heading1']))
        else:
            story.append(Paragraph(_("Motion No."), stylesheet['Heading1']))

        # submitter
        cell1a = []
        cell1a.append(Spacer(0, 0.2 * cm))
        cell1a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Submitter"), stylesheet['Heading4']))
        cell1b = []
        cell1b.append(Spacer(0, 0.2 * cm))
        cell1b.append(Paragraph("%s" % motion.submitter, stylesheet['Normal']))
        data.append([cell1a, cell1b])

        if motion.status == "pub":
            # Cell for the signature
            cell2a = []
            cell2b = []
            cell2a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Signature"), stylesheet['Heading4']))
            cell2b.append(Paragraph("__________________________________________", stylesheet['Signaturefield']))
            cell2b.append(Spacer(0, 0.1 * cm))
            cell2b.append(Spacer(0,0.2*cm))
            data.append([cell2a, cell2b])

        # supporters
        if config['motion_min_supporters']:
            cell3a = []
            cell3b = []
            cell3a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font><seqreset id='counter'>" % _("Supporters"), stylesheet['Heading4']))
            for supporter in motion.supporters:
                cell3b.append(Paragraph("<seq id='counter'/>.&nbsp; %s" % supporter, stylesheet['Signaturefield']))
            if motion.status == "pub":
                for x in range(motion.missing_supporters):
                    cell3b.append(Paragraph("<seq id='counter'/>.&nbsp; __________________________________________",stylesheet['Signaturefield']))
            cell3b.append(Spacer(0, 0.2 * cm))
            data.append([cell3a, cell3b])

        # status
        cell4a = []
        cell4b = []
        note = " ".join(motion.notes)
        cell4a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Status"), stylesheet['Heading4']))
        if note != "":
            if motion.status == "pub":
                cell4b.append(Paragraph(note, stylesheet['Normal']))
            else:
                cell4b.append(Paragraph("%s | %s" % (motion.get_status_display(), note), stylesheet['Normal']))
        else:
            cell4b.append(Paragraph("%s" % motion.get_status_display(), stylesheet['Normal']))
        data.append([cell4a, cell4b])

        # Version number (aid)
        if motion.public_version.aid > 1:
            cell5a = []
            cell5b = []
            cell5a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Version"), stylesheet['Heading4']))
            cell5b.append(Paragraph("%s" % motion.public_version.aid, stylesheet['Normal']))
            data.append([cell5a, cell5b])

        # voting results
        poll_results = motion.get_poll_results()
        if poll_results:
            cell6a = []
            cell6a.append(Paragraph("<font name='Ubuntu-Bold'>%s:</font>" % _("Vote results"), stylesheet['Heading4']))
            cell6b = []
            ballotcounter = 0
            for result in poll_results:
                ballotcounter += 1
                if len(poll_results) > 1:
                    cell6b.append(Paragraph("%s. %s" % (ballotcounter, _("Vote")), stylesheet['Bold']))
                cell6b.append(Paragraph("%s: %s <br/> %s: %s <br/> %s: %s <br/> %s: %s <br/> %s: %s" % (_("Yes"), result[0], _("No"), result[1], _("Abstention"), result[2], _("Invalid"), result[3], _("Votes cast"), result[4]), stylesheet['Normal']))
                cell6b.append(Spacer(0, 0.2*cm))
            data.append([cell6a, cell6b])

        # Creating Table
        t = Table(data)
        t._argW[0] = 4.5 * cm
        t._argW[1] = 11 * cm
        t.setStyle(TableStyle([('BOX', (0, 0), (-1, -1), 1, colors.black),
                               ('VALIGN', (0,0), (-1,-1), 'TOP')]))
        story.append(t)
        story.append(Spacer(0, 1 * cm))

        # title
        story.append(Paragraph(motion.public_version.title, stylesheet['Heading3']))
        # text
        story.append(Paragraph("%s" % motion.public_version.text.replace('\r\n','<br/>'), stylesheet['Paragraph']))
        # reason
        if motion.public_version.reason:
            story.append(Paragraph(_("Reason")+":", stylesheet['Heading3']))
            story.append(Paragraph("%s" % motion.public_version.reason.replace('\r\n','<br/>'), stylesheet['Paragraph']))
        return story
开发者ID:MechanisM,项目名称:OpenSlides,代码行数:99,代码来源:views.py

示例13: generarLibreta

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
  def generarLibreta(self, nombreEstudiante, calificaciones, grado, anioLectivo, representante,
    profesor):

    namefile = "Libreta_%s_%s.pdf"%(nombreEstudiante, grado)
    elementos = []
    styleSheet = getSampleStyleSheet()
    doc = SimpleDocTemplate(namefile, pagesize=letter)
    styles = getSampleStyleSheet()
    titulo = Paragraph("""<font size="9">ESCUELA PARTICULAR MIXTA # 851 &quot;Dr. JAIME ASPIAZU SEMINARIO&quot;</font>""", styleSheet["BodyText"])
    stringEstudiante = u"ESTUDIANTE:                    %s"%nombreEstudiante

    strigngradoAnio = u"GRADO:                         %s GRADO                            AÑO LECTIVO %s"%(grado, anioLectivo)

    datosHeader = [[titulo],[stringEstudiante],[strigngradoAnio],[]]
    tablaH = Table(datosHeader)
    tablaH.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
                       ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
                       ('TEXTCOLOR',(0,0),(-1,-1),colors.black),
                       ('BOX', (0,0), (-1,-1), 0.25, colors.black)]))

    tablaH._argW[0]=7*inch

    elementos.append(tablaH)

    m1 = ["Lengua y literatura"]
    m2 = [u"Matemática" ]
    m3 = ["Ciencias Naturales"]
    m4 = ["Estudio Sociales" ]
    m5 = [u"Cultura Estética"]
    m6 =        [u"Cultura Física" ]
    m7 = [u"Inglés"]
    m8 =  ["Optativa"]
    m9 =  ["Suma total"]
    m10 = ["PROMEDIO"]

    materias = []
    i =0
    for f in [m1, m2, m3,m4,m5,m6,m7,m8,m9,m10]:
      materias.append(f + calificaciones[i])
      i = i+1


    headerGrill = [["ASIGNATURA         ","1   ","2   ","3   ","EXA ","Prom", "1   ","2   ","3   ","EXA ",
                  "Prom", "PRO ", "SUP ", "PF  " ]] 




    for f in materias:
      headerGrill.append(f)


    tablaLibreta = Table(headerGrill)
    tablaLibreta.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
                       ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
                       ('TEXTCOLOR',(0,0),(-1,-1),colors.black),
                       ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
                       ('BOX', (0,0), (-1,-1), 0.25, colors.black),
                       ('FONTSIZE', (1, 1), (-1, -1), 8), 
                       ]))



    elementos.append(tablaLibreta)

    listaFinal = [["REPRESENTANTE ", representante],[u"PROFESOR GUÍA", profesor]]
    tablafinal = Table(listaFinal)
    tablafinal.setStyle(TableStyle([ ('ALIGN',(0,0),(-1,-1),'LEFT'),
                       ('VALIGN',(0,0),(-1,-1),'MIDDLE'),
                       ('TEXTCOLOR',(0,0),(-1,-1),colors.black),
                       ('INNERGRID', (0,0), (-1,-1), 0.25, colors.black),
                       ('BOX', (0,0), (-1,-1), 0.25, colors.black),
                       ]))

    tablafinal._argW[0]=3.49*inch
    tablafinal._argW[1]=3.49*inch

    elementos.append(tablafinal)

    doc.build(elementos)
开发者ID:obayona,项目名称:Proyecto-Bases-de-Datos-Python,代码行数:82,代码来源:GeneradorReporte.py

示例14: ImprimirAllProductoListar

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def ImprimirAllProductoListar(request, fechaI, fechaF):
	
	response = HttpResponse(content_type='application/pdf')

	finicio = datetime.fromtimestamp(int(fechaI) / 1e3)
	ffin = datetime.fromtimestamp(int(fechaF) / 1e3)
	pdf_name = "reporte_producto.pdf" 
	buff = BytesIO()
	
	doc = SimpleDocTemplate(buff,
							pagesize=letter,
							rightMargin=50,
							leftMargin=50,
							topMargin=20,
							bottomMargin=18,
							)
	doc.pagesize = landscape(A4)
	# doc.pagesize = portrait(A4)
	productos = []
	# producto = Producto.objects.get(id = int(idproducto))
	totales = DetalleVenta.objects.filter(venta__fecha__gte = finicio,  venta__fecha__lte = ffin, venta__estado = 'ACTIVO', venta__credito = False).aggregate(total = Sum(F('cantidad')*F('precio'), output_field=FloatField()), cantidad= Sum('cantidad', output_field=FloatField()))
	styles = getSampleStyleSheet()
	header = Paragraph("GRUPOEJ - SRL." , getStyleSheet()['Title'])
	# pro = Paragraph(producto.descripcion, getStyleSheet()['TopicTitle8'])
	productos.append(header)
	productos.append(Spacer(1, 0.2 * inch))	
	productos.append(Paragraph("REPORTE TOTAL." , getStyleSheet()['TopicTitle14']))
	productos.append(Spacer(1, 0.05 * inch))
	# productos.append(pro)
	productos.append(Paragraph("<para>Fecha Inicio: "+finicio.strftime('%d/%m/%Y')+" &nbsp;&nbsp;&nbsp;"+" Fecha Fin:"+ffin.strftime('%d/%m/%Y')+"</para>", getStyleSheet()['TopicTitle8']))
	productos.append(Spacer(1, 0.05 * inch))

	productos.append(Paragraph("DETALLE", getStyleSheet()['TopicTitle10']))
	productos.append(Spacer(1, 0.1 * inch))

	headings = ('CLIENTE', "PRODUCTO","CANTIDAD", 'PRECIO', "SUBTOTAL")
	detalleventa = [
			(str(dv.venta.pedido.cliente.nombres)+" "+str(dv.venta.pedido.cliente.apellidos)+" / "+str(dv.venta.pedido.cliente.area)+ " / "+ str(dv.venta.pedido.cliente.responsable), 
			str(dv.producto.descripcion),str(dv.cantidad), str(dv.precio), str(dv.cantidad * dv.precio)) for dv in DetalleVenta.objects.filter(venta__fecha__gte = finicio,  venta__fecha__lte = ffin, venta__estado = 'ACTIVO', venta__credito = False).order_by('producto_id')]
	data = ([headings] + detalleventa)

	data2 = [[Paragraph(cell, getStyleSheet()['TopicItemq0']) for cell in row] for row in data]
	t=Table(data2)
	style = TableStyle(
		[
			('BACKGROUND', (0, 0), (-1, 0), colors.gray),
			('LINEABOVE', (0,0), (-1,0), 2, colors.green),
			('LINEABOVE', (0,1), (-1,-1), 0.25, colors.black),
			('LINEBELOW', (0,-1), (-1,-1), 2, colors.green),
			('ALIGN', (1,1), (-1,-1), 'CENTER'),
		]
	)

	t.setStyle(style)
	t._argW[0]=3.8*inch
	t._argW[1]=4.9*inch
	t._argW[2]=0.75*inch
	t._argW[3]=0.8*inch
	productos.append(t)
	productos.append(Paragraph("CANTIDAD - TOTAL:( "+str(totales['cantidad'])+" ) &nbsp;&nbsp;&nbsp;"+"&nbsp;&nbsp;&nbsp;"+"PRECIO TOTAL: ( "+str(totales['total'])+" S/)", getStyleSheet()['TopicTitle8Right']))
	doc.build(productos)
	response.write(buff.getvalue())
	buff.close()
	return response
开发者ID:xcarlx,项目名称:ventas,代码行数:66,代码来源:views.py

示例15: users_passwords_to_pdf

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[0] [as 别名]
def users_passwords_to_pdf(pdf):
    """
    Create access data sheets for all users as PDF.
    """
    users_pdf_wlan_ssid = config["users_pdf_wlan_ssid"] or "-"
    users_pdf_wlan_password = config["users_pdf_wlan_password"] or "-"
    users_pdf_wlan_encryption = config["users_pdf_wlan_encryption"] or "-"
    users_pdf_url = config["users_pdf_url"] or "-"
    users_pdf_welcometitle = config["users_pdf_welcometitle"]
    users_pdf_welcometext = config["users_pdf_welcometext"]
    if config['users_sort_users_by_first_name']:
        sort = 'first_name'
    else:
        sort = 'last_name'
    qrcode_size = 2 * cm
    # qrcode for system url
    qrcode_url = QrCodeWidget(users_pdf_url)
    qrcode_url.barHeight = qrcode_size
    qrcode_url.barWidth = qrcode_size
    qrcode_url.barBorder = 0
    qrcode_url_draw = Drawing(45, 45)
    qrcode_url_draw.add(qrcode_url)
    # qrcode for wlan
    text = "WIFI:S:%s;T:%s;P:%s;;" % (users_pdf_wlan_ssid, users_pdf_wlan_encryption, users_pdf_wlan_password)
    qrcode_wlan = QrCodeWidget(text)
    qrcode_wlan.barHeight = qrcode_size
    qrcode_wlan.barWidth = qrcode_size
    qrcode_wlan.barBorder = 0
    qrcode_wlan_draw = Drawing(45, 45)
    qrcode_wlan_draw.add(qrcode_wlan)

    for user in User.objects.all().order_by(sort):
        pdf.append(Paragraph(escape(user.get_full_name()), stylesheet['h1']))
        pdf.append(Spacer(0, 1 * cm))
        data = []
        # WLAN access data
        cell = []
        cell.append(Paragraph(_("WLAN access data"),
                    stylesheet['h2']))
        cell.append(Paragraph("%s:" % _("WLAN name (SSID)"),
                    stylesheet['formfield']))
        cell.append(Paragraph(escape(users_pdf_wlan_ssid),
                    stylesheet['formfield_value']))
        cell.append(Paragraph("%s:" % _("WLAN password"),
                    stylesheet['formfield']))
        cell.append(Paragraph(escape(users_pdf_wlan_password),
                    stylesheet['formfield_value']))
        cell.append(Paragraph("%s:" % _("WLAN encryption"),
                    stylesheet['formfield']))
        cell.append(Paragraph(escape(users_pdf_wlan_encryption),
                    stylesheet['formfield_value']))
        cell.append(Spacer(0, 0.5 * cm))
        # OpenSlides access data
        cell2 = []
        cell2.append(Paragraph(_("OpenSlides access data"),
                     stylesheet['h2']))
        cell2.append(Paragraph("%s:" % _("Username"),
                     stylesheet['formfield']))
        cell2.append(Paragraph(escape(user.username),
                     stylesheet['formfield_value']))
        cell2.append(Paragraph("%s:" % _("Password"),
                     stylesheet['formfield']))
        cell2.append(Paragraph(escape(user.default_password),
                     stylesheet['formfield_value']))
        cell2.append(Paragraph("URL:",
                     stylesheet['formfield']))
        cell2.append(Paragraph(escape(users_pdf_url),
                     stylesheet['formfield_value']))
        data.append([cell, cell2])
        # QRCodes
        cell = []
        if users_pdf_wlan_ssid != "-" and users_pdf_wlan_encryption != "-":
            cell.append(qrcode_wlan_draw)
            cell.append(Paragraph(_("Scan this QRCode to connect WLAN."),
                        stylesheet['qrcode_comment']))
        cell2 = []
        if users_pdf_url != "-":
            cell2.append(qrcode_url_draw)
            cell2.append(Paragraph(_("Scan this QRCode to open URL."),
                         stylesheet['qrcode_comment']))
        data.append([cell, cell2])
        # build table
        table = Table(data)
        table._argW[0] = 8 * cm
        table._argW[1] = 8 * cm
        table.setStyle(TableStyle([('VALIGN', (0, 0), (-1, -1), 'TOP')]))
        pdf.append(table)
        pdf.append(Spacer(0, 2 * cm))

        # welcome title and text
        pdf.append(Paragraph(escape(users_pdf_welcometitle), stylesheet['h2']))
        pdf.append(Paragraph(escape(users_pdf_welcometext).replace('\r\n', '<br/>'),
                   stylesheet['Paragraph12']))
        pdf.append(PageBreak())
    return pdf
开发者ID:Ramoonus,项目名称:OpenSlides,代码行数:97,代码来源:pdf.py


注:本文中的reportlab.platypus.Table._argW[0]方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。