コード例 #1
0
ファイル: report.py プロジェクト: Manexware/openedunav
def get_table(number, grade, fullname):
    table = Table()
    if number != None:
        col = table.add_column(number)
        col.width = 15
        col.row.style.horizontal_alignment = alignment.LEFT
    col = table.add_column(grade)
    col.width = 40
    col.row.style.horizontal_alignment = alignment.LEFT
    col = table.add_column(fullname)
    col.width = 200
    col.row.style.horizontal_alignment = alignment.LEFT
    return table
コード例 #2
0
def get_table(number, grade, fullname):
    table = Table()
    if number != None:
        col = table.add_column(number)
        col.width = 15
        col.row.style.horizontal_alignment = alignment.LEFT
    col = table.add_column(grade)
    col.width = 40
    col.row.style.horizontal_alignment = alignment.LEFT
    col = table.add_column(fullname)
    col.width = 200
    col.row.style.horizontal_alignment = alignment.LEFT
    return table
コード例 #3
0
ファイル: certificate.py プロジェクト: Manexware/openedunav
def get_table(subject, average, coefficient, score_final):
    table = Table()
    col = table.add_column(subject)
    col.width = 300
    col.row.style.horizontal_alignment = alignment.LEFT
    col = table.add_column(average)
    col.width = 50
    col.row.style.horizontal_alignment = alignment.CENTER
    col = table.add_column(coefficient)
    col.width = 50
    col.row.style.horizontal_alignment = alignment.CENTER
    col = table.add_column(score_final)
    col.width = 50
    col.row.style.horizontal_alignment = alignment.CENTER
    return table
コード例 #4
0
def get_report(scores_array, column_width):
    rows = len(scores_array)
    columns = len(scores_array[0])
    table = table1 = table2 = table3 = table4 = tabla5 = Table()
    flag = 0
    if columns <= 17:
        flag = 1
        table = populate_table(columns, scores_array, column_width, rows, 3,
                               columns)
    elif (columns > 17) and (columns <= 31):
        flag = 2
        table = populate_table(columns, scores_array, column_width, rows, 3,
                               17)
        table1 = populate_table(columns, scores_array, column_width, rows, 17,
                                columns)
    elif columns > 31 and (columns <= 45):
        flag = 3
        table = populate_table(columns, scores_array, column_width, rows, 3,
                               17)
        table1 = populate_table(columns, scores_array, column_width, rows, 17,
                                31)
        table2 = populate_table(columns, scores_array, column_width, rows, 31,
                                columns)
    elif columns > 45 and (columns <= 59):
        flag = 4
        table = populate_table(columns, scores_array, column_width, rows, 3,
                               17)
        table1 = populate_table(columns, scores_array, column_width, rows, 17,
                                31)
        table2 = populate_table(columns, scores_array, column_width, rows, 31,
                                45)
        table3 = populate_table(columns, scores_array, column_width, rows, 45,
                                columns)
    elif columns > 59 and (columns <= 73):
        flag = 5
        table = populate_table(columns, scores_array, column_width, rows, 3,
                               17)
        table1 = populate_table(columns, scores_array, column_width, rows, 17,
                                31)
        table2 = populate_table(columns, scores_array, column_width, rows, 31,
                                45)
        table3 = populate_table(columns, scores_array, column_width, rows, 45,
                                59)
        table4 = populate_table(columns, scores_array, column_width, rows, 59,
                                columns)
    elif columns > 73:
        flag = 6
        table = populate_table(columns, scores_array, column_width, rows, 3,
                               17)
        table1 = populate_table(columns, scores_array, column_width, rows, 17,
                                31)
        table2 = populate_table(columns, scores_array, column_width, rows, 31,
                                45)
        table3 = populate_table(columns, scores_array, column_width, rows, 45,
                                59)
        table4 = populate_table(columns, scores_array, column_width, rows, 59,
                                73)
        table5 = populate_table(columns, scores_array, column_width, rows, 59,
                                columns)
    return flag, table, table1, table2, table3, table4, tabla5
コード例 #5
0
def get_table(subject, average, coefficient, score_final):
    table = Table()
    col = table.add_column(subject)
    col.width = 300
    col.row.style.horizontal_alignment = alignment.LEFT
    col = table.add_column(average)
    col.width = 50
    col.row.style.horizontal_alignment = alignment.CENTER
    col = table.add_column(coefficient)
    col.width = 50
    col.row.style.horizontal_alignment = alignment.CENTER
    col = table.add_column(score_final)
    col.width = 50
    col.row.style.horizontal_alignment = alignment.CENTER
    return table
