def SearchExpensesBeforeGivenDayAndLessThanAmmount(): """ searches all expense before a given day and less than a given ammount """ try: day = IO.GetDay() ammount = IO.GetAmmount() expenses = [expense for expense in Expenses.repo if Expenses.Day(expense) < day and Expenses.Ammount(expense) < ammount] if expenses == []: IO.OutputText("Nici o cheltuiala corespunzatoare!") else: IO.OutputText("Cheltuielile cerute sunt: ") for expense in expenses: IO.OutputExpense(expense) except Exception as ex: IO.OutputException(ex)
def SearchExpensesGreaterThanAmmount(): """ searches for expenses greater than a given ammount """ try: ammount = IO.GetAmmount() expenses = [] for expense in Expenses.repo: if Expenses.GreaterAmmount(Expenses.Ammount(expense), ammount): expenses.append(expense) if expenses == []: IO.OutputText("Nici o cheltuiala corespunzatoare!") else: IO.OutputText("Cheltuielile cerute sunt: ") for expense in expenses: IO.OutputExpense(expense) except Exception as ex: IO.OutputException(ex)
def WithoutExpensesOfGivenCategory(): """ removes all expenses of given category """ try: category = IO.GetCategory() expenses = [] for expense in Expenses.repo: if not Expenses.SameCategory(Expenses.Category(expense), category): expenses.append(expense) if expenses == []: IO.OutputText("Nici o cheltuiala corespunzatoare") else: IO.OutputText("Cheltuielile cerute sunt: ") for expense in expenses: IO.OutputExpense(expense) except Exception as ex: IO.OutputException(ex)