Beispiel #1
0
 def set_data_for(self, *args):
     date_ = args[0]
     self.data = [
         (pay.date, pay.libelle, pay.debit, pay.credit, pay.balance, pay.id)
         for pay in Payment.filter(Payment.date > date_[0], Payment.date <
                                   date_[1]).order_by(Payment.date.desc())
     ]
     self.refresh()
Beispiel #2
0
def get_debts_to_pay(student):
    debts = Debt.select()
    debts = [
        debt for debt in debts
        if student.entrou < datetime(debt.year, debt.month, 1) < student.saiu
    ]
    if not student.drink_coffee:
        debts = [debt for debt in debts if debt.type == 1]
    payments = Payment.filter(Payment.student_id == student.id)
    paid_debts = [pay.debt for pay in payments]
    return [debt for debt in debts if not debt in paid_debts]