コード例 #6
0
ファイル: report.py プロジェクト: Manexware/openedunav
def report_pdf(full_path, scores_array, course_name, promotion_name, title_report, full_title=None, teacher_title=None,
               detail_title=None, final=None, boss_name=None, boss_title=None, deviation_title=None):
    report = Report(full_path, paper_type.A4_LANDSCAPE, None, None, None, None, None, True, True)
    if final == True:

        get_heading_score_final(report, course_name, promotion_name, title_report, full_title, teacher_title,
                                deviation_title)
    else:
        get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title,
                    deviation_title)
    if scores_array:
        if final == True:
            column_with = 90
        else:
            column_with = 30
        flag, table, table1, table2, table3, table4, table5 = get_report(scores_array, column_with)
        if flag == 1:
            report.add(table)
        elif flag == 2:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table1)
        elif flag == 3:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table2)
        elif flag == 4:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table2)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table3)
        elif flag == 5:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table2)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table3)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table4)
        elif flag == 6:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table2)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table3)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table4)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report, full_title, teacher_title, detail_title)
            report.add(table5)
    if final == True:
        table_signature = Table()
        col = table_signature.add_column('col1')
        col.row.style.horizontal_alignment = alignment.CENTER
        table_signature.add_row(['  ', ])
        table_signature.add_row(['  ', ])
        table_signature.add_row(['  ', ])
        table_signature.add_row(['  ', ])
        table_signature.add_row(['  ', ])
        table_signature.add_row(['______________________________________________________', ])
        table_signature.add_row([u'%s' % boss_name, ])
        table_signature.add_row([u'%s' % boss_title, ])
        table_signature.add_row([u'EL JEFE DEL DEPARTAMENTO DE ESTADÍSTICA Y EVALUACIÓN', ])
        table_signature.auto_grow(report.canvas, report.page_width)
        table_signature.set_drew_header(True)
        table_signature.set_flag(False)
        report.add(table_signature)
    report.create()
コード例 #7
0
ファイル: certificate.py プロジェクト: Manexware/openedunav
def report_pdf(full_path, scores_array, course_name, promotion_name, year, student_name, student_nuc, student_id,
               subjects,
               t_hours, credit, start_date, end_date, logo_path, date_now, boss_name, boss_title, director_name,
               director_title, score_array_summary, score_array_summary_final, score_array_summary_productivity,
               score_array_summary_attitude, array_seminaries, foreign_students, child_course, child_achievement):
    report = Report(full_path, paper_type.A4_PORTRAIT,None, 40, 20, 40, 20, False, False, True, logo_path,
                    40, 40, 50)
    page_width = report.page_width - report.left_margin - report.right_margin

    if student_name:
        longitude = len(student_name)
        for index in range(longitude):
            get_heading(report, course_name, promotion_name, year, student_name[index], student_nuc[index],
                        t_hours, credit, start_date,end_date, index + 1)
            num_students = len(score_array_summary) - 1
            score_array, seniority = get_certificate_scores_array(student_id[index],scores_array, subjects, score_array_summary,
                                          score_array_summary_final, score_array_summary_productivity,
                                          score_array_summary_attitude, child_course, child_achievement)
            if score_array:
                table = get_report(score_array)
                table.auto_grow(report.canvas, page_width)
                list_columns = [subjects + 1, subjects + 2, subjects + 3, subjects + 4, subjects + 5, subjects + 6,
                                subjects + 7]
                table.set_flag(True, list_columns)
                report.add(table)


            table_seniority = Table()
            col = table_seniority.add_column('col1')
            col.row.style.horizontal_alignment = alignment.LEFT
            col = table_seniority.add_column('col2')
            col.width = 50
            col.row.style.horizontal_alignment = alignment.RIGHT
            table_seniority.add_row([' ', ' ', ])
            if seniority != '--':
                table_seniority.add_row(['ANTIGUEDAD', '%s de %s           ' %(seniority, num_students - foreign_students), ])
            table_seniority.add_row([' ', ' '])
            if array_seminaries:
                table_seniority.add_row(['SEMINARIOS:', ' '])
                for row in array_seminaries:
                    table_seniority.add_row([row, ''])
            table_seniority.add_row([' ', ' '])
            table_seniority.add_row([' ', 'Guayaquil, %s' % date_now,])
            table_seniority.auto_grow(report.canvas, page_width)
            table_seniority.set_drew_header(True)
            table_seniority.set_flag(False, [1])
            report.add(table_seniority)


            report.add(Heading('',
                               1, False, 8, alignment.CENTER, 18, False, False))

            table_signature =  Table()
            col = table_signature.add_column('col1')
            col.row.style.horizontal_alignment = alignment.CENTER
            col = table_signature.add_column('col2')
            col.row.style.horizontal_alignment = alignment.CENTER
            table_signature.add_row(['EL JEFE DEL DEPARTAMENTO DE', 'EL DIRECTOR DE LA ACADEMIA', ])
            table_signature.add_row([u'ESTADÍSTICA Y EVALUACIÓN', 'DE GUERRA NAVAL', ])
            table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['____________________________', '____________________________', ])
            table_signature.add_row([u'%s' % boss_name , u'%s' % director_name, ])
            table_signature.add_row([u'%s' % boss_title , u'%s' % director_title, ])
            table_signature.auto_grow(report.canvas, page_width)
            table_signature.set_drew_header(True)
            table_signature.set_flag(False)
            report.add(table_signature)

            #report.canvas.showPage()

            if index != longitude -1:
                report.add(PageBreak())

    report.create()
