Итоговый отчет фронт
Не доделан. Надо почистить входящий
This commit is contained in:
1 parent
54f1b7c870
commit
2397d910b7
4 files changed
+342
-94
No files matched your search
@@ -463,7 +463,7 @@ class DocxCreator:
|
||||
|
||||
|
||||
def report(data):
|
||||
print(data.created)
|
||||
print(data)
|
||||
print("WORD")
|
||||
document=Document()
|
||||
|
||||
@@ -484,47 +484,58 @@ class DocxCreator:
|
||||
p = document.add_paragraph("Исполнение контрольных событий")
|
||||
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
||||
|
||||
p = document.add_paragraph("Статус исполнения контрольных событий")
|
||||
p.alignment = WD_ALIGN_PARAGRAPH.LEFT
|
||||
table = document.add_table(1,6)
|
||||
table.style=document.styles['Table Grid']
|
||||
row = table.rows[0].cells
|
||||
for (index,x) in enumerate(["№","Блок/Контрольное событие","Плановый срок","Факт/прогноз","Ответственный","Комментарий"]):
|
||||
row[index].text = x
|
||||
|
||||
num = 1
|
||||
|
||||
for (index,x) in enumerate(data.vrersion["tasks"]):
|
||||
row = table.add_row().cells
|
||||
secnum=1
|
||||
row[0].text = str(num)
|
||||
row[1].text = x["name"]
|
||||
row[2].text = get_date_from_str(x["dateend"]).replace('"','')
|
||||
row[3].text =get_date_from_str(x["planning"]).replace('"','')
|
||||
short = x["responsible"]["givenName"].split(" ")
|
||||
row[4].text = f'{short[0][0]}.{short[1][0]}. {x["responsible"]["sn"]}'
|
||||
row[5].text = x["comment"]
|
||||
num+=1
|
||||
make_rows_bold(row)
|
||||
created = datetime.datetime.today()
|
||||
|
||||
resultbefore = [e for e in incoming['tasks'] if (datetime.datetime.strptime(e['dateend'], '%Y-%m-%d')<=created) or e['status']['id']==5 or taskwork(e['task_work'])==True]
|
||||
if len(resultbefore)>0:
|
||||
for (index,y) in enumerate(x['task_work']):
|
||||
row = table.add_row().cells
|
||||
row[0].text = str(num)
|
||||
row[1].text = y["name"]
|
||||
row[2].text = get_date_from_str(y["dateend"]).replace('"','')
|
||||
row[3].text =get_date_from_str(y["planning"]).replace('"','')
|
||||
short = y["responsible"]["givenName"].split(" ")
|
||||
row[4].text = f'{short[0][0]}.{short[1][0]}. {y["responsible"]["sn"]}'
|
||||
row[5].text = y["comment"]
|
||||
secnum+=1
|
||||
|
||||
|
||||
num+=1
|
||||
|
||||
table=set_col_widths(table, [Inches(.1), Inches(3), Inches(1.5), Inches(1.5)])
|
||||
th=["Статус исполнения контрольных событий", "Прогноз исполнения контрольных событий на ближайшие 3 месяца"]
|
||||
tp = ["Факт/прогноз", "Прогнозный срок"]
|
||||
for (ind,el) in enumerate(data.vrersion["tasks"]):
|
||||
if len(el)>0:
|
||||
p = document.add_paragraph()
|
||||
p = document.add_paragraph(th[ind])
|
||||
p.alignment = WD_ALIGN_PARAGRAPH.LEFT
|
||||
table = document.add_table(1,6)
|
||||
table.style=document.styles['Table Grid']
|
||||
row = table.rows[0].cells
|
||||
for (index,x) in enumerate(["№","Блок/Контрольное событие","Плановый срок",tp[ind],"Ответственный","Комментарий"]):
|
||||
row[index].text = x
|
||||
|
||||
|
||||
|
||||
for (index,x) in enumerate(el):
|
||||
row = table.add_row().cells
|
||||
row[0].text = str(x["keyy"])
|
||||
row[1].text = x["name"]
|
||||
row[2].text = dotteddate(x["dateend"])
|
||||
row[3].text =dotteddate(x["planning"])
|
||||
short = x["responsible"]["givenName"].split(" ")
|
||||
row[4].text = f'{short[0][0]}.{short[1][0]}. {x["responsible"]["sn"]}'
|
||||
row[5].text = x["comment"]["text"]
|
||||
|
||||
if 'task_work' in x.keys():
|
||||
make_rows_bold(row)
|
||||
table=set_col_widths(table, [Inches(.1), Inches(1), Inches(1), Inches(1.5), Inches(2.5)])
|
||||
|
||||
parag = ["Прочие проблемы и риски", "Ключевые результаты, не вошедшие в план"]
|
||||
th = [["№","Наименование проблемы/риска","комментарий"],["№","Ключевые достигнутые результаты","Ключевые запланированные результаты"]]
|
||||
keys = ["planresult","problemsrisks"]
|
||||
|
||||
for (index,x) in enumerate(keys):
|
||||
if len(data.vrersion[x])>0:
|
||||
p = document.add_paragraph()
|
||||
p = document.add_paragraph(parag[index])
|
||||
p.alignment = WD_ALIGN_PARAGRAPH.LEFT
|
||||
table = document.add_table(1,3)
|
||||
table.style=document.styles['Table Grid']
|
||||
row = table.rows[0].cells
|
||||
for (i,val) in enumerate(th[index]):
|
||||
row[i].text = val
|
||||
for(i,val) in enumerate(data.vrersion[x]):
|
||||
row = table.add_row().cells
|
||||
row[0].text = str(i+1)
|
||||
row[1].text = val["problem"]
|
||||
row[2].text = val["comment"]
|
||||
table=set_col_widths(table, [Inches(.1), Inches(5), Inches(5)])
|
||||
# table=set_col_widths(table, [Inches(.1), Inches(3), Inches(1.5), Inches(1.5)])
|
||||
|
||||
|
||||
# p = document.add_paragraph(f'{plan_podpisan[0 if data.approved is None else data.approved]}' )
|
||||
|
||||
Reference in new issue
Block a user