Ejemplo n.º 1
0
def GeneratePDF(request,tit,emp, *args, **kwargs):
    template = get_template('telephone/telephone_reim_form.html')
    try:
        obj = get_object_or_404(Telephone_Reim, name=tit)
    except:
        return redirect("../../../../dashboard/actions/telephone_gateway")#HttpResponseNotFound("Sorry " + tit + " form not found")
    else:
        print(BASE_DIR, "hey shrihari")

        context = {
            "object":obj,
            "today": datetime.date.today(),
            "n":obj.name,
            "base_dir": BASE_DIR,
        }
        if obj.employee_id != emp:
            return redirect("../../../../dashboard/actions/telephone_gateway")
        html = template.render(context)
        pdf = render_to_pdf('telephone/telephone_reim_form.html', context)
        if pdf:
            response = HttpResponse(pdf, content_type='application/pdf')
            filename = "TelephoneReimbursementForm_%s.pdf" %(context["n"])
            content = "inline; filename=%s" %(filename)
            download = request.GET.get("download")
            if download:
                content = "attachment;filename=%s" %(filename)
            response['Content-Disposition'] = content
            #return HttpResponse(html)
            return response
            #return HttpResponse(pdf, content_type='application/pdf')
        return HttpResponse("Not found")
Ejemplo n.º 2
0
 def get(self, request, *args, **kwargs):
     data = UserData.objects.get(id=self.kwargs['id'])
     experience = Experience.objects.filter(user_experience=data).all().order_by('-worked_till')
     education = Education.objects.filter(user_education=data).all().order_by('-left_at')
     skills = Skills.objects.filter(user_skills=data).all()
     workflow = Workflow.objects.filter(user_workflow=data).all()
     interest = Interest.objects.filter(user_interest=data).all()
     award = Certificate.objects.filter(user_certificates=data).all()
     project = Projects.objects.filter(user_project=data).all()
     context = {'data': data, 'award': award, 'project': project, 'experience': experience,'interest': interest, 'education': education, 'skills':skills, 'workflow':workflow}
     pdf = render_to_pdf('dashboard/resume.html', context)
     return HttpResponse(pdf, content_type='application/pdf')
Ejemplo n.º 3
0
def GeneratePDF(request, tit, emp, *args, **kwargs):
    template = get_template('ta_bill/ta_bill_form.html')
    try:
        obj = get_object_or_404(TA_Bill, name=tit)
    except:
        print("hi")
        return redirect(
            "../../../../dashboard/actions/tabill_gateway"
        )  #HttpResponseNotFound("Sorry " + tit + " form not found")
    else:
        print(BASE_DIR, "hey shrihari")

        context = {
            "object":
            obj,
            "today":
            datetime.date.today(),
            "n":
            obj.name,
            "base_dir":
            BASE_DIR,
            'tot_a':
            obj.fare_1 + obj.fare_2 + obj.fare_3,
            'tot_b':
            obj.other_exp_amount_1 + obj.other_exp_amount_2 +
            obj.other_exp_amount_3,
        }
        if obj.employee_id != emp:
            return redirect("../../../../dashboard/actions/tabill_gateway")
        html = template.render(context)
        pdf = render_to_pdf('ta_bill/ta_bill_form.html', context)
        if pdf:
            response = HttpResponse(pdf, content_type='application/pdf')
            filename = "TravellingAllowanceBill_%s.pdf" % (context["n"])
            content = "inline; filename=%s" % (filename)
            download = request.GET.get("download")
            if download:
                content = "attachment;filename=%s" % (filename)
            response['Content-Disposition'] = content
            #return HttpResponse(html)
            return response
            #return HttpResponse(pdf, content_type='application/pdf')
        return HttpResponse("Not found")
Ejemplo n.º 4
0
def GeneratePDF(request, tit, emp, *args, **kwargs):
    template = get_template('cert_a/cert_a_form.html')
    try:
        obj = get_object_or_404(Cert_A, name=tit)
    except:
        print("hi")
        return redirect("../../../../dashboard/actions/certa_gateway")
    else:
        print(BASE_DIR, "hey shrihari")

        context = {
            "object":
            obj,
            "today":
            datetime.date.today(),
            "n":
            obj.name,
            "base_dir":
            BASE_DIR,
            'total_amount':
            obj.Consult_fee1 + obj.Consult_fee2 + obj.Injection_fee1 +
            obj.Injection_fee2 + obj.Price1 + obj.Price2 +
            obj.Diagnostic_Test_price1 + obj.Diagnostic_Test_price2,
        }
        if obj.employee_id != emp:
            return redirect("../../../../dashboard/actions/certa_gateway")
        html = template.render(context)
        pdf = render_to_pdf('cert_a/cert_a_form.html', context)
        if pdf:
            response = HttpResponse(pdf, content_type='application/pdf')
            filename = "Certificate-A_%s.pdf" % (context["n"])
            content = "inline; filename=%s" % (filename)
            download = request.GET.get("download")
            if download:
                content = "attachment;filename=%s" % (filename)
            response['Content-Disposition'] = content
            # return HttpResponse(html)
            return response
            # return HttpResponse(pdf, content_type='application/pdf')
        return HttpResponse("Not found")