Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT ai.id, $3,
- asset_dep__straight_line_base(
- ai.usable_life, -- years
- ai.usable_life -
- get_fractional_year(coalesce(max(report_date),
- start_depreciation,
- purchase_date),
- coalesce(start_depreciation,
- purchase_date)),
- get_fractional_year(coalesce(max(report_date),
- start_depreciation,
- purchase_date),
- $2),
- purchase_value - salvage_value,
- coalesce(sum(l.amount), 0)),
- ai.department_id, ai.location_id
- FROM asset_item ai
- LEFT JOIN asset_report_line l ON (l.asset_id = ai.id)
- LEFT JOIN asset_report r ON (l.report_id = r.id)
- WHERE ai.id = ANY($1)
- GROUP BY ai.id, ai.start_depreciation, ai.purchase_date, ai.purchase_value,
- ai.salvage_value, ai.department_id, ai.location_id, ai.usable_life;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement