Пример #1
0
def usuarios(request, q):
  filename = 'usuarios_' + str(date.today()) + '.xls'
  headers = ['DOCUMENTO', 'APELLIDO', 'NOMBRE', 'PERFILES']
  if request.has_credencial('seg_ver_datos_acceso'):
    headers.append('Accesos')
    headers.append('Último Acceso')
  reporte = Reporte(headers=headers, filename=filename)
  for usuario in q:
    perfil = ''
    perfiles_tmp = []
    for p in usuario.perfiles.all():
      fecha = p.fecha_asignacion.strftime("%d/%m/%Y")
      try:
        fecha_desasignacion = ' al ' + p.fecha_desasignacion.strftime("%d/%m/%Y")
        fecha += fecha_desasignacion
      except AttributeError:
        pass 
      perfil = '%s (%s) Asignado desde %s' % (p.rol, p.ambito, fecha,) 
      perfiles_tmp.append(perfil)
    perfiles = '\n'.join("%s" % (p) for p in perfiles_tmp)
    new_row = [usuario.tipo_documento.abreviatura + ': ' + usuario.documento, usuario.apellido.encode('utf8'), usuario.nombre.encode('utf8'), perfiles]
    if request.has_credencial('seg_ver_datos_acceso'):
      new_row.append(usuario.logins_count)
      if usuario.last_login is None:
        new_row.append('')
      else:
        new_row.append(usuario.last_login.strftime("%d/%m/%Y"))
    reporte.rows.append(new_row)
  return reporte.as_csv()
Пример #2
0
def seguimiento(request):
    ambito = request.get_perfil().ambito
    sql = Reporte.get_sql_file_content('417_seguimiento_cohortes_b.sql').replace('{{AMBITO_PATH}}', "'" + str(ambito.path) + "%%'")
    
    cursor = connection.cursor()
    cursor.execute(sql)

    filename = 'seguimiento_cohortes_' + str(date.today()) + '.xls'
    reporte = Reporte(headers=[\
        'JURISDICCIÓN',\
        'GESTIÓN',\
        'CLAVE',\
        'TIPO',\
        'CUE',\
        'ESTABLECIMIENTO',\
        'CARRERA',\
        'COHORTE',\
        'CURSADA',\
        'INSCRIPTOS',\
        'SOLO CURSAN NUEVAS UNIDADES',\
        'SOLO RECURSAN NUEVAS UNIDADES',\
        'RECURSAN Y CURSAN NUEVAS UNIDADES',\
        'NO CURSAN',\
        'EGRESADOS',\
        'INICIAL',\
        'CONTÍNUA',\
        'INVESTIGACIÓN',\
        'APOYO',\
        'INICIAL',\
        'PRIMARIA',\
        'MEDIA',\
        'SUPERIOR'\
    ], filename=filename)
    for row in Reporte.dictfetchall(cursor):
        reporte.rows.append([\
            row['jurisdiccion'].encode('utf8') if row['jurisdiccion'] else '',\
            row['gestion'].encode('utf8') if row['gestion'] else '',\
            row['clave'] if row['clave'] else '',\
            row['tipo'].encode('utf8') if row['tipo'] else '',\
            row['cue'].encode('utf8') if row['cue'] else '',\
            row['establecimiento'].encode('utf8') if row['establecimiento'] else '',\
            row['carrera'].encode('utf8') if row['carrera'] else '',\
            row['cohorte'] if row['cohorte'] else '',\
            row['cursada'] if row['cursada'] else '',\
            row['inscriptos'] if row['inscriptos'] else '',\
            row['solo_cursan_nuevas_unidades'] if row['solo_cursan_nuevas_unidades'] else '',\
            row['solo_recursan_nuevas_unidades'] if row['solo_recursan_nuevas_unidades'] else '',\
            row['recursan_cursan_nuevas_unidades'] if row['recursan_cursan_nuevas_unidades'] else '',\
            row['no_cursan'] if row['no_cursan'] else '',\
            row['egresados'] if row['egresados'] else '',\
            row['inicial'].encode('utf8') if row['inicial'] else '',\
            row['continua'].encode('utf8') if row['continua'] else '',\
            row['investigacion'].encode('utf8') if row['investigacion'] else '',\
            row['apoyo'].encode('utf8') if row['apoyo'] else '',\
            row['inicial'].encode('utf8') if row['inicial'] else '',\
            row['primaria'].encode('utf8') if row['primaria'] else '',\
            row['media'].encode('utf8') if row['media'] else '',\
            row['superior'].encode('utf8') if row['superior'] else ''\
        ])
    return reporte.as_csv()
