def index():
    """Show all the transaction"""

    current_month = utils.get_first_day_of_month()
    last_month = utils.substract_months(current_month, 1)
    start = utils.get_first_day_of_month(last_month.year, last_month.month)
    end = datetime.date.today()

    transactions = Transaction.getTransactions(start, end)
    transactions.reverse()

    return render_template('transactions/index.html',
                           transactions=transactions)
Beispiel #2
0
def get_latest_transaction_by_rule(id, start=None):
    """Get a specific rule by id.

    :param id: id of the rule
    :return: the complete rule.
    :rause 404: if a rule with the given id does not exist
    """
    if start is None:
        start = utils.get_first_day_of_month()

    transaction = get_db().execute(
        'SELECT * FROM transactions WHERE rule_id = ? AND days < ? ORDER BY id DESC LIMIT 1',
        (id, start)).fetchone()

    return transaction
Beispiel #3
0
 def start(self):
     return self._kwargs.get("start", utils.get_first_day_of_month())
Beispiel #4
0
def custom_overview(year, month, month_count):
    return createOverview(
        utils.get_first_day_of_month(year, month),
        utils.add_months(utils.get_last_day_of_month(year, month),
                         (month_count - 1)))
Beispiel #5
0
def month_overview(year, month):
    return createOverview(utils.get_first_day_of_month(year, month),
                          utils.get_last_day_of_month(year, month))
Beispiel #6
0
def year_overview(year):
    return createOverview(utils.get_first_day_of_month(year, 1),
                          utils.get_last_day_of_month(year, 12))
Beispiel #7
0
def index():
    return createOverview(utils.get_first_day_of_month(),
                          utils.get_last_day_of_month())