def getExpences(): """ It gets all the expenses by week and by store for the current month or for the past 2 or 3 months if the parameter 'month' is passed """ month = request.args.get('month') current_month = datetime.today().strftime('%m') # print "MONTH PARAM", month, type(month),type(current_month) if not month: month = current_month else: month = int(current_month) - int(month) # print "MONTH", month if 'User' in session: expences = Expence.getExpencesGroupedByDate(session['User'], month) expences_by_store = Expence.getExpencesByStore(session['User'], month) data_expences = helpFunctions.setDisplayData(expences, expences_by_store) return jsonify(data_expences) else: flash = [] flash = "You need to login" return render_template("error.html")