def generate_L4PA9(batch,emp):
    flag = True
    files = batch.files.all()
    for filer in files:
        if filer.name == 'L4PA9':
            flag = False
            return filer
    if(flag):
        file_location = settings.MEDIA_ROOT.replace('\\','/')  + '/' +  '/'.join(['FilesCreated', str(batch.start_date.year), 'L4PA9.xls'])
        name = 'L4PA9'
       
        details = 'Auto Generated L4PA9 '
        employees = employees_of_batch(batch,emp)
        trainers = get_trainer_list(batch = batch)
        departments = list(UserModels.Department.objects.all().exclude(deptID = 'ALL'))
        grades = models.Grading.objects.filter(batch = batch)
        formatGenerator.make_l4pa9(batch, departments, trainers, grades, file_location)
        filer = File(open(file_location))
        fileObj = models.Files.objects.create(name = name, details = details , file = filer ,  year = str(batch.start_date.year))
        model_location = settings.MEDIA_ROOT.replace('\\','/')  + '/' + fileObj.file.name
        copyfile(file_location,model_location)
        fileObj.modifiedBy.add(emp)
        fileObj.save()
        batch.files.add(fileObj)
        batch.save()
        return fileObj
def generate_L4PA3(batch,emp):
    flag = True
    files = batch.files.all()
    for filer in files:
        if filer.name == 'L4PA3':
            flag = False
            return filer
    if(flag):
        file_location = settings.MEDIA_ROOT.replace('\\','/')  + '/' +  '/'.join(['FilesCreated', str(batch.start_date.year), 'L4PA3.xls'])
        name = 'L4PA3'
        model_location = settings.MEDIA_ROOT.replace('\\','/')  + '/' + '/'.join(['Files', str(batch.start_date.year), name + ".xls"])
        details = ' '
        employees = employees_of_batch(batch,emp)
        trainers = get_trainer_list(batch = batch)
        formatGenerator.make_l4pa3(batch, employees, trainers, file_location)
        filer = File(open(file_location))
        fileObj = models.Files.objects.create(name = name, details = details , file = filer , year = str(batch.start_date.year))
        model_location = settings.MEDIA_ROOT.replace('\\','/')  + '/' + fileObj.file.name
        copyfile(file_location,model_location)
        fileObj.modifiedBy.add(emp)
        fileObj.save()
        batch.files.add(fileObj)
        batch.save()
        return fileObj
        """"""
Exemplo n.º 3
0
 def __init__(self, course):
     self.course_name = course.course_name
     deptNames = []
     for department in course.department.all():
         deptNames.append(department.dept_name)
     self.departments = ','.join(deptNames)
     wcount = len(
         list(
             UserModels.CoursesToAttend.objects.filter(
                 employee__is_Staff=False,
                 employee__is_Admin=False,
                 employee__is_HOD=False,
                 employee__is_Manager=False,
                 course=course)))
     scount = len(
         list(
             UserModels.CoursesToAttend.objects.filter(
                 employee__is_Staff=True, course=course)))
     self.wscount = str(wcount) + "/" + str(scount)
     trainers = userfunctions.get_trainer_list(course=course)
     self.internal = ''
     self.external = ''
     trainerNames = []
     for trainer in trainers:
         trainerNames.append(trainer.user.first_name + " " +
                             trainer.user.last_name)
         if trainer.is_Internal:
             self.internal = 'Y'
         else:
             self.external = 'Y'
Exemplo n.º 4
0
def generate_L4PA1(batch, emp):
    flag = True
    files = batch.files.all()
    for filer in files:
        if filer.name == 'L4PA1':
            flag = False
            return filer
    if (flag):
        file_location = settings.MEDIA_ROOT.replace(
            '\\', '/') + '/' + '/'.join(
                ['FilesCreated',
                 str(batch.start_date.year), 'L4PA1.xls'])
        name = 'L4PA1'
        model_location = settings.MEDIA_ROOT.replace(
            '\\', '/') + '/' + '/'.join(
                ['Files', str(batch.start_date.year), name + ".xls"])
        details = ' '
        employees = employees_of_batch(batch, emp)
        trainers = get_trainer_list(batch=batch)
        formatGenerator.make_l4pa1(batch, employees, trainers, file_location)
        filer = File(open(file_location))
        fileObj = models.Files.objects.create(name=name,
                                              details=details,
                                              file=filer,
                                              year=str(batch.start_date.year))
        model_location = settings.MEDIA_ROOT.replace(
            '\\', '/') + '/' + fileObj.file.name
        copyfile(file_location, model_location)
        fileObj.modifiedBy.add(emp)
        fileObj.save()
        batch.files.add(fileObj)
        batch.save()
        return fileObj
Exemplo n.º 5
0
def generate_L4PA9(batch, emp):
    flag = True
    files = batch.files.all()
    for filer in files:
        if filer.name == 'L4PA9':
            flag = False
            return filer
    if (flag):
        file_location = settings.MEDIA_ROOT.replace(
            '\\', '/') + '/' + '/'.join(
                ['FilesCreated',
                 str(batch.start_date.year), 'L4PA9.xls'])
        name = 'L4PA9'

        details = 'Auto Generated L4PA9 '
        employees = employees_of_batch(batch, emp)
        trainers = get_trainer_list(batch=batch)
        departments = list(
            UserModels.Department.objects.all().exclude(deptID='ALL'))
        grades = models.Grading.objects.filter(batch=batch)
        formatGenerator.make_l4pa9(batch, departments, trainers, grades,
                                   file_location)
        filer = File(open(file_location))
        fileObj = models.Files.objects.create(name=name,
                                              details=details,
                                              file=filer,
                                              year=str(batch.start_date.year))
        model_location = settings.MEDIA_ROOT.replace(
            '\\', '/') + '/' + fileObj.file.name
        copyfile(file_location, model_location)
        fileObj.modifiedBy.add(emp)
        fileObj.save()
        batch.files.add(fileObj)
        batch.save()
        return fileObj
 def __init__(self,course):
     self.course_name = course.course_name
     deptNames = []
     for department in course.department.all():
         deptNames.append(department.dept_name)
     self.departments = ','.join(deptNames)
     wcount = len(list(UserModels.CoursesToAttend.objects.filter(employee__is_Staff = False , employee__is_Admin = False , employee__is_HOD = False ,employee__is_Manager  = False , course = course)))
     scount = len(list(UserModels.CoursesToAttend.objects.filter(employee__is_Staff = True , course = course)))
     self.wscount = str(wcount) + "/" + str(scount)
     trainers = userfunctions.get_trainer_list(course = course)
     self.internal = ''
     self.external = ''
     trainerNames = []
     for trainer in trainers:
         trainerNames.append(trainer.user.first_name + " " + trainer.user.last_name)
         if trainer.is_Internal:
             self.internal = 'Y'
         else:
             self.external = 'Y'
def add_deafult_trainers_to_batch(batch):
    trainers = userfunctions.get_trainer_list(course = batch.course)
    for trainer in trainers:
        add_trainer_to_batch(trainer, batch)
Exemplo n.º 8
0
def add_deafult_trainers_to_batch(batch):
    trainers = userfunctions.get_trainer_list(course=batch.course)
    for trainer in trainers:
        add_trainer_to_batch(trainer, batch)