chore: refactor some reports
This commit is contained in:
parent
18fc2b5695
commit
1fd73af744
@ -131,8 +131,8 @@ def get_assets(filters):
|
|||||||
else
|
else
|
||||||
0
|
0
|
||||||
end), 0) as depreciation_amount_during_the_period
|
end), 0) as depreciation_amount_during_the_period
|
||||||
from `tabAsset` a, `tabDepreciation Schedule` ds
|
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 a.name = ds.parent and ifnull(ds.journal_entry, '') != ''
|
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
|
group by a.asset_category
|
||||||
union
|
union
|
||||||
SELECT a.asset_category,
|
SELECT a.asset_category,
|
||||||
|
@ -176,7 +176,7 @@ def get_finance_book_value_map(filters):
|
|||||||
return frappe._dict(
|
return frappe._dict(
|
||||||
frappe.db.sql(
|
frappe.db.sql(
|
||||||
""" Select
|
""" Select
|
||||||
ads.name, SUM(depreciation_amount)
|
ads.asset, SUM(depreciation_amount)
|
||||||
FROM `tabAsset Depreciation Schedule` ads, `tabDepreciation Schedule` ds
|
FROM `tabAsset Depreciation Schedule` ads, `tabDepreciation Schedule` ds
|
||||||
WHERE
|
WHERE
|
||||||
ds.parent = ads.name
|
ds.parent = ads.name
|
||||||
@ -185,7 +185,7 @@ def get_finance_book_value_map(filters):
|
|||||||
AND ds.parentfield='depreciation_schedule'
|
AND ds.parentfield='depreciation_schedule'
|
||||||
AND ds.schedule_date<=%s
|
AND ds.schedule_date<=%s
|
||||||
AND ds.journal_entry IS NOT NULL
|
AND ds.journal_entry IS NOT NULL
|
||||||
GROUP BY ads.name""",
|
GROUP BY ads.asset""",
|
||||||
(cstr(filters.finance_book or ""), date),
|
(cstr(filters.finance_book or ""), date),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user