USE [StoreDbNew] GO /****** Object: StoredProcedure [dbo].[SP_GET_Depreciation_Report] Script Date: 8/5/2020 2:45:08 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SP_GET_Depreciation_Report] ( @branchId int, @onDATE DATETIME ) AS BEGIN select i.Id ItemId, i.Name ItemName, i.NameNp ItemNameNp,i.Specification Specification,lh.Date AcquisitionDate, b.Balance Quantity, b.LotId, lh.Rate Rate,(b.Balance * lh.Rate) Total,ISNULL(dbo.SF_GetDepreciationAmount(i.DepreciationRate,(b.Balance * lh.rate),lh.Date,@onDATE),0) Depreciation from EItems i inner join EStockCurrentBals b on i.Id = b.ItemId inner join EItemLotHists lh on b.LotId = lh.Id where i.IsAssets = 1 END