def normativas_jurisdiccionales(request, q):
    filename = 'normativas_jurisdiccionales_' + str(date.today()) + '.xls'
    reporte = Reporte(headers=['NUMERO/AÑO', 'TIPO', 'JURISDICCION', 'OTORGADA POR', 'OBSERVACIONES', 'ESTADO'], filename=filename)
    for nj in q:
        if nj.estado is None:
            estado_nombre = ''
        else:
            estado_nombre = nj.estado.nombre.encode('utf8')
        reporte.rows.append([nj.numero_anio.encode('utf8'), unicode(nj.tipo_normativa_jurisdiccional), unicode(nj.jurisdiccion), unicode(nj.otorgada_por), nj.observaciones.encode('utf8'), estado_nombre])
    return reporte.as_csv()
Пример #4
0
def titulos_nacionales(request, q):
	filename = 'titulos_nacionales_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['NORMATIVA', 'NOMBRE', 'OBSERVACIONES', 'FECHA DE ALTA', 'ESTADO'], filename=filename)
	for t in q:
		if t.estado is None:
			estado_nombre = ''
		else:
			estado_nombre = t.estado.nombre.encode('utf8')
		reporte.rows.append([t.normativa_nacional.numero.encode('utf8'), t.nombre.encode('utf8'), t.observaciones, t.fecha_alta.strftime("%d/%m/%Y"), estado_nombre])

	return reporte.as_csv()
Пример #5
0
def detalle_numeracion(request, validez):
	filename = 'detalle_numeracion_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['TIPO UE', 'CUE', 'NOMBRE DE LA UE', 'DEPARTAMENTO', 'LOCALIDAD', 'NRO INFD'], filename=filename)

	for v in validez:
		nombre_ue = v.get_unidad_educativa().nombre.encode('utf8')
		departamento = str(v.get_unidad_educativa().get_domicilio_institucional().localidad.departamento)
		localidad = str(v.get_unidad_educativa().get_domicilio_institucional().localidad)
		reporte.rows.append([v.tipo_unidad_educativa.encode('utf8'), v.cue, nombre_ue, departamento, localidad, v.nro_infd])

	return reporte.as_csv()
def cohortes_jurisdiccionales(request, q):
	filename = 'cohortes_jurisdiccionales_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['CARRERA', 'JURISDICCIÓN', 'COHORTES GENERADAS', 'ESTADO'], filename=filename)
	for cj in q:
		cohortes_generadas = ' - '.join("%s" % c.anio for c in cj.cohortes.all().order_by('anio'))
		if cj.estado is None:
			estado_nombre = ''
		else:
			estado_nombre = cj.estado.nombre.encode('utf8')
		reporte.rows.append([cj.carrera.nombre.encode('utf8'), cj.jurisdiccion.nombre, cohortes_generadas, estado_nombre])

	return reporte.as_csv()
Пример #7
0
def carreras(request, q):
	filename = 'carreras_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['NOMBRE', 'JURISDICCIONES', 'OBSERVACIONES', 'FECHA DE ALTA', 'ESTADO'], filename=filename)
	for carrera in q:
		try:
			obs = carrera.observaciones.encode('utf8')
		except Exception:
			obs = ''
		if carrera.estado is None:
			estado_nombre = ''
		else:
			estado_nombre = carrera.estado.nombre.encode('utf8')
		jurisdicciones = ' - '.join("%s" % (j.nombre.encode('utf8')) for j in carrera.jurisdicciones.all())
		reporte.rows.append([carrera.nombre.encode('utf8'), jurisdicciones, obs, carrera.fecha_alta.strftime("%d/%m/%Y"), estado_nombre])

	return reporte.as_csv()
Пример #8
0
def establecimientos(request, q):
	filename = 'establecimientos_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['REGION', 'JURISDICCIÓN', 'CUE', 'DEPENDENCIA FUNCIONAL', 'NOMBRE', 'DEPARTAMENTO', 'LOCALIDAD', 'ESTADO', 'VERIFICADO'], filename=filename)
	for est in q:
		try:
			localidad = est.get_first_domicilio().localidad
			departamento = localidad.departamento.nombre
			localidad = localidad.nombre
		except AttributeError:
			localidad = ''
			departamento = ''
		if est.estado is None:
			estado_nombre = ''
		else:
			estado_nombre = est.estado.nombre.encode('utf8')
		reporte.rows.append([est.dependencia_funcional.jurisdiccion.region.nombre.encode('utf8'), est.dependencia_funcional.jurisdiccion.nombre.encode('utf8'),\
		est.cue, est.dependencia_funcional.nombre.encode('utf8'), est.nombre.encode('utf8'), departamento.encode('utf8'), localidad.encode('utf8'), estado_nombre,
    "SI" if est.verificado() else "NO"])

	return reporte.as_csv()
