def show_cost(request): log.debug('cost = ') log.debug('weekday = %s' % datetime.now().weekday()) log.debug(datetime.now().isocalendar()) yesterday_midnight = datetime.today().replace(hour=0, minute=0, second=0, microsecond=0) day = cost_tools.get_instance_hours_in_date_range(yesterday_midnight, datetime.now()) month_midnight = datetime.today().replace(day=1, hour=0, minute=0, second=0, microsecond=0) month = cost_tools.get_instance_hours_in_date_range( month_midnight, datetime.now()) year_midnight = datetime.today().replace(month=1, day=1, hour=0, minute=0, second=0, microsecond=0) week_midnight = year_midnight + timedelta( weeks=datetime.today().isocalendar()[1]) week = cost_tools.get_instance_hours_in_date_range(week_midnight, datetime.now()) return render_to_response('vdi/cost_display.html', { 'day': day, 'week': week, 'month': month }, context_instance=RequestContext(request))
def show_cost(request): log.debug('cost = ') log.debug('weekday = %s' % datetime.now().weekday()) log.debug(datetime.now().isocalendar()) yesterday_midnight = datetime.today().replace(hour=0,minute=0,second=0,microsecond=0) day = cost_tools.get_instance_hours_in_date_range(yesterday_midnight,datetime.now()) month_midnight = datetime.today().replace(day=1,hour=0,minute=0,second=0,microsecond=0) month = cost_tools.get_instance_hours_in_date_range(month_midnight,datetime.now()) year_midnight = datetime.today().replace(month=1,day=1,hour=0,minute=0,second=0,microsecond=0) week_midnight = year_midnight +timedelta(weeks=datetime.today().isocalendar()[1]) week = cost_tools.get_instance_hours_in_date_range(week_midnight,datetime.now()) return render_to_response('vdi/cost_display.html', {'day' : day, 'week' : week, 'month' : month}, context_instance=RequestContext(request))
def calculate_cost(request, start_date, end_date): starting_date = cost_tools.convert_to_date_time(start_date) ending_date = cost_tools.convert_to_date_time(end_date) total_hours_in_range = cost_tools.get_instance_hours_in_date_range(starting_date, ending_date) cost = cost_tools.generate_cost(total_hours_in_range) return HttpResponse("Calculating cost for date " + str(starting_date) + " to " + str(ending_date) + ". The total hours used in this range is " + str(total_hours_in_range) + " with cost $" + str(cost))
def calculate_cost(request, start_date, end_date): starting_date = cost_tools.convert_to_date_time(start_date) ending_date = cost_tools.convert_to_date_time(end_date) total_hours_in_range = cost_tools.get_instance_hours_in_date_range( starting_date, ending_date) cost = cost_tools.generate_cost(total_hours_in_range) return HttpResponse("Calculating cost for date " + str(starting_date) + " to " + str(ending_date) + ". The total hours used in this range is " + str(total_hours_in_range) + " with cost $" + str(cost))