def report(request): """ Weekly appointment reminder report. """ status = request.GET.get('status', None) today = datetime.date.today() appt_date = today + datetime.timedelta(weeks=1) form = ReportForm(request.GET or None) if form.is_valid(): appt_date = form.cleaned_data['date'] or appt_date confirmed_patients = reminders.Patient.objects.confirmed_for_date(appt_date) unconfirmed_patients = reminders.Patient.objects.unconfirmed_for_date(appt_date) context = { 'report_form': form, 'status': status, 'appt_date': appt_date, 'confirmed_patients': confirmed_patients, 'unconfirmed_patients': unconfirmed_patients, } if status == 'confirmed': context['patients'] = context['confirmed_patients'] elif status == 'unconfirmed': context['patients'] = context['unconfirmed_patients'] if status: return render_to_response('reminders/small-report.html', context, RequestContext(request)) else: return render_to_response('reminders/report.html', context, RequestContext(request))
def report(request): """ Weekly appointment reminder report. """ status = request.GET.get('status', None) today = datetime.date.today() appt_date = today + datetime.timedelta(weeks=1) form = ReportForm(request.GET or None) if form.is_valid(): appt_date = form.cleaned_data['date'] or appt_date confirmed_patients = reminders.Patient.objects.confirmed_for_date( appt_date) unconfirmed_patients = reminders.Patient.objects.unconfirmed_for_date( appt_date) context = { 'report_form': form, 'status': status, 'appt_date': appt_date, 'confirmed_patients': confirmed_patients, 'unconfirmed_patients': unconfirmed_patients, } if status == 'confirmed': context['patients'] = context['confirmed_patients'] elif status == 'unconfirmed': context['patients'] = context['unconfirmed_patients'] if status: return render_to_response('reminders/small-report.html', context, RequestContext(request)) else: return render_to_response('reminders/report.html', context, RequestContext(request))
def list_patients(request): today = datetime.date.today() report_date = today # + datetime.timedelta(weeks=1) form = ReportForm(request.GET or None) if form.is_valid(): report_date = form.cleaned_data['date'] or report_date context = get_patient_stats_context(report_date) context['report_form'] = form context['report_month'] = report_date.strftime('%B') context['report_day'] = report_date.day return render(request, 'patients/patient_stats.html', context)
def dashboard(request): today = datetime.date.today() appt_date = today + datetime.timedelta(weeks=1) form = ReportForm(request.GET or None) if form.is_valid(): appt_date = form.cleaned_data['date'] or appt_date unconfirmed_patients = reminders.Patient.objects.unconfirmed_for_date(appt_date) notifications = reminders.Notification.objects.all() context = { 'report_form': form, 'notifications': notifications, 'unconfirmed_patients': unconfirmed_patients, 'appt_date': appt_date, } return render_to_response('reminders/dashboard.html', context, RequestContext(request))
def dashboard(request): today = datetime.date.today() appt_date = today + datetime.timedelta(weeks=1) form = ReportForm(request.GET or None) if form.is_valid(): appt_date = form.cleaned_data['date'] or appt_date unconfirmed_patients = reminders.Patient.objects.unconfirmed_for_date( appt_date) notifications = reminders.Notification.objects.all() context = { 'report_form': form, 'notifications': notifications, 'unconfirmed_patients': unconfirmed_patients, 'appt_date': appt_date, } return render_to_response('reminders/dashboard.html', context, RequestContext(request))