Files
AS_timbres/Clientes/models.py
fjrodriguez db198e7083 timbres
2022-12-05 10:42:07 -06:00

54 lines
1.6 KiB
Python

from django.db import models
import datetime
class saldoModel(models.Model):
saldo = models.IntegerField()
class Timbres(models.Model):
uuid = models.CharField(max_length=36, unique=True)
rfcc = models.CharField(max_length=13)
rfcp = models.CharField(max_length=13)
fecha = models.CharField(max_length=55)
folio = models.CharField(max_length=55)
serie = models.CharField(max_length=10,blank=True)
tipo = models.CharField(max_length=35)
created_at = models.DateTimeField(auto_now_add=True)
modo = models.CharField(max_length=10,blank=True, null =True)
class Meta:
ordering = ('-created_at',)
class ErroresTimbres(models.Model):
uuid = models.CharField(max_length=36)
description = models.TextField()
rfcc = models.CharField(max_length=13)
folio = models.CharField(max_length=55)
created_at = models.DateTimeField(auto_now_add=True)
modo = models.CharField(max_length=10,blank=True, null =True)
class Meta:
ordering = ('uuid',)
class Clientes(models.Model):
RFC = models.CharField(max_length=13, unique=True)
Nombre = models.CharField(max_length=100)
Activo = models.BooleanField(default=False)
fecha_baja = models.DateField(blank=True,null=True)
@property
def timbres_mes_count(self):
today = datetime.date.today()
month = today.month
year = today.year
return Timbres.objects.filter(rfcc=self.RFC, created_at__year=str(year),created_at__month=str(month)).count()
class Meta:
ordering = ('-Activo','RFC',)