diff --git a/src/commons/templatetags/my_tags.py b/src/commons/templatetags/my_tags.py
index 42cc4a4..242beaa 100644
--- a/src/commons/templatetags/my_tags.py
+++ b/src/commons/templatetags/my_tags.py
@@ -74,3 +74,42 @@ def file_version(path):
return md5(open(full_path, 'rb').read()).hexdigest()
except IOError:
return ''
+
+
+@register.filter
+def rub_in_parts(string, part):
+ """Преобразуем строку с суммой прописью для вывода в накладную"""
+ s = ''
+ rub = string.find('руб')
+ if rub != -1:
+ result = string[:rub - 1]
+ else:
+ result = string
+ if len(result) >= 50:
+ words = result.split(' ')
+ len_string = 0
+
+ for word in words:
+ if len_string >= 50:
+ break
+ len_string += len(word) + 1
+ first_part = result[:len_string]
+ second_part = result[len_string:]
+ if part == 1:
+ s = first_part
+ elif part == 2:
+ s = second_part
+ else:
+ s = result
+ else:
+ s = result
+ return s
+
+
+@register.filter
+def only_kopeck(sum):
+ kopeck = str(sum).split('.')[-1]
+ if len(kopeck) < 2:
+ return f'{kopeck}0'
+ else:
+ return kopeck
diff --git a/templates/docs/nakladn/as_pdf.html b/templates/docs/nakladn/as_pdf.html
index cea55c8..9bc89f9 100644
--- a/templates/docs/nakladn/as_pdf.html
+++ b/templates/docs/nakladn/as_pdf.html
@@ -304,17 +304,17 @@
| {{ forloop.counter }} | {# 1 #}
{{ item.name|safe }} | {# 2 #}
- | {# 3 #}
+ - | {# 3 #}
{{ item.units|safe }} | {# 4 #}
{{ item.units_kod|safe }} | {# 5 #}
- | {# 6 #}
- | {# 7 #}
- | {# 8 #}
- | {# 9 #}
+ - | {# 6 #}
+ - | {# 7 #}
+ - | {# 8 #}
+ - | {# 9 #}
{{ item.qty }} | {# 10 #}
{{ item.clean_price}} | {# 11 #}
{{ item.clean_total_price|floatformat:2 }} | {# 12 #}
- {{ obj.get_nds_as_number }} | {# 13 #}
+ {% if obj.get_nds_as_number != 0 %}{{ obj.get_nds_as_number }}{% else %}Без НДС{% endif %} | {# 13 #}
{{ item.total_nds|floatformat:2 }} | {# 14 #}
{{ item.full_total_price|floatformat:2 }} | {# 15 #}
@@ -388,7 +388,7 @@
|
Товарная накладная имеет приложение на |
|
- |
+ --- |
|
листах |
@@ -447,7 +447,7 @@
|
Всего мест |
|
- |
+ --- |
|
Масса груза (брутто) |
|
@@ -496,7 +496,7 @@
| Приложение (паспорта, сертификаты и т.п.) на |
|
- |
+ --- |
|
листах |
{# правая половина #}
@@ -522,7 +522,7 @@
| Всего отпущено на сумму |
|
- |
+ {{ obj.sum_full_total_price|to_float|rubles|rub_in_parts:1|capfirst }} |
|
{# правая половина #}
|
@@ -539,9 +539,9 @@
(кем, кому (организация, должность, фамилия, и., о.)) |
- |
+ {{ obj.sum_full_total_price|to_float|rubles|rub_in_parts:2 }} |
руб. |
- |
+ {{ obj.sum_full_total_price|to_float|only_kopeck }} |
коп. |
{# правая половина #}
|
@@ -692,24 +692,24 @@
|
« |
- |
+ {{ obj.doc_date|date:"d" }} |
» |
|
- |
+ {{ obj.doc_date|date:"E" }} |
|
- |
+ {{ obj.doc_date|date:"Y" }} |
года |
{# правая половина #}
|
М.П. |
|
« |
- |
+ {{ obj.doc_date|date:"d" }} |
» |
|
- |
+ {{ obj.doc_date|date:"E" }} |
|
- |
+ {{ obj.doc_date|date:"Y" }} |
года |