Пример #1
0
 def test_rendre_monnaie(self):
     payment = Paiement()
     payment.type = PaiementType()
     payment.montant = Decimal("900")
     self.facture.add_product(self.plat)
     self.facture.update()
     self.facture.rendre_monnaie(payment)
     left = self.facture.total_ttc - Decimal("900")
     self.assertEqual(left, self.facture.paiements.all()[0].montant)
Пример #2
0
 def test_rendre_monnaie(self):
     payment = Paiement()
     payment.type = PaiementType()
     payment.montant = Decimal("900")
     self.facture.add_product(self.plat)
     self.facture.update()
     self.facture.rendre_monnaie(payment)
     left = self.facture.total_ttc - Decimal("900")
     self.assertEqual(left, self.facture.paiements.all()[0].montant)
Пример #3
0
 def test_del_payment(self):
     payment = Paiement()
     montant = 42
     valeur_unitaire = 73
     paymentType = PaiementType()
     payment.montant = 73
     payment.type = paymentType
     payment.valeur_unitaire = Decimal(valeur_unitaire)
     payment.montant = Decimal(montant)
     self.facture.add_payment(paymentType, montant, valeur_unitaire)
     self.facture.del_payment(payment)
Пример #4
0
 def test_del_payment(self):
     payment = Paiement()
     montant = 42
     valeur_unitaire = 73
     paymentType = PaiementType()
     payment.montant = 73
     payment.type = paymentType
     payment.valeur_unitaire = Decimal(valeur_unitaire)
     payment.montant = Decimal(montant)
     self.facture.add_payment(paymentType, montant, valeur_unitaire)
     self.facture.del_payment(payment)
Пример #5
0
    if id_table:
        table = Table_get(id=id_table)
#        facture = Facture(id=id, date_creation=newdate_creation, date_paiement=newdate_paiement, montant_normal=ttc, montant_alcool=ttc_alcool, table=table, couverts=nb_couverts)
        facture = Facture(id=id, date_creation=newdate_creation, montant_normal=convert_prix(ttc), montant_alcool=convert_prix(ttc_alcool), table=table, couverts=nb_couverts)
    else:
#        facture = Facture(id=id, date_creation=newdate_creation, date_paiement=newdate_paiement, montant_normal=ttc, montant_alcool=ttc_alcool, couverts=nb_couverts)
        facture = Facture(id=id, date_creation=newdate_creation, montant_normal=convert_prix(ttc), montant_alcool=convert_prix(ttc_alcool), couverts=nb_couverts)
    facture.save()
    facture.date_creation = newdate_creation

    cu.execute("select id,id_mode_paiement,valeur_unitaire,date,montant_ttc from paiements where id_facture=%d" % facture.id)
    for id,id_mode_paiement,valeur_unitaire,date,montant_ttc in cu.fetchall():
        olddate = str(date)
        newdate = "%s-%s-%s %s:%s:%s" % (olddate[0:4],olddate[4:6],olddate[6:8],olddate[8:10],olddate[10:12],olddate[12:14])
        type = PaiementType_get(id=id_mode_paiement)
        paiement = Paiement(id=id, type=type, facture=facture, montant=convert_prix(montant_ttc), date=newdate)
        paiement.save()
        paiement.date = newdate
        if paiement.type.fixed_value:
            # on calcule le nombre de tickets
#            print paiement.montant
#            print paiement.valeur_unitaire
            paiement.valeur_unitaire = valeur_unitaire=convert_prix(valeur_unitaire)
            paiement.nb_tickets = int( Decimal(paiement.montant) / Decimal(paiement.valeur_unitaire) )
        paiement.save()
        facture.paiements.add(paiement)

    cu.execute("select id_produit from factures_produits where id_facture=%d" % facture.id)
    # liste des relations des sous produits deja pris
    deja_pris = []
    for [id_produit] in cu.fetchall():
Пример #6
0
    facture.save()
    facture.date_creation = newdate_creation

    cu.execute(
        "select id,id_mode_paiement,valeur_unitaire,date,montant_ttc from paiements where id_facture=%d"
        % facture.id)
    for id, id_mode_paiement, valeur_unitaire, date, montant_ttc in cu.fetchall(
    ):
        olddate = str(date)
        newdate = "%s-%s-%s %s:%s:%s" % (olddate[0:4], olddate[4:6],
                                         olddate[6:8], olddate[8:10],
                                         olddate[10:12], olddate[12:14])
        type = PaiementType_get(id=id_mode_paiement)
        paiement = Paiement(id=id,
                            type=type,
                            facture=facture,
                            montant=convert_prix(montant_ttc),
                            date=newdate)
        paiement.save()
        paiement.date = newdate
        if paiement.type.fixed_value:
            # on calcule le nombre de tickets
            #            print paiement.montant
            #            print paiement.valeur_unitaire
            paiement.valeur_unitaire = valeur_unitaire = convert_prix(
                valeur_unitaire)
            paiement.nb_tickets = int(
                Decimal(paiement.montant) / Decimal(paiement.valeur_unitaire))
        paiement.save()
        facture.paiements.add(paiement)