p align="left"> Sheets("База").Cells(all + 1, 14) = AddClientForm.ed_mobile.Text Sheets("База").Cells(all + 1, 15) = "Нет" Sheets("База").Cells(all + 1, 16) = "Нет" Sheets("База").Cells(all + 1, 17) = "Нет" Sheets("База").Cells(all + 1, 18) = AddClientForm.cb_car.Value Sheets("База").Cells(all + 1, 19) = AddClientForm.cb_teacher.Value Sheets("База").Cells(all + 1, 20) = 0 Sheets("База").Cells(all + 1, 21) = 0 Sheets("База").Cells(all + 1, 23) = "Нет" Sheets("База").Cells(all + 1, 24) = "Нет" Sheets("База").Cells(all + 1, 25) = "Нет" Sheets("База").Cells(all + 1, 26) = "Нет" Sheets("База").Cells(all + 1, 27) = "Нет" Sheets("База").Cells(all + 1, 28) = "Нет" Sheets("База").Cells(all + 1, 29) = "Ожидает" x = MsgBox("Клиент успешно занесен в базу данных", vbInformation + vbOKOnly, "Автошкола") AddClientForm.Hide ClientForm.Show (0) Else erin: x = MsgBox("Проверьте правильность введеных значений", vbCritical + vbOKOnly, "Автошкола") End If End Sub Кнопка “Закрыть”: Private Sub bt_exit_Click() AddClientForm.Hide ClientForm.Show (0) End Sub Список “Автомобиль”: Private Sub cb_car_Change() Sheets("Данные").Activate cb_teacher.Clear For i = 2 To 10 If Sheets("Данные").Cells(i, 4) = cb_car.Value Then cb_teacher.AddItem Sheets("Данные").Cells(i, 3) Next i cb_teacher.ListIndex = 0 End Sub Поле “Дом”: Private Sub ed_home_Change() ed_home.Text = Val(ed_home.Text) End Sub Поле “Сотовый”: Private Sub ed_mobile_Change() ed_mobile.Text = Val(ed_mobile.Text) End Sub Поле “Номер”: Private Sub ed_num_Change() ed_num.Text = Val(ed_num.Text) End Sub Поле “Дом. телефон”: Private Sub ed_phone_Change() ed_phone.Text = Val(ed_phone.Text) End Sub Поле “Квартира”: Private Sub ed_room_Change() ed_room.Text = Val(ed_room.Text) End Sub Поле “Серия”: Private Sub ed_ser_Change() ed_ser.Text = Val(ed_ser.Text) End Sub Активация формы: Private Sub UserForm_Activate() ed_surname.Text = "" ed_name.Text = "" ed_patron.Text = "" ed_birth.Text = "" ed_who.Text = "" ed_date.Text = "" ed_ser.Text = "" ed_num.Text = "" ed_str.Text = "" ed_home.Text = "" ed_room.Text = "" ed_phone.Text = "" ed_mobile.Text = "" End Sub Инициализация формы: Private Sub UserForm_Initialize() Sheets("Данные").Activate cb_car.ListIndex = 0 cb_teacher.Clear cb_teacher.AddItem Cells(4, 3) cb_teacher.ListIndex = 0 End Sub Завершение работы формы: Private Sub UserForm_Terminate() AddClientForm.Hide ClientForm.Show (0) End Sub 5.7 Форма “Формирование бланка оплаты”Кнопка “Закрыть”: Private Sub bt_exit_Click() PayForm.Hide ClientForm.Show (0) End Sub Кнопка “Сформировать бланк”: Private Sub bt_makeblank_Click() If (ed_datepay.Text = CDate(ed_datepay.Text)) And cb_whopay.Text <> "" And ed_money.Value <> "" And ed_money.Value <> 0 Then Sheets("Оплата").Activate Sheets("Оплата").Range("B5").Value = cb_whopay.Value Sheets("Оплата").Range("C8").Value = ed_datepay.Text Sheets("Оплата").Range("C9").Value = ed_money.Text & " руб." PayForm.Hide Sheets("Оплата").Visible = True Else x = MsgBox("Проверьте правильность введеных значений", vbCritical + vbOKOnly, "Автошкола") End If End Sub Кнопка “Подтвердить оплату”: Private Sub bt_pay_Click() If (ed_datepay.Text = CDate(ed_datepay.Text)) And cb_whopay.Text <> "" And ed_money.Value <> "" And ed_money.Value <> 0 Then Sheets("База").Activate Sheets("База").Cells(1, 1).Select all = Selection.CurrentRegion.Rows.Count For i = 2 To all If Sheets("База").Cells(i, 29) <> "Окончил" And (Sheets("База").Cells(i, 2) & " " & Sheets("База").Cells(i, 3) & " " & Sheets("База").Cells(i, 4)) = cb_whopay.Text Then Cells(i, 21) = Val(Cells(i, 21)) + ed_money.Value Next i y = MsgBox("Оплата внесена!", vbInformation + vbOKOnly, "Автошкола") Else x = MsgBox("Проверьте правильность введеных значений", vbCritical + vbOKOnly, "Автошкола") End If End Sub Поле “Сумма платежа (руб.)”: Private Sub ed_money_Change() ed_money.Value = Val(ed_money.Value) End Sub Активация формы: Private Sub UserForm_Activate() cb_whopay.Clear ed_money.Value = "" Dim x As Integer x = 0 ed_datepay.Text = Date Sheets("База").Activate Sheets("База").Cells(1, 1).Select all = Selection.CurrentRegion.Rows.Count For i = 2 To all If Sheets("База").Cells(i, 29) <> "Окончил" Then cb_whopay.AddItem (Sheets("База").Cells(i, 2) & " " & Sheets("База").Cells(i, 3) & " " & Sheets("База").Cells(i, 4)) x = x + 1 End If Next i If x = 0 Then y = MsgBox("Текущая группа пуста!", vbCritical + vbOKOnly, "Автошкола") PayForm.Hide ClientForm.Show (0) Else cb_whopay.ListIndex = 0 End If End Sub Завершение работы формы: Private Sub UserForm_Terminate() PayForm.Hide ClientForm.Show (0) End Sub 5.8 Форма “Допуски”Процедура (обновление активности): Sub endis() level_1.Enabled = True level_2.Enabled = True level_3.Enabled = True If cb_able.Value = True And cb_pdd.Value = True And cb_help.Value = True And Val(desc_howmuchdrive.Text) >= Sheets("Данные").Range("L4") And Val(desc_howmuchpay.Caption) >= Sheets("Данные").Range("L2") Then level_1.Enabled = False If cb_insidepdd.Value = True And cb_insidedrive.Value = True And cb_insidegorod.Value = True Then level_2.Enabled = False Else level_3.Enabled = False End If Else level_2.Enabled = False level_3.Enabled = False End If End Sub Кнопка “Выйти”: Private Sub bt_exit_Click() WayForm.Hide ClientForm.Show (0) End Sub Кнопка “Сохранить”: Private Sub bt_save_Click() Sheets("База").Activate Sheets("База").Cells(1, 1).Select all = Selection.CurrentRegion.Rows.Count For i = 2 To all If ComboBox1.Text = (Sheets("База").Cells(i, 2) & " " & Sheets("База").Cells(i, 3) & " " & Sheets("База").Cells(i, 4)) And Sheets("База").Cells(i, 29) = "Обучаемый" Then If cb_able.Value = True Then Sheets("База").Cells(i, 17) = "Да" Else Sheets("База").Cells(i, 17) = "Нет" If cb_pdd.Value = True Then Sheets("База").Cells(i, 15) = "Да" Else Sheets("База").Cells(i, 15) = "Нет" If cb_help.Value = True Then Sheets("База").Cells(i, 16) = "Да" Else Sheets("База").Cells(i, 16) = "Нет" If cb_insidepdd.Value = True Then Sheets("База").Cells(i, 23) = "Да" Else Sheets("База").Cells(i, 23) = "Нет" If cb_insidedrive.Value = True Then Sheets("База").Cells(i, 24) = "Да" Else Sheets("База").Cells(i, 24) = "Нет" If cb_insidegorod.Value = True Then Sheets("База").Cells(i, 25) = "Да" Else Sheets("База").Cells(i, 25) = "Нет" If cb_gaipdd.Value = True Then Sheets("База").Cells(i, 26) = "Да" Else Sheets("База").Cells(i, 26) = "Нет" If cb_gaidrive.Value = True Then Sheets("База").Cells(i, 27) = "Да" Else Sheets("База").Cells(i, 27) = "Нет" If cb_gaigorod.Value = True Then Sheets("База").Cells(i, 28) = "Да" Else Sheets("База").Cells(i, 28) = "Нет" Sheets("База").Cells(i, 20) = desc_howmuchdrive.Text End If Next i End Sub Элементы типа Checkbox: Private Sub cb_able_Click() Call endis End Sub Private Sub cb_help_Click() Call endis End Sub Private Sub cb_insidedrive_Click() Call endis End Sub Private Sub cb_insidegorod_Click() Call endis End Sub Private Sub cb_insidepdd_Click() Call endis End Sub Private Sub cb_pdd_Click() Call endis End Sub Список “Клиент”: Private Sub ComboBox1_Change() Sheets("База").Activate Sheets("База").Cells(1, 1).Select all = Selection.CurrentRegion.Rows.Count For i = 2 To all If ComboBox1.Text = (Sheets("База").Cells(i, 2) & " " & Sheets("База").Cells(i, 3) & " " & Sheets("База").Cells(i, 4)) And Sheets("База").Cells(i, 29) = "Обучаемый" Then cb_able.Value = False cb_pdd.Value = False cb_help.Value = False cb_insidepdd.Value = False cb_insidedrive.Value = False cb_insidegorod.Value = False cb_gaipdd.Value = False cb_gaidrive.Value = False cb_gaigorod.Value = False level_1.Enabled = True level_2.Enabled = True level_3.Enabled = True If Sheets("База").Cells(i, 17) = "Да" Then cb_able.Value = True If Sheets("База").Cells(i, 15) = "Да" Then cb_pdd.Value = True If Sheets("База").Cells(i, 16) = "Да" Then cb_help.Value = True If Sheets("База").Cells(i, 23) = "Да" Then cb_insidepdd.Value = True If Sheets("База").Cells(i, 24) = "Да" Then cb_insidedrive.Value = True If Sheets("База").Cells(i, 25) = "Да" Then cb_insidegorod.Value = True If Sheets("База").Cells(i, 26) = "Да" Then cb_gaipdd.Value = True If Sheets("База").Cells(i, 27) = "Да" Then cb_gaidrive.Value = True
Страницы: 1, 2, 3, 4, 5
|