예제 #1
0
def report_export(request):
    """
    export admission data in html or pdf
    """

    html = 'report/report_export.html'

    if request.method == 'POST':

        r = Report()
        org_active = request.user.get_profile().org_active
        
        # admission statistcs data
        if request.POST.get('view') == '1': # admission
            title = _('Admission Report')
            view = 'admission'
            data = Report().get_admissions_range(org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('accumulated'))

            if request.POST.get('clients'):
                report_clients = ReportAdmission.objects.clients_all(request.user, request.POST.get('date_start'), request.POST.get('date_end'))
            data, chart_url, date_start,date_end = data

        if request.POST.get('view') == '2': # referral
            title = _('Referral Report')
            if request.POST.get('service'):
                sub_title = u'%s %s' % (_('Service'), Service.objects.get(organization=request.user.get_profile().org_active, pk=request.POST.get('service')))
            view = 'referral'
            data = Report().get_referral_range(org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('service'), request.POST.get('accumulated'))

            if request.POST.get('clients'):
                report_clients = ReportReferral.objects.clients_all(request.user, request.POST.get('date_start'), request.POST.get('date_end'))
            
            data,date_start,date_end, service = data

        # renevues / faturamento
        if request.POST.get('view') == '3':

            view = 'receive'
            title = _('Revenues Report')
            html = 'report/report_receive_export.html'

            data , colors , date_start , date_end , list_receive , total_receive = Report().get_receive_( org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('professional'), request.POST.get('receipt_status'), request.POST.get('service'), request.POST.get('payment_way'), request.POST.get('cove') )

            # variables of JS
            option_title = u'Estatística de todos os profíssionais, serviços e pagamentos para o período escolhido.'
            option_rows = data 
            option_colors = colors

            IMG_PREFIX = '/media/' if int(request.POST.get('format')) == 1 else MEDIA_ROOT.replace('\\','/') + '/' # this a path bug fix. format == 1 (html)

            if int(request.POST.get('format')) == 2: # pdf print
                return write_pdf( html , locals(), ('%s-%s-%s-%s-%s.pdf' % (view, slugify(_('report-between')), request.POST.get('date_start').replace('/','-'), _('and'), request.POST.get('date_end').replace('/','-'))))

        # default out is html format
        remove_links = True
        export_graph_type = request.POST.get('export_graph_type')
        return render_to_response( html , locals(), context_instance=RequestContext(request))
예제 #2
0
파일: views.py 프로젝트: Niets/gestorpsi
def report_export(request):
    """
    export admission data in html or pdf
    """
    if request.method == 'POST':
        r = Report()
        org_active = request.user.get_profile().org_active
        
        # admission statistcs data
        if request.POST.get('view') == '1': # admission
            title = _('Admission Report')
            view = 'admission'
            data = Report().get_admissions_range(org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('accumulated'))

            if request.POST.get('clients'):
                report_clients = ReportAdmission.objects.clients_all(request.user, request.POST.get('date_start'), request.POST.get('date_end'))
            data, chart_url, date_start,date_end = data

        if request.POST.get('view') == '2': # referral
            title = _('Referral Report')
            if request.POST.get('service'):
                sub_title = u'%s %s' % (_('Service'), Service.objects.get(organization=request.user.get_profile().org_active, pk=request.POST.get('service')))
            view = 'referral'
            data = Report().get_referral_range(org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('service'), request.POST.get('accumulated'))

            if request.POST.get('clients'):
                report_clients = ReportReferral.objects.clients_all(request.user, request.POST.get('date_start'), request.POST.get('date_end'))
            
            data,date_start,date_end, service = data
        

        IMG_PREFIX = '/media/' if int(request.POST.get('format')) == 1 else MEDIA_ROOT.replace('\\','/') + '/' # this a path bug fix. format == 1 (html)

        if int(request.POST.get('format')) == 2: # pdf print
            user = request.user
            return write_pdf('report/report_export.html', locals(), ('%s-%s-%s-%s-%s.pdf' % (view, slugify(_('report-between')), request.POST.get('date_start').replace('/','-'), _('and'), request.POST.get('date_end').replace('/','-'))))

        remove_links = True
        export_graph_type = request.POST.get('export_graph_type')
        return render_to_response('report/report_export.html', locals(), context_instance=RequestContext(request))
예제 #3
0
def report_export(request):
    """
    export admission data in html or pdf
    """
    if request.method == 'POST':
        r = Report()
        org_active = request.user.get_profile().org_active
        
        # admission statistcs data
        if request.POST.get('view') == '1': # admission
            title = _('Admission Report')
            view = 'admission'
            data = Report().get_admissions_range(org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('accumulated'))

            if request.POST.get('clients'):
                report_clients = ReportAdmission.objects.clients_all(request.user, request.POST.get('date_start'), request.POST.get('date_end'))
            data, chart_url, date_start,date_end = data
        if request.POST.get('view') == '2': # referral
            title = _('Referral Report')
            if request.POST.get('service'):
                sub_title = u'%s %s' % (_('Service'), Service.objects.get(organization=request.user.get_profile().org_active, pk=request.POST.get('service')))
            view = 'referral'
            data = Report().get_referral_range(org_active, request.POST.get('date_start'), request.POST.get('date_end'), request.POST.get('service'), request.POST.get('accumulated'))

            if request.POST.get('clients'):
                report_clients = ReportReferral.objects.clients_all(request.user, request.POST.get('date_start'), request.POST.get('date_end'))
            
            data,date_start,date_end, service = data
        

        IMG_PREFIX = '/media/' if int(request.POST.get('format')) == 1 else MEDIA_ROOT.replace('\\','/') + '/' # this a path bug fix. format == 1 (html)

        if int(request.POST.get('format')) == 2: # pdf print
            user = request.user
            return write_pdf('report/report_export.html', locals(), ('%s-%s-%s-%s-%s.pdf' % (view, slugify(_('report-between')), request.POST.get('date_start').replace('/','-'), _('and'), request.POST.get('date_end').replace('/','-'))))

        remove_links = True
        export_graph_type = request.POST.get('export_graph_type')
        return render_to_response('report/report_export.html', locals(), context_instance=RequestContext(request))