예제 #1
0
파일: views.py 프로젝트: iverlandth/sisccom
def billings_index(request):
    billings = Billing.objects.none()
    company_id = int(request.session['company_id'])
    if request.is_ajax():
        query = request.GET.get('q')
        template = request.GET.get('t')
        query_find = Q(id__icontains=query) | Q(customer__nit__icontains=query)
        counts = 0

        if query is not None:
            billings = Billing.objects.filter(query_find, Q(company_id=company_id))
            counts = billings.count()

        if template:
            t = template
        else:
            t = 'billings/_billings.html'

        page = request.GET.get('page')
        billings = get_paginator(page, billings)

        return render_to_response(t, {'billings': billings,
                                      'instance_model': Billing,
                                      'query': query,
                                      'counts': counts, },
                                  context_instance=RequestContext(request))
    else:
        billings = Billing.objects.filter(company_id=company_id)
        page = request.GET.get('page')
        billings = get_paginator(page, billings)

    return render(request, 'billings/index.html', {
        'billings': billings,
        'instance_model': Billing,
    })
예제 #2
0
파일: views.py 프로젝트: iverlandth/sisccom
def customers_index(request):
    customers = Customer.objects.none()
    if request.is_ajax():
        query = request.GET.get('q')
        template = request.GET.get('t')
        query_find = Q(full_name__icontains=query) | Q(nit__icontains=query)
        counts = 0

        if query is not None:
            customers = Customer.objects.filter(query_find)
            counts = customers.count()

        t = template

        page = request.GET.get('page')
        customers = get_paginator(page, customers)

        return render_to_response(t, {'customers': customers,
                                      'instance_model_customer': Customer,
                                      'query': query,
                                      'counts': counts, },
                                  context_instance=RequestContext(request))
    else:
        customers = Customer.objects.all()

    return render(request, 'customers/index.html', {
        'customers': customers,
        'instance_model': Customer
    })
예제 #3
0
파일: views.py 프로젝트: iverlandth/sisccom
def articles_index(request):
    articles_all = Article.objects.all()
    page = request.GET.get('page')
    articles_all = get_paginator(page, articles_all)

    return render(request, 'articles/index.html', {
        'articles': articles_all,
        'instance_model': Article
    })
예제 #4
0
파일: views.py 프로젝트: iverlandth/sisccom
def book_sales_index(request):
    company_id = int(request.session['company_id'])

    book_sales_all = ReportsBilling.objects.filter(company_id=company_id)
    page = request.GET.get('page')
    book_sales_all = get_paginator(page, book_sales_all)

    return render(request, 'book_sales/index.html', {
        'book_sales': book_sales_all,
        'instance_model': ReportsBilling
    })