Сохранить
This commit is contained in:
1 parent
965e26f7bd
commit
14840b2d00
4 files changed
+41
-12
No files matched your search
BIN
Binary file not shown.
@@ -16,7 +16,7 @@
|
|||||||
class="bg-transparent py"
|
class="bg-transparent py"
|
||||||
density="compact"
|
density="compact"
|
||||||
:prepend-avatar="imageSrc"
|
:prepend-avatar="imageSrc"
|
||||||
title="Портал МиФНС по ЦОД № 2"
|
title="Портал МИ ФНС по ЦОД № 2"
|
||||||
variant="text"
|
variant="text"
|
||||||
:to="'/'" />
|
:to="'/'" />
|
||||||
|
|
||||||
|
|||||||
+40
-11
@@ -12,9 +12,7 @@ from django.shortcuts import render
|
|||||||
from pandas.io.excel import ExcelWriter
|
from pandas.io.excel import ExcelWriter
|
||||||
import openpyxl as oxl
|
import openpyxl as oxl
|
||||||
from openpyxl import Workbook
|
from openpyxl import Workbook
|
||||||
from openpyxl.styles import Font, Color
|
from openpyxl.styles import Font, Alignment, Side, Border
|
||||||
from openpyxl.styles import Alignment
|
|
||||||
|
|
||||||
|
|
||||||
class GeneralVacationAPIView(APIView):
|
class GeneralVacationAPIView(APIView):
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
@@ -47,6 +45,8 @@ class DailyRoundUpAPIView(APIView):
|
|||||||
df = pd.DataFrame.from_records(user)
|
df = pd.DataFrame.from_records(user)
|
||||||
df['tabel'] = df['login'].str.split('-', expand = True)[1]+df['login'].str.split('-', expand = True)[2]
|
df['tabel'] = df['login'].str.split('-', expand = True)[1]+df['login'].str.split('-', expand = True)[2]
|
||||||
file_path = 'media/DailyRoundUp.xlsx'
|
file_path = 'media/DailyRoundUp.xlsx'
|
||||||
|
|
||||||
|
thins = Side(border_style="thin")
|
||||||
# l = pd.DataFrame(df[(df.department=='Руководство')][['tabel', 'familyname', 'name', 'parentname']])
|
# l = pd.DataFrame(df[(df.department=='Руководство')][['tabel', 'familyname', 'name', 'parentname']])
|
||||||
# l.to_excel(file_path, sheet_name="Список", index= False, header= False, startcol=2, startrow=8)
|
# l.to_excel(file_path, sheet_name="Список", index= False, header= False, startcol=2, startrow=8)
|
||||||
wb = Workbook()
|
wb = Workbook()
|
||||||
@@ -55,11 +55,30 @@ class DailyRoundUpAPIView(APIView):
|
|||||||
ws['B2'] = 'Список сотрудников'
|
ws['B2'] = 'Список сотрудников'
|
||||||
ws['B3'] = 'МИ ФНС России по ЦОД № 2'
|
ws['B3'] = 'МИ ФНС России по ЦОД № 2'
|
||||||
ws['B4'] = 'по подразделениям'
|
ws['B4'] = 'по подразделениям'
|
||||||
|
|
||||||
|
ws['B6'] = 'Таб.'
|
||||||
|
ws['C6'] = 'Фамилия'
|
||||||
|
ws['D6'] = 'Имя'
|
||||||
|
ws['E6'] = 'Очество'
|
||||||
|
|
||||||
|
for col in ws.iter_cols(min_row=6, max_row=6, min_col=2, max_col=5):
|
||||||
|
for cell in col:
|
||||||
|
cell.font = Font(name='Times New Roman', size=11, bold=True)
|
||||||
|
cell.border = Border(top=thins, bottom=thins, left=thins, right=thins)
|
||||||
|
|
||||||
|
ws['G6'] = 'Отпуск'
|
||||||
|
ws['I6'] = 'Болен'
|
||||||
|
ws['K6'] = 'Удаленка'
|
||||||
|
|
||||||
|
for col in ws.iter_cols(min_row=6, max_row=6, min_col=2, max_col=5):
|
||||||
|
for cell in col:
|
||||||
|
cell.font = Font(name='Times New Roman', size=11, bold=True)
|
||||||
|
cell.border = Border(top=thins, bottom=thins, left=thins, right=thins)
|
||||||
|
|
||||||
|
|
||||||
ws['I1'] = 'На '+ date.today().strftime("%d.%m.%Y")
|
ws['I1'] = 'На '+ date.today().strftime("%d.%m.%Y")
|
||||||
|
|
||||||
|
numb = 1
|
||||||
|
|
||||||
column_widths = [29, 53, 96, 96, 112, 28, 222, 29, 148, 28, 145, 33]
|
column_widths = [29, 53, 96, 96, 112, 28, 222, 29, 148, 28, 145, 33]
|
||||||
for i, width in enumerate(column_widths):
|
for i, width in enumerate(column_widths):
|
||||||
@@ -70,31 +89,41 @@ class DailyRoundUpAPIView(APIView):
|
|||||||
for cell in col:
|
for cell in col:
|
||||||
cell.font = Font(name='Times New Roman', size=12, bold=True)
|
cell.font = Font(name='Times New Roman', size=12, bold=True)
|
||||||
cell.alignment = Alignment(horizontal='center')
|
cell.alignment = Alignment(horizontal='center')
|
||||||
|
|
||||||
ws['I1'].font = Font(name='Times New Roman', size=14, bold=True)
|
ws['I1'].font = Font(name='Times New Roman', size=14, bold=True)
|
||||||
ws['I1'].alignment = Alignment(horizontal='left')
|
ws['I1'].alignment = Alignment(horizontal='left')
|
||||||
|
|
||||||
|
|
||||||
for x in range(3):
|
for x in range(3):
|
||||||
ws.merge_cells(start_row=2+x, start_column=2, end_row=2+x, end_column=6)
|
ws.merge_cells(start_row=2+x, start_column=2, end_row=2+x, end_column=6)
|
||||||
#
|
|
||||||
kl = ['Руководство']
|
|
||||||
|
|
||||||
k=7
|
k=7
|
||||||
for i in df['department'].unique():
|
for i in df['department'].unique():
|
||||||
ws.cell(row = k, column = 2).value = i
|
ws.cell(row = k, column = 2).value = i
|
||||||
print(k, '-------------------1')
|
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)
|
||||||
|
|
||||||
l = pd.DataFrame(df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']])
|
l = pd.DataFrame(df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']])
|
||||||
# l.to_excel(file_path, sheet_name="Список", index= False, header= False, startcol=2, startrow=8)
|
|
||||||
|
|
||||||
|
|
||||||
for x in range(len(l)):
|
for x in range(len(l)):
|
||||||
k=k+1
|
k=k+1
|
||||||
print(k, '-------------------1')
|
|
||||||
|
ws.cell(row = k, column = 1).value = numb
|
||||||
|
ws.cell(row = k, column = 1).font = Font(name='Times New Roman', size=10, bold=True)
|
||||||
|
|
||||||
ws.cell(row = k, column = 2).value = l.iloc[x]['tabel']
|
ws.cell(row = k, column = 2).value = l.iloc[x]['tabel']
|
||||||
ws.cell(row = k, column = 3).value = l.iloc[x]['familyname']
|
ws.cell(row = k, column = 3).value = l.iloc[x]['familyname']
|
||||||
ws.cell(row = k, column = 4).value = l.iloc[x]['name']
|
ws.cell(row = k, column = 4).value = l.iloc[x]['name']
|
||||||
ws.cell(row = k, column = 5).value = l.iloc[x]['parentname']
|
ws.cell(row = k, column = 5).value = l.iloc[x]['parentname']
|
||||||
|
|
||||||
|
|
||||||
|
for v in range(4):
|
||||||
|
ws.cell(row = k, column = 2+v).font = Font(name='Times New Roman', size=10)
|
||||||
|
ws.cell(row = k, column = 2+v).border = Border(top=thins, bottom=thins, left=thins, right=thins)
|
||||||
|
|
||||||
|
numb=numb+1
|
||||||
print(l.iloc[x]['name'])
|
print(l.iloc[x]['name'])
|
||||||
k=k+1
|
k=k+1
|
||||||
print(k, '-------------------1')
|
print(k, '-------------------1')
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user