Пример #9
0
def solicitudes(request, q):
	filename = 'solicitudes_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['JURISDICCIÓN', 'CARRERA', 'TÍTULO', 'NORMATIVAS JURISDICCIONALES.', 'CUE', 'COHORTES', 'ESTADO', 'DICTAMEN COFEV', 'NORMATIVAS NACIONALES'], filename=filename)
	
	for sol in q:
		
		normativas_jurisdiccionales = ", ".join(sol.normativas_jurisdiccionales.all()) or "---"
		cues = "cues"
		
		try:
			dictamen_cofev = sol.dictamen_cofev.encode('utf8')
		except AttributeError:
			dictamen_cofev = "---"
			
		try:
			normativas_nacionales = sol.normativas_nacionales.encode('utf8')
		except AttributeError:
			normativas_nacionales = "---"
			
		reporte.rows.append([sol.jurisdiccion.nombre.encode('utf8'), sol.carrera.nombre.encode('utf8'), sol.titulo_nacional.nombre.encode('utf8'),\
		normativas_jurisdiccionales, cues, (sol.primera_cohorte or "--- ") + '/' + (sol.ultima_cohorte or " ---"), sol.estado.nombre.encode('utf8'), dictamen_cofev, normativas_nacionales])

	return reporte.as_csv()
Пример #10
0
def consulta_validez(request, q):
	filename = 'validez_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['JURISDICCIÓN', 'CUE', 'NOMBRE DEL ISFD', 'TIPO DE GESTIÓN', 'CARRERA', 'TITULO', 'PRIMERA COHORTE', 'ULTIMA COHORTE', 'NORMATIVA_JURISDICCIONAL', 'NORMATIVA_NACIONAL', 'NRO_INFD'], filename=filename)
	for v in q:
		ue = v.get_unidad_educativa()
		if v.tipo_unidad_educativa == ValidezNacional.TIPO_UE_SEDE:
			df = ue.dependencia_funcional
		else:
			df = ue.establecimiento.dependencia_funcional

		reporte.rows.append([
		df.jurisdiccion.nombre.encode('utf8'),
		v.cue,
		ue.nombre, 
		df.tipo_gestion.nombre.encode('utf8'),
		v.carrera.encode('utf8'),
		v.titulo_nacional.encode('utf8'), 
		v.primera_cohorte.encode('utf8'), 
		v.ultima_cohorte.encode('utf8'),
		v.normativa_jurisdiccional.encode("utf8"), 
		v.normativas_nacionales.encode("utf8"),
		v.nro_infd])

	return reporte.as_csv()
Пример #11
0
def dependencias_funcionales(request, q):
	filename = 'dependencias_funcionales_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['NOMBRE', 'TIPO DE GESTIÓN', 'TIPO DE DEPENDENCIA'], filename=filename)
	for dep in q:
		reporte.rows.append([dep.nombre.encode('utf8'), dep.tipo_gestion.nombre.encode('utf8'), dep.tipo_dependencia_funcional.nombre.encode('utf8')])
	return reporte.as_csv()
Пример #12
0
def oferta_nacional(request, q, anio):
	filename = 'oferta_nacional_' + str(anio) + '_' + str(date.today()) + '.xls'
	reporte = Reporte(headers=['JURISDICCIÓN', 'CUE', 'NOMBRE DEL ISFD', 'CARRERA', 'DOMICILIO', 'DEPARTAMENTO', 'LOCALIDAD', 'EMAIL', 'SITIO WEB'], filename=filename)
	
	q_est = q[0]
	q_anexo = q[1]
	q_ea = q[2]

	for t in q_est:
		dom = t.establecimiento.get_domicilio_institucional()
		if not dom:
			dom = ""
			departamento = ""
			localidad = ""
		else:
			departamento = str(dom.localidad.departamento)
			localidad = str(dom.localidad)
		
		reporte.rows.append([
			t.establecimiento.dependencia_funcional.jurisdiccion.nombre.encode('utf8'),
			t.establecimiento.cue,
			t.establecimiento.nombre,
			t.cohorte.carrera_jurisdiccional.carrera.nombre.encode('utf8'),
			str(dom),
			departamento,
			localidad,
			t.establecimiento.email,
			t.establecimiento.sitio_web
		])

	for t in q_anexo:
		dom = t.anexo.get_domicilio_institucional()
		if not dom:
			dom = ""
			departamento = ""
			localidad = ""
		else:
			departamento = str(dom.localidad.departamento)
			localidad = str(dom.localidad)
		
		reporte.rows.append([
			t.anexo.establecimiento.dependencia_funcional.jurisdiccion.nombre.encode('utf8'),
			t.anexo.cue,
			t.anexo.nombre,
			t.cohorte.carrera_jurisdiccional.carrera.nombre.encode('utf8'),
			str(dom),
			departamento,
			localidad,
			t.anexo.email,
			t.anexo.sitio_web
		])

	for t in q_ea:
		dom = t.extension_aulica.get_domicilio_institucional()
		if not dom:
			dom = ""
			departamento = ""
			localidad = ""
		else:
			departamento = str(dom.localidad.departamento)
			localidad = str(dom.localidad)
		
		reporte.rows.append([
			t.extension_aulica.establecimiento.dependencia_funcional.jurisdiccion.nombre.encode('utf8'),
			t.extension_aulica.cue,
			t.extension_aulica.nombre,
			t.cohorte.carrera_jurisdiccional.carrera.nombre.encode('utf8'),
			str(dom),
			departamento,
			localidad,
			t.extension_aulica.email,
			t.extension_aulica.sitio_web
		])

	return reporte.as_csv()
