|
|
|
@ -28,15 +28,15 @@ def get_doc(request, order_num=None): |
|
|
|
data = request.user.profile |
|
|
|
data = request.user.profile |
|
|
|
if pm == 0: |
|
|
|
if pm == 0: |
|
|
|
tmp_name = 'bill.xls' |
|
|
|
tmp_name = 'bill.xls' |
|
|
|
file_name = "Invoice No.%s.xls" % (order_num,) |
|
|
|
file_name = "Invoice No.{order_num}.xls" |
|
|
|
elif pm == 2: |
|
|
|
elif pm == 2: |
|
|
|
tmp_name = '4pd.xls' |
|
|
|
tmp_name = '4pd.xls' |
|
|
|
file_name = "Kvitanciya na oplatu zakaza No.%s.xls" % (order_num,) |
|
|
|
file_name = f"Kvitanciya na oplatu zakaza No.{order_num}.xls" |
|
|
|
else: |
|
|
|
else: |
|
|
|
raise Http404() |
|
|
|
raise Http404() |
|
|
|
|
|
|
|
|
|
|
|
response = HttpResponse(content_type="application/vnd.ms-excel") |
|
|
|
response = HttpResponse(content_type="application/vnd.ms-excel") |
|
|
|
response['Content-Disposition'] = 'attachment; filename=%s' % file_name |
|
|
|
response['Content-Disposition'] = f'attachment; filename={file_name}' |
|
|
|
|
|
|
|
|
|
|
|
rb = open_workbook(os.path.join(XLS_ROOT, tmp_name), on_demand=True, formatting_info=True) |
|
|
|
rb = open_workbook(os.path.join(XLS_ROOT, tmp_name), on_demand=True, formatting_info=True) |
|
|
|
wb = copy(rb) |
|
|
|
wb = copy(rb) |
|
|
|
@ -63,10 +63,10 @@ def get_doc(request, order_num=None): |
|
|
|
) |
|
|
|
) |
|
|
|
style4.num_format_str = "#,##0.00" |
|
|
|
style4.num_format_str = "#,##0.00" |
|
|
|
|
|
|
|
|
|
|
|
ws.write(11, 0, u"СЧЕТ № %s от %s" % (order_num, license.order_date.strftime('%d.%m.%Y')), |
|
|
|
ws.write(11, 0, f"СЧЕТ № {order_num} от {license.order_date.strftime('%d.%m.%Y')}", |
|
|
|
style0_center) |
|
|
|
style0_center) |
|
|
|
ws.write(13, 0, u"Покупатель: %s" % data.name, style1) |
|
|
|
ws.write(13, 0, f"Покупатель: {data.name}", style1) |
|
|
|
ws.write(16, 2, u"Лицензия Dokumentor.ru на %s" % (license.get_term()), style3) |
|
|
|
ws.write(16, 2, f"Лицензия Dokumentor.ru на {license.get_term()}", style3) |
|
|
|
|
|
|
|
|
|
|
|
style3.num_format_str = "#,##0.00" |
|
|
|
style3.num_format_str = "#,##0.00" |
|
|
|
|
|
|
|
|
|
|
|
@ -74,8 +74,8 @@ def get_doc(request, order_num=None): |
|
|
|
ws.write(16, 44, license.pay_sum, style3) |
|
|
|
ws.write(16, 44, license.pay_sum, style3) |
|
|
|
ws.write(17, 44, license.pay_sum, style4) |
|
|
|
ws.write(17, 44, license.pay_sum, style4) |
|
|
|
ws.write(19, 44, license.pay_sum, style4) |
|
|
|
ws.write(19, 44, license.pay_sum, style4) |
|
|
|
ws.write(21, 0, u"Всего наименование 1, на сумму %s,00 руб." % license.pay_sum, style1) |
|
|
|
ws.write(21, 0, f"Всего наименование 1, на сумму {license.pay_sum},00 руб.", style1) |
|
|
|
ws.write(23, 0, u"%s." % rubles(license.pay_sum).capitalize(), style2) |
|
|
|
ws.write(23, 0, f"{rubles(license.pay_sum).capitalize()}.", style2) |
|
|
|
|
|
|
|
|
|
|
|
ws.insert_bitmap(os.path.join(XLS_ROOT, 'stamp.bmp'), 26, 12, y=3, scale_y=1.1) |
|
|
|
ws.insert_bitmap(os.path.join(XLS_ROOT, 'stamp.bmp'), 26, 12, y=3, scale_y=1.1) |
|
|
|
|
|
|
|
|
|
|
|
@ -90,7 +90,7 @@ def get_doc(request, order_num=None): |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
# заполняем оригинал |
|
|
|
# заполняем оригинал |
|
|
|
ws.write(11, 4, u"Лицензия Dokumentor.ru на %s" % (license.get_term()), style1) |
|
|
|
ws.write(11, 4, f"Лицензия Dokumentor.ru на {license.get_term()}", style1) |
|
|
|
ws.write(13, 13, data.get_boss_fio(), style0) |
|
|
|
ws.write(13, 13, data.get_boss_fio(), style0) |
|
|
|
ws.write(14, 13, re.sub("^\s+|\n|\r|\s+$", ' ', data.address), style0) |
|
|
|
ws.write(14, 13, re.sub("^\s+|\n|\r|\s+$", ' ', data.address), style0) |
|
|
|
ws.write(15, 11, license.pay_sum, style1) |
|
|
|
ws.write(15, 11, license.pay_sum, style1) |
|
|
|
|