fnschool 20250109.80500.803__py3-none-any.whl → 20251011.80531.840__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fnschool might be problematic. Click here for more details.
- fnschoo1/__init__.py +52 -0
- fnschoo1/canteen/admin.py +3 -0
- fnschoo1/canteen/apps.py +6 -0
- fnschoo1/canteen/forms.py +84 -0
- fnschoo1/canteen/migrations/0001_initial.py +119 -0
- fnschoo1/canteen/migrations/0002_ingredient_is_disabled.py +20 -0
- fnschoo1/canteen/migrations/0003_consumption_is_disabled_alter_ingredient_is_disabled.py +23 -0
- fnschoo1/canteen/migrations/0004_alter_ingredient_name_category_and_more.py +66 -0
- fnschoo1/canteen/migrations/0005_alter_category_created_at_alter_category_name_and_more.py +41 -0
- fnschoo1/canteen/migrations/0006_category_is_disabled_alter_category_user_and_more.py +49 -0
- fnschoo1/canteen/migrations/0007_alter_consumption_amount_used_and_more.py +30 -0
- fnschoo1/canteen/migrations/0008_category_abbreviation_mealtype.py +67 -0
- fnschoo1/canteen/migrations/0009_alter_category_abbreviation_and_more.py +55 -0
- fnschoo1/canteen/migrations/0010_alter_consumption_options_alter_ingredient_options_and_more.py +215 -0
- fnschoo1/canteen/migrations/0011_category_pin_to_consumptions_top.py +23 -0
- fnschoo1/canteen/migrations/0012_alter_ingredient_storage_date.py +18 -0
- fnschoo1/canteen/models.py +179 -0
- fnschoo1/canteen/templates/canteen/category/create.html +17 -0
- fnschoo1/canteen/templates/canteen/category/delete.html +61 -0
- fnschoo1/canteen/templates/canteen/category/list.html +63 -0
- fnschoo1/canteen/templates/canteen/category/update.html +23 -0
- fnschoo1/canteen/templates/canteen/close.html +11 -0
- fnschoo1/canteen/templates/canteen/consumption/_create.html +19 -0
- fnschoo1/canteen/templates/canteen/consumption/create.html +456 -0
- fnschoo1/canteen/templates/canteen/ingredient/close.html +11 -0
- fnschoo1/canteen/templates/canteen/ingredient/create.html +19 -0
- fnschoo1/canteen/templates/canteen/ingredient/create_one.html +17 -0
- fnschoo1/canteen/templates/canteen/ingredient/delete.html +41 -0
- fnschoo1/canteen/templates/canteen/ingredient/list.html +128 -0
- fnschoo1/canteen/templates/canteen/ingredient/update.html +23 -0
- fnschoo1/canteen/templates/canteen/meal_type/create.html +17 -0
- fnschoo1/canteen/templates/canteen/meal_type/delete.html +56 -0
- fnschoo1/canteen/templates/canteen/meal_type/list.html +59 -0
- fnschoo1/canteen/templates/canteen/meal_type/update.html +23 -0
- fnschoo1/canteen/tests.py +3 -0
- fnschoo1/canteen/urls.py +116 -0
- fnschoo1/canteen/views.py +814 -0
- fnschoo1/canteen/workbook/generate.py +2098 -0
- fnschoo1/db.sqlite3 +0 -0
- fnschoo1/fnschool/__init__.py +13 -0
- fnschoo1/fnschool/asgi.py +16 -0
- fnschoo1/fnschool/settings.py +167 -0
- fnschoo1/fnschool/templatetags/fnschool_tags.py +27 -0
- fnschoo1/fnschool/urls.py +30 -0
- fnschoo1/fnschool/views.py +9 -0
- fnschoo1/fnschool/wsgi.py +16 -0
- fnschoo1/locale/en/LC_MESSAGES/django.mo +0 -0
- fnschoo1/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- fnschoo1/manage.py +25 -0
- fnschoo1/profiles/admin.py +27 -0
- fnschoo1/profiles/apps.py +12 -0
- fnschoo1/profiles/forms.py +67 -0
- fnschoo1/profiles/migrations/0001_initial.py +192 -0
- fnschoo1/profiles/migrations/0002_alter_profile_bio.py +20 -0
- fnschoo1/profiles/migrations/0003_alter_profile_options_alter_profile_address_and_more.py +67 -0
- fnschoo1/profiles/migrations/0004_profile_gender.py +26 -0
- fnschoo1/profiles/migrations/0005_alter_profile_gender.py +23 -0
- fnschoo1/profiles/models.py +60 -0
- fnschoo1/profiles/signals.py +20 -0
- fnschoo1/profiles/templates/profiles/create.html +16 -0
- fnschoo1/profiles/templates/profiles/detail.html +14 -0
- fnschoo1/profiles/templates/profiles/edit.html +12 -0
- fnschoo1/profiles/templates/profiles/log_in.html +20 -0
- fnschoo1/profiles/templates/profiles/log_out.html +12 -0
- fnschoo1/profiles/tests.py +3 -0
- fnschoo1/profiles/urls.py +15 -0
- fnschoo1/profiles/views.py +63 -0
- fnschoo1/static/css/bootstrap.min.css +11776 -0
- fnschoo1/static/css/fnschool.css +26 -0
- fnschoo1/static/js/bootstrap.bundle.min.js +4223 -0
- fnschoo1/static/js/bootstrap.min.js +2919 -0
- fnschoo1/static/js/fnschool.js +84 -0
- fnschoo1/static/js/jquery.min.js +5413 -0
- fnschoo1/static/js/jquery.slim.min.js +4331 -0
- fnschoo1/static/js/popper.min.js +1306 -0
- fnschoo1/static_collected/admin/css/autocomplete.css +377 -0
- fnschoo1/static_collected/admin/css/base.css +1224 -0
- fnschoo1/static_collected/admin/css/changelists.css +334 -0
- fnschoo1/static_collected/admin/css/dark_mode.css +136 -0
- fnschoo1/static_collected/admin/css/dashboard.css +30 -0
- fnschoo1/static_collected/admin/css/forms.css +546 -0
- fnschoo1/static_collected/admin/css/login.css +62 -0
- fnschoo1/static_collected/admin/css/nav_sidebar.css +145 -0
- fnschoo1/static_collected/admin/css/responsive.css +1043 -0
- fnschoo1/static_collected/admin/css/responsive_rtl.css +84 -0
- fnschoo1/static_collected/admin/css/rtl.css +311 -0
- fnschoo1/static_collected/admin/css/vendor/select2/select2.css +708 -0
- fnschoo1/static_collected/admin/css/vendor/select2/select2.min.css +1 -0
- fnschoo1/static_collected/admin/css/widgets.css +639 -0
- fnschoo1/static_collected/admin/js/SelectBox.js +128 -0
- fnschoo1/static_collected/admin/js/SelectFilter2.js +503 -0
- fnschoo1/static_collected/admin/js/actions.js +232 -0
- fnschoo1/static_collected/admin/js/admin/DateTimeShortcuts.js +496 -0
- fnschoo1/static_collected/admin/js/admin/RelatedObjectLookups.js +276 -0
- fnschoo1/static_collected/admin/js/autocomplete.js +33 -0
- fnschoo1/static_collected/admin/js/calendar.js +251 -0
- fnschoo1/static_collected/admin/js/cancel.js +29 -0
- fnschoo1/static_collected/admin/js/change_form.js +21 -0
- fnschoo1/static_collected/admin/js/collapse.js +43 -0
- fnschoo1/static_collected/admin/js/core.js +174 -0
- fnschoo1/static_collected/admin/js/filters.js +37 -0
- fnschoo1/static_collected/admin/js/inlines.js +439 -0
- fnschoo1/static_collected/admin/js/jquery.init.js +8 -0
- fnschoo1/static_collected/admin/js/nav_sidebar.js +81 -0
- fnschoo1/static_collected/admin/js/popup_response.js +24 -0
- fnschoo1/static_collected/admin/js/prepopulate.js +43 -0
- fnschoo1/static_collected/admin/js/prepopulate_init.js +20 -0
- fnschoo1/static_collected/admin/js/theme.js +57 -0
- fnschoo1/static_collected/admin/js/urlify.js +529 -0
- fnschoo1/static_collected/admin/js/vendor/jquery/jquery.js +10913 -0
- fnschoo1/static_collected/admin/js/vendor/jquery/jquery.min.js +2 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/af.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ar.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/az.js +33 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bg.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bn.js +39 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/bs.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ca.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/cs.js +62 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/da.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/de.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/dsb.js +51 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/el.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/en.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/es.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/et.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/eu.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fa.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fi.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/fr.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/gl.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/he.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hi.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hr.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hsb.js +51 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hu.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/hy.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/id.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/is.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/it.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ja.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ka.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/km.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ko.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/lt.js +45 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/lv.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/mk.js +42 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ms.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/nb.js +38 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ne.js +44 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/nl.js +46 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pl.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ps.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt-BR.js +39 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/pt.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ro.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/ru.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sk.js +61 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sl.js +41 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sq.js +43 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr-Cyrl.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sr.js +48 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/sv.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/th.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/tk.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/tr.js +40 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/uk.js +59 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/vi.js +37 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-CN.js +36 -0
- fnschoo1/static_collected/admin/js/vendor/select2/i18n/zh-TW.js +33 -0
- fnschoo1/static_collected/admin/js/vendor/select2/select2.full.js +7115 -0
- fnschoo1/static_collected/admin/js/vendor/select2/select2.full.min.js +2 -0
- fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.js +4993 -0
- fnschoo1/static_collected/admin/js/vendor/xregexp/xregexp.min.js +160 -0
- fnschoo1/static_collected/css/bootstrap.min.css +11776 -0
- fnschoo1/static_collected/css/fnschool.css +26 -0
- fnschoo1/static_collected/js/bootstrap.bundle.min.js +4223 -0
- fnschoo1/static_collected/js/bootstrap.min.js +2919 -0
- fnschoo1/static_collected/js/fnschool.js +84 -0
- fnschoo1/static_collected/js/jquery.min.js +5413 -0
- fnschoo1/static_collected/js/jquery.slim.min.js +4331 -0
- fnschoo1/static_collected/js/popper.min.js +1306 -0
- fnschoo1/templates/base/_css.html +1 -0
- fnschoo1/templates/base/_js.html +15 -0
- fnschoo1/templates/base/content.html +30 -0
- fnschoo1/templates/base/header_content_footer.html +35 -0
- fnschoo1/templates/close.html +11 -0
- fnschoo1/templates/home.html +51 -0
- fnschoo1/templates/includes/_footer.html +39 -0
- fnschoo1/templates/includes/_header.html +77 -0
- fnschoo1/templates/includes/_navigation.html +0 -0
- fnschoo1/templates/includes/_paginator.html +27 -0
- fnschoo1/templates/registration/logged_out.html +0 -0
- fnschoo1/templates/registration/login.html +0 -0
- fnschool-20251011.80531.840.dist-info/METADATA +179 -0
- fnschool-20251011.80531.840.dist-info/RECORD +207 -0
- {fnschool-20250109.80500.803.dist-info → fnschool-20251011.80531.840.dist-info}/WHEEL +1 -1
- fnschool-20251011.80531.840.dist-info/entry_points.txt +2 -0
- fnschool-20251011.80531.840.dist-info/top_level.txt +1 -0
- fnschool/__init__.py +0 -35
- fnschool/__main__.py +0 -16
- fnschool/app.py +0 -103
- fnschool/canteen/__init__.py +0 -3
- fnschool/canteen/__main__.py +0 -3
- fnschool/canteen/bill.py +0 -253
- fnschool/canteen/canteen.py +0 -1
- fnschool/canteen/canteen.toml +0 -61
- fnschool/canteen/config.py +0 -10
- fnschool/canteen/consuming.py +0 -53
- fnschool/canteen/currency.py +0 -17
- fnschool/canteen/data/bill.i18n.xlsx +0 -0
- fnschool/canteen/data/bill.xlsx +0 -0
- fnschool/canteen/data/consuming.xlsx +0 -0
- fnschool/canteen/data/purchase_list.xlsx +0 -0
- fnschool/canteen/entry.py +0 -40
- fnschool/canteen/food.py +0 -206
- fnschool/canteen/food_classes.py +0 -33
- fnschool/canteen/food_classes.toml +0 -64
- fnschool/canteen/operator.py +0 -91
- fnschool/canteen/path.py +0 -28
- fnschool/canteen/spreadsheet/base.py +0 -212
- fnschool/canteen/spreadsheet/consuming.py +0 -310
- fnschool/canteen/spreadsheet/consumingsum.py +0 -76
- fnschool/canteen/spreadsheet/cover.py +0 -64
- fnschool/canteen/spreadsheet/ctspreadsheet.py +0 -351
- fnschool/canteen/spreadsheet/food.py +0 -680
- fnschool/canteen/spreadsheet/inventory.py +0 -375
- fnschool/canteen/spreadsheet/merging.py +0 -340
- fnschool/canteen/spreadsheet/preconsuming.py +0 -329
- fnschool/canteen/spreadsheet/purchasing.py +0 -885
- fnschool/canteen/spreadsheet/purchasingsum.py +0 -110
- fnschool/canteen/spreadsheet/spreadsheet.py +0 -363
- fnschool/canteen/spreadsheet/translating.py +0 -12
- fnschool/canteen/spreadsheet/unwarehousing.py +0 -178
- fnschool/canteen/spreadsheet/unwarehousingsum.py +0 -11
- fnschool/canteen/spreadsheet/warehousing.py +0 -360
- fnschool/canteen/spreadsheet/workbook.py +0 -17
- fnschool/canteen/test.py +0 -97
- fnschool/config.py +0 -48
- fnschool/entry.py +0 -67
- fnschool/exam/__init__.py +0 -8
- fnschool/exam/data/parental_emails.xlsx +0 -0
- fnschool/exam/data/score.xlsx +0 -0
- fnschool/exam/email.py +0 -349
- fnschool/exam/entry.py +0 -36
- fnschool/exam/language.py +0 -19
- fnschool/exam/path.py +0 -24
- fnschool/exam/score.py +0 -1191
- fnschool/exam/subject.py +0 -20
- fnschool/exam/teacher.py +0 -54
- fnschool/external.py +0 -89
- fnschool/games/__init__.py +0 -1
- fnschool/games/__main__.py +0 -1
- fnschool/games/games.py +0 -1
- fnschool/inoutput.py +0 -97
- fnschool/language.py +0 -40
- fnschool/locales/en_US/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_CN/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_HK/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_SG/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/locales/zh_TW/LC_MESSAGES/fnschool.mo +0 -0
- fnschool/path.py +0 -45
- fnschool/test.py +0 -24
- fnschool/user.py +0 -262
- fnschool-20250109.80500.803.dist-info/METADATA +0 -342
- fnschool-20250109.80500.803.dist-info/RECORD +0 -78
- fnschool-20250109.80500.803.dist-info/entry_points.txt +0 -5
- fnschool-20250109.80500.803.dist-info/top_level.txt +0 -1
- /fnschool/canteen/consume.py → /fnschoo1/canteen/__init__.py +0 -0
- /fnschool/canteen/food_recount.toml → /fnschoo1/canteen/migrations/__init__.py +0 -0
- {fnschool/canteen/spreadsheet → fnschoo1/canteen/workbook}/__init__.py +0 -0
- /fnschool/exam/__main__.py → /fnschoo1/fnschool/templatetags/__init__.py +0 -0
- /fnschool/canteen/food_recounts.toml → /fnschoo1/profiles/__init__.py +0 -0
- /fnschool/canteen/warehouse.py → /fnschoo1/profiles/migrations/__init__.py +0 -0
- /fnschool/canteen/workbook.toml → /fnschoo1/templates/base/_content.html +0 -0
- {fnschool-20250109.80500.803.dist-info → fnschool-20251011.80531.840.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,680 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import sys
|
|
3
|
-
import secrets
|
|
4
|
-
import random
|
|
5
|
-
|
|
6
|
-
from fnschool import *
|
|
7
|
-
from fnschool.canteen.spreadsheet.base import *
|
|
8
|
-
from openpyxl.styles import *
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Food(Base):
|
|
12
|
-
def __init__(self, bill):
|
|
13
|
-
super().__init__(bill)
|
|
14
|
-
self.sheet_name = self.s.sfood_name
|
|
15
|
-
self._food_sheet0 = None
|
|
16
|
-
pass
|
|
17
|
-
|
|
18
|
-
def get_sheet(self, name=None, wb=None):
|
|
19
|
-
sheet = None
|
|
20
|
-
bfoods = self.bfoods
|
|
21
|
-
wb = wb or self.bwb
|
|
22
|
-
|
|
23
|
-
if name in wb.sheetnames:
|
|
24
|
-
sheet = wb[name]
|
|
25
|
-
else:
|
|
26
|
-
sheet = wb.copy_worksheet(wb[self.sheet_name])
|
|
27
|
-
sheet.title = name
|
|
28
|
-
|
|
29
|
-
for row_index in range(1, sheet.max_row + 1):
|
|
30
|
-
rc1_value = sheet.cell(row_index, 1).value
|
|
31
|
-
rc1_value = str(rc1_value)
|
|
32
|
-
if rc1_value and "材料名称:()" in rc1_value:
|
|
33
|
-
unit = [f.unit_name for f in bfoods if f.name == name]
|
|
34
|
-
unit = unit[0] if len(unit) > 0 else "斤"
|
|
35
|
-
sheet.cell(row_index, 1, f"材料名称:{name}({unit})")
|
|
36
|
-
|
|
37
|
-
return sheet
|
|
38
|
-
|
|
39
|
-
def format(self, sheet):
|
|
40
|
-
if isinstance(sheet, str):
|
|
41
|
-
sheet = self.get_sheet(sheet)
|
|
42
|
-
|
|
43
|
-
self.unmerge_sheet_cells(sheet)
|
|
44
|
-
|
|
45
|
-
for row in sheet.iter_rows(
|
|
46
|
-
min_row=1,
|
|
47
|
-
max_row=sheet.max_row,
|
|
48
|
-
min_col=1,
|
|
49
|
-
max_col=14,
|
|
50
|
-
):
|
|
51
|
-
sheet.row_dimensions[row[0].row].height = 15.75
|
|
52
|
-
if row[0].value and "入库、出库台账" in str(row[0].value):
|
|
53
|
-
sheet.row_dimensions[row[0].row].height = 27
|
|
54
|
-
sheet.merge_cells(
|
|
55
|
-
start_row=row[0].row,
|
|
56
|
-
end_row=row[0].row,
|
|
57
|
-
start_column=1,
|
|
58
|
-
end_column=13,
|
|
59
|
-
)
|
|
60
|
-
row[0].border = self.cell_border0
|
|
61
|
-
|
|
62
|
-
if row[0].value and "年" in str(row[0].value):
|
|
63
|
-
sheet.merge_cells(
|
|
64
|
-
start_row=row[0].row,
|
|
65
|
-
end_row=row[0].row,
|
|
66
|
-
start_column=1,
|
|
67
|
-
end_column=2,
|
|
68
|
-
)
|
|
69
|
-
row[0].border = self.cell_border0
|
|
70
|
-
|
|
71
|
-
if row[3].value and "入库" in str(row[3].value).replace(
|
|
72
|
-
" ", ""
|
|
73
|
-
).replace(" ", ""):
|
|
74
|
-
sheet.merge_cells(
|
|
75
|
-
start_row=row[0].row,
|
|
76
|
-
end_row=row[0].row,
|
|
77
|
-
start_column=4,
|
|
78
|
-
end_column=6,
|
|
79
|
-
)
|
|
80
|
-
row[3].border = self.cell_border0
|
|
81
|
-
|
|
82
|
-
if row[6].value and "出库" in str(row[6].value).replace(
|
|
83
|
-
" ", ""
|
|
84
|
-
).replace(" ", ""):
|
|
85
|
-
sheet.merge_cells(
|
|
86
|
-
start_row=row[0].row,
|
|
87
|
-
end_row=row[0].row,
|
|
88
|
-
start_column=7,
|
|
89
|
-
end_column=9,
|
|
90
|
-
)
|
|
91
|
-
row[6].border = self.cell_border0
|
|
92
|
-
|
|
93
|
-
if row[9].value and "库存" in str(row[9].value).replace(
|
|
94
|
-
" ", ""
|
|
95
|
-
).replace(" ", ""):
|
|
96
|
-
sheet.merge_cells(
|
|
97
|
-
start_row=row[0].row,
|
|
98
|
-
end_row=row[0].row,
|
|
99
|
-
start_column=10,
|
|
100
|
-
end_column=12,
|
|
101
|
-
)
|
|
102
|
-
row[9].border = self.cell_border0
|
|
103
|
-
|
|
104
|
-
if row[12].value and "编号" in str(row[12].value).replace(" ", ""):
|
|
105
|
-
sheet.merge_cells(
|
|
106
|
-
start_row=row[0].row,
|
|
107
|
-
end_row=row[0].row + 1,
|
|
108
|
-
start_column=13,
|
|
109
|
-
end_column=13,
|
|
110
|
-
)
|
|
111
|
-
row[12].border = self.cell_border0
|
|
112
|
-
|
|
113
|
-
if row[0].value and self.food_form_title_like in str(row[0].value):
|
|
114
|
-
sheet.merge_cells(
|
|
115
|
-
start_row=row[0].row,
|
|
116
|
-
end_row=row[0].row,
|
|
117
|
-
start_column=1,
|
|
118
|
-
end_column=13,
|
|
119
|
-
)
|
|
120
|
-
row[0].font = Font(size=18, bold=True)
|
|
121
|
-
row[0].alignment = self.cell_alignment0
|
|
122
|
-
row[0].border = self.cell_border0
|
|
123
|
-
if row[0].row - 1 > 0:
|
|
124
|
-
note_cell = sheet.cell(row[0].row - 1, 2)
|
|
125
|
-
note_cell.value = (
|
|
126
|
-
"注:《学校食堂材料入库、出库台账》"
|
|
127
|
-
+ "是以入库单、出库单为依据按日进行登记。"
|
|
128
|
-
)
|
|
129
|
-
note_cell.alignment = Alignment(
|
|
130
|
-
horizontal="left", vertical="center"
|
|
131
|
-
)
|
|
132
|
-
note_cell.border = self.cell_border0
|
|
133
|
-
sheet.merge_cells(
|
|
134
|
-
start_row=note_cell.row,
|
|
135
|
-
end_row=note_cell.row,
|
|
136
|
-
start_column=2,
|
|
137
|
-
end_column=13,
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
print_info(_("Sheet {0} has been reformatted.").format(sheet.title))
|
|
141
|
-
|
|
142
|
-
def get_form_index(self, sheet):
|
|
143
|
-
indexes = self.get_form_indexes(sheet)
|
|
144
|
-
index_range = indexes[self.bill.consuming.month - 1]
|
|
145
|
-
return index_range
|
|
146
|
-
|
|
147
|
-
def get_form_indexes(self, sheet):
|
|
148
|
-
indexes = []
|
|
149
|
-
for row in sheet.iter_rows(
|
|
150
|
-
min_row=1, max_row=sheet.max_row, min_col=1, max_col=14
|
|
151
|
-
):
|
|
152
|
-
if row[0].value and "材料名称" in str(row[0].value).replace(
|
|
153
|
-
" ", ""
|
|
154
|
-
):
|
|
155
|
-
indexes.append([row[0].row + 3, None])
|
|
156
|
-
|
|
157
|
-
if row[2].value and "本月合计" in str(row[2].value).replace(
|
|
158
|
-
" ", ""
|
|
159
|
-
):
|
|
160
|
-
indexes[-1][1] = row[0].row + 1
|
|
161
|
-
return indexes
|
|
162
|
-
|
|
163
|
-
def update_inventories(self, sheet):
|
|
164
|
-
|
|
165
|
-
print_warning(_('Updating inventories for "{0}"').format(sheet.title))
|
|
166
|
-
|
|
167
|
-
row_indexes = []
|
|
168
|
-
row_index0 = None
|
|
169
|
-
row_index1 = None
|
|
170
|
-
for row in sheet.iter_rows(max_col=14):
|
|
171
|
-
if str(row[2].value) == "摘要":
|
|
172
|
-
row_index0 = row[2].row + 1
|
|
173
|
-
|
|
174
|
-
elif str(row[2].value) == "本月合计":
|
|
175
|
-
row_index1 = row[2].row - 1
|
|
176
|
-
if not row_index0:
|
|
177
|
-
print_error(
|
|
178
|
-
_(
|
|
179
|
-
"cannot find the starting index of form in "
|
|
180
|
-
+ 'Sheet "{0}". (row {1})'
|
|
181
|
-
).format(sheet.title, row[0].row)
|
|
182
|
-
)
|
|
183
|
-
if not row_index1:
|
|
184
|
-
print_error(
|
|
185
|
-
_(
|
|
186
|
-
"cannot find the ending index of form in "
|
|
187
|
-
+ 'Sheet "{0}". (row {1})'
|
|
188
|
-
).form(sheet.title, row[0].row)
|
|
189
|
-
)
|
|
190
|
-
if row_index0 and row_index1:
|
|
191
|
-
row_indexes.append([row_index0, row_index1])
|
|
192
|
-
row_index0 = None
|
|
193
|
-
row_index1 = None
|
|
194
|
-
pass
|
|
195
|
-
|
|
196
|
-
for ri0, ri1 in row_indexes:
|
|
197
|
-
|
|
198
|
-
unit_prices = [
|
|
199
|
-
sheet.cell(ri, 11).value for ri in range(ri0, ri1 + 1)
|
|
200
|
-
]
|
|
201
|
-
unit_prices = [
|
|
202
|
-
float(u)
|
|
203
|
-
for u in unit_prices
|
|
204
|
-
if str(u).replace(".", "").isnumeric()
|
|
205
|
-
]
|
|
206
|
-
|
|
207
|
-
unit_price_rows = []
|
|
208
|
-
for u in unit_prices:
|
|
209
|
-
u_rows = []
|
|
210
|
-
for ri in range(ri0, ri1 + 1):
|
|
211
|
-
cell10_value = sheet.cell(ri, 11).value
|
|
212
|
-
if str(cell10_value).replace(".", "").isnumeric():
|
|
213
|
-
if float(cell10_value) == u:
|
|
214
|
-
u_rows.append(ri)
|
|
215
|
-
unit_price_rows.append([u, u_rows])
|
|
216
|
-
|
|
217
|
-
for unit_price, rows in unit_price_rows:
|
|
218
|
-
rows_len = len(rows)
|
|
219
|
-
|
|
220
|
-
for row_i in range(rows_len):
|
|
221
|
-
if row_i + 1 >= rows_len:
|
|
222
|
-
break
|
|
223
|
-
row_index = rows[row_i]
|
|
224
|
-
row_indexp1 = rows[row_i + 1]
|
|
225
|
-
|
|
226
|
-
w_count_n = sheet.cell(row_indexp1, 4).value
|
|
227
|
-
w_unit_price_n = sheet.cell(row_indexp1, 5).value
|
|
228
|
-
if str(w_count_n).replace(".", "").isnumeric():
|
|
229
|
-
w_count_n = float(w_count_n)
|
|
230
|
-
else:
|
|
231
|
-
w_count_n = 0
|
|
232
|
-
if str(w_unit_price_n).replace(".", "").isnumeric():
|
|
233
|
-
w_unit_price_n = float(w_unit_price_n)
|
|
234
|
-
else:
|
|
235
|
-
w_unit_price_n = 0
|
|
236
|
-
w_total_price_n = w_count_n * w_unit_price_n
|
|
237
|
-
|
|
238
|
-
c_count_n = sheet.cell(row_indexp1, 7).value
|
|
239
|
-
c_unit_price_n = sheet.cell(row_indexp1, 8).value
|
|
240
|
-
if str(c_count_n).replace(".", "").isnumeric():
|
|
241
|
-
c_count_n = float(c_count_n)
|
|
242
|
-
else:
|
|
243
|
-
c_count_n = 0
|
|
244
|
-
if str(c_unit_price_n).replace(".", "").isnumeric():
|
|
245
|
-
c_unit_price_n = float(c_unit_price_n)
|
|
246
|
-
else:
|
|
247
|
-
c_unit_price_n = 0
|
|
248
|
-
c_total_price_n = c_count_n * c_unit_price_n
|
|
249
|
-
|
|
250
|
-
i_count_n = sheet.cell(row_indexp1, 10).value
|
|
251
|
-
i_unit_price_n = sheet.cell(row_indexp1, 11).value
|
|
252
|
-
if str(i_count_n).replace(".", "").isnumeric():
|
|
253
|
-
i_count_n = float(i_count_n)
|
|
254
|
-
else:
|
|
255
|
-
i_count_n = 0
|
|
256
|
-
if str(i_unit_price_n).replace(".", "").isnumeric():
|
|
257
|
-
i_unit_price_n = float(i_unit_price_n)
|
|
258
|
-
else:
|
|
259
|
-
i_unit_price_n = 0
|
|
260
|
-
i_total_price_n = i_count_n * i_unit_price_n
|
|
261
|
-
|
|
262
|
-
i_count = sheet.cell(row_index, 10).value
|
|
263
|
-
i_unit_price = sheet.cell(row_index, 11).value
|
|
264
|
-
if str(i_count).replace(".", "").isnumeric():
|
|
265
|
-
i_count = float(i_count)
|
|
266
|
-
else:
|
|
267
|
-
i_count = 0
|
|
268
|
-
if str(i_unit_price).replace(".", "").isnumeric():
|
|
269
|
-
i_unit_price = float(i_unit_price)
|
|
270
|
-
else:
|
|
271
|
-
i_unit_price = 0
|
|
272
|
-
i_total_price = i_count * i_unit_price
|
|
273
|
-
|
|
274
|
-
if (
|
|
275
|
-
i_unit_price == w_unit_price_n
|
|
276
|
-
and not i_count_n == (i_count + w_count_n - c_count_n)
|
|
277
|
-
and not (w_count_n == 0 and c_count_n == 0)
|
|
278
|
-
):
|
|
279
|
-
sheet.cell(
|
|
280
|
-
row_indexp1, 10, i_count + w_count_n - c_count_n
|
|
281
|
-
)
|
|
282
|
-
sheet.cell(
|
|
283
|
-
row_indexp1,
|
|
284
|
-
12,
|
|
285
|
-
i_unit_price * (i_count + w_count_n - c_count_n)
|
|
286
|
-
)
|
|
287
|
-
|
|
288
|
-
pass
|
|
289
|
-
pass
|
|
290
|
-
pass
|
|
291
|
-
|
|
292
|
-
for row_index in range(ri0,ri1+1):
|
|
293
|
-
w_count = sheet.cell(row_index, 4).value
|
|
294
|
-
w_unit_price = sheet.cell(row_index, 5).value
|
|
295
|
-
if str(w_count).replace(".", "").isnumeric():
|
|
296
|
-
w_count = float(w_count)
|
|
297
|
-
else:
|
|
298
|
-
w_count = 0
|
|
299
|
-
if str(w_unit_price).replace(".", "").isnumeric():
|
|
300
|
-
w_unit_price = float(w_unit_price)
|
|
301
|
-
else:
|
|
302
|
-
w_unit_price = 0
|
|
303
|
-
w_total_price = w_count * w_unit_price
|
|
304
|
-
|
|
305
|
-
if not sheet.cell(row_index,6).value:
|
|
306
|
-
sheet.cell(row_index, 6, w_total_price)
|
|
307
|
-
|
|
308
|
-
c_count = sheet.cell(row_index, 7).value
|
|
309
|
-
c_unit_price = sheet.cell(row_index, 8).value
|
|
310
|
-
if str(c_count).replace(".", "").isnumeric():
|
|
311
|
-
c_count = float(c_count)
|
|
312
|
-
else:
|
|
313
|
-
c_count = 0
|
|
314
|
-
if str(c_unit_price).replace(".", "").isnumeric():
|
|
315
|
-
c_unit_price = float(c_unit_price)
|
|
316
|
-
else:
|
|
317
|
-
c_unit_price = 0
|
|
318
|
-
c_total_price = c_count * c_unit_price
|
|
319
|
-
|
|
320
|
-
if not sheet.cell(row_index, 9).value:
|
|
321
|
-
sheet.cell(row_index, 9, c_total_price)
|
|
322
|
-
|
|
323
|
-
i_count = sheet.cell(row_index, 10).value
|
|
324
|
-
i_unit_price = sheet.cell(row_index, 11).value
|
|
325
|
-
if str(i_count).replace(".", "").isnumeric():
|
|
326
|
-
i_count = float(i_count)
|
|
327
|
-
else:
|
|
328
|
-
i_count = 0
|
|
329
|
-
if str(i_unit_price).replace(".", "").isnumeric():
|
|
330
|
-
i_unit_price = float(i_unit_price)
|
|
331
|
-
else:
|
|
332
|
-
i_unit_price = 0
|
|
333
|
-
i_total_price = i_count * i_unit_price
|
|
334
|
-
|
|
335
|
-
if i_count == 0:
|
|
336
|
-
sheet.cell(row_index, 10, "0")
|
|
337
|
-
|
|
338
|
-
if not sheet.cell(row_index, 12).value:
|
|
339
|
-
sheet.cell(row_index, 12, i_total_price)
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
pass
|
|
345
|
-
|
|
346
|
-
print_info(_("Update completed!"))
|
|
347
|
-
|
|
348
|
-
pass
|
|
349
|
-
|
|
350
|
-
def update_summation(self, sheet):
|
|
351
|
-
|
|
352
|
-
print_info(
|
|
353
|
-
_('Update monthly and annual accumulation for "{0}".').format(
|
|
354
|
-
sheet.title
|
|
355
|
-
)
|
|
356
|
-
)
|
|
357
|
-
warehousing_sum_m = 0
|
|
358
|
-
warehousing_sum_y = 0
|
|
359
|
-
|
|
360
|
-
warehousing_count_m = 0
|
|
361
|
-
warehousing_count_y = 0
|
|
362
|
-
|
|
363
|
-
consuming_sum_m = 0
|
|
364
|
-
consuming_sum_y = 0
|
|
365
|
-
|
|
366
|
-
consuming_count_m = 0
|
|
367
|
-
consuming_count_y = 0
|
|
368
|
-
|
|
369
|
-
for row in sheet.iter_rows(max_col=14):
|
|
370
|
-
if str(row[3].value) == "数量":
|
|
371
|
-
warehousing_count_m = 0
|
|
372
|
-
warehousing_sum_m = 0
|
|
373
|
-
|
|
374
|
-
consuming_count_m = 0
|
|
375
|
-
consuming_sum_m = 0
|
|
376
|
-
|
|
377
|
-
current_row_index = row[0].row
|
|
378
|
-
row_index_end = None
|
|
379
|
-
for row_index in range(current_row_index, sheet.max_row + 1):
|
|
380
|
-
if str(sheet.cell(row_index, 3).value) == "本月合计":
|
|
381
|
-
row_index_end = row_index
|
|
382
|
-
break
|
|
383
|
-
|
|
384
|
-
for row_index in range(current_row_index, row_index_end):
|
|
385
|
-
cell3_value = str(sheet.cell(row_index, 4).value).replace(
|
|
386
|
-
".", ""
|
|
387
|
-
)
|
|
388
|
-
|
|
389
|
-
if cell3_value.isnumeric():
|
|
390
|
-
cell3_value = str(sheet.cell(row_index, 4).value)
|
|
391
|
-
|
|
392
|
-
warehousing_count_m += float(cell3_value)
|
|
393
|
-
|
|
394
|
-
cell4_value = str(
|
|
395
|
-
sheet.cell(row_index, 5).value
|
|
396
|
-
).replace(".", "")
|
|
397
|
-
|
|
398
|
-
if cell4_value.isnumeric():
|
|
399
|
-
cell4_value = str(sheet.cell(row_index, 5).value)
|
|
400
|
-
sheet.cell(
|
|
401
|
-
row_index,
|
|
402
|
-
6,
|
|
403
|
-
float(cell3_value) * float(cell4_value),
|
|
404
|
-
)
|
|
405
|
-
|
|
406
|
-
cell5_value = str(sheet.cell(row_index, 6).value).replace(
|
|
407
|
-
".", ""
|
|
408
|
-
)
|
|
409
|
-
if cell5_value.isnumeric():
|
|
410
|
-
cell5_value = str(sheet.cell(row_index, 6).value)
|
|
411
|
-
|
|
412
|
-
warehousing_sum_m += float(cell5_value)
|
|
413
|
-
|
|
414
|
-
cell6_value = str(sheet.cell(row_index, 7).value).replace(
|
|
415
|
-
".", ""
|
|
416
|
-
)
|
|
417
|
-
if cell6_value.isnumeric():
|
|
418
|
-
cell6_value = str(sheet.cell(row_index, 7).value)
|
|
419
|
-
consuming_count_m += float(cell6_value)
|
|
420
|
-
|
|
421
|
-
cell7_value = str(
|
|
422
|
-
sheet.cell(row_index, 8).value
|
|
423
|
-
).replace(".", "")
|
|
424
|
-
if cell7_value.isnumeric():
|
|
425
|
-
cell7_value = str(sheet.cell(row_index, 8).value)
|
|
426
|
-
sheet.cell(
|
|
427
|
-
row_index,
|
|
428
|
-
9,
|
|
429
|
-
float(cell6_value) * float(cell7_value),
|
|
430
|
-
)
|
|
431
|
-
|
|
432
|
-
cell8_value = str(sheet.cell(row_index, 9).value).replace(
|
|
433
|
-
".", ""
|
|
434
|
-
)
|
|
435
|
-
if cell8_value.isnumeric():
|
|
436
|
-
cell8_value = str(sheet.cell(row_index, 9).value)
|
|
437
|
-
|
|
438
|
-
consuming_sum_m += float(cell8_value)
|
|
439
|
-
|
|
440
|
-
warehousing_count_y += warehousing_count_m
|
|
441
|
-
warehousing_sum_y += warehousing_sum_m
|
|
442
|
-
|
|
443
|
-
consuming_count_y += consuming_count_m
|
|
444
|
-
consuming_sum_y += consuming_sum_m
|
|
445
|
-
|
|
446
|
-
if str(row[2].value) == "本年累计":
|
|
447
|
-
row[3].value = warehousing_count_y
|
|
448
|
-
row[5].value = warehousing_sum_y
|
|
449
|
-
row[6].value = consuming_count_y
|
|
450
|
-
row[8].value = consuming_sum_y
|
|
451
|
-
pass
|
|
452
|
-
|
|
453
|
-
elif str(row[2].value) == "本月合计":
|
|
454
|
-
row[3].value = warehousing_count_m
|
|
455
|
-
row[5].value = warehousing_sum_m
|
|
456
|
-
row[6].value = consuming_count_m
|
|
457
|
-
row[8].value = consuming_sum_m
|
|
458
|
-
|
|
459
|
-
warehousing_count_m = None
|
|
460
|
-
warehousing_sum_m = None
|
|
461
|
-
consuming_sum_m = None
|
|
462
|
-
consuming_count_m = None
|
|
463
|
-
pass
|
|
464
|
-
|
|
465
|
-
else:
|
|
466
|
-
pass
|
|
467
|
-
|
|
468
|
-
warehousing_sum_y = None
|
|
469
|
-
warehousing_count_y = None
|
|
470
|
-
consuming_sum_y = None
|
|
471
|
-
consuming_count_y = None
|
|
472
|
-
|
|
473
|
-
print_warning(_("Update completed."))
|
|
474
|
-
|
|
475
|
-
def update(self):
|
|
476
|
-
|
|
477
|
-
year = self.bill.consuming.year
|
|
478
|
-
month = self.bill.consuming.month
|
|
479
|
-
cfoods = [f for f in self.bfoods if not f.is_abandoned]
|
|
480
|
-
food_names = list(set([f.name for f in cfoods]))
|
|
481
|
-
wb = self.bwb
|
|
482
|
-
|
|
483
|
-
wb[self.sheet_name].sheet_state = "visible"
|
|
484
|
-
|
|
485
|
-
rfoods = [
|
|
486
|
-
f for f in self.bfoods if (not f.is_abandoned and f.is_inventory)
|
|
487
|
-
]
|
|
488
|
-
|
|
489
|
-
consuming_days = []
|
|
490
|
-
for f in cfoods:
|
|
491
|
-
for d, c in f.consumptions:
|
|
492
|
-
if (not d in consuming_days) and (d.month == month):
|
|
493
|
-
consuming_days.append(d)
|
|
494
|
-
|
|
495
|
-
consuming_days = sorted(consuming_days)
|
|
496
|
-
|
|
497
|
-
warehousing_days = sorted(
|
|
498
|
-
list(set([f.xdate for f in cfoods if f.xdate.month == month]))
|
|
499
|
-
)
|
|
500
|
-
|
|
501
|
-
food_names = list(set([f.name for f in rfoods] + food_names))
|
|
502
|
-
|
|
503
|
-
sheet = None
|
|
504
|
-
for food_name in food_names:
|
|
505
|
-
sheet = self.get_sheet(food_name)
|
|
506
|
-
form_index_range = self.get_form_index(sheet)
|
|
507
|
-
index_start, index_end = form_index_range
|
|
508
|
-
|
|
509
|
-
for row_index in range(index_start, index_end - 1):
|
|
510
|
-
for col_index in range(1, 14):
|
|
511
|
-
sheet.cell(row_index, col_index).value = ""
|
|
512
|
-
row_index = index_start
|
|
513
|
-
col_index = 1
|
|
514
|
-
|
|
515
|
-
m_rfoods = [f for f in rfoods if f.name == food_name]
|
|
516
|
-
m_cfoods = [f for f in cfoods if f.name == food_name]
|
|
517
|
-
|
|
518
|
-
self.unmerge_sheet_cells(sheet)
|
|
519
|
-
|
|
520
|
-
sheet.cell(index_start - 2, 1, f"{year}年")
|
|
521
|
-
|
|
522
|
-
if len(m_rfoods) > 0:
|
|
523
|
-
for m_row_index in range(
|
|
524
|
-
index_start, index_start + len(m_rfoods)
|
|
525
|
-
):
|
|
526
|
-
food = m_rfoods[m_row_index - index_start]
|
|
527
|
-
sheet.cell(
|
|
528
|
-
m_row_index,
|
|
529
|
-
3,
|
|
530
|
-
("上年结转" if month == 1 else "上月结转"),
|
|
531
|
-
)
|
|
532
|
-
sheet.cell(row_index, 10, food.count)
|
|
533
|
-
sheet.cell(row_index, 11, food.unit_price)
|
|
534
|
-
sheet.cell(row_index, 12, food.count * food.unit_price)
|
|
535
|
-
row_index += 1
|
|
536
|
-
else:
|
|
537
|
-
sheet.cell(
|
|
538
|
-
row_index,
|
|
539
|
-
3,
|
|
540
|
-
("上年结转" if month == 1 else "上月结转"),
|
|
541
|
-
)
|
|
542
|
-
|
|
543
|
-
row_index += 1
|
|
544
|
-
|
|
545
|
-
row_count_form = index_end - index_start - 1
|
|
546
|
-
|
|
547
|
-
cdates = []
|
|
548
|
-
for food in m_cfoods:
|
|
549
|
-
if len(food.consumptions) > 0:
|
|
550
|
-
cdates += [d for d, c in food.consumptions]
|
|
551
|
-
cdates.append(food.xdate)
|
|
552
|
-
cdates = sorted(list(set(cdates)))
|
|
553
|
-
|
|
554
|
-
consuming_n = None
|
|
555
|
-
warehousing_n = None
|
|
556
|
-
|
|
557
|
-
row_offset = 0
|
|
558
|
-
|
|
559
|
-
row_count_foods = 0
|
|
560
|
-
for f in m_cfoods:
|
|
561
|
-
row_count_foods += len([d for d, __ in f.consumptions])
|
|
562
|
-
row_count_foods += len([f.xdate for f in m_cfoods])
|
|
563
|
-
|
|
564
|
-
row_count_diff = row_count_foods - row_count_form
|
|
565
|
-
if row_count_diff > 0:
|
|
566
|
-
self.row_inserting_tip(row_index + 1)
|
|
567
|
-
sheet.insert_rows(row_index + 1, row_count_diff + 1)
|
|
568
|
-
for col_index in range(1, 14):
|
|
569
|
-
for row_index_b in range(
|
|
570
|
-
row_index + 1, row_index + 1 + row_count_diff + 1
|
|
571
|
-
):
|
|
572
|
-
|
|
573
|
-
cell = sheet.cell(row_index_b, col_index)
|
|
574
|
-
cell.border = self.cell_border0
|
|
575
|
-
cell.alignment = self.cell_alignment0
|
|
576
|
-
|
|
577
|
-
pass
|
|
578
|
-
|
|
579
|
-
for cdate in cdates:
|
|
580
|
-
|
|
581
|
-
for food in m_cfoods:
|
|
582
|
-
|
|
583
|
-
if food.xdate == cdate and food.xdate.month == month:
|
|
584
|
-
warehousing_n = warehousing_days.index(cdate) + 1
|
|
585
|
-
sheet.cell(row_index, 1, cdate.month)
|
|
586
|
-
sheet.cell(row_index, 2, cdate.day)
|
|
587
|
-
sheet.cell(row_index, 4, food.count)
|
|
588
|
-
sheet.cell(row_index, 5, food.unit_price)
|
|
589
|
-
sheet.cell(row_index, 6, food.count * food.unit_price)
|
|
590
|
-
sheet.cell(row_index, 9, "")
|
|
591
|
-
sheet.cell(row_index, 10).number_format = (
|
|
592
|
-
numbers.FORMAT_NUMBER_00
|
|
593
|
-
)
|
|
594
|
-
sheet.cell(row_index, 10, food.count)
|
|
595
|
-
|
|
596
|
-
sheet.cell(row_index, 11, food.unit_price)
|
|
597
|
-
sheet.cell(row_index, 12, food.count * food.unit_price)
|
|
598
|
-
sheet.cell(
|
|
599
|
-
row_index,
|
|
600
|
-
13,
|
|
601
|
-
f"R{cdate.month:0>2}{warehousing_n:0>2}",
|
|
602
|
-
)
|
|
603
|
-
warehousing_n += 1
|
|
604
|
-
row_index += 1
|
|
605
|
-
|
|
606
|
-
if cdate in [d for d, __ in food.consumptions]:
|
|
607
|
-
|
|
608
|
-
unit_price = food.unit_price
|
|
609
|
-
remainder = food.get_remainder(cdate)
|
|
610
|
-
consuming_n = consuming_days.index(cdate) + 1
|
|
611
|
-
ccount = [
|
|
612
|
-
c for d, c in food.consumptions if d == cdate
|
|
613
|
-
][0]
|
|
614
|
-
sheet.cell(row_index, 1, cdate.month)
|
|
615
|
-
sheet.cell(row_index, 2, cdate.day)
|
|
616
|
-
sheet.cell(row_index, 6, "")
|
|
617
|
-
sheet.cell(row_index, 7).number_format = (
|
|
618
|
-
numbers.FORMAT_NUMBER_00
|
|
619
|
-
)
|
|
620
|
-
sheet.cell(row_index, 7, ccount)
|
|
621
|
-
|
|
622
|
-
sheet.cell(row_index, 8, unit_price)
|
|
623
|
-
sheet.cell(row_index, 9, ccount * unit_price)
|
|
624
|
-
sheet.cell(row_index, 10, remainder)
|
|
625
|
-
sheet.cell(
|
|
626
|
-
row_index,
|
|
627
|
-
11,
|
|
628
|
-
food.unit_price,
|
|
629
|
-
)
|
|
630
|
-
sheet.cell(row_index, 12, remainder * unit_price)
|
|
631
|
-
|
|
632
|
-
sheet.cell(
|
|
633
|
-
row_index,
|
|
634
|
-
13,
|
|
635
|
-
f"C{cdate.month:0>2}{consuming_n:0>2}",
|
|
636
|
-
)
|
|
637
|
-
consuming_n += 1
|
|
638
|
-
row_index += 1
|
|
639
|
-
|
|
640
|
-
self.update_summation(sheet)
|
|
641
|
-
self.update_inventories(sheet)
|
|
642
|
-
|
|
643
|
-
self.format(sheet)
|
|
644
|
-
self.update_food_sheet_year(sheet)
|
|
645
|
-
print_info(_("Sheet '%s' was updated.") % sheet.title)
|
|
646
|
-
|
|
647
|
-
wb[self.sheet_name].sheet_state = "hidden"
|
|
648
|
-
|
|
649
|
-
wb.active = sheet
|
|
650
|
-
|
|
651
|
-
bfood_names = list(set([f.name for f in self.bfoods]))
|
|
652
|
-
for name in bfood_names:
|
|
653
|
-
if name in self.bwb.sheetnames:
|
|
654
|
-
sheet = self.get_sheet(name)
|
|
655
|
-
sheet.sheet_properties.tabColor = "0" * 8
|
|
656
|
-
|
|
657
|
-
print_info(_("All food sheets have their tab colors reset."))
|
|
658
|
-
|
|
659
|
-
for name in food_names:
|
|
660
|
-
sheet = self.get_sheet(name)
|
|
661
|
-
sheet.sheet_properties.tabColor = secrets.token_hex(4)
|
|
662
|
-
food_names_s = sqr_slist(food_names)
|
|
663
|
-
sep_s = get_random_sep_char() * max(
|
|
664
|
-
[
|
|
665
|
-
len(s) + len([c for c in s if is_zh_CN_char(c)])
|
|
666
|
-
for s in food_names_s.split("\n")
|
|
667
|
-
]
|
|
668
|
-
)
|
|
669
|
-
|
|
670
|
-
print_error(sep_s)
|
|
671
|
-
print_warning(_("Food sheets have their tab colors recolor:"))
|
|
672
|
-
print_info(food_names_s)
|
|
673
|
-
|
|
674
|
-
print_error(sep_s)
|
|
675
|
-
print_warning(_("Updated food sheets:"))
|
|
676
|
-
print_info(food_names_s)
|
|
677
|
-
print_error(sep_s)
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
# The end
|