Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Документация_4.2 / Пояснительная записка 4.2_ГОСТ.doc
Скачиваний:
28
Добавлен:
17.04.2015
Размер:
678.4 Кб
Скачать

Форма ипотечного калькулятора

Public Class ipoteka

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim r_monthly_payment As Integer, r_total_percent As Double, r_total_purchase_refund As Double, r_total_percent_refund As Double, r_effective_mortgage_percent As Double, mortgage_percent_without_comma_and_percent As Double

Dim val1 As Integer, val2 As Integer, zpp As Integer

Dim mortgage_percent_without_comma

'Валидатор

If Not ValidateNumericTextBox(Label3.Text.Substring(0, Label3.Text.Length - 6), purchase_amount, Lala, Nothing, Nothing) Then Return

If Not ValidateNumericTextBox(Label4.Text.Substring(0, Label4.Text.Length - 6), mortgage_amount, Lala, Nothing, Nothing) Then Return

If Not ValidateNumericTextBox(Label5.Text.Substring(0, Label5.Text.Length - 3), mortgage_percent, Lala, Nothing, Nothing) Then Return

If Not ValidateNumericTextBox(Label6.Text.Substring(0, Label6.Text.Length - 6), mortgage_term, Lala, Nothing, Nothing) Then Return

If Not ValidateNumericTextBox(Label7.Text.Substring(0, Label7.Text.Length - 6), monthly_gross_salary, Lala, Nothing, Nothing) Then Return

' Конец валидатора

val1 = purchase_amount.Text

val2 = 2000000

mortgage_percent_without_comma = Replace(mortgage_percent.Text, ",", ".") 'сли внесена запятая, заменим на точку

mortgage_percent_without_comma_and_percent = Replace(mortgage_percent_without_comma, "%", "") 'если внесен знак процента, уберем его

r_monthly_payment = mortgage_amount.Text / ((1 - Math.Pow(1 + ((mortgage_percent_without_comma_and_percent / 12) / 100), -mortgage_term.Text * 12)) / ((mortgage_percent_without_comma_and_percent / 12) / 100))

r_total_percent = r_monthly_payment * 12 * mortgage_term.Text - mortgage_amount.Text

r_total_purchase_refund = Math.Min(val1, val2) * 0.13

r_total_percent_refund = r_total_percent * 0.13

r_effective_mortgage_percent = mortgage_percent_without_comma_and_percent - 1.3

zpp = monthly_gross_salary.Text

'Если зарплата меньше ежемесячного платежа, предупредить

If zpp < r_monthly_payment Then

MsgBox("Размер ежемесячных платежей превышает вашу заработную плату. Измените, пожалуйста, срок кредита")

End If

'вывод значений на экан

ezemes_platez.Text = r_monthly_payment

vsego_percentov.Text = r_total_percent

nal_za_vse_godi.Text = r_total_purchase_refund

vozvrat_percentov.Text = r_total_percent_refund

pers_s_uchetom.Text = r_effective_mortgage_percent

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

purchase_amount.Text = ""

mortgage_amount.Text = ""

mortgage_percent.Text = ""

mortgage_term.Text = ""

monthly_gross_salary.Text = ""

ezemes_platez.Text = ""

vsego_percentov.Text = ""

nal_za_vse_godi.Text = ""

vozvrat_percentov.Text = ""

pers_s_uchetom.Text = ""

End Sub

Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked

nal_ipoteka.Show()

End Sub

End Class

2

Соседние файлы в папке Документация_4.2