minor changes in validate RFC view
This commit is contained in:
@@ -11,8 +11,6 @@ def Custom_is_staff_function(user):
|
|||||||
if user.is_staff:
|
if user.is_staff:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def is_staff_access(view_to_return="index"):
|
def is_staff_access(view_to_return="index"):
|
||||||
def decorator(view):
|
def decorator(view):
|
||||||
@wraps(view)
|
@wraps(view)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ from .forms import ClienteForm,EmailForm
|
|||||||
from rest_framework.views import APIView
|
from rest_framework.views import APIView
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
|
from rest_framework import status
|
||||||
|
|
||||||
#EXCEL
|
#EXCEL
|
||||||
from openpyxl import Workbook
|
from openpyxl import Workbook
|
||||||
@@ -318,7 +319,7 @@ def export_Excel(request):
|
|||||||
mes = month
|
mes = month
|
||||||
|
|
||||||
dat =datetime.datetime(int(year), int(mes),1)
|
dat =datetime.datetime(int(year), int(mes),1)
|
||||||
|
|
||||||
if dat.month in(1,3,5,7,8,10,12):
|
if dat.month in(1,3,5,7,8,10,12):
|
||||||
findate = dat +datetime.timedelta(days=30)
|
findate = dat +datetime.timedelta(days=30)
|
||||||
elif dat.month in (4,6,9,11):
|
elif dat.month in (4,6,9,11):
|
||||||
@@ -326,7 +327,7 @@ def export_Excel(request):
|
|||||||
else:
|
else:
|
||||||
findate = dat+datetime.timedelta(days=28)
|
findate = dat+datetime.timedelta(days=28)
|
||||||
findate +=datetime.timedelta(days=1)
|
findate +=datetime.timedelta(days=1)
|
||||||
|
|
||||||
if mes is not None and RFC is not None:
|
if mes is not None and RFC is not None:
|
||||||
objeto_a_trabajar = Timbres.objects.filter(rfcc=RFC, created_at__range=[dat,findate])
|
objeto_a_trabajar = Timbres.objects.filter(rfcc=RFC, created_at__range=[dat,findate])
|
||||||
else:
|
else:
|
||||||
@@ -336,7 +337,7 @@ def export_Excel(request):
|
|||||||
|
|
||||||
wb = Workbook()
|
wb = Workbook()
|
||||||
ws = wb.active
|
ws = wb.active
|
||||||
|
|
||||||
if RFC is not None:
|
if RFC is not None:
|
||||||
#Encabezado
|
#Encabezado
|
||||||
ws['A1']='RFC_EXPEDIDO'
|
ws['A1']='RFC_EXPEDIDO'
|
||||||
@@ -387,7 +388,7 @@ def PACS_Retrive_RFCS(request):
|
|||||||
|
|
||||||
#-----------------------------------API VIEWS
|
#-----------------------------------API VIEWS
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
from rest_framework import status
|
|
||||||
class check_RFC(APIView):
|
class check_RFC(APIView):
|
||||||
permission_classes = (IsAuthenticated,)
|
permission_classes = (IsAuthenticated,)
|
||||||
def get(self,request):
|
def get(self,request):
|
||||||
@@ -395,11 +396,14 @@ class check_RFC(APIView):
|
|||||||
try:
|
try:
|
||||||
cliente, created = Clientes.objects.get_or_create(RFC=rfc)
|
cliente, created = Clientes.objects.get_or_create(RFC=rfc)
|
||||||
serializer = ClienteSerializer(cliente)
|
serializer = ClienteSerializer(cliente)
|
||||||
|
|
||||||
|
if created:
|
||||||
|
cliente.Activo=True
|
||||||
|
cliente.save()
|
||||||
|
|
||||||
if not serializer.is_valid:
|
if not serializer.is_valid:
|
||||||
return Response(serializer.errors,status=400)
|
return Response(serializer.errors,status=400)
|
||||||
if created:
|
|
||||||
cliente.Activo=True
|
|
||||||
cliente.save()
|
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
except Exception as E:
|
except Exception as E:
|
||||||
return Response({'Error':f'check_RFC:{E} RFC:{rfc}','isError':True})
|
return Response({'Error':f'check_RFC:{E} RFC:{rfc}','isError':True})
|
||||||
@@ -415,15 +419,8 @@ class add_timbre2(APIView):
|
|||||||
tipo=request.GET.get('tipo', None)
|
tipo=request.GET.get('tipo', None)
|
||||||
rfcp=request.GET.get('rfcp', None)
|
rfcp=request.GET.get('rfcp', None)
|
||||||
modo=request.GET.get('modo', None)
|
modo=request.GET.get('modo', None)
|
||||||
obj={
|
obj={'uuid':uuid,'rfcc':rfcc,'fecha':fecha,'folio':folio,
|
||||||
'uuid':uuid,
|
'serie':serie,'tipo':tipo,'rfcp':rfcp,'modo':modo
|
||||||
'rfcc':rfcc,
|
|
||||||
'fecha':fecha,
|
|
||||||
'folio':folio,
|
|
||||||
'serie':serie,
|
|
||||||
'tipo':tipo,
|
|
||||||
'rfcp':rfcp,
|
|
||||||
'modo':modo
|
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
obj = Timbres.objects.create(**obj)
|
obj = Timbres.objects.create(**obj)
|
||||||
|
|||||||
@@ -23,9 +23,13 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
<a data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
<a data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
|
||||||
Total x mes
|
Total x mes
|
||||||
</a>
|
</a>
|
||||||
<strong>
|
|
||||||
<small>Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label></small>
|
<small>
|
||||||
</strong>
|
<strong>
|
||||||
|
Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label>
|
||||||
|
</strong>
|
||||||
|
</small>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div style="display:none;" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
<div style="display:none;" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -39,8 +43,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
<!--ANIOS-->
|
<!--ANIOS-->
|
||||||
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
||||||
<!--option value="0"></option-->
|
<!--option value="0"></option-->
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!--MESES-->
|
<!--MESES-->
|
||||||
<select id="table_select" class="form-control form-control-sm">
|
<select id="table_select" class="form-control form-control-sm">
|
||||||
<option value="01">Enero</option>
|
<option value="01">Enero</option>
|
||||||
@@ -158,102 +161,100 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
<div id='id_filters' style="display: none;">{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}</div>
|
||||||
|
<!-- Modal EMAIL-->
|
||||||
|
<div class="modal fade" data-backdrop="static" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
<!-- Modal EMAIL-->
|
<form enctype="multipart/form-data" id="id_form" action="{% url 'send_timbres_Email' %}?mes={{mes}}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" method="post">
|
||||||
<div class="modal fade" data-backdrop="static" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
{% csrf_token %}
|
||||||
<form enctype="multipart/form-data" id="id_form" action="{% url 'send_timbres_Email' %}?mes={{mes}}{% for i,v in filters.items %}&{{i}}={{v}}{% endfor%}" method="post">
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
{% csrf_token %}
|
|
||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title" id="exampleModalCenterTitle">Enviar Email</h5>
|
|
||||||
<button id="cerrar2" type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="email"><strong>Email</strong></label>
|
|
||||||
<!--input type="email" name="email" id="email_add" autocomplete="off" class="form-control" placeholder="Email"-->
|
|
||||||
|
|
||||||
<div class="input-group mb-3">
|
|
||||||
<input type="email" name="email" id="email_add" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="button-addon2">
|
|
||||||
<div class="input-group-append">
|
|
||||||
<button class="btn btn-outline-secondary" type="button" data-toggle="modal" data-target="#exampleModalCenter2" id="button-addon2" >
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
|
||||||
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="subject"><strong> Subject </strong></label>
|
|
||||||
<input type="text" name="subject" maxlength="100" id="subject_add" autocomplete="off" class="form-control" placeholder="Subject">
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="adjunto"><strong>Adjunto</strong></label>
|
|
||||||
<!--input type="file" name="adjunto" multiple="" id="adjunto_add" autocomplete="off" class="form-control" placeholder="Adjunto"-->
|
|
||||||
{{emailForm.adjunto}}
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="message"><strong>Message</strong></label>
|
|
||||||
<textarea name="message" cols="40" rows="10" id="message_add" autocomplete="off" class="form-control" placeholder="Message" required></textarea>
|
|
||||||
</div>
|
|
||||||
<div hidden class="form-group">
|
|
||||||
<label for="RFC"><strong> Rfc </strong></label>
|
|
||||||
<input type="text" name="RFC" maxlength="13" id="RFC_add" autocomplete="off" class="form-control" placeholder="RFC" required>
|
|
||||||
</div>
|
|
||||||
<div hidden class="form-group">
|
|
||||||
<label for="mes"><strong> Mes </strong></label>
|
|
||||||
<input type="text" name="mes" maxlength="2" value="{{mes}}" id="mes_add" autocomplete="off" class="form-control" placeholder="Mes" required>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button id="cerrar1" type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
|
|
||||||
<button id="enviar_btn" type="submit" class="btn btn-primary">
|
|
||||||
<span id="spinner_enviar" style="display:none;" class="spinner-grow spinner-grow-sm" role="status" aria-hidden="false"></span>
|
|
||||||
Enviar
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Modal LISTA EMAILS-->
|
|
||||||
<div class="modal fade bd-example-modal-lg" id="exampleModalCenter2" tabindex="-1" role="contentinfo" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalCenterTitle">Lista email</h5>
|
<h5 class="modal-title" id="exampleModalCenterTitle">Enviar Email</h5>
|
||||||
<button id="close_emails_list" type="button" class="close" data-dismiss="modal" aria-label="Close">
|
<button id="cerrar2" type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<div class="table-responsive">
|
<div class="form-group">
|
||||||
<table id="email_list" class="table table-hover">
|
<label for="email"><strong>Email</strong></label>
|
||||||
<thead>
|
<!--input type="email" name="email" id="email_add" autocomplete="off" class="form-control" placeholder="Email"-->
|
||||||
<tr>
|
|
||||||
<th scope="col">EMAIL</th>
|
<div class="input-group mb-3">
|
||||||
</tr>
|
<input type="email" name="email" id="email_add" class="form-control" placeholder="Email" aria-label="Email" aria-describedby="button-addon2">
|
||||||
</thead>
|
<div class="input-group-append">
|
||||||
<tbody id="table_body" style="cursor: pointer;">
|
<button class="btn btn-outline-secondary" type="button" data-toggle="modal" data-target="#exampleModalCenter2" id="button-addon2" >
|
||||||
<!--This is a exaple append js rows structure---->
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
|
||||||
<!--tr class="table_row"><td id="1">@Mark</td></tr-->
|
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
|
||||||
</tbody>
|
</svg>
|
||||||
</table>
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="subject"><strong> Subject </strong></label>
|
||||||
|
<input type="text" name="subject" maxlength="100" id="subject_add" autocomplete="off" class="form-control" placeholder="Subject">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="adjunto"><strong>Adjunto</strong></label>
|
||||||
|
<!--input type="file" name="adjunto" multiple="" id="adjunto_add" autocomplete="off" class="form-control" placeholder="Adjunto"-->
|
||||||
|
{{emailForm.adjunto}}
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="message"><strong>Message</strong></label>
|
||||||
|
<textarea name="message" cols="40" rows="10" id="message_add" autocomplete="off" class="form-control" placeholder="Message" required></textarea>
|
||||||
|
</div>
|
||||||
|
<div hidden class="form-group">
|
||||||
|
<label for="RFC"><strong> Rfc </strong></label>
|
||||||
|
<input type="text" name="RFC" maxlength="13" id="RFC_add" autocomplete="off" class="form-control" placeholder="RFC" required>
|
||||||
|
</div>
|
||||||
|
<div hidden class="form-group">
|
||||||
|
<label for="mes"><strong> Mes </strong></label>
|
||||||
|
<input type="text" name="mes" maxlength="2" value="{{mes}}" id="mes_add" autocomplete="off" class="form-control" placeholder="Mes" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<h1>Footer</h1>
|
<button id="cerrar1" type="button" class="btn btn-secondary" data-dismiss="modal">Cerrar</button>
|
||||||
|
<button id="enviar_btn" type="submit" class="btn btn-primary">
|
||||||
|
<span id="spinner_enviar" style="display:none;" class="spinner-grow spinner-grow-sm" role="status" aria-hidden="false"></span>
|
||||||
|
Enviar
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Modal LISTA EMAILS-->
|
||||||
|
<div class="modal fade bd-example-modal-lg" id="exampleModalCenter2" tabindex="-1" role="contentinfo" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title" id="exampleModalCenterTitle">Lista email</h5>
|
||||||
|
<button id="close_emails_list" type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="email_list" class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">EMAIL</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="table_body" style="cursor: pointer;">
|
||||||
|
<!--This is a exaple append js rows structure---->
|
||||||
|
<!--tr class="table_row"><td id="1">@Mark</td></tr-->
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<h1>Footer</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
@@ -472,5 +473,4 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock scripts %}
|
{% endblock scripts %}
|
||||||
Reference in New Issue
Block a user