.cs
int loan_amt = Int32.Parse(txtLoan_Amount.Text);
double Int_rate = Double.Parse(TxtInterest_Rate.Text);
string freq = DdlFrequency.SelectedItem.Text;
int duration = Int32.Parse(txtDuration.Text);
double Remaining_amt = Int32.Parse( txtLoan_Amount.Text);
while (Remaining_amt > 0)
{
for(int i =1; i<= duration; i++)
{
double monthly_installment = Math.Round(Financial.Pmt((Int_rate / 100) / 12, duration, -(loan_amt)), 0, MidpointRounding.AwayFromZero);
double interest_amt= Math.Round((Remaining_amt * Int_rate )/100/12 ,0,MidpointRounding.AwayFromZero);
GridView1.Rows[i].Cells[1].Text = i.ToString();
Remaining_amt= Remaining_amt- (monthly_installment-interest_amt);
GridView1.Rows[i].Cells[2].Text = Remaining_amt.ToString();
GridView1.Rows[i].Cells[3].Text = (monthly_installment - interest_amt).ToString();
GridView1.Rows[i].Cells[4].Text = interest_amt.ToString();
GridView1.Rows[i].Cells[5].Text = "";
}
}
double Int_rate = Double.Parse(TxtInterest_Rate.Text);
string freq = DdlFrequency.SelectedItem.Text;
int duration = Int32.Parse(txtDuration.Text);
double Remaining_amt = Int32.Parse( txtLoan_Amount.Text);
while (Remaining_amt > 0)
{
for(int i =1; i<= duration; i++)
{
double monthly_installment = Math.Round(Financial.Pmt((Int_rate / 100) / 12, duration, -(loan_amt)), 0, MidpointRounding.AwayFromZero);
double interest_amt= Math.Round((Remaining_amt * Int_rate )/100/12 ,0,MidpointRounding.AwayFromZero);
GridView1.Rows[i].Cells[1].Text = i.ToString();
Remaining_amt= Remaining_amt- (monthly_installment-interest_amt);
GridView1.Rows[i].Cells[2].Text = Remaining_amt.ToString();
GridView1.Rows[i].Cells[3].Text = (monthly_installment - interest_amt).ToString();
GridView1.Rows[i].Cells[4].Text = interest_amt.ToString();
GridView1.Rows[i].Cells[5].Text = "";
}
}
.aspx
JohnPosted Jul 16, 2016, 4:30 AM
Sharad MishraPosted Jul 16, 2016, 3:09 AM
double Int_rate = Double.Parse(TxtInterest_Rate.Text);
string freq = DdlFrequency.SelectedItem.Text;
int duration = Int32.Parse(txtDuration.Text);
double Remaining_amt = Int32.Parse( txtLoan_Amount.Text);
Sharad MishraPosted Jul 16, 2016, 3:08 AM
JohnPosted Jul 16, 2016, 2:55 AM
Sharad MishraPosted Jul 16, 2016, 2:52 AM
JohnPosted Jul 16, 2016, 2:38 AM
Remaining_amt= Remaining_amt- (monthly_installment-interest_amt);
GridView1.Rows[i].Cells[1].Text = Remaining_amt.ToString();
GridView1.Rows[i].Cells[2].Text = (monthly_installment - interest_amt).ToString();
GridView1.Rows[i].Cells[3].Text = interest_amt.ToString();
GridView1.Rows[i].Cells[4].Text = "";