diff --git a/db.sqlite3 b/db.sqlite3 index 26b1a1218..bccc216f4 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/general_vacation/views.py b/general_vacation/views.py index 9f8506327..1da04721b 100644 --- a/general_vacation/views.py +++ b/general_vacation/views.py @@ -14,6 +14,8 @@ import openpyxl as oxl from openpyxl import Workbook from openpyxl.styles import Font, Alignment, Side, Border, PatternFill from openpyxl.worksheet.formula import ArrayFormula +from pandas.api.types import CategoricalDtype +import urllib.request class GeneralVacationAPIView(APIView): def get(self, request): @@ -40,6 +42,8 @@ class DailyRoundUpAPIView(APIView): """ PIXELS_PER_CHAR = 7 return (width) / PIXELS_PER_CHAR + + def get(self, request): user = DictEmployee.objects.using('user_directory').filter(deleted=0).values('login', 'department', 'familyname', 'name', 'parentname') @@ -115,8 +119,12 @@ class DailyRoundUpAPIView(APIView): k=7 - for i in df['department'].unique(): + + + for i in sorted(df['department'].unique(), reverse=True): + ws.cell(row = k, column = 2).value = i + ws.cell(row = k, column = 2).font = Font(name='Times New Roman', size=10, bold=True) ws.merge_cells(start_row=k, start_column=2, end_row=k, end_column=12) @@ -182,15 +190,18 @@ class DailyRoundUpAPIView(APIView): ws.cell(row = k+3, column=7).value = "факт работающих" ws.cell(row = k+3, column=7).font = Font(name='Times New Roman', size=14, bold=True) -# +"-J"+str(k-1)+"-L"+str(k-1)+" - ws.cell(row = k+3, column=8).value = "=F"+str(k+1)+"-H"+str(k+1)+"-J"+str(k+1) + + + ws.cell(row = k+3, column=8).value = f"=F{k+1}-H{k+1}-J{k+1}-L{k+1}" ws.cell(row = k+3, column=8).font = Font(name='Times New Roman', size=14, bold=True) - print(ws.cell(row = k, column=6), '-------------------1') + # print(ws.write(k+3, col, 'hhh'), '-------------------1') wb.save(file_path) + urllib.request.urlretrieve(file_path, 'Пупка.xlsx') + # file_path = 'media/DailyRoundUp.xlsx' diff --git a/media/DailyRoundUp.xlsx b/media/DailyRoundUp.xlsx index e8db51268..3f77e3b66 100644 Binary files a/media/DailyRoundUp.xlsx and b/media/DailyRoundUp.xlsx differ