forked from DGNum/gestioCOF
Assistant sur nouveau relevé
- Reprise de l'affichage - Affichage en direct des totaux et erreurs - Possibilité de ne pas compter la caisse ajoutée (et identifiée par `not_count` dans le modèle Statement si tel est le cas)
This commit is contained in:
parent
f73b25e65f
commit
b6c75fd84a
6 changed files with 239 additions and 29 deletions
|
@ -259,6 +259,7 @@ class CheckoutStatement(models.Model):
|
|||
amount_taken = models.DecimalField(max_digits = 6, decimal_places = 2)
|
||||
amount_error = models.DecimalField(max_digits = 6, decimal_places = 2)
|
||||
at = models.DateTimeField(auto_now_add = True)
|
||||
not_count = models.BooleanField(default=False)
|
||||
|
||||
taken_001 = models.PositiveSmallIntegerField(default=0)
|
||||
taken_002 = models.PositiveSmallIntegerField(default=0)
|
||||
|
@ -275,7 +276,7 @@ class CheckoutStatement(models.Model):
|
|||
taken_100 = models.PositiveSmallIntegerField(default=0)
|
||||
taken_200 = models.PositiveSmallIntegerField(default=0)
|
||||
taken_500 = models.PositiveSmallIntegerField(default=0)
|
||||
taken_cheque = models.PositiveSmallIntegerField(default=0)
|
||||
taken_cheque = models.DecimalField(default=0, max_digits=6, decimal_places=2)
|
||||
|
||||
def __str__(self):
|
||||
return '%s %s' % (self.checkout, self.at)
|
||||
|
@ -285,8 +286,10 @@ class CheckoutStatement(models.Model):
|
|||
checkout_id = self.checkout_id
|
||||
self.balance_old = (Checkout.objects
|
||||
.values_list('balance', flat=True).get(pk=checkout_id))
|
||||
if self.not_count:
|
||||
self.balance_new = self.balance_old - self.amount_taken
|
||||
self.amount_error = (
|
||||
self.balance_new + self.amount_taken - self.balance_old)
|
||||
self.balance_new + self.amount_taken - self.balance_old)
|
||||
with transaction.atomic():
|
||||
Checkout.objects.filter(pk=checkout_id).update(balance=self.balance_new)
|
||||
super(CheckoutStatement, self).save(*args, **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue