From f4ef0b501e456262eed85b649b2766322dbed389 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Thu, 19 Oct 2023 10:02:54 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A8=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=20=D0=B2?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B0=20=D0=B4=D0=B0=D0=BD=D0=BD=D1=8B=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.sqlite3 | Bin 376832 -> 376832 bytes general_vacation/views.py | 76 ++++++++++++++++++++++++++++++++++---- r.txt | Bin 2482 -> 2520 bytes 3 files changed, 68 insertions(+), 8 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index bcecb68c3928596979bb0fd287a0c34fae8ee037..26b1a121866490e4d4220429fc6f59e4f4d4b43c 100644 GIT binary patch delta 247 zcmWlTJxjw-7)EoSBzGv`zS#cIAidhA;H7_WRlwvG#GgSCix! zbV={zu``4h&kymX%vE!rUq297dePkEL5aCIy2FX4(1Qlin!jW`bGv6F6}v z!39a%6oNFDDO#>nBZFQjq#HU?ziPzI3?VONRlJd5OIckl4IV$EjrBvmKeGc~F0djN vc&EUw2skSc)TBxcI-p#o>`eX-C%97Fy0tr4)BJR8hyC6Z6=vLHUGd@97WQSMHCD|Ckx_pIEOQw4?fRJdtUl@0`%X8zM%SkEn{l6J=d(erslgQ z9BhqpTw-{NA0%3!`-K+t#YoehVT|?Y`vMAM(`r7*bJ;E?R;Urdl<(cbeo}CZ7)JPm zef+|AG6Kkv8G!H?131CqqQWMV6g@*$a4}%`iVoi3t{9LZ!J)EL*JTN-qInJDSg_0X zY{@E@EQ>L%M4cm^hxr=a9r6lUA)-FOF^G8r1*}) jb?U{CL1!IbST3u{GebVfHg&GJQ?JILlJKkX(4+hV#am-F diff --git a/general_vacation/views.py b/general_vacation/views.py index 3b7d4ce9c..9f8506327 100644 --- a/general_vacation/views.py +++ b/general_vacation/views.py @@ -12,7 +12,8 @@ from django.shortcuts import render from pandas.io.excel import ExcelWriter import openpyxl as oxl from openpyxl import Workbook -from openpyxl.styles import Font, Alignment, Side, Border +from openpyxl.styles import Font, Alignment, Side, Border, PatternFill +from openpyxl.worksheet.formula import ArrayFormula class GeneralVacationAPIView(APIView): def get(self, request): @@ -51,6 +52,8 @@ class DailyRoundUpAPIView(APIView): # l.to_excel(file_path, sheet_name="Список", index= False, header= False, startcol=2, startrow=8) wb = Workbook() ws = wb.active + filters = ws.auto_filter + filters.ref = "A6:L15" ws.title = "Список" ws['B2'] = 'Список сотрудников' ws['B3'] = 'МИ ФНС России по ЦОД № 2' @@ -70,10 +73,21 @@ class DailyRoundUpAPIView(APIView): 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['F99']= ArrayFormula("A1:A90", "=SUM(C2:C11*D2:D11)") + + + + heads =['G6', 'I6', 'K6'] + for x in heads: + + ws[x].fill = PatternFill(fgColor="00FFFF00", fill_type = "solid") + ws[x].font = Font(name='Times New Roman', size=10, bold=True) + ws[x].border = Border(top=thins, bottom=thins, left=thins, right=thins) + ws[x].alignment = Alignment(horizontal='center') + # 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") @@ -85,6 +99,8 @@ class DailyRoundUpAPIView(APIView): column_letter = openpyxl.utils.get_column_letter(i+1) ws.column_dimensions[column_letter].width = self.convert_width(width) + + for col in ws.iter_cols(min_row=2, max_row=5, min_col=2, max_col=5): for cell in col: cell.font = Font(name='Times New Roman', size=12, bold=True) @@ -106,7 +122,7 @@ class DailyRoundUpAPIView(APIView): l = pd.DataFrame(df[(df.department==i)][['tabel', 'familyname', 'name', 'parentname']]) - + zap = [7, 9, 11] for x in range(len(l)): k=k+1 @@ -117,16 +133,60 @@ class DailyRoundUpAPIView(APIView): 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 = 5).value = l.iloc[x]['parentname'] + + for h in zap: + ws.cell(row = k, column = h).border = Border(top=thins, bottom=thins, left=thins, right=thins) + ws.cell(row = k, column = h).font = Font(name='Times New Roman', size=10) + ws.cell(row = k, column = h).alignment = Alignment(horizontal='center') 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']) + k=k+1 - print(k, '-------------------1') + + ws.cell(row = k+1, column=6).value = "=SUM(F6:F"+str(k-1)+")" + ws.cell(row = k+1, column=6).fill = PatternFill(fgColor="00FFFF00", fill_type = "solid") + ws.cell(row = k+1, column=6).font = Font(name='Times New Roman', size=13, bold=True) + + ws.cell(row = k+1, column=7).value = "ВСЕГО отпуск=" + ws.cell(row = k+1, column=7).fill = PatternFill(fgColor="00FFFF00", fill_type = "solid") + ws.cell(row = k+1, column=7).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k+1, column=8).value = "=SUM(H6:H"+str(k-1)+")" + ws.cell(row = k+1, column=8).fill = PatternFill(fgColor="00FFFF00", fill_type = "solid") + ws.cell(row = k+1, column=8).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k+1, column=9).value = "Всего больных=" + ws.cell(row = k+1, column=9).fill = PatternFill(fgColor="8EA9DB", fill_type = "solid") + ws.cell(row = k+1, column=9).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k+1, column=10).value = "=SUM(J6:J"+str(k-1)+")" + ws.cell(row = k+1, column=10).fill = PatternFill(fgColor="8EA9DB", fill_type = "solid") + ws.cell(row = k+1, column=10).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k+1, column=11).value = "Всего удаленка=" + ws.cell(row = k+1, column=11).fill = PatternFill(fgColor="8EA9DB", fill_type = "solid") + ws.cell(row = k+1, column=11).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k+1, column=12).value = "=SUM(L6:L"+str(k-1)+")" + ws.cell(row = k+1, column=12).fill = PatternFill(fgColor="8EA9DB", fill_type = "solid") + ws.cell(row = k+1, column=12).font = Font(name='Times New Roman', size=10, bold=True) + + ws.cell(row = k+3, column=5).value = "ИТОГО" + ws.cell(row = k+3, column=5).font = Font(name='Times New Roman', size=14, bold=True) + + 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).font = Font(name='Times New Roman', size=14, bold=True) + + print(ws.cell(row = k, column=6), '-------------------1') wb.save(file_path) diff --git a/r.txt b/r.txt index 0dae6e2c1144d75629c4128a8b5bea46d60f31f9..95a5881c53b837464122ca6192048ca0e788679c 100644 GIT binary patch delta 45 wcmdlad_#Cc4yR%SLk>eRLj^-PLlHwJLkUAFkhTRvV+K72Lm;-8oX+VD00qkl;{X5v delta 11 Scmca1yh(UN4(H@aoNfRd$^=RP