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


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

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


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

示例1: GenerarListaAsistencia

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[4] [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: genInvoice

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

#.........这里部分代码省略.........
    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
    t._argW[3] = 2*cm
    t._argW[4] = 2*cm
    t._argW[5] = 2*cm
    t.wrapOn(c, 19*cm, 6*cm)
    t.drawOn(c, 1*cm, 18*cm)
开发者ID:pkyad,项目名称:libreERP-main,代码行数:104,代码来源:views.py

示例3: Table

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[4] [as 别名]
#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)
buffer.close()
file.close()
开发者ID:johndavidback,项目名称:ReportLabs,代码行数:31,代码来源:GenerateReport.py

示例4: ImprimirVentasCreditos

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[4] [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

示例5: generate_case_report

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[4] [as 别名]
def generate_case_report(case, cs_docs):

    cName = case[0]
    cNumber = case[1]
    cTitle = case[2]
    cDescr = case[3]
    cDate = case[4]
    cLocation = case[5]

    filename = cNumber + "_" + cName + "_report.pdf"
    fileN = cNumber + "_" + cName + "_report"
    # logo =  os.path.join(os.path.dirname(os.path.abspath(__file__)),"static/reporting/images/crime_loud_logo.jpg")

    response = HttpResponse(content_type="application/pdf")
    response["Content-Disposition"] = "attachment; filename=" + filename

    buffer = BytesIO()
    # might have to change margins depending on what mamzo wants
    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>" + "Case Name: " + cName + "</h1>", styleH))
    elements.append(Paragraph("<h3>" + "Case Number: " + cNumber + "</h3>", styleH))
    elements.append(Paragraph("<h3>" + "Title: " + cTitle + "</h3>", styleH))
    elements.append(Paragraph("<h3>" + "Description: " + cDescr + "</h3>", styleH))
    elements.append(Paragraph("<h3>" + "Date: " + cDate + "</h3>", styleH))
    elements.append(Paragraph("<h3>" + "Location: " + cLocation + "</h3>", styleH))

    elements.append(Spacer(width=0, height=0.1 * cm))

    ##############################################

    tdata = [[Paragraph("<b>" + "Crime Scene Uploads" + "</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>User Name</b>", styleN),
            Paragraph("<b>Date</b>", styleN),
            Paragraph("<b>Action</b>", styleN),
            Paragraph("<b>Description</b>", styleN),
            Paragraph("<b>PDE Date </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
    table._argW[4] = 1.5 * inch

    elements.append(table)
    elements.append(Spacer(width=0, height=1 * cm))
    """
    this part of the table must loop through the community aray to display all available information
    for example:
    
    for k in cs_docs:
    
        tdata = [k[0], k[1],k[2], k[3],k[4]]
        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
        table2._argW[4]=1.5*inch
        elements.append(table2)
        
    elements.append(Spacer(width=0, height=1*cm))
    """
#.........这里部分代码省略.........
开发者ID:u12094847,项目名称:Neighborhood-Watch-,代码行数:103,代码来源:api.py

示例6: ImprimirClienteListar

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[4] [as 别名]
def ImprimirClienteListar(request, idcliente, 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 = []
	cliente = Cliente.objects.get(id = int(idcliente))
	totales = DetalleVenta.objects.filter(venta__pedido__cliente__id = idcliente, venta__fecha__gte = finicio,  venta__fecha__lte = ffin, venta__credito = False , venta__estado = 'ACTIVO').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(str(cliente.nombres)+" "+str(cliente.apellidos)+" / "+str(cliente.area)+" / "+str(cliente.responsable), getStyleSheet()['TopicTitle8'])
	productos.append(header)
	productos.append(Spacer(1, 0.2 * inch))	
	productos.append(Paragraph("REPORTE POR CLIENTE." , 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 = ('FECHA', "CLIENTE", "PRODUCTO", "CANTIDAD", 'PRECIO')
	detalleventa = [
			(
				(dv.venta.fecha).strftime('%d/%m/%Y') , 
				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)
			) 
			for dv in DetalleVenta.objects.filter(venta__pedido__cliente__id=idcliente, venta__fecha__gte = finicio,  venta__fecha__lte = ffin, venta__credito = False, venta__estado = 'ACTIVO')]
	
	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]=0.8*inch
	t._argW[1]=2.5*inch
	t._argW[2]=2.5*inch
	t._argW[3]=0.75*inch
	t._argW[4]=0.8*inch
	productos.append(t)
	productos.append(Paragraph("CANTIDAD - TOTAL:( "+str(totales['cantidad'])+" ) &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,代码行数:74,代码来源:views.py

示例7: generate_assessment_report

# 需要导入模块: from reportlab.platypus import Table [as 别名]
# 或者: from reportlab.platypus.Table import _argW[4] [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

示例8: ImprimirReporteEnvacePorProducto

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

	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 = []
	cliente = Cliente.objects.get(id = idcliente)
	# prod = Prestamo.objects.filter(id = idproducto)
	# produc = Producto.objects.filter(id = prod[0].producto.id)
	totales = Prestamo.objects.filter(cliente__id = idcliente, producto__id= idproducto).aggregate(
			total_entregado=Sum(F('entregado'),output_field=FloatField()), 
			total_devuelto=Sum(F('devuelto'),output_field=FloatField())
		)
	# aggregate(total = Sum(F('cantidad')*F('precio'), output_field=FloatField())
	# extra(select = {'total_entregado': 'SUM(entregado)','total_devuelto': 'SUM(devuelto)'})
	styles = getSampleStyleSheet()
	header = Paragraph("GRUPOEJ - SRL." , getStyleSheet()['Title'])
	cli = Paragraph(str(cliente.nombres)+" "+str(cliente.apellidos)+" / "+str(cliente.area)+ " / "+ str(cliente.responsable), 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(cli)
	productos.append(Paragraph("DETALLE", getStyleSheet()['TopicTitle10']))
	productos.append(Spacer(1, 0.1 * inch))

	headings = ("PRODUCTO","FECHA","NRO DOCUMENTO","ENTREGADA ", 'DEVUELTA', 'DEBE')
	detalleventa = [
			(str(dv.producto.descripcion),str(dv.fecha),str(dv.nro_documento) ,str(dv.entregado), str(dv.devuelto), str(dv.entregado - dv.devuelto)) 
			for dv in Prestamo.objects.filter(cliente__id = idcliente, producto__id= idproducto)]
	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]=2.5*inch
	t._argW[1]=1.0*inch
	t._argW[2]=1.2*inch
	t._argW[3]=0.9*inch
	t._argW[4]=0.8*inch
	t._argW[5]=0.7*inch
	productos.append(t)
	productos.append(
		Paragraph("Total Entregado &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+str(int(totales['total_entregado']))
			+" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+"Total Devuelto &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+str(int(totales['total_devuelto']))
			+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+"TOTAL DEBE: "
			+str(int(totales['total_entregado']) - int(totales['total_devuelto'])), getStyleSheet()['TopicTitle8Right']))
	doc.build(productos)
	response.write(buff.getvalue())
	buff.close()
	return response
开发者ID:xcarlx,项目名称:ventas,代码行数:78,代码来源:views.py

示例9: some_view3

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

#.........这里部分代码省略.........
            ['Regnr:', workorder.registration_nr],
            ['Km:', workorder.km]]

    c=Table(data,style=[        #(col, row)
                        #('GRID',(0,0),(-1,-1),2,colors.black),
                        #('LINEABOVE',(1,1),(1,1),1,colors.black),
                        #('LINEABOVE',(1,2),(1,2),1,colors.black),
                        #('LINEABOVE',(1,3),(1,3),1,colors.black),
                        #('LINEABOVE',(1,4),(1,4),1,colors.black),
                        ('VALIGN',(0,7),(0,8),'TOP'),
                        ('ALIGN',(0,0),(-1,-1),'LEFT'),
                        
    ])
    c._argW[1]=3.7*inch

    elements.append(c)

    elements.append(FrameBreak())
    ###############################################################

    ###############################################################
    #Articles

    data = [['Art.nr.', 'Antal', 'Benämning', 'Pris st', 'Pris']]

    d=Table(data,style=[        #(col, row)
                        ('GRID',(0,1),(-1,-1),2,colors.black),
                        ('ALIGN',(0,0),(-1,-1),'LEFT'),             
    ])
    d._argW[0]=1.0*inch
    d._argW[1]=1.0*inch
    d._argW[2]=3.0*inch
    d._argW[3]=1.0*inch
    d._argW[4]=1.0*inch

    elements.append(d)


    #For varje artikel lagg till rad med information
    #MAX 15 articles

    existing_articles = int(workorder.article_set.all().count())
    max_articles = 15
    #Check if workorder has any articles
     
    #counter = 0
    for article in workorder.article_set.all():
        #counter += 1
        data = [[article.article_nr, article.quantity, article.description, article.price, article.price_total ]]
        e=Table(data,style=[        #(col, row)
                            ('GRID',(0,0),(-1,-1),2,colors.black),
                            ('ALIGN',(0,0),(-1,-1),'LEFT'),             
        ])
        e._argW[0]=1.0*inch
        e._argW[1]=1.0*inch
        e._argW[2]=3.0*inch
        e._argW[3]=1.0*inch
        e._argW[4]=1.0*inch

        elements.append(e)

    #Calculate how many empty rows to fill up
    rest = (max_articles - existing_articles)
    for empty_articles in range(rest):
        data = [['', '', '', '', '']]
        e=Table(data,style=[        #(col, row)
开发者ID:Happyhours,项目名称:nmcs-program-OLD,代码行数:70,代码来源:views.py


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