Beispiel #1
0
def overview():
    page = getIntQueryParam(request, 1)
    per_page = app.config['PER_PAGE']
    cons = Consumption.query.filter(
        and_(Consumption.user_id == current_user.id,
             Consumption.billed == False)).order_by(desc(
                 Consumption.time)).paginate(page, per_page, error_out=False)

    sum = db.engine.execute(text(
        'select sum(amount * price) from consumption where user_id = :uid and billed = 0'
    ),
                            uid=current_user.id).fetchone()
    return render_template('overview.html',
                           summed=format_curr(sum[0] or 0),
                           consumptions=cons)
Beispiel #2
0
 def getprice(self):
     return format_curr(self.price)
Beispiel #3
0
 def getsum(self):
     return format_curr(self.sum)
Beispiel #4
0
 def formatsum(self):
     return format_curr(self.getsum())
Beispiel #5
0
 def getsum(self):
     return format_curr(self.price * self.amount)
Beispiel #6
0
 def getprice(self):
     if not self.price:
         return None
     return format_curr(self.price)