added new report vat_allocation_tax_articles_report
This commit is contained in:
parent
3b4973f9a8
commit
211054d0ca
|
|
@ -82,13 +82,14 @@ def get_vat_allocation_items(filters):
|
|||
# Фильтр по company - ИГНОРИРУЕМ (нет поля в VAT Allocation)
|
||||
# Фильтр присутствует только для совместимости с formula editor
|
||||
|
||||
# Фильтр по датам - используем creation date VAT Allocation документа
|
||||
# Фильтр по датам - конвертируем year + month в дату
|
||||
# Используем STR_TO_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"))
|
||||
|
||||
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"))
|
||||
|
||||
# Только submitted документы
|
||||
|
|
@ -107,7 +108,7 @@ def get_vat_allocation_items(filters):
|
|||
va.name as vat_allocation,
|
||||
va.year,
|
||||
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.tax_article,
|
||||
vasi.allocated_amount
|
||||
|
|
@ -117,7 +118,7 @@ def get_vat_allocation_items(filters):
|
|||
`tabVAT allocation sales invoice` vasi ON va.name = vasi.parent
|
||||
{where_clause}
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue