Skip to content

Commit

Permalink
feat: added 'cost of new capitalized asset' column
Browse files Browse the repository at this point in the history
(cherry picked from commit 1eb9cc3)
(cherry picked from commit 27cd51e)
  • Loading branch information
khushi8112 authored and mergify[bot] committed Sep 30, 2024
1 parent 2d09ef2 commit 96d8b52
Showing 1 changed file with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ def get_group_by_asset_category_data(filters):
+ flt(row.cost_of_new_purchase)
- flt(row.cost_of_sold_asset)
- flt(row.cost_of_scrapped_asset)
- flt(row.cost_of_capitalized_asset)
)
# Update row with corresponding asset data

row.update(
next(
asset
Expand Down Expand Up @@ -111,13 +112,24 @@ def get_asset_categories_for_grouped_by_category(filters):
end
else
0
end), 0) as cost_of_scrapped_asset
end), 0) as cost_of_scrapped_asset,
ifnull(sum(case when ifnull(a.disposal_date, 0) != 0
and a.disposal_date >= %(from_date)s
and a.disposal_date <= %(to_date)s then
case when a.status = "Capitalized" then
a.gross_purchase_amount
else
0
end
else
0
end), 0) as cost_of_capitalized_asset
from `tabAsset` a
where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s {condition}
and not exists(
select 1 from `tabAsset Capitalization Asset Item` acai join `tabAsset Capitalization` ac on acai.parent=ac.name
where acai.asset = a.name
and ac.posting_date <= %(to_date)s
and ac.posting_date < %(from_date)s
and ac.docstatus=1
)
group by a.asset_category
Expand Down Expand Up @@ -179,13 +191,24 @@ def get_asset_details_for_grouped_by_category(filters):
end
else
0
end), 0) as cost_of_scrapped_asset
end), 0) as cost_of_scrapped_asset,
ifnull(sum(case when ifnull(a.disposal_date, 0) != 0
and a.disposal_date >= %(from_date)s
and a.disposal_date <= %(to_date)s then
case when a.status = "Capitalized" then
a.gross_purchase_amount
else
0
end
else
0
end), 0) as cost_of_capitalized_asset
from `tabAsset` a
where a.docstatus=1 and a.company=%(company)s and a.purchase_date <= %(to_date)s {condition}
and not exists(
select 1 from `tabAsset Capitalization Asset Item` acai join `tabAsset Capitalization` ac on acai.parent=ac.name
where acai.asset = a.name
and ac.posting_date <= %(to_date)s
and ac.posting_date < %(from_date)s
and ac.docstatus=1
)
group by a.name
Expand Down Expand Up @@ -217,6 +240,7 @@ def get_group_by_asset_data(filters):
+ flt(row.cost_of_new_purchase)
- flt(row.cost_of_sold_asset)
- flt(row.cost_of_scrapped_asset)
- flt(row.cost_of_capitalized_asset)
)

row.update(next(asset for asset in assets if asset["asset"] == asset_detail.get("name", "")))
Expand Down Expand Up @@ -445,6 +469,12 @@ def get_columns(filters):
"fieldtype": "Currency",
"width": 140,
},
{
"label": _("Cost of New Capitalized Asset"),
"fieldname": "cost_of_capitalized_asset",
"fieldtype": "Currency",
"width": 140,
},
{
"label": _("Cost as on") + " " + formatdate(filters.to_date),
"fieldname": "cost_as_on_to_date",
Expand Down

0 comments on commit 96d8b52

Please sign in to comment.