added new report vat_allocation_tax_articles_report

This commit is contained in:
Ali 2026-02-09 18:06:21 +04:00
parent 3b4973f9a8
commit 211054d0ca
1 changed files with 6 additions and 5 deletions

View File

@ -82,13 +82,14 @@ def get_vat_allocation_items(filters):
# Фильтр по company - ИГНОРИРУЕМ (нет поля в VAT Allocation) # Фильтр по company - ИГНОРИРУЕМ (нет поля в VAT Allocation)
# Фильтр присутствует только для совместимости с formula editor # Фильтр присутствует только для совместимости с formula editor
# Фильтр по датам - используем creation date VAT Allocation документа # Фильтр по датам - конвертируем year + month в дату
# Используем STR_TO_DATE для конвертации названия месяца в дату
if filters.get("from_date"): if filters.get("from_date"):
conditions.append("va.creation >= %s") conditions.append("STR_TO_DATE(CONCAT('01 ', va.month, ' ', va.year), '%d %M %Y') >= %s")
values.append(filters.get("from_date")) values.append(filters.get("from_date"))
if filters.get("to_date"): if filters.get("to_date"):
conditions.append("va.creation <= %s") conditions.append("STR_TO_DATE(CONCAT('01 ', va.month, ' ', va.year), '%d %M %Y') <= %s")
values.append(filters.get("to_date")) values.append(filters.get("to_date"))
# Только submitted документы # Только submitted документы
@ -107,7 +108,7 @@ def get_vat_allocation_items(filters):
va.name as vat_allocation, va.name as vat_allocation,
va.year, va.year,
va.month, va.month,
va.creation as posting_date, STR_TO_DATE(CONCAT('01 ', va.month, ' ', va.year), '%d %M %Y') as posting_date,
vasi.customer, vasi.customer,
vasi.tax_article, vasi.tax_article,
vasi.allocated_amount vasi.allocated_amount
@ -117,7 +118,7 @@ def get_vat_allocation_items(filters):
`tabVAT allocation sales invoice` vasi ON va.name = vasi.parent `tabVAT allocation sales invoice` vasi ON va.name = vasi.parent
{where_clause} {where_clause}
ORDER BY ORDER BY
va.creation DESC, va.name STR_TO_DATE(CONCAT('01 ', va.month, ' ', va.year), '%d %M %Y') DESC, va.name
""" """
return frappe.db.sql(query, values, as_dict=True) return frappe.db.sql(query, values, as_dict=True)