예제 #1
0
    def get(self):
        """
        12시 연장신청 엑셀 다운로드
        """
        wb = Workbook()
        ws = wb.active

        ready_applyment_worksheet(ws)

        for apply in ExtensionApply12Model.objects:
            student = apply.student

            number_cell, name_cell, status_cell = get_cell_positions_from_student_number(
                student)

            ws[number_cell] = student.number
            ws[name_cell] = student.name
            ws[status_cell] = EXTENSION_CLASSES[apply.class_ - 1]

        filename = '12.xlsx'

        wb.save('{}'.format(filename))
        wb.close()

        resp = make_response(send_from_directory('../', filename))
        resp.headers.extend({'Cache-Control': 'no-cache'})

        return resp
예제 #2
0
    def generate_excel(self):
        wb, ws = self.ready_worksheet()

        for apply in self.model.objects:
            student = apply.student

            number_cell, name_cell, status_cell = get_cell_positions_from_student_number(student)

            stay_apply = StayApplyModel.objects(student=student).first()

            if stay_apply.value < 3:
                ws[number_cell] = None
                ws[name_cell] = None
                continue
            else:
                ws[number_cell] = student.number
                ws[name_cell] = student.name

            ws.column_dimensions['D'].width = 20
            ws.column_dimensions['H'].width = 20
            ws.column_dimensions['L'].width = 20
            ws.column_dimensions['P'].width = 20

            ws[status_cell] = self.get_status(apply)

        self.save_excel(wb)
예제 #3
0
    def generate_excel(self):
        wb, ws = self.ready_worksheet()

        for apply in self.model.objects:
            student = apply.student

            number_cell, name_cell, status_cell = get_cell_positions_from_student_number(
                student)

            ws[number_cell] = student.number
            ws[name_cell] = student.name
            ws[status_cell] = self.get_status(apply)

        self.save_excel(wb)
예제 #4
0
    def get(self):
        """
        외출신청 엑셀 다운로드
        """
        wb = Workbook()
        ws = wb.active

        ready_applyment_worksheet(ws)

        for apply in GoingoutApplyModel.objects:
            student = apply.student

            number_cell, name_cell, status_cell = get_cell_positions_from_student_number(
                student)

            stay_apply = StayApplyModel.objects(student=student).first()

            if stay_apply.value < 3:
                ws[number_cell] = None
                ws[name_cell] = None
                continue
            else:
                ws[number_cell] = student.number
                ws[name_cell] = student.name

            if apply.on_saturday and apply.on_sunday:
                status = '토요일, 일요일 외출'
            elif apply.on_saturday:
                status = '토요일 외출'
            elif apply.on_sunday:
                status = '일요일 외출'
            else:
                status = ''
            ws.column_dimensions['D'].width = 20
            ws.column_dimensions['H'].width = 20
            ws.column_dimensions['L'].width = 20
            ws.column_dimensions['P'].width = 20

            ws[status_cell] = status

        filename = 'goingout.xlsx'

        wb.save('{}'.format(filename))
        wb.close()

        resp = make_response(send_from_directory('../', filename))
        resp.headers.extend({'Cache-Control': 'no-cache'})

        return resp
예제 #5
0
    def generate_excel(self):
        wb, ws = self.ready_worksheet()

        for apply in self.model.objects:
            student = apply.student

            if student.number in self.employed:
                continue

            number_cell, name_cell, status_cell = get_cell_positions_from_student_number(
                student)

            ws[number_cell] = student.number
            ws[name_cell] = student.name

            apply = StayApplyModel.objects(student=student).first()

            ws[status_cell] = self.get_status(apply)

        self.save_excel(wb)
예제 #6
0
    def get(self):
        """
        잔류신청 엑셀 다운로드
        """
        wb = Workbook()
        ws = wb.active

        ready_applyment_worksheet(ws)

        for student in StudentModel.objects:
            number_cell, name_cell, status_cell = get_cell_positions_from_student_number(
                student)

            ws[number_cell] = student.number
            ws[name_cell] = student.name

            apply = StayApplyModel.objects(student=student).first()

            if not apply or apply.value == 4:
                status = '잔류'
            elif apply.value == 1:
                status = '금요 귀가'
            elif apply.value == 2:
                status = '토요 귀가'
            elif apply.value == 3:
                status = '토요 귀사'
            else:
                status = '잔류'

            ws[status_cell] = status

        filename = 'stay.xlsx'

        wb.save('{}'.format(filename))
        wb.close()

        resp = make_response(send_from_directory('../', filename))
        resp.headers.extend({'Cache-Control': 'no-cache'})

        return resp