Пример #1
0
    def get(self, request):
        params = self.params
        pdf = render_to_pdf('pdf_voucher_template/bus_voucher.html', params)
        file = Render.render_to_file('pdf_voucher_template/bus_voucher.html',
                                     params)

        return file
Пример #2
0
 def get_file_path_multiple_invoice(self, request):
     params = self.params
     pdf = render_to_pdf(
         'pdf_voucher_template/bill_template/bill_multiple_invoice.html',
         params)
     file = Render.render_to_bill_pdf(
         'pdf_voucher_template/bill_template/bill_multiple_invoice.html',
         params)
     return file
Пример #3
0
 def get_file_path_rembusment(self, request):
     params = self.params
     pdf = render_to_pdf(
         'pdf_voucher_template/bill_template/bill_single_invoice.html',
         params)
     file = Render.render_to_bill_pdf_bill(
         'pdf_voucher_template/bill_template/bill_single_invoice.html',
         params)
     return file
Пример #4
0
def pdf_render_test(request):
    # payload = {'bill_id': 106}
    # url = settings.API_BASE_URL + "view_bill"
    # company = getDataFromAPI("10", "W6UC9UJJ63BT1XSQ9ZXSKEWVCF90WME8I9YWP9106V1688GZZ0ZINGQEY33C", url, payload)
    # print(company['Bill'][0])
    # voucher = {'bill_datas':company['Bill'][0]}
    # pdf = render_to_pdf('pdf_voucher_template/bill_template/bill_single_invoice.html', voucher)

    #return render(request,'train_email_temp.html')

    # cursor2 = connection.cursor()
    # cursor2.callproc('viewFlightBooking', [220])
    # emp = dictfetchall(cursor2)
    # cursor2.close()
    #
    # cursor1 = connection.cursor()
    # cursor1.callproc('getAllFlightBookingPassangers', [220])
    # passanger = dictfetchall(cursor1)
    # emp[0]['Passangers'] = passanger
    # cursor1.close()
    #
    # cursor3 = connection.cursor()
    # cursor3.callproc('getAllFlightBookingFlights', [220])
    # flights = dictfetchall(cursor3)
    # cursor3.close()
    #
    # emp[0]['Flights'] = flights
    #
    # DEP_DATE_0 = ''
    # for i, f in enumerate(flights):
    #     print(f)
    #
    #     ARRV_DATE_i = f['arrival_datetime']
    #     DEP_DATE_i = f['departure_datetime']
    #     adDate = datetime.strptime(str(DEP_DATE_i), "%d-%m-%Y %H:%M")
    #     ddDate = datetime.strptime(str(ARRV_DATE_i), "%d-%m-%Y %H:%M")
    #     dayHours_onword_i = timesince(adDate, ddDate)
    #     if i == 0:
    #         DEP_DATE_0 = f['arrival_datetime']
    #     if i == 1 or i == 2 or i == 3:
    #         ii = i - 1
    #         adDate = datetime.strptime(str(DEP_DATE_0), "%d-%m-%Y %H:%M")
    #         ddDate = datetime.strptime(str(DEP_DATE_i), "%d-%m-%Y %H:%M")
    #         emp[0]['DELAY_' + str(i)] = timesince(adDate, ddDate)
    #         DEP_DATE_0 = f['arrival_datetime']
    #     emp[0]['DURATION_' + str(i)] = dayHours_onword_i

    cursor2 = connection.cursor()
    cursor2.callproc('viewBusBooking', [120])
    emp = dictfetchall(cursor2)
    cursor2.close()

    cursor1 = connection.cursor()
    cursor1.callproc('getAllBusBookingPassangers', [120])
    passanger = dictfetchall(cursor1)
    emp[0]['Passangers'] = passanger
    cursor1.close()
    print(emp[0])
    #
    # cursor2 = connection.cursor()
    # cursor2.callproc('viewHotelBooking', [106])
    # emp = dictfetchall(cursor2)
    # cursor2.close()
    #
    # cursor1 = connection.cursor()
    # cursor1.callproc('getAllHotelBookingPassangers', [106])
    # passanger = dictfetchall(cursor1)
    # emp[0]['Passangers'] = passanger
    # cursor1.close()

    print(emp[0])

    pdf = render_to_pdf('pdf_voucher_template/bus_voucher.html', emp[0])
    return HttpResponse(pdf, content_type='application/pdf')