def _add_header(worksheet, organization):
    report_sequence = organization.report_sequence()
    column_titles = []
    for item in report_sequence:
        column_titles.append(str(_(item)))

    add_row(worksheet, column_titles)
    cells = worksheet.range("A1:N1")[0]
    for cell in cells:
        cell.font = Font(bold=True)
Esempio n. 2
0
def _add_periods(worksheet, periods, affectations):
    for period in periods:
        add_row(worksheet, [
            str(period.name),
            period.date_start.strftime("%d-%m-%Y"),
            period.date_end.strftime("%d-%m-%Y")
        ])
        coloring_non_editable_line(worksheet, worksheet.max_row, 9)
        _add_affectations(worksheet, period, affectations)
        add_row(worksheet)
Esempio n. 3
0
def _add_affectations(worksheet, period, affectations):
    for affectation in affectations:
        if affectation.period.name == period.name:
            student = affectation.student
            add_row(worksheet, [
                str(student.person.last_name),
                str(student.person.first_name), student.registration_id,
                affectation.email, affectation.adress, student.person.gender,
                student.person.birth_date, affectation.phone_mobile
            ])
Esempio n. 4
0
def _add_masters(worksheet, fields):
    fields_names = _build_fields_names(fields)
    master_allocation = MasterAllocation.objects.filter(master=OuterRef('pk'))
    masters = InternshipMaster.objects.all().order_by('person__last_name', 'person__first_name').annotate(
        specialty=Subquery(master_allocation.values('specialty__name')[:1]),
        organization=Subquery(master_allocation.values('organization__name')[:1]),
        organization_ref=Subquery(master_allocation.values('organization__reference')[:1])
    ).values_list(*fields_names, 'specialty', 'organization', 'organization_ref').distinct()
    for master in masters:
        add_row(worksheet, master)
def _add_header(cohort, worksheet):
    periods = models.period.find_by_cohort(cohort)
    column_titles = ["Nom", "Prénom", "NOMA"]
    for period in periods:
        column_titles.append(period.name)
        column_titles.append("{}+".format(period.name))
    add_row(worksheet, column_titles)
    cells = worksheet.range("A1:AA1")[0]
    for cell in cells:
        cell.font = Font(bold=True)
def _add_students(cohort, worksheet):
    students_stat = models.internship_student_affectation_stat.find_by_cohort(
        cohort)
    previous_student = None
    columns = []
    for student_stat in students_stat:
        # Line breaking condition.
        if student_stat.student.registration_id != previous_student:
            if len(columns) > 0:
                add_row(worksheet, columns)
                columns = []
            columns.append(student_stat.student.person.last_name.upper())
            columns.append(student_stat.student.person.first_name)
            columns.append(student_stat.student.registration_id)
            previous_student = student_stat.student.registration_id
        _add_period(columns, student_stat)
    add_row(worksheet, columns)
def _add_students(worksheet, cohort, organization):
    students_stat = models.internship_student_affectation_stat.find_by_organization(
        cohort, organization)
    rep_seq = list(organization.report_sequence())

    for student in students_stat:
        seq_dict = {
            organization_report_fields.PERIOD:
            student.period.name,
            organization_report_fields.START_DATE:
            student.period.date_start.strftime("%d-%m-%Y"),
            organization_report_fields.END_DATE:
            student.period.date_end.strftime("%d-%m-%Y"),
            organization_report_fields.LAST_NAME:
            student.student.person.last_name,
            organization_report_fields.FIRST_NAME:
            student.student.person.first_name,
            organization_report_fields.GENDER:
            student.student.person.gender,
            organization_report_fields.SPECIALTY:
            student.speciality.name,
            organization_report_fields.BIRTHDATE:
            student.student.person.birth_date.strftime("%d-%m-%Y"),
            organization_report_fields.EMAIL:
            student.student.person.email,
            organization_report_fields.NOMA:
            student.student.registration_id,
            organization_report_fields.PHONE:
            "",
            organization_report_fields.ADDRESS:
            "",
            organization_report_fields.POSTAL_CODE:
            "",
            organization_report_fields.CITY:
            ""
        }

        columns = []
        for seq in rep_seq:
            columns.append(seq_dict[seq])

        add_row(worksheet, columns)
Esempio n. 8
0
def _add_header(worksheet, organization, specialty, affectations):
    add_row(worksheet, [str(organization.name) if organization else ''])
    add_row(worksheet, [str(specialty.name)])
    add_row(worksheet)
    date_format = str(_('Date format'))
    printing_date = timezone.now()
    printing_date = printing_date.strftime(date_format)
    add_row(worksheet,
            [str('%s: %s' % (_('File production date'), printing_date))])
    add_row(worksheet)
    add_row(worksheet, [str(affectations[0].master) if affectations else ''])
    add_row(worksheet)
    add_row(worksheet)
Esempio n. 9
0
def _add_header(worksheet, fields):
    fields_verbose_names = [_(field.verbose_name.capitalize()) for field in fields]
    fields_verbose_names.extend([_("Specialty"), _("Organization"), "Ref"])
    add_row(worksheet, fields_verbose_names)
    worksheet.row_dimensions[1].font = Font(bold=True)