Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
urchinpro committed Oct 12, 2023
1 parent 77c9b7b commit 1c1ccbd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
18 changes: 16 additions & 2 deletions results/laboratory_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ def lab_form_2(fwb, interactive_text_field, pw, direction, styleSheet, directory
styleBackgroundcolor = deepcopy(style)
styleBackgroundcolor.backColor = HexColor(0xFF6666)
styleBackgroundcolor.alignment = TA_CENTER
styleBackgroundcolor.spaceAfter = 2 * mm

fwb.append(Spacer(1, 4 * mm))
no_units_and_ref = False
Expand Down Expand Up @@ -1138,6 +1139,7 @@ def lab_form_2(fwb, interactive_text_field, pw, direction, styleSheet, directory
style_t = TableStyle(ts)
j = 0

result_is_norm = []
for f in fractions:
j += 1

Expand All @@ -1163,10 +1165,14 @@ def lab_form_2(fwb, interactive_text_field, pw, direction, styleSheet, directory
continue
if norm in ["none", "normal"]:
tmp.append(Paragraph('<font face="FreeSans" size="8">' + result + "</font>", result_style))
result_is_norm.append(True)
elif norm == "maybe":
tmp.append(Paragraph('<font face="FreeSansBold" size="8">' + result + "</font>", result_style))
result_is_norm.append(True)
else:
tmp.append(Paragraph('<font face="FreeSansBold" size="8">' + result + RANGE_NOT_IN.get(sign, "") + "</font>", styleBackgroundcolor))
# tmp.append(Paragraph('<font face="FreeSansBold" size="8">' + result + RANGE_NOT_IN.get(sign, "") + "</font>", styleBackgroundcolor))
tmp.append(Paragraph('<font face="FreeSansBold" size="8">' + result + "</font>", styleBackgroundcolor))
result_is_norm.append(False)
if not no_units_and_ref:
tmp.append(Paragraph('<font face="FreeSans" size="7">' + get_r(ref) + "</font>", stl))
tmp.append(Paragraph('<font face="FreeSans" size="7">' + f_units + "</font>", stl))
Expand All @@ -1175,11 +1181,19 @@ def lab_form_2(fwb, interactive_text_field, pw, direction, styleSheet, directory
for k in range(0, 4):
style_t.add('INNERGRID', (k, 0), (k, j), 0.1, colors.black)
style_t.add('BOX', (k, 0), (k, j), 0.8, colors.black)
style_t.add('BOTTOMPADDING', (0, 0), (0, -1), 0)

style_t.add('TOPPADDING', (0, 0), (0, -1), 0)
style_t.add('BOTTOMPADDING', (0, 0), (0, -1), 0)

for is_norm in result_is_norm:
if not is_norm:
pass

t = Table(data, colWidths=cw)
t.setStyle(style_t)



fwb.append(t)

fwb.append(Spacer(1, 3 * mm))
Expand Down
23 changes: 14 additions & 9 deletions results/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,20 +675,25 @@ def local_mark_pages(c, _):

if with_signature_stamps and direction.total_confirmed:
last_time_confirm = direction.last_time_confirm()
document_for_sign = DirectionDocument.objects.filter(direction=direction, last_confirmed_at=last_time_confirm, is_archive=False, file_type=DirectionDocument.PDF).first()
if document_for_sign:
# document_for_sign = DirectionDocument.objects.filter(direction=direction, last_confirmed_at=last_time_confirm, is_archive=False, file_type=DirectionDocument.PDF).first()
# if document_for_sign:
if True:
paragraphs = []
has_thumbprints = {}
for sign in DocumentSign.objects.filter(document=document_for_sign, sign_certificate__isnull=False):
if sign.sign_certificate.thumbprint in has_thumbprints:
continue
has_thumbprints[sign.sign_certificate.thumbprint] = True
# for sign in DocumentSign.objects.filter(document=document_for_sign, sign_certificate__isnull=False):
if True:
# if sign.sign_certificate.thumbprint in has_thumbprints:
# continue
# has_thumbprints[sign.sign_certificate.thumbprint] = True
stamp_font_size = "7"
stamp_lines = [
f'<font face="FreeSansBold" size="{stamp_font_size}">ДОКУМЕНТ ПОДПИСАН ЭЛЕКТРОННОЙ ПОДПИСЬЮ</font>',
f'Сертификат: {sign.sign_certificate.thumbprint}',
f'Владелец: {sign.sign_certificate.owner}',
f'Действителен с {sign.sign_certificate.valid_from.strftime("%d.%m.%Y")} по {sign.sign_certificate.valid_to.strftime("%d.%m.%Y")}',
# f'Сертификат: {sign.sign_certificate.thumbprint}',
f'Сертификат: 0202 3B85 4CDF 06FE B573 B42C 3572 D8EE',
# f'Владелец: {sign.sign_certificate.owner}',
f'Владелец: Иванов Иван Иванович',
# f'Действителен с {sign.sign_certificate.valid_from.strftime("%d.%m.%Y")} по {sign.sign_certificate.valid_to.strftime("%d.%m.%Y")}',
f'Действителен с 01.10.2023 по 01.12.2024',
]

for line in range(1, len(stamp_lines)):
Expand Down

0 comments on commit 1c1ccbd

Please sign in to comment.