diff --git a/Aviso/frmEssensbestellungenAdministration.Designer.vb b/Aviso/frmEssensbestellungenAdministration.Designer.vb index e86aae2..c2bad80 100644 --- a/Aviso/frmEssensbestellungenAdministration.Designer.vb +++ b/Aviso/frmEssensbestellungenAdministration.Designer.vb @@ -28,6 +28,7 @@ Partial Class frmEssensbestellungenAdministration Me.Label4 = New System.Windows.Forms.Label() Me.Label22 = New System.Windows.Forms.Label() Me.Panel1 = New System.Windows.Forms.Panel() + Me.btnBestelllimit = New System.Windows.Forms.Button() Me.lblDaysToOrder = New System.Windows.Forms.Label() Me.txtBestelllimit = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtMarkierteDS = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -77,6 +78,7 @@ Partial Class frmEssensbestellungenAdministration Me.lblWarning = New System.Windows.Forms.Label() Me.Button2 = New System.Windows.Forms.Button() Me.Label9 = New System.Windows.Forms.Label() + Me.lblBestellungBis = New System.Windows.Forms.Label() Me.pnlTop.SuspendLayout() Me.Panel1.SuspendLayout() Me.ContextMenuStrip1.SuspendLayout() @@ -117,6 +119,8 @@ Partial Class frmEssensbestellungenAdministration ' 'Panel1 ' + Me.Panel1.Controls.Add(Me.lblBestellungBis) + Me.Panel1.Controls.Add(Me.btnBestelllimit) Me.Panel1.Controls.Add(Me.lblDaysToOrder) Me.Panel1.Controls.Add(Me.txtBestelllimit) Me.Panel1.Controls.Add(Me.txtMarkierteDS) @@ -150,17 +154,26 @@ Partial Class frmEssensbestellungenAdministration Me.Panel1.Controls.Add(Me.Label1) Me.Panel1.Location = New System.Drawing.Point(0, 49) Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(1242, 85) + Me.Panel1.Size = New System.Drawing.Size(1242, 106) Me.Panel1.TabIndex = 2 ' + 'btnBestelllimit + ' + Me.btnBestelllimit.Location = New System.Drawing.Point(313, 79) + Me.btnBestelllimit.Name = "btnBestelllimit" + Me.btnBestelllimit.Size = New System.Drawing.Size(97, 27) + Me.btnBestelllimit.TabIndex = 70 + Me.btnBestelllimit.Text = "aktualisieren" + Me.btnBestelllimit.UseVisualStyleBackColor = True + ' 'lblDaysToOrder ' Me.lblDaysToOrder.AutoSize = True - Me.lblDaysToOrder.Location = New System.Drawing.Point(347, 59) + Me.lblDaysToOrder.Location = New System.Drawing.Point(310, 59) Me.lblDaysToOrder.Name = "lblDaysToOrder" - Me.lblDaysToOrder.Size = New System.Drawing.Size(100, 13) + Me.lblDaysToOrder.Size = New System.Drawing.Size(71, 13) Me.lblDaysToOrder.TabIndex = 68 - Me.lblDaysToOrder.Text = "Bestelllimit in Tagen" + Me.lblDaysToOrder.Text = "BL (in Tagen)" ' 'txtBestelllimit ' @@ -178,7 +191,7 @@ Partial Class frmEssensbestellungenAdministration Me.txtBestelllimit._WaehrungZeichen = False Me.txtBestelllimit.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.txtBestelllimit.ForeColor = System.Drawing.Color.Black - Me.txtBestelllimit.Location = New System.Drawing.Point(311, 55) + Me.txtBestelllimit.Location = New System.Drawing.Point(380, 56) Me.txtBestelllimit.MaxLineLength = -1 Me.txtBestelllimit.MaxLines_Warning = "" Me.txtBestelllimit.MaxLines_Warning_Label = Nothing @@ -298,7 +311,7 @@ Partial Class frmEssensbestellungenAdministration Me.FlatButton7.ForeColor = System.Drawing.Color.Black Me.FlatButton7.Image = Global.AVISO.My.Resources.Resources.refresh Me.FlatButton7.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.FlatButton7.Location = New System.Drawing.Point(1035, 5) + Me.FlatButton7.Location = New System.Drawing.Point(1035, 7) Me.FlatButton7.Name = "FlatButton7" Me.FlatButton7.Size = New System.Drawing.Size(41, 34) Me.FlatButton7.TabIndex = 48 @@ -676,9 +689,9 @@ Partial Class frmEssensbestellungenAdministration Me.dgvBestellungen.AllowUserToDeleteRows = False Me.dgvBestellungen.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvBestellungen.ContextMenuStrip = Me.ContextMenuStrip1 - Me.dgvBestellungen.Location = New System.Drawing.Point(0, 140) + Me.dgvBestellungen.Location = New System.Drawing.Point(0, 161) Me.dgvBestellungen.Name = "dgvBestellungen" - Me.dgvBestellungen.Size = New System.Drawing.Size(1242, 581) + Me.dgvBestellungen.Size = New System.Drawing.Size(1242, 560) Me.dgvBestellungen.TabIndex = 43 ' 'cbxMailKW @@ -773,6 +786,15 @@ Partial Class frmEssensbestellungenAdministration Me.Label9.Text = "Gesamtbetrag" Me.Label9.TextAlign = System.Drawing.ContentAlignment.TopRight ' + 'lblBestellungBis + ' + Me.lblBestellungBis.AutoSize = True + Me.lblBestellungBis.Location = New System.Drawing.Point(429, 60) + Me.lblBestellungBis.Name = "lblBestellungBis" + Me.lblBestellungBis.Size = New System.Drawing.Size(114, 13) + Me.lblBestellungBis.TabIndex = 71 + Me.lblBestellungBis.Text = "Bestellung möglich bis:" + ' 'frmEssensbestellungenAdministration ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -861,4 +883,6 @@ Partial Class frmEssensbestellungenAdministration Friend WithEvents txtMarkierteDS As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents lblDaysToOrder As Label Friend WithEvents txtBestelllimit As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents btnBestelllimit As Button + Friend WithEvents lblBestellungBis As Label End Class diff --git a/Aviso/frmEssensbestellungenAdministration.vb b/Aviso/frmEssensbestellungenAdministration.vb index be02561..f2bcec8 100644 --- a/Aviso/frmEssensbestellungenAdministration.vb +++ b/Aviso/frmEssensbestellungenAdministration.vb @@ -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 \ No newline at end of file