Ejemplo n.º 1
0
def reports(request,*kw,**kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:             #from menu:select->reports
            form = forms.SelectReports()     
            return django.shortcuts.render(request, form.template, {'form': form})    #go to the SelectReports form
        else:                                   #from menu:run->report
            cleaned_data = {'page':1,'sortedby':'idta','sortedasc':False}   #go to default report-query using these default parameters
    else: #request.method == 'POST'
        if 'fromselect' in request.POST:        #from SelectReports form
            formin = forms.SelectReports(request.POST)
            if not formin.is_valid():
                return django.shortcuts.render(request, formin.template, {'form': formin})
            #go to default report-query using parameters from select screen
        elif 'report2incoming' in request.POST:       #from ViewReports form using star view incoming
            request.POST = viewlib.preparereport2view(request.POST,viewlib.save_int(request.POST['report2incoming']))
            return incoming(request)
        elif 'report2outgoing' in request.POST:       #from ViewReports form using star view outgoing
            request.POST = viewlib.preparereport2view(request.POST,viewlib.save_int(request.POST['report2outgoing']))
            return outgoing(request)
        elif 'report2process' in request.POST:       #from ViewReports form using star view process errors
            request.POST = viewlib.preparereport2view(request.POST,viewlib.save_int(request.POST['report2process']))
            return process(request)
        elif 'report2errors' in request.POST:       #from ViewReports form using star file errors
            newpost = viewlib.preparereport2view(request.POST,viewlib.save_int(request.POST['report2errors']))
            newpost['statust'] = ERROR
            request.POST = newpost
            return incoming(request)
        elif 'report2commerrors' in request.POST:       #from ViewReports form using star communcation errors
            newpost = viewlib.preparereport2view(request.POST,viewlib.save_int(request.POST['report2commerrors']))
            newpost['statust'] = ERROR
            request.POST = newpost
            return outgoing(request)
        else:                                   #from ViewReports form
            formin = forms.ViewReports(request.POST)
            if not formin.is_valid():
                return django.shortcuts.render(request, formin.template, {'form': formin})
            elif '2select' in request.POST:               #from ViewReports form using button change selection
                form = forms.SelectReports(formin.cleaned_data)
                return django.shortcuts.render(request, form.template, {'form': form})
            else:                                       #from ViewReports, next page etc 
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data
    #normal report-query with parameters
    query = models.report.objects.all()
    pquery = viewlib.filterquery(query,cleaned_data)
    form = forms.ViewReports(initial=cleaned_data)
    return django.shortcuts.render(request, form.template, {'form': form,'queryset':pquery})
Ejemplo n.º 2
0
def reports(request, *kw, **kwargs):
    #~ print 'reports received',kw,kwargs,request.POST,request.GET
    if request.method == 'GET':
        if 'select' in request.GET:  #via menu, go to select form
            formout = forms.SelectReports()
            return viewlib.render(request, formout)
        else:  #via menu, go to view form
            cleaned_data = {'page': 1, 'sortedby': 'ts', 'sortedasc': False}
    else:  # request.method == 'POST'
        if 'fromselect' in request.POST:  #coming from select criteria screen
            formin = forms.SelectReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
        else:
            formin = forms.ViewReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request, formin)
            if '2select' in request.POST:  #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectReports(formin.cleaned_data)
                return viewlib.render(request, formout)
            elif 'report2incoming' in request.POST:  #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2incoming']))
                return incoming(request)
            elif 'report2outgoing' in request.POST:  #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2outgoing']))
                return outgoing(request)
            elif 'report2process' in request.POST:  #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2process']))
                return process(request)
            elif 'report2errors' in request.POST:  #coming from ViewIncoming, go to incoming
                newpost = viewlib.preparereport2view(
                    request.POST, int(request.POST['report2errors']))
                newpost['statust'] = ERROR
                request.POST = newpost
                return incoming(request)
            else:  #coming from ViewIncoming
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.report.objects.all()
    pquery = viewlib.filterquery(query, cleaned_data)
    formout = forms.ViewReports(initial=cleaned_data)
    return viewlib.render(request, formout, pquery)
