From dba8a60bf429044a902f49d0cb3a2346343929e5 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Wed, 15 Feb 2023 12:27:12 +0100 Subject: [PATCH] Essensbestellung, nun kann in EssensbestellungenAdmin manuell Tage bis Bestelllimit gesetzt werden. --- Aviso/My Project/AssemblyInfo.vb | 4 +- ...sensbestellungenAdministration.Designer.vb | 39 +++++++++++++++ Aviso/frmEssensbestellungenAdministration.vb | 50 ++++++++++++++++--- 3 files changed, 85 insertions(+), 8 deletions(-) diff --git a/Aviso/My Project/AssemblyInfo.vb b/Aviso/My Project/AssemblyInfo.vb index f29d573..d3053cf 100644 --- a/Aviso/My Project/AssemblyInfo.vb +++ b/Aviso/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Aviso/frmEssensbestellungenAdministration.Designer.vb b/Aviso/frmEssensbestellungenAdministration.Designer.vb index ca1ab03..e86aae2 100644 --- a/Aviso/frmEssensbestellungenAdministration.Designer.vb +++ b/Aviso/frmEssensbestellungenAdministration.Designer.vb @@ -28,6 +28,8 @@ 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.lblDaysToOrder = New System.Windows.Forms.Label() + Me.txtBestelllimit = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtMarkierteDS = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Label11 = New System.Windows.Forms.Label() Me.btnNew = New System.Windows.Forms.Button() @@ -115,6 +117,8 @@ Partial Class frmEssensbestellungenAdministration ' 'Panel1 ' + Me.Panel1.Controls.Add(Me.lblDaysToOrder) + Me.Panel1.Controls.Add(Me.txtBestelllimit) Me.Panel1.Controls.Add(Me.txtMarkierteDS) Me.Panel1.Controls.Add(Me.Label11) Me.Panel1.Controls.Add(Me.btnNew) @@ -149,6 +153,39 @@ Partial Class frmEssensbestellungenAdministration Me.Panel1.Size = New System.Drawing.Size(1242, 85) Me.Panel1.TabIndex = 2 ' + 'lblDaysToOrder + ' + Me.lblDaysToOrder.AutoSize = True + Me.lblDaysToOrder.Location = New System.Drawing.Point(347, 59) + Me.lblDaysToOrder.Name = "lblDaysToOrder" + Me.lblDaysToOrder.Size = New System.Drawing.Size(100, 13) + Me.lblDaysToOrder.TabIndex = 68 + Me.lblDaysToOrder.Text = "Bestelllimit in Tagen" + ' + 'txtBestelllimit + ' + Me.txtBestelllimit._DateTimeOnly = False + Me.txtBestelllimit._numbersOnly = False + Me.txtBestelllimit._numbersOnlyKommastellen = "" + Me.txtBestelllimit._numbersOnlyTrennzeichen = True + Me.txtBestelllimit._Prozent = False + Me.txtBestelllimit._ShortDateNew = False + Me.txtBestelllimit._ShortDateOnly = False + Me.txtBestelllimit._TimeOnly = False + Me.txtBestelllimit._TimeOnly_Seconds = False + Me.txtBestelllimit._value = Nothing + Me.txtBestelllimit._Waehrung = False + 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.MaxLineLength = -1 + Me.txtBestelllimit.MaxLines_Warning = "" + Me.txtBestelllimit.MaxLines_Warning_Label = Nothing + Me.txtBestelllimit.Name = "txtBestelllimit" + Me.txtBestelllimit.Size = New System.Drawing.Size(30, 20) + Me.txtBestelllimit.TabIndex = 67 + ' 'txtMarkierteDS ' Me.txtMarkierteDS._DateTimeOnly = False @@ -822,4 +859,6 @@ Partial Class frmEssensbestellungenAdministration Friend WithEvents btnNew As Button Friend WithEvents Label11 As Label Friend WithEvents txtMarkierteDS As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents lblDaysToOrder As Label + Friend WithEvents txtBestelllimit As VERAG_PROG_ALLGEMEIN.MyTextBox End Class diff --git a/Aviso/frmEssensbestellungenAdministration.vb b/Aviso/frmEssensbestellungenAdministration.vb index 4e1a7fd..c522586 100644 --- a/Aviso/frmEssensbestellungenAdministration.vb +++ b/Aviso/frmEssensbestellungenAdministration.vb @@ -27,9 +27,9 @@ Public Class frmEssensbestellungenAdministration cboAbteilung.fillWithSQL("SELECT DISTINCT(eb_abteilung) FROM [tblEssensbestellungen]", False, "AVISO", True) cboAbteilung.changeItem("") - cbKW.fillWithSQL("SELECT DISTINCT(eb_kw) FROM [tblEssensbestellungen] ORDER BY eb_kw desc", False, "AVISO", True) + cbKW.fillWithSQL("SELECT DISTINCT(eb_kw) FROM [tblEssensbestellungen] UNION SELECT (REPLACE(MenuTitel,'Wochenkarte ','')) + ' - ' + Convert(varchar, Year(MenuDateVon)) as kwDateNew FROM [tblEBMenu] where MenuDateVon > GETDATE()ORDER BY eb_kw desc", False, "AVISO", True) - cbxMailKW.Items.AddRange(cbKW.Items.Cast(Of VERAG_PROG_ALLGEMEIN.MyListItem).ToArray()) + cbxMailKW.fillWithSQL("SELECT DISTINCT(eb_kw) FROM [tblEssensbestellungen] ORDER BY eb_kw desc", False, "AVISO", True) cbxMailKW.changeItem("") cbxMailGebäude.changeItem("") @@ -530,16 +530,21 @@ Public Class frmEssensbestellungenAdministration Private Sub cbKW_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbKW.SelectedValueChanged - If cbKW._value Is Nothing Or cbKW._value = "" Then Exit Sub + If cbKW._value Is Nothing Or cbKW._value = "" Then + txtBestelllimit.Text = "" + Exit Sub + End If If dt IsNot Nothing Then dt.Clear() End If - dt = SQL.loadDgvBySql("SELECT Top 1 * from (SELECT (REPLACE(MenuTitel,'Wochenkarte ','')) + ' - ' + Convert(varchar, Year(MenuDateVon)) as kwDate, MenuDateVon, MenuDateBis FROM tblEBMenu) kwDate where kwDate = '" & cbKW._value & "'", "AVISO", 100, True) + dt = SQL.loadDgvBySql("SELECT Top 1 * from (SELECT (REPLACE(MenuTitel,'Wochenkarte ','')) + ' - ' + Convert(varchar, Year(MenuDateVon)) as kwDate, MenuDateVon, MenuDateBis, MenuBestellungBisTageVorher FROM tblEBMenu) kwDate where kwDate = '" & cbKW._value & "'", "AVISO", 100, True) + + txtBestelllimit.Text = "" If dt.Rows.Count > 0 Then - + txtBestelllimit.Text = dt.Rows(0).Item("MenuBestellungBisTageVorher").ToString txtBestellDat.Text = CDate(dt.Rows(0).Item("MenuDateVon")).ToString("dd.MM.yyyy") txtBestellDatBis.Text = CDate(dt.Rows(0).Item("MenuDateBis")).ToString("dd.MM.yyyy") btnSuche.PerformClick() @@ -547,7 +552,6 @@ Public Class frmEssensbestellungenAdministration - End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click, Button2.Click @@ -734,4 +738,38 @@ Public Class frmEssensbestellungenAdministration txtMarkierteDS._value = countSumme.ToString End Sub + + + + + Private Sub txtBestelllimit_KeyDown(sender As Object, e As KeyEventArgs) Handles txtBestelllimit.KeyDown + + 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 + + End If + + End Sub + + Private Sub txtBestelllimit_ValueChanged() Handles txtBestelllimit.TextChanged + If cbKW._value Is Nothing Or cbKW._value = "" Then + txtBestelllimit.Enabled = False + Exit Sub + End If + + If dt.Rows.Count > 0 Then + If CDate(dt.Rows(0).Item("MenuDateVon")).ToString("dd.MM.yyyy") < Today Then + + txtBestelllimit.Enabled = False + Else + txtBestelllimit.Enabled = True + End If + End If + + + End Sub End Class \ No newline at end of file