Beispiel #1
0
def recibo(request, pk, output=None):

    from datetime import datetime

    if request.user.has_perm('esocial.can_see_s2206evtAltContratual'):

        s2206_evtaltcontratual = get_object_or_404(s2206evtAltContratual,
                                                   id=pk)

        context = {
            'pk': pk,
            'evento': s2206_evtaltcontratual,
            'data': datetime.now(),
            'output': output,
            'user': request.user,
        }

        if output == 'xls':

            response = render_to_response('recibo_pdf_esocial.html', context)
            filename = "%s.xls" % s2206_evtaltcontratual.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response[
                'Content-Type'] = 'application/vnd.ms-excel; charset=UTF-8'

            return response

        elif output == 'csv':

            response = render_to_response('recibo_csv_esocial.html', context)
            filename = "%s.csv" % s2206_evtaltcontratual.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response['Content-Type'] = 'text/csv; charset=UTF-8'

            return response

        elif output == 'pdf':

            return render_to_pdf('recibo_pdf_esocial.html', context)

        else:

            return render(request, 'recibo_pdf_esocial.html', context)

    else:

        context = {
            'data': datetime.now(),
        }

        return render(request, 'permissao_negada.html', context)
Beispiel #2
0
def recibo(request, pk, output=None):

    from datetime import datetime

    if request.user.has_perm('efdreinf.can_see_r3010evtEspDesportivo'):

        r3010_evtespdesportivo = get_object_or_404(r3010evtEspDesportivo,
                                                   id=pk)

        context = {
            'pk': pk,
            'evento': r3010_evtespdesportivo,
            'data': datetime.now(),
            'output': output,
            'user': request.user,
        }

        if output == 'xls':

            response = render_to_response('recibo_pdf_efdreinf.html', context)
            filename = "%s.xls" % r3010_evtespdesportivo.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response[
                'Content-Type'] = 'application/vnd.ms-excel; charset=UTF-8'

            return response

        elif output == 'csv':

            response = render_to_response('recibo_csv_efdreinf.html', context)
            filename = "%s.csv" % r3010_evtespdesportivo.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response['Content-Type'] = 'text/csv; charset=UTF-8'

            return response

        elif output == 'pdf':

            return render_to_pdf('recibo_pdf_efdreinf.html', context)

        else:

            return render(request, 'recibo_pdf_efdreinf.html', context)

    else:

        context = {
            'data': datetime.now(),
        }

        return render(request, 'permissao_negada.html', context)
Beispiel #3
0
def recibo(request, pk, output=None):

    from datetime import datetime
    from emensageriapro.mensageiro.models import RetornosEventos, RetornosEventosHorarios, \
        RetornosEventosIntervalos, RetornosEventosOcorrencias

    if request.user.has_perm('esocial.can_see_s2231evtCessao'):

        s2231_evtcessao = get_object_or_404(s2231evtCessao, id=pk)

        retorno = get_object_or_404(RetornosEventos,
                                    id=s2231_evtcessao.retornos_eventos_id)

        retorno_horarios = RetornosEventosHorarios.objects.\
            filter(retornos_eventos_id=retorno.id).all()

        retorno_intervalos = RetornosEventosIntervalos.objects.\
            filter(retornos_eventos_horarios_id__in=listar_ids(retorno_horarios)).all()

        retorno_ocorrencias = RetornosEventosOcorrencias.objects.\
            filter(retornos_eventos_id=retorno.id).all()

        context = {
            'pk': pk,
            's2231_evtcessao': s2231_evtcessao,
            'retorno': retorno,
            'retorno_horarios': retorno_horarios,
            'retorno_intervalos': retorno_intervalos,
            'retorno_ocorrencias': retorno_ocorrencias,
            'data': datetime.now(),
            'output': output,
            'user': request.user,
        }

        if output == 'xls':

            response = render_to_response('s2231_evtcessao_recibo_pdf.html',
                                          context)
            filename = "%s.xls" % s2231_evtcessao.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response[
                'Content-Type'] = 'application/vnd.ms-excel; charset=UTF-8'

            return response

        elif output == 'csv':

            response = render_to_response('s2231_evtcessao_recibo_csv.html',
                                          context)
            filename = "%s.csv" % s2231_evtcessao.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response['Content-Type'] = 'text/csv; charset=UTF-8'

            return response

        elif output == 'pdf':

            return render_to_pdf('s2231_evtcessao_recibo_pdf.html', context)

        else:

            return render(request, 's2231_evtcessao_recibo_pdf.html', context)

    else:

        context = {
            'data': datetime.now(),
        }

        return render(request, 'permissao_negada.html', context)
