DECLARE
@LoanAmount MONEY = '5000000.00'
,@ROI FLOAT = 11
,@Tenure NUMERIC(18,2) = 12
,@Period INT
,@Principal MONEY
,@Interest MONEY
,@EMI MONEY
,@AMT MONEY
SET @Period = 1
SET @ROI = (@ROI/100)/12
DECLARE
@EMI_TABLE TABLE
(PERIOD INT,PAYDATE SMALLDATETIME,EMI MONEY,PRINCIPAL MONEY,INTEREST MONEY ,BALANCE MONEY)
--EMI = [P x R x (1 + R)^N] / [(1 + R)^N - 1]
SELECT @EMI = ROUND((@LoanAmount * @ROI * POWER((1 + @ROI), @Tenure)) / (POWER((1 + @ROI), @Tenure) - 1),2)
WHILE @Period <= @Tenure
BEGIN
--INTEREST
= [P x R]
SELECT
@Interest = ROUND((@LoanAmount * @ROI),2)
--PRINCIPAL
= [EMI - INTEREST]
SELECT
@Principal = ROUND((@EMI - @Interest),2)
--OUTSTANDING
LOAN AMOUNT = [@LoanAmount - Principal]
SELECT
@LoanAmount = ROUND((@LoanAmount -
@Principal),2)
INSERT
INTO @EMI_TABLE VALUES(@Period,DATEADD(MM,@Period,GETDATE()),@EMI,@Principal,@Interest,@LoanAmount)
SET
@Period = @Period +
1
END
SELECT * FROM @EMI_TABLE
Output
P - Loan Amount
R - Rate of Interest
N - Tenure/Loan Period
R - Rate of Interest
N - Tenure/Loan Period
You will get different in paisa. Need to manage as per requirement.
Wow awesome ...Got helped by this.
ReplyDeleteWonderful illustrated information. I thank you about that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject! Development Finance calculator
ReplyDeleteHow to make casino games - DrMCD
ReplyDeleteCasino Games - Play casino games for free, without cost. All games will be tested in 충주 출장샵 real time, 나주 출장샵 or 김해 출장마사지 in-game, 과천 출장샵 and no fees 안산 출장안마 are charged. This