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()
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()
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()
# date_flag=None, # flag_footer=None, # logo=None, # logo_filename=None, # logo_width=None, # logo_height=None): report = Report('demo.pdf', paper.A4_PORTRAIT, None, None, None, None, None, True, False, True, 'python_logo.png', 80, 80, 70) report.title = '' report.author = 'Manuel Vega' line1_0 = 'CURSO :' line1_1 = u'%s ' % 'CURSO DEMO' line1_2 = u'PROMOCIÓN :' line1_3 = u'%s ' % 'ARMAS XL' line1_4 = u'ANO: ' line1_5 = u'%s' % '2014' text = [line1_0, line1_1, line1_2, line1_3, line1_4, line1_5] heading = HeadingArray(text, 1, True, 14, alignment.LEFT, 4, False, False) report.add(heading) table.auto_grow(report.canvas, report.page_width - report.left_margin - report.right_margin) table.set_drew_header(True) table.set_flag(False) report.add(table) report.add(table2) report.add(PageBreak()) report.create()
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()