Ejemplo n.º 3
0
def reports(request,*kw,**kwargs):
    #~ print 'reports received',kw,kwargs,request.POST,request.GET
    if request.method == 'GET':
        if 'select' in request.GET:             #via menu, go to select form
            formout = forms.SelectReports()
            return viewlib.render(request,formout)
        else:                              #via menu, go to view form
            cleaned_data = {'page':1,'sortedby':'ts','sortedasc':False}
    else:                                  # request.method == 'POST'
        if 'fromselect' in request.POST:        #coming from select criteria screen
            formin = forms.SelectReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
        else:
            formin = forms.ViewReports(request.POST)
            if not formin.is_valid():
                return viewlib.render(request,formin)
            if '2select' in request.POST:         #coming from ViewIncoming, change the selection criteria, go to select form
                formout = forms.SelectReports(formin.cleaned_data)
                return viewlib.render(request,formout)
            elif 'report2incoming' in request.POST:         #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(request.POST,int(request.POST['report2incoming']))
                return incoming(request)
            elif 'report2outgoing' in request.POST:         #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(request.POST,int(request.POST['report2outgoing']))
                return outgoing(request)
            elif 'report2process' in request.POST:         #coming from ViewIncoming, go to incoming
                request.POST = viewlib.preparereport2view(request.POST,int(request.POST['report2process']))
                return process(request)
            elif 'report2errors' in request.POST:         #coming from ViewIncoming, go to incoming
                newpost = viewlib.preparereport2view(request.POST,int(request.POST['report2errors']))
                newpost['statust'] = ERROR
                request.POST = newpost
                return incoming(request)
            else:                                    #coming from ViewIncoming
                viewlib.handlepagination(request.POST,formin.cleaned_data)
        cleaned_data = formin.cleaned_data

    query = models.report.objects.all()
    pquery = viewlib.filterquery(query,cleaned_data)
    formout = forms.ViewReports(initial=cleaned_data)
    return viewlib.render(request,formout,pquery)
Ejemplo n.º 4
0
def reports(request, *kw, **kwargs):
    if request.method == 'GET':
        if 'select' in request.GET:  #from menu:select->reports
            form = forms.SelectReports()
            return django.shortcuts.render(
                request, form.template,
                {'form': form})  #go to the SelectReports form
        else:  #from menu:run->report
            cleaned_data = {
                'page': 1,
                'sortedby': 'idta',
                'sortedasc': False
            }  #go to default report-query using these default parameters
    else:  #request.method == 'POST'
        if 'fromselect' in request.POST:  #from SelectReports form
            formin = forms.SelectReports(request.POST)
            if not formin.is_valid():
                return django.shortcuts.render(request, formin.template,
                                               {'form': formin})
            #go to default report-query using parameters from select screen
        elif 'report2incoming' in request.POST:  #from ViewReports form using star view incoming
            request.POST = viewlib.preparereport2view(
                request.POST,
                viewlib.save_int(request.POST['report2incoming']))
            return incoming(request)
        elif 'report2outgoing' in request.POST:  #from ViewReports form using star view outgoing
            request.POST = viewlib.preparereport2view(
                request.POST,
                viewlib.save_int(request.POST['report2outgoing']))
            return outgoing(request)
        elif 'report2process' in request.POST:  #from ViewReports form using star view process errors
            request.POST = viewlib.preparereport2view(
                request.POST, viewlib.save_int(request.POST['report2process']))
            return process(request)
        elif 'report2errors' in request.POST:  #from ViewReports form using star file errors
            newpost = viewlib.preparereport2view(
                request.POST, viewlib.save_int(request.POST['report2errors']))
            newpost['statust'] = ERROR
            request.POST = newpost
            return incoming(request)
        elif 'report2commerrors' in request.POST:  #from ViewReports form using star communcation errors
            newpost = viewlib.preparereport2view(
                request.POST,
                viewlib.save_int(request.POST['report2commerrors']))
            newpost['statust'] = ERROR
            request.POST = newpost
            return outgoing(request)
        else:  #from ViewReports form
            formin = forms.ViewReports(request.POST)
            if not formin.is_valid():
                return django.shortcuts.render(request, formin.template,
                                               {'form': formin})
            elif '2select' in request.POST:  #from ViewReports form using button change selection
                form = forms.SelectReports(formin.cleaned_data)
                return django.shortcuts.render(request, form.template,
                                               {'form': form})
            else:  #from ViewReports, next page etc
                viewlib.handlepagination(request.POST, formin.cleaned_data)
        cleaned_data = formin.cleaned_data
    #normal report-query with parameters
    query = models.report.objects.all()
    pquery = viewlib.filterquery(query, cleaned_data)
    form = forms.ViewReports(initial=cleaned_data)
    return django.shortcuts.render(request, form.template, {
        'form': form,
        'queryset': pquery
    })