Пример #13
0
def anexos(request):
    sql = Reporte.get_sql_file_content('404_datos_basicos_anexos.sql').replace('{{AMBITO_PATH}}', "'" + str(request.get_perfil().ambito.path) + "%%'")
    cursor = connection.cursor()

    cursor.execute(sql)

    filename = 'anexos_datos_basicos_' + str(date.today()) + '.xls'
    reporte = Reporte(headers=[\
        'JURISDICCIÓN',\
        'GESTIÓN',\
        'CUE',\
        'ANEXO',\
        'TELÉFONO',\
        'EMAIL',\
        'DEP. FUNCIONAL',\
        'TM',\
        'TT',\
        'TN',\
        'CALLE INSTITUCIONAL',\
        'ALTURA',\
        'REFERENCIA',\
        'CP',\
        'LOCALIDAD',\
        'CALLE POSTAL',\
        'ALTURA', 'REFERENCIA',\
        'CP',\
        'LOCALIDAD',\
        'CONEXIÓN',\
        'COMPARTIDO',\
        'INICIAL',\
        'CONTÍNUA',\
        'INVESTIGACIÓN',\
        'APOYO',\
        'INICIAL',\
        'PRIMARIA',\
        'MEDIA',\
        'SUPERIOR'\
    ], filename=filename)

    for row in Reporte.dictfetchall(cursor):
        reporte.rows.append([\
            row['jurisdiccion'].encode('utf8') if row['jurisdiccion'] else '',\
            row['gestion'].encode('utf8') if row['gestion'] else '',\
            row['cue'].encode('utf8') if row['cue'] else '',\
            row['anexo'].encode('utf8') if row['anexo'] else '',\
            row['telefono'].encode('utf8') if row['telefono'] else '',\
            row['email'].encode('utf8') if row['email'] else '',\
            row['dep_funcional'].encode('utf8') if row['dep_funcional'] else '',\
            row['tm'].encode('utf8') if row['tm'] else '',\
            row['tt'].encode('utf8') if row['tt'] else '',\
            row['tn'].encode('utf8') if row['tn'] else '',\
            row['calle_institucional'].encode('utf8') if row['calle_institucional'] else '',\
            row['altura_institucional'].encode('utf8') if row['altura_institucional'] else '',\
            row['referencia_institucional'].encode('utf8') if row['referencia_institucional'] else '',\
            row['cp_institucional'].encode('utf8') if row['cp_institucional'] else '',\
            row['localidad_institucional'].encode('utf8') if row['localidad_institucional'] else '',\
            row['calle_postal'].encode('utf8') if row['calle_postal'] else '',\
            row['altura_postal'].encode('utf8') if row['altura_postal'] else '',\
            row['referencia_postal'].encode('utf8') if row['referencia_postal'] else '',\
            row['cp_postal'].encode('utf8') if row['cp_postal'] else '',\
            row['localidad_postal'].encode('utf8') if row['localidad_postal'] else '',\
            row['conexion'].encode('utf8') if row['conexion'] else '',\
            row['compartido'].encode('utf8') if row['compartido'] else '',\
            row['inicial_funcion'].encode('utf8') if row['inicial_funcion'] else '',\
            row['continua'].encode('utf8') if row['continua'] else '',\
            row['investigacion'].encode('utf8') if row['investigacion'] else '',\
            row['apoyo'].encode('utf8') if row['apoyo'] else '',\
            row['inicial'].encode('utf8') if row['inicial'] else '',\
            row['primaria'].encode('utf8') if row['primaria'] else '',\
            row['media'].encode('utf8') if row['media'] else '',\
            row['superior'].encode('utf8') if row['superior'] else ''\
        ])
    return reporte.as_csv()