chore: refactor some reports

This commit is contained in:
anandbaburajan 2022-12-09 00:28:34 +05:30
parent 18fc2b5695
commit 1fd73af744
2 changed files with 4 additions and 4 deletions

View File

@ -131,8 +131,8 @@ def get_assets(filters):
else
0
end), 0) as depreciation_amount_during_the_period
from `tabAsset` a, `tabDepreciation Schedule` ds
where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and a.name = ds.parent and ifnull(ds.journal_entry, '') != ''
from `tabAsset` a, `tabAsset Depreciation Schedule` ads, `tabDepreciation Schedule` ds
where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s and ads.asset = a.name and ads.docstatus=1 and ads.name = ds.parent and ifnull(ds.journal_entry, '') != ''
group by a.asset_category
union
SELECT a.asset_category,

View File

@ -176,7 +176,7 @@ def get_finance_book_value_map(filters):
return frappe._dict(
frappe.db.sql(
""" Select
ads.name, SUM(depreciation_amount)
ads.asset, SUM(depreciation_amount)
FROM `tabAsset Depreciation Schedule` ads, `tabDepreciation Schedule` ds
WHERE
ds.parent = ads.name
@ -185,7 +185,7 @@ def get_finance_book_value_map(filters):
AND ds.parentfield='depreciation_schedule'
AND ds.schedule_date<=%s
AND ds.journal_entry IS NOT NULL
GROUP BY ads.name""",
GROUP BY ads.asset""",
(cstr(filters.finance_book or ""), date),
)
)