コード例 #8
0
ファイル: test.py プロジェクト: Manexware/podunk
#!/usr/bin/env python
#  -*- coding: UTF-8 -*-
from manexreport.prefab import alignment
from manexreport.prefab.formats import format_two_decimals
from manexreport.prefab.formats import format_us_currency
from manexreport.project.report import Report
from manexreport.widget.pagebreak import PageBreak
from manexreport.widget.table import Table

import manexreport.prefab.paper as paper
from manexreport.widget.heading_array import HeadingArray

table = Table()

col = table.add_column('employee')

col.row.style.horizontal_alignment = alignment.RIGHT

col = table.add_column('employee')
col.row.format = format_two_decimals
col.row.style.horizontal_alignment = alignment.RIGHT

col = table.add_column('employee')
col.row.format = format_us_currency
col.row.style.horizontal_alignment = alignment.RIGHT

col = table.add_column('employee')
col.row.format = format_us_currency
col.row.style.horizontal_alignment = alignment.RIGHT

for x in range(10):
コード例 #9
0
def report_pdf(full_path,
               scores_array,
               course_name,
               promotion_name,
               title_report,
               full_title=None,
               teacher_title=None,
               detail_title=None,
               final=None,
               boss_name=None,
               boss_title=None,
               deviation_title=None):
    report = Report(full_path, paper_type.A4_LANDSCAPE, None, None, None, None,
                    None, True, True)
    if final == True:

        get_heading_score_final(report, course_name, promotion_name,
                                title_report, full_title, teacher_title,
                                deviation_title)
    else:
        get_heading(report, course_name, promotion_name, title_report,
                    full_title, teacher_title, detail_title, deviation_title)
    if scores_array:
        if final == True:
            column_with = 90
        else:
            column_with = 30
        flag, table, table1, table2, table3, table4, table5 = get_report(
            scores_array, column_with)
        if flag == 1:
            report.add(table)
        elif flag == 2:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table1)
        elif flag == 3:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table2)
        elif flag == 4:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table2)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table3)
        elif flag == 5:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table2)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table3)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table4)
        elif flag == 6:
            report.add(table)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table1)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table2)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table3)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table4)
            report.add(PageBreak())
            get_heading(report, course_name, promotion_name, title_report,
                        full_title, teacher_title, detail_title)
            report.add(table5)
    if final == True:
        table_signature = Table()
        col = table_signature.add_column('col1')
        col.row.style.horizontal_alignment = alignment.CENTER
        table_signature.add_row([
            '  ',
        ])
        table_signature.add_row([
            '  ',
        ])
        table_signature.add_row([
            '  ',
        ])
        table_signature.add_row([
            '  ',
        ])
        # table_signature.add_row(['  ', ])
        table_signature.add_row([
            '______________________________________________________',
        ])
        table_signature.add_row([
            u'%s' % boss_name,
        ])
        table_signature.add_row([
            u'%s' % boss_title,
        ])
        table_signature.add_row([
            u'EL JEFE DEL DEPARTAMENTO DE ESTADÍSTICA Y EVALUACIÓN',
        ])
        table_signature.auto_grow(report.canvas, report.page_width)
        table_signature.set_drew_header(True)
        table_signature.set_flag(False)
        report.add(table_signature)
    report.create()
