belDiscipline(id).cod nota.IDisc = id nota.semPlan = CByte(txtSemPlan.Text) nota.data = DateSerial(CInt(txtAnulN.Text), CInt(cmbLunaN.ItemData(cmbLunaN.ListIndex)), CInt(txtZiuaN.Text)) If gTabelDiscipline(id).ModFinalizare = "A" Then nota.nota = 0 nota.notaC = txtNota.Text Else nota.nota = CSng(txtNota.Text) nota.notaC = "" End If nota.Sters = False nota.absent = IIf(chkAbsent.value = vbChecked, True, False) nota.finala = IIf(chkFinala.value = vbChecked, True, False) 'adauga la gTabelNote indn = AdaugaNota(nota) 'adauga la grdNote AdaugaLinieGridNote nota, indn Else indn = IndNota nota = gTabelNote(indn) nota.data = DateSerial(CInt(txtAnulN.Text), CInt(cmbLunaN.ItemData(cmbLunaN.ListIndex)), CInt(txtZiuaN.Text)) If gTabelDiscipline(id).ModFinalizare = "A" Then nota.nota = 0 nota.notaC = txtNota.Text Else nota.nota = CSng(txtNota.Text) nota.notaC = "" End If nota.Sters = False nota.absent = IIf(chkAbsent.value = vbChecked, True, False) nota.finala = IIf(chkFinala.value = vbChecked, True, False) ModificaLinieGridNote nota, indn gTabelNote(indn) = nota End If fraNote.Enabled = False cmdAdaugaT.Enabled = True cmdModificaT.Enabled = grdNote.Rows > 1 cmdStergeT.Enabled = grdNote.Rows > 1 cmdSalveaza.Enabled = True cmdInchide.Enabled = True lEditareGrid = egNone grdNote.Enabled = True lstSemestru.Enabled = True lstSortGrid.Enabled = True txtSemCrt.Enabled = True grdNote.SetFocus flagModif = True End If End Sub Private Sub cmdAdaugaT_Click() lEditareGrid = egAdauga fraNote.Enabled = True chkAbsent.value = vbUnchecked chkFinala.value = vbChecked cmdAdaugaT.Enabled = False cmdModificaT.Enabled = False cmdStergeT.Enabled = False cmdSalveaza.Enabled = False cmdInchide.Enabled = False grdNote.Enabled = False lstSemestru.Enabled = False lstSortGrid.Enabled = False txtSemCrt.Enabled = False lstDisc.Enabled = True txtNota.Text = "" lstDisc.SetFocus If lstDisc.ListIndex >= 0 Then lstDisc_Click End If End Sub Private Sub cmdInchide_Click() Dim rasp As Integer If flagModif Then rasp = MsgBoxT("Datele au fost modificate." & vbCrLf & _ "Doriți să le salvați?", _ vbYesNoCancel, _ "Inchidere fereastra note student") Select Case rasp Case vbYes SalveazaDateNote Case vbCancel Exit Sub End Select End If Unload Me End Sub Private Sub cmdModificaT_Click() If grdNote.Rows > 1 Then lEditareGrid = egModifica fraNote.Enabled = True cmdAdaugaT.Enabled = False cmdModificaT.Enabled = False cmdStergeT.Enabled = False cmdSalveaza.Enabled = False cmdInchide.Enabled = False grdNote.Enabled = False lstSemestru.Enabled = False lstSortGrid.Enabled = False txtSemCrt.Enabled = False lstDisc.Enabled = False txtNota.SetFocus End If End Sub Private Sub cmdRenuntaT_Click() Dim r As Integer fraNote.Enabled = False cmdAdaugaT.Enabled = True cmdModificaT.Enabled = grdNote.Rows > 1 cmdStergeT.Enabled = grdNote.Rows > 1 cmdSalveaza.Enabled = True cmdInchide.Enabled = True lEditareGrid = egNone grdNote.Enabled = True lstSemestru.Enabled = True lstSortGrid.Enabled = True txtSemCrt.Enabled = True grdNote.SetFocus If grdNote.row > 1 Then GridToEditare End Sub Private Sub cmdSalveaza_Click() If Not flagModif Then If MsgBoxT("Datele NU au fost modificate." & vbCrLf & _ "Doriți totuși să le salvați?", _ vbYesNo, _ "Salvare note student") <> vbYes Then Exit Sub End If End If SalveazaDateNote flagModif = False End Sub Private Sub cmdStergeT_Click() Dim indn As Integer If grdNote.row = 0 Then Exit Sub End If If MsgBoxT("Doriți într-adevăr să ștergeți nota" & vbCrLf & _ "Anul universitar = " & CitesteText(grdNote, grdNote.row, 1) & _ " Semestrul = " & CitesteText(grdNote, grdNote.row, 0) & vbCrLf & _ "Disciplina = " & Trim(CitesteText(grdNote, grdNote.row, 3)) & vbCrLf & _ "Nota = " & CitesteText(grdNote, grdNote.row, 6) & _ " din data = " & CitesteText(grdNote, grdNote.row, 5), _ vbYesNo, "Stergere nota") = vbYes Then indn = CInt(CitesteText(grdNote, grdNote.row, 9)) StergeNota indn StergeLinie grdNote cmdModificaT.Enabled = grdNote.Rows > 1 cmdStergeT.Enabled = grdNote.Rows > 1 lblNrDisc.Caption = "Număr note: " & CStr(grdNote.Rows - 1) flagModif = True End If End Sub Private Sub Form_Resize() ConfigureazaForma Me End Sub Function ValideazaNota() As Boolean Dim id As Long ValideazaNota = False 'disciplina If lstDisc.ListIndex < 0 Then MsgBoxS "Selectați o disciplină!" DoEvents lstDisc.SetFocus Exit Function End If id = lstDisc.ItemData(lstDisc.ListIndex) If chkAbsent.value = vbChecked Then chkFinala.value = vbUnchecked txtNota.Text = "0" Else If gTabelDiscipline(id).ModFinalizare <> "A" Then ' valideaza nota numerica If Not IsNumeric(txtNota.Text) Then MsgBoxS "Nota este nenumerică" DoEvents txtNota.SetFocus Exit Function End If If CSng(txtNota.Text) < 1 Or CSng(txtNota.Text) > 10 Then MsgBoxS "Nota nu este cuprinsă între 1 și 10" DoEvents txtNota.SetFocus Exit Function End If If CSng(txtNota.Text) < 5 Then chkFinala.value = vbUnchecked End If End If End If 'data examenului If txtZiuaN.Text = "" Then MsgBoxS "Introduceți ziua examenului" txtZiuaN.SetFocus Exit Function End If If Not IsNumeric(txtZiuaN.Text) Then MsgBoxS "Ziua din data examenului nu este numerica" txtZiuaN.SetFocus Exit Function End If If CInt(txtZiuaN.Text) < 0 Then MsgBoxS "Ziua din data examenului este negativă" txtZiuaN.SetFocus Exit Function End If If cmbLunaN.ListIndex < 0 Then MsgBoxS "Selectați luna din data examenului" cmbLunaN.SetFocus Exit Function End If If txtAnulN.Text = "" Then MsgBoxS "Introduceți anul din data examenului" txtAnulN.SetFocus Exit Function End If If Not IsNumeric(txtAnulN.Text) Then MsgBoxS "Anul din data examenului nu este numeric" txtAnulN.SetFocus Exit Function End If If CInt(txtAnulN.Text) < 0 Then MsgBoxS "Anul din data examenului este negativ" txtAnulN.SetFocus Exit Function End If If Not DataValida(CInt(txtAnulN.Text), _ CInt(cmbLunaN.ItemData(cmbLunaN.ListIndex)), _ CInt(txtZiuaN.Text)) Then MsgBoxS "Data examenului este eronată" DoEvents txtZiuaN.SetFocus Exit Function End If ValideazaNota = True End Function Private Sub grdNote_Compare(ByVal Row1 As Long, ByVal Row2 As Long, Cmp As Integer) Dim d1 As Date, d2 As Date Select Case grdNote.col Case 0, 1, 4 'sort numeric - intregi If grdNote.TextMatrix(Row1, grdNote.col) < grdNote.TextMatrix(Row2, grdNote.col) Then Cmp = -1 ElseIf grdNote.TextMatrix(Row1, grdNote.col) > grdNote.TextMatrix(Row2, grdNote.col) Then Cmp = 1 Else Cmp = 0 End If Case 2, 3, 7, 8 'sort alfa If grdNote.TextMatrix(Row1, grdNote.col) < grdNote.TextMatrix(Row2, grdNote.col) Then Cmp = -1 ElseIf grdNote.TextMatrix(Row1, grdNote.col) > grdNote.TextMatrix(Row2, grdNote.col) Then Cmp = 1 Else Cmp = 0 End If Case 5 'sort data d1 = StringPctToData(grdNote.TextMatrix(Row1, grdNote.col)) d2 = StringPctToData(grdNote.TextMatrix(Row2, grdNote.col)) If d1 < d2 Then Cmp = -1 ElseIf d1 > d2 Then Cmp = 1 Else Cmp = 0 E