This commit is contained in:
2023-02-22 08:59:32 +01:00
parent da424c83b4
commit abdf9f299a
2 changed files with 66 additions and 17 deletions

View File

@@ -744,34 +744,59 @@ Public Class frmEssensbestellungenAdministration
Private Sub txtBestelllimit_KeyDown(sender As Object, e As KeyEventArgs) Handles txtBestelllimit.KeyDown
'Private Sub txtBestelllimit_KeyDown(sender As Object, e As KeyEventArgs) Handles txtBestelllimit.KeyDown
If e.KeyCode = Keys.Enter Then
' If e.KeyCode = Keys.Enter Then
If IsNumeric(txtBestelllimit.Text) And txtBestelllimit.Text > 0 Then
SQL.doSQL("UPDATE tblEBMenu SET MenuBestellungBisTageVorher='" & txtBestelllimit.Text & "' WHERE MenuDateVon = '" & dt.Rows(0).Item("MenuDateVon").ToString() & "'", "AVISO")
e.Handled = True
End If
' If IsNumeric(txtBestelllimit.Text) And txtBestelllimit.Text > 0 Then
' SQL.doSQL("UPDATE tblEBMenu SET MenuBestellungBisTageVorher='" & txtBestelllimit.Text & "' WHERE MenuDateVon = '" & dt.Rows(0).Item("MenuDateVon").ToString() & "'", "AVISO")
' e.Handled = True
' End If
End If
' End If
End Sub
'End Sub
Private Sub txtBestelllimit_ValueChanged() Handles txtBestelllimit.TextChanged
If cbKW._value Is Nothing Or cbKW._value = "" Then
txtBestelllimit.Enabled = False
btnBestelllimit.Enabled = False
Exit Sub
End If
If dt.Rows.Count > 0 Then
If dt.Rows.Count > 0 AndAlso IsNumeric(txtBestelllimit.Text) Then
calcBestellLimit()
If CDate(dt.Rows(0).Item("MenuDateVon")).ToString("dd.MM.yyyy") < Today Then
txtBestelllimit.Enabled = False
btnBestelllimit.Enabled = False
Else
txtBestelllimit.Enabled = True
btnBestelllimit.Enabled = True
End If
End If
End Sub
Private Sub btnBestelllimit_Click(sender As Object, e As EventArgs) Handles btnBestelllimit.Click
If IsNumeric(txtBestelllimit.Text) And txtBestelllimit.Text > 0 Then
SQL.doSQL("UPDATE tblEBMenu SET MenuBestellungBisTageVorher='" & txtBestelllimit.Text & "' WHERE MenuDateVon = '" & dt.Rows(0).Item("MenuDateVon").ToString() & "'", "AVISO")
btnBestelllimit.Enabled = False
calcBestellLimit()
End If
End Sub
Private Sub calcBestellLimit()
Dim startMenu = Date.Parse(dt.Rows(0).Item("MenuDateVon"))
Dim newTime As New TimeSpan(14, 30, 0)
Dim tageBisBestellende = txtBestelllimit.Text * -1
Dim timeToOrderLimit = startMenu.AddDays(tageBisBestellende) + newTime
lblBestellungBis.Text = "Bestellung möglich bis: " & timeToOrderLimit.ToShortDateString & " - " & timeToOrderLimit.ToShortTimeString
End Sub
End Class