コード例 #10
0
def report_pdf(full_path, scores_array, course_name, promotion_name, year, student_name, student_nuc, student_id,
               subjects, t_hours, credit, start_date, end_date, logo_path, date_now, boss_name, boss_title,
               director_name, director_title, score_array_summary, score_array_summary_final, array_seminaries,
               child_course, child_achievement, flag_new_table):
    report = Report(full_path, paper_type.A4_PORTRAIT, None, 40, 30, 40, 20, False, False, True, logo_path,
                    40, 40, 50)
    page_width = report.page_width - report.left_margin - report.right_margin

    if student_name:
        longitude = len(student_name)
        for index in range(longitude):
            get_heading(report, course_name, promotion_name, year, student_name[index], student_nuc[index],
                        t_hours, credit, start_date, end_date, index + 1)
            num_students = len(score_array_summary) - 1
            if flag_new_table:
                score_array, seniority = get_certificate_scores_array_new_table(student_id[index], scores_array,
                                                                                subjects,
                                                                                score_array_summary,
                                                                                score_array_summary_final,
                                                                                child_course, child_achievement)
            else:
                score_array, seniority = get_certificate_scores_array(student_id[index], scores_array, subjects,
                                                                      score_array_summary, score_array_summary_final,
                                                                      child_course, child_achievement)
            if score_array:
                table = get_report(score_array)
                try:
                    table.auto_grow(report.canvas, page_width)
                except:
                    pass
                list_columns = [subjects + 1, subjects + 2, subjects + 3, subjects + 4, subjects + 5, subjects + 6,
                                subjects + 7]
                table.set_flag(True, list_columns)
                report.add(table)

            table_seniority = Table()
            col = table_seniority.add_column('col1')
            col.row.style.horizontal_alignment = alignment.LEFT
            col = table_seniority.add_column('col2')
            col.width = 50
            col.row.style.horizontal_alignment = alignment.RIGHT
            table_seniority.add_row([' ', ' ', ])
            if seniority != '--':
                table_seniority.add_row(
                    ['ANTIGUEDAD', '%s de %s           ' % (seniority, num_students), ])
            table_seniority.add_row([' ', ' '])
            if array_seminaries:
                table_seniority.add_row(['SEMINARIOS:', ' '])
                for row in array_seminaries:
                    table_seniority.add_row([row, ''])
            table_seniority.add_row([' ', ' '])
            table_seniority.add_row([' ', 'Guayaquil, %s' % date_now, ])
            table_seniority.auto_grow(report.canvas, page_width)
            table_seniority.set_drew_header(True)
            table_seniority.set_flag(False, [1])

            report.add(table_seniority)

            report.add(Heading('', 1, False, 8, alignment.CENTER, 18, False, False))

            table_signature = Table()
            col = table_signature.add_column('col1')
            col.row.style.horizontal_alignment = alignment.CENTER
            col = table_signature.add_column('col2')
            col.row.style.horizontal_alignment = alignment.CENTER
            if table.get_row_count() <= 35:
                table_signature.add_row(['  ', '  ', ])
                table_signature.add_row(['  ', '  ', ])
                table_signature.add_row(['  ', '  ', ])
                table_signature.add_row(['  ', '  ', ])
                table_signature.add_row(['  ', '  ', ])
                table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['EL JEFE DEL DEPARTAMENTO DE', 'EL DIRECTOR DE LA ACADEMIA', ])
            table_signature.add_row([u'ESTADÍSTICA Y EVALUACIÓN', 'DE GUERRA NAVAL', ])
            table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['  ', '  ', ])
            table_signature.add_row(['____________________________', '____________________________', ])
            table_signature.add_row([u'%s' % boss_name, u'%s' % director_name, ])
            table_signature.add_row([u'%s' % boss_title, u'%s' % director_title, ])
            table_signature.auto_grow(report.canvas, page_width)
            table_signature.set_drew_header(True)
            table_signature.set_flag(False)
            report.add(table_signature)

            if index != longitude - 1:
                report.add(PageBreak())
    report.create()