Beispiel #4
0
def recibo(request, pk, output=None):

    from datetime import datetime
    from emensageriapro.efdreinf.models import r5001evtTotal
    from emensageriapro.efdreinf.models import r5011evtTotalContrib
    from emensageriapro.efdreinf.models import r9001evtTotal
    from emensageriapro.efdreinf.models import r9002evtRet
    from emensageriapro.efdreinf.models import r9011evtTotalContrib
    from emensageriapro.efdreinf.models import r9012evtRetCons

    if request.user.has_perm('efdreinf.can_see_r5001evtTotal'):

        r5001_evttotal = get_object_or_404(r5001evtTotal, id=pk)

        if r5001_evttotal.retornos_r5001_id:
            r5001_evttotal = get_object_or_404(
                r5001evtTotal, id=r5001_evttotal.retornos_r5001_id)
        else:
            r5001_evttotal = None

        if r5001_evttotal.retornos_r5011_id:
            r5011_evttotalcontrib = get_object_or_404(
                r5011evtTotalContrib, id=r5001_evttotal.retornos_r5011_id)
        else:
            r5011_evttotalcontrib = None

        if r5001_evttotal.retornos_r9001_id:
            r9001_evttotal = get_object_or_404(
                r9001evtTotal, id=r5001_evttotal.retornos_r9001_id)
        else:
            r9001_evttotal = None

        if r5001_evttotal.retornos_r9002_id:
            r9002_evtret = get_object_or_404(
                r9002evtRet, id=r5001_evttotal.retornos_r9002_id)
        else:
            r9002_evtret = None

        if r5001_evttotal.retornos_r9011_id:
            r9011_evttotalcontrib = get_object_or_404(
                r9011evtTotalContrib, id=r5001_evttotal.retornos_r9011_id)
        else:
            r9011_evttotalcontrib = None

        if r5001_evttotal.retornos_r9012_id:
            r9012_evtretcons = get_object_or_404(
                r9012evtRetCons, id=r5001_evttotal.retornos_r9012_id)
        else:
            r9012_evtretcons = None

        context = {
            'pk': pk,
            'r5001_evttotal': r5001_evttotal,
            'r5001_evttotal': r5001_evttotal,
            'r5011_evttotalcontrib': r5011_evttotalcontrib,
            'r9001_evttotal': r9001_evttotal,
            'r9002_evtret': r9002_evtret,
            'r9011_evttotalcontrib': r9011_evttotalcontrib,
            'r9012_evtretcons': r9012_evtretcons,
            'data': datetime.now(),
            'output': output,
            'user': request.user,
        }

        if output == 'xls':

            response = render_to_response('r5001_evttotal_recibo_pdf.html',
                                          context)
            filename = "%s.xls" % r5001_evttotal.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response[
                'Content-Type'] = 'application/vnd.ms-excel; charset=UTF-8'

            return response

        elif output == 'csv':

            response = render_to_response('r5001_evttotal_recibo_csv.html',
                                          context)
            filename = "%s.csv" % r5001_evttotal.identidade
            response[
                'Content-Disposition'] = 'attachment; filename=' + filename
            response['Content-Type'] = 'text/csv; charset=UTF-8'

            return response

        elif output == 'pdf':

            return render_to_pdf('r5001_evttotal_recibo_pdf.html', context)

        else:

            return render(request, 'r5001_evttotal_recibo_pdf.html', context)

    else:

        context = {
            'data': datetime.now(),
        }

        return render(request, 'permissao_negada.html', context)