|
import streamlit as st |
|
from termcolor import colored |
|
|
|
def check_garant( |
|
garant_pdf, |
|
garant_docx, |
|
price_doc, |
|
MCKs |
|
): |
|
print("-" * 80) |
|
print( |
|
f"garant_pdf: {garant_pdf}\n" + |
|
f"garant_docx: {garant_docx}\n" + |
|
f"price_doc: {price_doc}\n" + |
|
f"MCKs: {MCKs}" |
|
) |
|
|
|
correct = False |
|
|
|
|
|
|
|
if all([ |
|
garant_pdf == "не требуется", |
|
garant_docx == None, |
|
price_doc == None |
|
]) or all([ |
|
garant_pdf == "не требуется", |
|
garant_docx == "не установлены", |
|
price_doc == "не установлены" |
|
]) or all([ |
|
garant_pdf == "не требуется", |
|
garant_docx == "не установлены", |
|
price_doc == "не устанавливается" |
|
]) or all([ |
|
garant_pdf == "не требуется", |
|
garant_docx == "не устанавливается", |
|
price_doc == "не устанавливается" |
|
]): |
|
|
|
st.write(":green[ВЕРНО]") |
|
|
|
correct = True |
|
|
|
|
|
|
|
elif garant_docx and price_doc and all([ |
|
"Российский рубль" in garant_pdf, |
|
"%" in garant_docx, |
|
"руб" in price_doc |
|
]): |
|
clean_garant_docx = garant_docx.replace("процент", "%").replace(" ", '') |
|
clean_price_doc = float(price_doc.replace(" ", "").split(",")[0].replace("руб", "")) |
|
clean_garant_pdf = float(garant_pdf.removesuffix("Российский рубль").strip()) |
|
for MCK in MCKs: |
|
procent_garant_docx = float(clean_garant_docx.strip("% ")) * MCK / 100 |
|
print("СРАВНЕНИЕ", |
|
f"\tprocent_garant_docx: {procent_garant_docx}", |
|
f"\tclean_garant_pdf: {clean_garant_pdf}", |
|
f"\tclean_price_doc: {clean_price_doc}", |
|
f"\tclean_garant_docx: {clean_garant_docx}", sep="\n") |
|
|
|
if ( |
|
abs(clean_garant_pdf - procent_garant_docx) < 3 and |
|
abs(clean_price_doc - procent_garant_docx) < 3): |
|
|
|
|
|
|
|
st.write(":green[ВЕРНО]") |
|
|
|
correct = True |
|
|
|
|
|
|
|
elif garant_pdf and garant_docx and all([ |
|
"Российский рубль" in garant_pdf, |
|
"%" in garant_docx, |
|
price_doc == None |
|
]): |
|
clean_garant_pdf = float(garant_pdf.removesuffix("Российский рубль").strip()) |
|
clean_garant_docx = garant_docx[0].replace(" ", '').replace("процент", "%") |
|
for MCK in MCKs: |
|
procent_garant_docx = float(garant_docx.strip("% ")) * MCK / 100 |
|
print( |
|
"СРАВНЕНИЕ\n" + |
|
f"\tprocent_garant_docx: {procent_garant_docx}\n" + |
|
f"\tclean_garant_pdf: {clean_garant_pdf}\n") |
|
if abs(clean_garant_pdf - procent_garant_docx) < 3: |
|
|
|
st.write(":green[ВЕРНО]") |
|
|
|
correct = True |
|
|
|
if not correct: |
|
|
|
st.write(":red[ОШИБКА]") |
|
|
|
st.write("Проверьте блок обеспечения гарантийных обязательств на совпадение требований Извещения и проекта Контракта," |
|
" а также арифметические операции") |
|
st.write("Условие Извещения (Российский рубль) = Условие ПК % * НМЦК") |
|
st.write("Условие Извещения (Российский рубль) = Условие ПК (рублей)") |
|
st.write("Условие Извещения 'не требуется' = Условие ПК 'не установлено'") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|