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:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_staff_access(view_to_return="index"):
|
||||
def decorator(view):
|
||||
@wraps(view)
|
||||
|
||||
@@ -24,6 +24,7 @@ from .forms import ClienteForm,EmailForm
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from rest_framework import status
|
||||
|
||||
#EXCEL
|
||||
from openpyxl import Workbook
|
||||
@@ -318,7 +319,7 @@ def export_Excel(request):
|
||||
mes = month
|
||||
|
||||
dat =datetime.datetime(int(year), int(mes),1)
|
||||
|
||||
|
||||
if dat.month in(1,3,5,7,8,10,12):
|
||||
findate = dat +datetime.timedelta(days=30)
|
||||
elif dat.month in (4,6,9,11):
|
||||
@@ -326,7 +327,7 @@ def export_Excel(request):
|
||||
else:
|
||||
findate = dat+datetime.timedelta(days=28)
|
||||
findate +=datetime.timedelta(days=1)
|
||||
|
||||
|
||||
if mes is not None and RFC is not None:
|
||||
objeto_a_trabajar = Timbres.objects.filter(rfcc=RFC, created_at__range=[dat,findate])
|
||||
else:
|
||||
@@ -336,7 +337,7 @@ def export_Excel(request):
|
||||
|
||||
wb = Workbook()
|
||||
ws = wb.active
|
||||
|
||||
|
||||
if RFC is not None:
|
||||
#Encabezado
|
||||
ws['A1']='RFC_EXPEDIDO'
|
||||
@@ -387,7 +388,7 @@ def PACS_Retrive_RFCS(request):
|
||||
|
||||
#-----------------------------------API VIEWS
|
||||
#--------------------------------------------
|
||||
from rest_framework import status
|
||||
|
||||
class check_RFC(APIView):
|
||||
permission_classes = (IsAuthenticated,)
|
||||
def get(self,request):
|
||||
@@ -395,11 +396,14 @@ class check_RFC(APIView):
|
||||
try:
|
||||
cliente, created = Clientes.objects.get_or_create(RFC=rfc)
|
||||
serializer = ClienteSerializer(cliente)
|
||||
|
||||
if created:
|
||||
cliente.Activo=True
|
||||
cliente.save()
|
||||
|
||||
if not serializer.is_valid:
|
||||
return Response(serializer.errors,status=400)
|
||||
if created:
|
||||
cliente.Activo=True
|
||||
cliente.save()
|
||||
|
||||
return Response(serializer.data)
|
||||
except Exception as E:
|
||||
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)
|
||||
rfcp=request.GET.get('rfcp', None)
|
||||
modo=request.GET.get('modo', None)
|
||||
obj={
|
||||
'uuid':uuid,
|
||||
'rfcc':rfcc,
|
||||
'fecha':fecha,
|
||||
'folio':folio,
|
||||
'serie':serie,
|
||||
'tipo':tipo,
|
||||
'rfcp':rfcp,
|
||||
'modo':modo
|
||||
obj={'uuid':uuid,'rfcc':rfcc,'fecha':fecha,'folio':folio,
|
||||
'serie':serie,'tipo':tipo,'rfcp':rfcp,'modo':modo
|
||||
}
|
||||
try:
|
||||
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">
|
||||
Total x mes
|
||||
</a>
|
||||
<strong>
|
||||
<small>Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label></small>
|
||||
</strong>
|
||||
|
||||
<small>
|
||||
<strong>
|
||||
Filtrado: Mes:{{mes}}, Año:{{year}}, PAC:<label id="lbl_pac"></label>
|
||||
</strong>
|
||||
</small>
|
||||
|
||||
</div>
|
||||
<div style="display:none;" id="spinner_id" class="spinner-border ml-auto spinner-border-sm" role="status" aria-hidden="true"></div>
|
||||
</div>
|
||||
@@ -39,8 +43,7 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
<!--ANIOS-->
|
||||
<select style="display:inline" id="table_select_anio" class="form-control form-control-sm">
|
||||
<!--option value="0"></option-->
|
||||
</select>
|
||||
|
||||
</select>
|
||||
<!--MESES-->
|
||||
<select id="table_select" class="form-control form-control-sm">
|
||||
<option value="01">Enero</option>
|
||||
@@ -158,102 +161,100 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
</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">
|
||||
<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">
|
||||
{% 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">
|
||||
<!-- Modal EMAIL-->
|
||||
<div class="modal fade" data-backdrop="static" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
||||
<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">
|
||||
{% 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">Lista email</h5>
|
||||
<button id="close_emails_list" type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<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="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 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">
|
||||
<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>
|
||||
</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>
|
||||
{% endblock content %}
|
||||
|
||||
{% block scripts %}
|
||||
@@ -472,5 +473,4 @@ Timbres disponibles Comercio Digital: {{saldo}}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock scripts %}
|
||||
Reference in New Issue
Block a user