From 830347ae427bd8c3b0910664c94023742a8979e1 Mon Sep 17 00:00:00 2001 From: Kilian Wirl Date: Fri, 3 Apr 2026 16:11:07 +0200 Subject: [PATCH] =?UTF-8?q?HatNachwaesche=20bei=20Kunden=20hinterlegt,=20S?= =?UTF-8?q?peichern=20von=20=C3=84nderungen=20in=20KundenVW,=20UCInventur?= =?UTF-8?q?=20Abbrechen=20implementiert,=20FehlmengeCount=20EK=20Artikel?= =?UTF-8?q?=20verarbeitet,=20Nachw=C3=A4scheverarbeitung=20begonnen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AA-Forms/FormArtikelVW.Designer.cs | 48 ++++++- AA-Forms/FormArtikelVW.cs | 211 ++++++++++++++++++++++++++--- AA-Forms/FormFehlmengeCount.cs | 101 +++++++++----- AA-Forms/FormKundeVW.cs | 56 +++++--- AA-Forms/FormKundeVW.designer.cs | 136 ++++++++++++------- AA-Forms/FormMain.cs | 4 +- AA-Klassen/Artikel.cs | 29 ++-- AA-Klassen/ArtikelNachwaesche.cs | 102 ++++++++++++++ AA-Klassen/Auftrag.cs | 5 +- AA-Klassen/DataClass.cs | 52 +++++++ AA-Klassen/Funktionen.cs | 134 +----------------- AA-Klassen/Kunde.cs | 23 ++-- AA-Klassen/KundeArtikel.cs | 22 ++- Program.cs | 17 ++- UserControls/UCInventur.cs | 2 +- Verwaltung.csproj | 2 + Verwaltung_ReadMe.txt | 16 +-- 17 files changed, 647 insertions(+), 313 deletions(-) create mode 100644 AA-Klassen/ArtikelNachwaesche.cs create mode 100644 AA-Klassen/DataClass.cs diff --git a/AA-Forms/FormArtikelVW.Designer.cs b/AA-Forms/FormArtikelVW.Designer.cs index ced8d80..191b9a8 100644 --- a/AA-Forms/FormArtikelVW.Designer.cs +++ b/AA-Forms/FormArtikelVW.Designer.cs @@ -30,44 +30,78 @@ { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormArtikelVW)); this.objectListViewArtikel = new BrightIdeasSoftware.ObjectListView(); + this.fLPSuche = new System.Windows.Forms.FlowLayoutPanel(); + this.comboBoxArtikel = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.objectListViewArtikel)).BeginInit(); + this.fLPSuche.SuspendLayout(); this.SuspendLayout(); // // objectListViewArtikel // this.objectListViewArtikel.AlternateRowBackColor = System.Drawing.Color.LightSteelBlue; + this.objectListViewArtikel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.objectListViewArtikel.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClick; + this.objectListViewArtikel.CellEditEnterChangesRows = true; this.objectListViewArtikel.CellEditUseWholeCell = false; this.objectListViewArtikel.Cursor = System.Windows.Forms.Cursors.Default; - this.objectListViewArtikel.Dock = System.Windows.Forms.DockStyle.Fill; this.objectListViewArtikel.FullRowSelect = true; this.objectListViewArtikel.GridLines = true; this.objectListViewArtikel.HideSelection = false; - this.objectListViewArtikel.Location = new System.Drawing.Point(0, 0); + this.objectListViewArtikel.Location = new System.Drawing.Point(271, 0); + this.objectListViewArtikel.Margin = new System.Windows.Forms.Padding(4); this.objectListViewArtikel.MultiSelect = false; this.objectListViewArtikel.Name = "objectListViewArtikel"; this.objectListViewArtikel.SelectColumnsOnRightClick = false; this.objectListViewArtikel.SelectColumnsOnRightClickBehaviour = BrightIdeasSoftware.ObjectListView.ColumnSelectBehaviour.None; - this.objectListViewArtikel.Size = new System.Drawing.Size(860, 496); + this.objectListViewArtikel.Size = new System.Drawing.Size(876, 610); this.objectListViewArtikel.TabIndex = 0; this.objectListViewArtikel.UseAlternatingBackColors = true; this.objectListViewArtikel.UseCompatibleStateImageBehavior = false; this.objectListViewArtikel.UseFiltering = true; this.objectListViewArtikel.View = System.Windows.Forms.View.Details; - this.objectListViewArtikel.AfterCreatingGroups += new System.EventHandler(this.objectListViewArtikel_AfterCreatingGroups); this.objectListViewArtikel.ButtonClick += new System.EventHandler(this.objectListViewArtikel_ButtonClick); + this.objectListViewArtikel.CellEditFinished += new BrightIdeasSoftware.CellEditEventHandler(this.objectListViewArtikel_CellEditFinished); + this.objectListViewArtikel.CellEditStarting += new BrightIdeasSoftware.CellEditEventHandler(this.objectListViewArtikel_CellEditStarting); + this.objectListViewArtikel.Resize += new System.EventHandler(this.objectListViewArtikel_Resize); + // + // fLPSuche + // + this.fLPSuche.Controls.Add(this.comboBoxArtikel); + this.fLPSuche.Dock = System.Windows.Forms.DockStyle.Left; + this.fLPSuche.Location = new System.Drawing.Point(0, 0); + this.fLPSuche.Name = "fLPSuche"; + this.fLPSuche.Size = new System.Drawing.Size(264, 610); + this.fLPSuche.TabIndex = 1; + // + // comboBoxArtikel + // + this.comboBoxArtikel.Dock = System.Windows.Forms.DockStyle.Top; + this.comboBoxArtikel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxArtikel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.comboBoxArtikel.FormattingEnabled = true; + this.comboBoxArtikel.Location = new System.Drawing.Point(3, 3); + this.comboBoxArtikel.Name = "comboBoxArtikel"; + this.comboBoxArtikel.Size = new System.Drawing.Size(261, 33); + this.comboBoxArtikel.TabIndex = 0; + this.comboBoxArtikel.SelectedIndexChanged += new System.EventHandler(this.comboBoxArtikel_SelectedIndexChanged); // // FormArtikelVW // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); - this.ClientSize = new System.Drawing.Size(860, 496); + this.ClientSize = new System.Drawing.Size(1147, 610); + this.Controls.Add(this.fLPSuche); this.Controls.Add(this.objectListViewArtikel); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4); this.Name = "FormArtikelVW"; this.Text = "ARTIKELVERWALTUNG"; this.Load += new System.EventHandler(this.FormArtikelVW_Load); ((System.ComponentModel.ISupportInitialize)(this.objectListViewArtikel)).EndInit(); + this.fLPSuche.ResumeLayout(false); this.ResumeLayout(false); } @@ -75,5 +109,7 @@ #endregion private BrightIdeasSoftware.ObjectListView objectListViewArtikel; + private System.Windows.Forms.FlowLayoutPanel fLPSuche; + private System.Windows.Forms.ComboBox comboBoxArtikel; } } \ No newline at end of file diff --git a/AA-Forms/FormArtikelVW.cs b/AA-Forms/FormArtikelVW.cs index cccfa3e..155f91c 100644 --- a/AA-Forms/FormArtikelVW.cs +++ b/AA-Forms/FormArtikelVW.cs @@ -1,4 +1,9 @@ -using System; +using BrightIdeasSoftware; +using DatenDB; +using Deckungsbeitrag.AA_Klassen; +using Deckungsbeitrag.UserControls; +//using HarfBuzzSharp; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -8,24 +13,39 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using BrightIdeasSoftware; -using DatenDB; namespace Deckungsbeitrag { public partial class FormArtikelVW : Form { + private Benutzer user; + private List artikelList; + private List artNWList; public FormArtikelVW() { InitializeComponent(); } + public FormArtikelVW(Benutzer benutzer) : this() + { + this.user = benutzer; + } private void FormArtikelVW_Load(object sender, EventArgs e) { - OLV_Load(); - + + List artlist = Artikel.GetArtikelList("Nachwaesche"); + this.comboBoxArtikel.SelectedIndexChanged -= comboBoxArtikel_SelectedIndexChanged; + this.comboBoxArtikel.DataSource = artlist; + this.comboBoxArtikel.DisplayMember = "Bezeichnung"; + this.comboBoxArtikel.SelectedIndex = -1; + this.comboBoxArtikel.SelectedIndexChanged += comboBoxArtikel_SelectedIndexChanged; + + OLV_Load_with_Artikel(); + } + #region ObjectListView + private void OLV_GroupCount() { foreach (OLVGroup group in this.objectListViewArtikel.OLVGroups) @@ -42,24 +62,99 @@ namespace Deckungsbeitrag } - private void OLV_Load() + private void OLV_Load_with_Artikel() { - Generator.GenerateColumns(this.objectListViewArtikel, typeof(Artikel), true); - this.objectListViewArtikel.SetObjects(Artikel.GetArtikelList()); - OLVColumn sortColumn = new OLVColumn(); - sortColumn = (OLVColumn)this.objectListViewArtikel.Columns[6]; - this.objectListViewArtikel.Sort(sortColumn); - OLV_GroupCount(); - OLVColumn buttonColumn = new OLVColumn(); - buttonColumn = (OLVColumn)this.objectListViewArtikel.Columns[7]; - buttonColumn.IsButton = true; - buttonColumn.ButtonSizing = OLVColumn.ButtonSizingMode.CellBounds; - this.objectListViewArtikel = Funktionen.Columns_Resize(null, this.objectListViewArtikel).olv; + //foreach (OLVColumn col in this.objectListViewArtikel.Columns) col.IsEditable = false; + + if (this.user.Rolle == BenutzerRolle.Expedit || this.user.Rolle == BenutzerRolle.Frottee || this.user.Rolle == BenutzerRolle.Master) + { + //TODO: Einbinden der NachwaescheArtikelData... + Generator.GenerateColumns(this.objectListViewArtikel, typeof(NachwaescheArtikelData)); + this.artikelList = Artikel.GetArtikelList("Nachwaesche"); + var NWArtikelList = new List(); + foreach (Artikel art in this.artikelList) + { - this.objectListViewArtikel.FilterMenuBuildStrategy = new MeinFilterMenu(); + NWArtikelList.Add(new NachwaescheArtikelData + { + ArtikelID = art.ArtikelID, + ArtNummer = art.Nummer.ToString(), + ArtName = art.Bezeichnung, + Short = art.Short, + Sauber = 0, + Muell = 0, + Kategorie = art.Kategorie + }); + + } + //foreach (OLVColumn col in this.objectListViewArtikel.Columns) if (col.Text == "Kategorie" || col.Text == "Abkürzung") col.IsVisible = col.IsEditable = false; + this.objectListViewArtikel.Font = new Font(this.objectListViewArtikel.Font.FontFamily, 16, FontStyle.Regular); + //this.objectListViewArtikel.SetObjects(this.artikelList); + this.objectListViewArtikel.SetObjects(NWArtikelList); + this.objectListViewArtikel.PrimarySortColumn = (OLVColumn)this.objectListViewArtikel.AllColumns[6]; + this.objectListViewArtikel.SecondarySortColumn = (OLVColumn)this.objectListViewArtikel.Columns["Abkürzung"]; + this.objectListViewArtikel.Sort(); + this.objectListViewArtikel.Refresh(); + } + else + { + Generator.GenerateColumns(this.objectListViewArtikel, typeof(Artikel), true); + this.artikelList = Artikel.GetArtikelList("Alle"); + this.objectListViewArtikel.SetObjects(this.artikelList); + OLVColumn sortColumn = new OLVColumn(); + sortColumn = (OLVColumn)this.objectListViewArtikel.Columns[6]; + this.objectListViewArtikel.Sort(sortColumn); + OLV_GroupCount(); + OLVColumn buttonColumn = new OLVColumn(); + buttonColumn = (OLVColumn)this.objectListViewArtikel.Columns[7]; + buttonColumn.IsButton = true; + buttonColumn.ButtonSizing = OLVColumn.ButtonSizingMode.CellBounds; + + } + OLV_ColumnsResize(this.objectListViewArtikel); } + private void OLV_Load_with_Kunden(Artikel art) + { + this.Cursor = Cursors.WaitCursor; + this.SuspendLayout(); + this.objectListViewArtikel.Columns.Clear(); + this.objectListViewArtikel.ShowGroups = false; + Generator.GenerateColumns(this.objectListViewArtikel, typeof(NWData)); + + List kndartList = KundeArtikel.GetFehlmengeList(null, art.ArtikelID); + var NWDataList = new List(); + + // Kunden sammeln + foreach (KundeArtikel kndart in kndartList) + { + Kunde knd = Kunde.GetKunde(null, kndart.KundeID, null); + NWDataList.Add(new NWData + { + KndArtID = kndart.KundeArtikelID, + KundeID = kndart.KundeID, + KndNummer = knd.KundeNummer, + Kunde = knd.Suchtext == null ? knd.KundeName : knd.Suchtext, + Nachwaesche = kndart.Fehlmenge + }); + } + + this.objectListViewArtikel.SetObjects(NWDataList); + this.objectListViewArtikel.Refresh(); + + OLV_ColumnsResize(this.objectListViewArtikel); + + this.ResumeLayout(); + this.Cursor = Cursors.Default; + } + private void OLV_ColumnsResize(ObjectListView olv) + { + this.objectListViewArtikel.FilterMenuBuildStrategy = new MeinFilterMenu(); + this.objectListViewArtikel.Width = Funktionen.Columns_Resize(null, objectListViewArtikel).olv.Width + 20; + + this.objectListViewArtikel.Refresh(); + } private void objectListViewArtikel_ButtonClick(object sender, CellClickEventArgs e) { Artikel artikel = (Artikel)e.Model; @@ -83,5 +178,85 @@ namespace Deckungsbeitrag } } + + private void objectListViewArtikel_CellEditFinished(object sender, CellEditEventArgs e) + { + OLVColumn col = e.Column; + DateTime timestamp = DateTime.Now.Date; + + if (col == null) return; + + if (int.TryParse(e.NewValue.ToString(), out int i)) + { + if (i > 0) + { + Artikel art = Artikel.GetArtikel(null, ((NachwaescheArtikelData)e.RowObject).ArtikelID); + ArtikelNachwaesche artnw = ArtikelNachwaesche.FindeDatensatz(art.ArtikelID, timestamp); + + if (col.Text == "Sauber") + { + if (artnw.NachwaescheID != null) artnw.Sauber += i; + else + { + artnw = new ArtikelNachwaesche() + { + ArtikelID = art.ArtikelID, + Datum = timestamp, + Sauber = i + }; + } + + + } + if (col.Text == "Müll") + { + if (artnw.NachwaescheID != null) artnw.Muell += i; + else + { + artnw = new ArtikelNachwaesche() + { + ArtikelID = art.ArtikelID, + Datum = timestamp, + Muell = i + }; + } + } + artnw.Save(); + } + else + { + if (col.Text == "Nachwäsche") + { + NWData nw = (NWData)e.RowObject; + KundeArtikel kndart = KundeArtikel.GetItem((int)nw.KndArtID); + kndart.Fehlmenge = i; + kndart.Save(); + } + } + } + else { MessageBox.Show("Bitte nur ganze Zahlen eingeben.", "ACHTUNG", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; } + + this.objectListViewArtikel.RefreshObject(e.RowObject); + } + + private void objectListViewArtikel_CellEditStarting(object sender, CellEditEventArgs e) + { + OLVColumn col = e.Column; + if (e.Control is NumericUpDown numeric) { numeric.Select(0, Text.Length); numeric.Focus(); } + } + #endregion + private void comboBoxArtikel_SelectedIndexChanged(object sender, EventArgs e) + { + ComboBox cb = sender as ComboBox; + Artikel art = cb.SelectedItem as Artikel; + + OLV_Load_with_Kunden(art); + } + + private void objectListViewArtikel_Resize(object sender, EventArgs e) + { + this.ClientSize = new Size(this.objectListViewArtikel.Width + this.objectListViewArtikel.Left, this.ClientSize.Height); + + } } } diff --git a/AA-Forms/FormFehlmengeCount.cs b/AA-Forms/FormFehlmengeCount.cs index 1136c67..647754f 100644 --- a/AA-Forms/FormFehlmengeCount.cs +++ b/AA-Forms/FormFehlmengeCount.cs @@ -1,5 +1,6 @@ using AForge.Video.DirectShow; using DatenDB; +using Deckungsbeitrag.AA_Klassen; using System; using System.CodeDom; using System.Collections.Generic; @@ -102,7 +103,7 @@ namespace Deckungsbeitrag this.labelAnmerkungText.BackColor = Color.White; } //this.textBoxScann.Clear(); - this.artikelListe = KundeArtikel.GetFehlmengeList(kunde.KundeID.ToString()); + if (this.kunde.HatNachwaesche) this.artikelListe = KundeArtikel.GetFehlmengeList(kunde.KundeID.ToString(), null); this.textBoxScann.Text = this.kunde.KundeNummer; this.textBoxScann.Enabled = false; if ((userid != null && userid.Contains("reklamation")) || (this.benutzer != null && this.benutzer.Rolle == BenutzerRolle.Expedit)) Reklamation_GroupBox(); @@ -132,10 +133,28 @@ namespace Deckungsbeitrag /// private void GroupBox_Load() { + if (!this.kunde.HatNachwaesche) + { + this.tableLayoutPanelArtikel.Visible = false; + Label label = new Label() + { + Name = "labelNoNW", + Text = "DIESER KUNDE HAT EIGENWÄSCHE.\n\nKEINE NACHWÄSCHE ZU ERFASSEN.\n\nSCHMUTZIGE TEILE SEPARAT AN KUNDE SCHICKEN.", + Font = new Font(labelSuchtext.Font.FontFamily, 40, FontStyle.Bold), + ForeColor = Color.White, + AutoSize = false, + Dock = DockStyle.Fill, + TextAlign = ContentAlignment.MiddleCenter + + }; + this.groupBoxArtikel.Controls.Add(label); + this.groupBoxArtikel.Visible = true; + return; + } foreach (Button btn in this.tableLayoutPanelArtikel.Controls) btn.Tag = btn.Text = null; this.groupBoxArtikel.Visible = true; - + this.tableLayoutPanelArtikel.Visible = true; //TODO: Nach Test und Rücksprache eventuell wieder umbauen. Benutzer.Rolle etc. // Buttons werden den Artikeln aus der Artikelliste zugewiesen. Unterschied zwischen Frotteewäsche, Spannleintüchern, Großteilen und Kleinteilen foreach (KundeArtikel artikel in artikelListe) @@ -150,28 +169,28 @@ namespace Deckungsbeitrag // Wird bei FROTTEE verarbeitet. switch (artikel.ArtikelNR) { - case var nr when nr.ToString().StartsWith("6311"): //HANDTUCH + case var nr when nr.ToString().Substring(1).StartsWith("311"): //HANDTUCH this.buttonArt1.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6312") & nr.ToString().EndsWith("0"): //DUSCHTUCH WEISS + case var nr when nr.ToString().Substring(1).StartsWith("312") & nr.ToString().EndsWith("0"): //DUSCHTUCH WEISS this.buttonArt2.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6314"): //BADEVORLEGER + case var nr when nr.ToString().Substring(1).StartsWith("314"): //BADEVORLEGER this.buttonArt3.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6313"): //BADETUCH + case var nr when nr.ToString().Substring(1).StartsWith("313"): //BADETUCH this.buttonArt4.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6316"): //BADEMANTEL + case var nr when nr.ToString().Substring(1).StartsWith("316"): //BADEMANTEL this.buttonArt5.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6324"): //SAUNATUCH + case var nr when nr.ToString().Substring(1).StartsWith("324"): //SAUNATUCH this.buttonArt6.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("6312") & nr.ToString().EndsWith("1"): //DUSCHTUCH BLAU + case var nr when nr.ToString().Substring(1).StartsWith("312") & nr.ToString().EndsWith("1"): //DUSCHTUCH BLAU this.buttonArt7.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61115") & (nr.ToString().EndsWith("00") || nr.ToString().EndsWith("10")): //SPANNLEINTUCH SINGLE + case var nr when nr.ToString().Substring(1).StartsWith("1115") & (nr.ToString().EndsWith("00") || nr.ToString().EndsWith("10")): //SPANNLEINTUCH SINGLE this.buttonArt8.Tag = artikel; break; default: @@ -185,13 +204,13 @@ namespace Deckungsbeitrag // Wird bei Großteilen verarbeitet switch (artikel.ArtikelNR) { - case var nr when nr.ToString().StartsWith("6112"): //DECKENBEZUG + case var nr when nr.ToString().Substring(1).StartsWith("112"): //DECKENBEZUG this.buttonArt1.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61110"): //LEINTUCH SINGLE + case var nr when nr.ToString().Substring(1).StartsWith("1110"): //LEINTUCH SINGLE this.buttonArt2.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61112"): //DOPPELLEINTUCH + case var nr when nr.ToString().Substring(1).StartsWith("1112"): //DOPPELLEINTUCH this.buttonArt3.Tag = artikel; break; //case var nr when nr.ToString().StartsWith(""): @@ -220,25 +239,25 @@ namespace Deckungsbeitrag // Wird bei Kleinteilen verarbeitet switch (artikel.ArtikelNR) { - case var nr when nr.ToString().StartsWith("61210"): //POLSTERBEZUG 60x80 + case var nr when nr.ToString().Substring(1).StartsWith("1210"): //POLSTERBEZUG 60x80 this.buttonArt1.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61211") & nr.ToString().EndsWith("0"): //POLSTERBEZUG 40x40 + case var nr when nr.ToString().Substring(1).StartsWith("1211") & nr.ToString().EndsWith("0"): //POLSTERBEZUG 40x40 this.buttonArt2.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61211") & nr.ToString().EndsWith("1"): //POLSTERBEZUG 40x50 + case var nr when nr.ToString().Substring(1).StartsWith("1211") & nr.ToString().EndsWith("1"): //POLSTERBEZUG 40x50 this.buttonArt3.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61211") & nr.ToString().EndsWith("2"): //POLSTERBEZUG 40x60 + case var nr when nr.ToString().Substring(1).StartsWith("1211") & nr.ToString().EndsWith("2"): //POLSTERBEZUG 40x60 this.buttonArt4.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61211") & nr.ToString().EndsWith("3"): //POLSTERBEZUG 40x70 + case var nr when nr.ToString().Substring(1).StartsWith("1211") & nr.ToString().EndsWith("3"): //POLSTERBEZUG 40x70 this.buttonArt5.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61221"): //MUNDSERVIETTE + case var nr when nr.ToString().Substring(1).StartsWith("1221"): //MUNDSERVIETTE this.buttonArt6.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61222"): //DECKSERVIETTE + case var nr when nr.ToString().Substring(1).StartsWith("1222"): //DECKSERVIETTE this.buttonArt7.Tag = artikel; break; default: @@ -253,28 +272,28 @@ namespace Deckungsbeitrag { switch (artikel.ArtikelNR) { - case var nr when nr.ToString().StartsWith("61115") & (nr.ToString().EndsWith("00") || nr.ToString().EndsWith("30")): //SPANNLEINTUCH SINGLE + case var nr when nr.ToString().Substring(1).StartsWith("1115") & (nr.ToString().EndsWith("00") || nr.ToString().EndsWith("30")): //SPANNLEINTUCH SINGLE this.buttonArt1.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61115") & nr.ToString().EndsWith("10"): //SPANNLEINTUCH SINGLE GELB + case var nr when nr.ToString().Substring(1).StartsWith("1115") & nr.ToString().EndsWith("10"): //SPANNLEINTUCH SINGLE GELB this.buttonArt2.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61115") & nr.ToString().EndsWith("20"): //SPANNLEINTUCH SINGLE WEISS + case var nr when nr.ToString().Substring(1).StartsWith("1115") & nr.ToString().EndsWith("20"): //SPANNLEINTUCH SINGLE WEISS this.buttonArt3.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61115") & (nr.ToString().EndsWith("30") || nr.ToString().EndsWith("40")): //SPANNLEINTUCH QUEEN BLAU GELB + case var nr when nr.ToString().Substring(1).StartsWith("1115") & (nr.ToString().EndsWith("30") || nr.ToString().EndsWith("40")): //SPANNLEINTUCH QUEEN BLAU GELB this.buttonArt4.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61116") & nr.ToString().EndsWith("00"): //SPANNLEINTUCH DOUBLE + case var nr when nr.ToString().Substring(1).StartsWith("1116") & nr.ToString().EndsWith("00"): //SPANNLEINTUCH DOUBLE this.buttonArt5.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61116") & (nr.ToString().EndsWith("10") || nr.ToString().EndsWith("40")): //SPANNLEINTUCH LILA ITALO + case var nr when nr.ToString().Substring(1).StartsWith("1116") & (nr.ToString().EndsWith("10") || nr.ToString().EndsWith("40")): //SPANNLEINTUCH LILA ITALO this.buttonArt6.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61116") & (nr.ToString().EndsWith("20") || nr.ToString().EndsWith("21")): //SPANNLEINTUCH DOUBLE WEISS GRAU + case var nr when nr.ToString().Substring(1).StartsWith("1116") & (nr.ToString().EndsWith("20") || nr.ToString().EndsWith("21")): //SPANNLEINTUCH DOUBLE WEISS GRAU this.buttonArt7.Tag = artikel; break; - case var nr when nr.ToString().StartsWith("61116") & nr.ToString().EndsWith("30"): //SPANNLEINTUCH DOUBLE ROT + case var nr when nr.ToString().Substring(1).StartsWith("1116") & nr.ToString().EndsWith("30"): //SPANNLEINTUCH DOUBLE ROT this.buttonArt8.Tag = artikel; break; default: @@ -416,7 +435,7 @@ namespace Deckungsbeitrag /// Auftragliste aufrufen. /// /// Wenn Extrakunde dann true - private void Open_Liste() + private async void Open_Liste() { int listentyp = 0; @@ -494,19 +513,29 @@ namespace Deckungsbeitrag { // Beim geklickten Artikel wird Fehlmenge erhöht Button btn = (Button)sender; - KundeArtikel artstand = (KundeArtikel)btn.Tag; + KundeArtikel kndart = (KundeArtikel)btn.Tag; - if ((userid != null && userid.Contains("reklamation")) || (this.benutzer != null && this.benutzer.Rolle == BenutzerRolle.Expedit)) artstand.Reklamation++; - else { artstand.Fehlmenge++; artstand.Save(); return; } + if ((userid != null && userid.Contains("reklamation")) || (this.benutzer != null && this.benutzer.Rolle == BenutzerRolle.Expedit)) kndart.Reklamation++; + else kndart.Fehlmenge++; // Wenn speichern nicht möglich, wird darauf hingewiesen. - if (artstand.Save() != 1) meldung.FehlmengeCount(); + if (kndart.Save() != 1) meldung.FehlmengeCount(); else { - Artikel artikel = Artikel.GetArtikel(artstand.ArtikelNR); - artikel.Nachwaesche++; + DateTime timestamp = DateTime.Now.Date; + ArtikelNachwaesche artnw = ArtikelNachwaesche.FindeDatensatz(kndart.ArtikelID, timestamp); + if (artnw.NachwaescheID != null) artnw.Nachwaesche++; + else + { + artnw = new ArtikelNachwaesche() + { + ArtikelID = kndart.ArtikelID, + Datum = timestamp, + Nachwaesche = 1 + }; + } - artikel.Save(); + artnw.Save(); } } diff --git a/AA-Forms/FormKundeVW.cs b/AA-Forms/FormKundeVW.cs index 58b5946..30a28bc 100644 --- a/AA-Forms/FormKundeVW.cs +++ b/AA-Forms/FormKundeVW.cs @@ -41,8 +41,10 @@ namespace Deckungsbeitrag private bool aufgabeChanged = false; private bool serviceChanged = false; private bool lieferrhythmusChanged = false; + private bool nachwaescheChanged = false; + private bool _tosave = false; - public FormKundeVW() + public FormKundeVW() { InitializeComponent(); } @@ -190,6 +192,9 @@ namespace Deckungsbeitrag this.textBoxSuchtext.Text = this.kunde.Suchtext; this.textBoxAnmerkung.Text = this.kunde.Anmerkung; + // CheckBox aktivieren + this.checkBoxNW.Checked = this.kunde.HatNachwaesche; + // ComboBox-Item für Aufgabe wird gewählt und Button Entfernen aktiviert foreach (Aufgabe auf in comboBoxAufgabe.Items) if (auf.AufgabeID == this.kunde.Aufgabe) this.comboBoxAufgabe.SelectedItem = auf; if (this.comboBoxAufgabe.SelectedItem != null) this.buttonAufgEnt.Enabled = true; @@ -262,6 +267,11 @@ namespace Deckungsbeitrag } private void TSBNext_Click(object sender, EventArgs e) { + if (_tosave) + { + if (MessageBox.Show("Möchtest du die Änderungen speichern?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) this.kunde.Save(); + } + // Kundenliste öffnen und Kunde auswählen. this.kunde = Funktionen.KundenAuswahl(); if (kunde != null) DatenLesen(); @@ -534,7 +544,7 @@ namespace Deckungsbeitrag private void textBoxAnmerkung_Leave(object sender, EventArgs e) { - if (textBoxAnmerkung.TextLength > 0) if (meldung.GetFrage(this, "Möchtest du die Anmerkung speichern?", false) == DialogResult.Yes) { kunde.Anmerkung = textBoxAnmerkung.Text; kunde.Save(); } + if (textBoxAnmerkung.TextLength > 0) if (meldung.GetFrage(this, "Möchtest du die Anmerkung speichern?", false) == DialogResult.Yes) { kunde.Anmerkung = textBoxAnmerkung.Text; } } private void numericUpDownAufgabeCount_Leave(object sender, EventArgs e) { @@ -557,29 +567,37 @@ namespace Deckungsbeitrag private void textBoxAnmerkung_TextChanged(object sender, EventArgs e) { if (formloading) return; - anmerkungChanged = true; + _tosave = true; labelAnzahlChars.Text = textBoxAnmerkung.TextLength.ToString() + "/" + textBoxAnmerkung.MaxLength.ToString(); + textBoxAnmerkung_Leave(this, null); } private void comboBoxAufgabe_SelectedIndexChanged(object sender, EventArgs e) { if (formloading) return; - aufgabeChanged = true; + if (this.comboBoxAufgabe.SelectedItem != null && this.numericUpDownAufgabeCount.Value == 0) { meldung.GetFehler(this, $"Du hast für deine Aufgabe noch keine Auftraganzahl eingegeben. Hole das bitte jetzt nach."); return; } + _tosave = true; } private void numericUpDownAufgabeCount_ValueChanged(object sender, EventArgs e) { + NumericUpDown numeric = (NumericUpDown)sender; if (formloading) return; - aufgabeChanged = true; - + if (numeric.Value > 0) numericUpDownAufgabeCount_Leave(this, null); + else { meldung.GetFehler(this, $"Du hast für deine Aufgabe noch keine Auftraganzahl eingegeben. Hole das bitte jetzt nach."); return; } + _tosave = true; } private void comboBoxService_SelectedValueChanged(object sender, EventArgs e) { - if ((formloading)) return; - serviceChanged = true; + if (formloading) return; + if (this.comboBoxService.Enabled == true) this.kunde.Service = this.comboBoxService.SelectedValue.ToString(); + else return; + _tosave = true; } private void comboBoxLieferrhythmus_SelectedIndexChanged(object sender, EventArgs e) { - if ((formloading)) return; - lieferrhythmusChanged = true; + if (formloading) return; + this.kunde.SommerLieferRhythmus = (int)this.comboBoxLRSommer.SelectedValue; + this.kunde.WinterLieferRhythmus = (int)this.comboBoxLRWinter.SelectedValue; + _tosave = true; } /// @@ -589,19 +607,17 @@ namespace Deckungsbeitrag /// private void FormKundeVW_FormClosing(object sender, FormClosingEventArgs e) { - if (anmerkungChanged) textBoxAnmerkung_Leave(this, null); - if (this.comboBoxAufgabe.SelectedItem != null && this.numericUpDownAufgabeCount.Value == 0) { meldung.GetFehler(this, $"Du hast für deine Aufgabe noch keine Auftraganzahl eingegeben. Hole das bitte jetzt nach."); e.Cancel = true; return; } - if (aufgabeChanged) { numericUpDownAufgabeCount_Leave(this, null); } - if (serviceChanged) { if (this.comboBoxService.Enabled == true) this.kunde.Service = this.comboBoxService.SelectedValue.ToString(); } - if (lieferrhythmusChanged) + if (_tosave) { - this.kunde.SommerLieferRhythmus = (int)this.comboBoxLRSommer.SelectedValue; - this.kunde.WinterLieferRhythmus = (int)this.comboBoxLRWinter.SelectedValue; + if (MessageBox.Show("Möchtest du die Änderungen speichern?", "FRAGE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) this.kunde.Save(); } - - this.kunde.Save(); } - + private void checkBoxNW_Click(object sender, EventArgs e) + { + if (formloading) return; + this.kunde.HatNachwaesche = this.checkBoxNW.Checked; + _tosave = true; + } } } //INSTALL-REMINDER: Tabelle KundeArtikel Spalten ArtikelID und Reihung hinzufügen. diff --git a/AA-Forms/FormKundeVW.designer.cs b/AA-Forms/FormKundeVW.designer.cs index 47bbb08..6118e56 100644 --- a/AA-Forms/FormKundeVW.designer.cs +++ b/AA-Forms/FormKundeVW.designer.cs @@ -103,6 +103,7 @@ namespace Deckungsbeitrag this.buttonServiceBearbeiten = new System.Windows.Forms.Button(); this.buttonAufgEnt = new System.Windows.Forms.Button(); this.pictureBoxQRCode = new System.Windows.Forms.PictureBox(); + this.checkBoxNW = new System.Windows.Forms.CheckBox(); this.contextMenuStrip1.SuspendLayout(); this.tabControlKunde.SuspendLayout(); this.tabPageVorschau.SuspendLayout(); @@ -128,7 +129,7 @@ namespace Deckungsbeitrag this.textBoxKndNr.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxKndNr.Location = new System.Drawing.Point(13, 99); this.textBoxKndNr.Name = "textBoxKndNr"; - this.textBoxKndNr.Size = new System.Drawing.Size(102, 26); + this.textBoxKndNr.Size = new System.Drawing.Size(102, 30); this.textBoxKndNr.TabIndex = 0; // // labelKundeNummer @@ -138,7 +139,7 @@ namespace Deckungsbeitrag this.labelKundeNummer.ForeColor = System.Drawing.Color.White; this.labelKundeNummer.Location = new System.Drawing.Point(9, 76); this.labelKundeNummer.Name = "labelKundeNummer"; - this.labelKundeNummer.Size = new System.Drawing.Size(69, 20); + this.labelKundeNummer.Size = new System.Drawing.Size(86, 25); this.labelKundeNummer.TabIndex = 2; this.labelKundeNummer.Text = "KND NR"; // @@ -149,7 +150,7 @@ namespace Deckungsbeitrag this.labelKundeName.ForeColor = System.Drawing.Color.White; this.labelKundeName.Location = new System.Drawing.Point(9, 128); this.labelKundeName.Name = "labelKundeName"; - this.labelKundeName.Size = new System.Drawing.Size(51, 20); + this.labelKundeName.Size = new System.Drawing.Size(64, 25); this.labelKundeName.TabIndex = 3; this.labelKundeName.Text = "Name"; // @@ -159,7 +160,7 @@ namespace Deckungsbeitrag this.textBoxKundeName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxKundeName.Location = new System.Drawing.Point(13, 151); this.textBoxKundeName.Name = "textBoxKundeName"; - this.textBoxKundeName.Size = new System.Drawing.Size(263, 26); + this.textBoxKundeName.Size = new System.Drawing.Size(263, 30); this.textBoxKundeName.TabIndex = 4; // // textBoxStraße @@ -168,7 +169,7 @@ namespace Deckungsbeitrag this.textBoxStraße.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxStraße.Location = new System.Drawing.Point(13, 255); this.textBoxStraße.Name = "textBoxStraße"; - this.textBoxStraße.Size = new System.Drawing.Size(352, 26); + this.textBoxStraße.Size = new System.Drawing.Size(352, 30); this.textBoxStraße.TabIndex = 5; // // labelStraße @@ -178,7 +179,7 @@ namespace Deckungsbeitrag this.labelStraße.ForeColor = System.Drawing.Color.White; this.labelStraße.Location = new System.Drawing.Point(9, 232); this.labelStraße.Name = "labelStraße"; - this.labelStraße.Size = new System.Drawing.Size(94, 20); + this.labelStraße.Size = new System.Drawing.Size(116, 25); this.labelStraße.TabIndex = 6; this.labelStraße.Text = "Straße/HNr."; // @@ -188,7 +189,7 @@ namespace Deckungsbeitrag this.textBoxPLZ.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxPLZ.Location = new System.Drawing.Point(13, 307); this.textBoxPLZ.Name = "textBoxPLZ"; - this.textBoxPLZ.Size = new System.Drawing.Size(102, 26); + this.textBoxPLZ.Size = new System.Drawing.Size(102, 30); this.textBoxPLZ.TabIndex = 9; // // labelPLZ @@ -198,7 +199,7 @@ namespace Deckungsbeitrag this.labelPLZ.ForeColor = System.Drawing.Color.White; this.labelPLZ.Location = new System.Drawing.Point(9, 284); this.labelPLZ.Name = "labelPLZ"; - this.labelPLZ.Size = new System.Drawing.Size(38, 20); + this.labelPLZ.Size = new System.Drawing.Size(48, 25); this.labelPLZ.TabIndex = 10; this.labelPLZ.Text = "PLZ"; // @@ -208,7 +209,7 @@ namespace Deckungsbeitrag this.textBoxOrt.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxOrt.Location = new System.Drawing.Point(121, 307); this.textBoxOrt.Name = "textBoxOrt"; - this.textBoxOrt.Size = new System.Drawing.Size(244, 26); + this.textBoxOrt.Size = new System.Drawing.Size(244, 30); this.textBoxOrt.TabIndex = 11; // // labelOrt @@ -218,7 +219,7 @@ namespace Deckungsbeitrag this.labelOrt.ForeColor = System.Drawing.Color.White; this.labelOrt.Location = new System.Drawing.Point(117, 284); this.labelOrt.Name = "labelOrt"; - this.labelOrt.Size = new System.Drawing.Size(31, 20); + this.labelOrt.Size = new System.Drawing.Size(39, 25); this.labelOrt.TabIndex = 12; this.labelOrt.Text = "Ort"; // @@ -229,7 +230,7 @@ namespace Deckungsbeitrag this.labelKdnName2.ForeColor = System.Drawing.Color.White; this.labelKdnName2.Location = new System.Drawing.Point(9, 180); this.labelKdnName2.Name = "labelKdnName2"; - this.labelKdnName2.Size = new System.Drawing.Size(100, 20); + this.labelKdnName2.Size = new System.Drawing.Size(123, 25); this.labelKdnName2.TabIndex = 25; this.labelKdnName2.Text = "NameZusatz"; // @@ -239,14 +240,14 @@ namespace Deckungsbeitrag this.textBoxKndName2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxKndName2.Location = new System.Drawing.Point(13, 203); this.textBoxKndName2.Name = "textBoxKndName2"; - this.textBoxKndName2.Size = new System.Drawing.Size(352, 26); + this.textBoxKndName2.Size = new System.Drawing.Size(352, 30); this.textBoxKndName2.TabIndex = 26; // // buttonBewertung // this.buttonBewertung.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonBewertung.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonBewertung.Location = new System.Drawing.Point(195, 706); + this.buttonBewertung.Location = new System.Drawing.Point(195, 748); this.buttonBewertung.Name = "buttonBewertung"; this.buttonBewertung.Size = new System.Drawing.Size(170, 41); this.buttonBewertung.TabIndex = 1; @@ -257,7 +258,7 @@ namespace Deckungsbeitrag // this.buttonProgramm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.buttonProgramm.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonProgramm.Location = new System.Drawing.Point(13, 706); + this.buttonProgramm.Location = new System.Drawing.Point(13, 748); this.buttonProgramm.Name = "buttonProgramm"; this.buttonProgramm.Size = new System.Drawing.Size(170, 41); this.buttonProgramm.TabIndex = 28; @@ -273,7 +274,7 @@ namespace Deckungsbeitrag this.textBoxSuchtext.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxSuchtext.Location = new System.Drawing.Point(122, 99); this.textBoxSuchtext.Name = "textBoxSuchtext"; - this.textBoxSuchtext.Size = new System.Drawing.Size(154, 26); + this.textBoxSuchtext.Size = new System.Drawing.Size(154, 30); this.textBoxSuchtext.TabIndex = 38; // // label1 @@ -283,7 +284,7 @@ namespace Deckungsbeitrag this.label1.ForeColor = System.Drawing.Color.White; this.label1.Location = new System.Drawing.Point(118, 76); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(95, 20); + this.label1.Size = new System.Drawing.Size(122, 25); this.label1.TabIndex = 39; this.label1.Text = "SUCHTEXT"; // @@ -294,7 +295,7 @@ namespace Deckungsbeitrag this.comboBoxAufgabe.FormattingEnabled = true; this.comboBoxAufgabe.Location = new System.Drawing.Point(13, 498); this.comboBoxAufgabe.Name = "comboBoxAufgabe"; - this.comboBoxAufgabe.Size = new System.Drawing.Size(263, 28); + this.comboBoxAufgabe.Size = new System.Drawing.Size(263, 33); this.comboBoxAufgabe.TabIndex = 41; this.comboBoxAufgabe.SelectedIndexChanged += new System.EventHandler(this.comboBoxAufgabe_SelectedIndexChanged); this.comboBoxAufgabe.DropDownClosed += new System.EventHandler(this.comboBoxAufgabe_DropDownClosed); @@ -306,23 +307,24 @@ namespace Deckungsbeitrag this.label2.ForeColor = System.Drawing.Color.White; this.label2.Location = new System.Drawing.Point(9, 475); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(123, 20); + this.label2.Size = new System.Drawing.Size(152, 25); this.label2.TabIndex = 42; this.label2.Text = "Kundenaufgabe"; // // contextMenuStrip1 // + this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.nächsterKundeToolStripMenuItem}); this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(186, 26); + this.contextMenuStrip1.Size = new System.Drawing.Size(217, 28); // // nächsterKundeToolStripMenuItem // this.nächsterKundeToolStripMenuItem.Name = "nächsterKundeToolStripMenuItem"; this.nächsterKundeToolStripMenuItem.ShortcutKeyDisplayString = "[F9]"; this.nächsterKundeToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F9; - this.nächsterKundeToolStripMenuItem.Size = new System.Drawing.Size(185, 22); + this.nächsterKundeToolStripMenuItem.Size = new System.Drawing.Size(216, 24); this.nächsterKundeToolStripMenuItem.Text = "Nächster Kunde"; this.nächsterKundeToolStripMenuItem.Click += new System.EventHandler(this.nächsterKundeToolStripMenuItem_Click); // @@ -340,7 +342,7 @@ namespace Deckungsbeitrag this.tabControlKunde.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.tabControlKunde.Name = "tabControlKunde"; this.tabControlKunde.SelectedIndex = 0; - this.tabControlKunde.Size = new System.Drawing.Size(933, 730); + this.tabControlKunde.Size = new System.Drawing.Size(1009, 772); this.tabControlKunde.TabIndex = 44; // // tabPageVorschau @@ -348,9 +350,9 @@ namespace Deckungsbeitrag this.tabPageVorschau.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); this.tabPageVorschau.Controls.Add(this.buttonSWS_Drucken); this.tabPageVorschau.Controls.Add(this.pictureBoxEntwurf); - this.tabPageVorschau.Location = new System.Drawing.Point(4, 29); + this.tabPageVorschau.Location = new System.Drawing.Point(4, 34); this.tabPageVorschau.Name = "tabPageVorschau"; - this.tabPageVorschau.Size = new System.Drawing.Size(925, 697); + this.tabPageVorschau.Size = new System.Drawing.Size(1001, 734); this.tabPageVorschau.TabIndex = 2; this.tabPageVorschau.Text = "SWS-Vorschau"; // @@ -361,7 +363,7 @@ namespace Deckungsbeitrag this.buttonSWS_Drucken.FlatAppearance.BorderSize = 0; this.buttonSWS_Drucken.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSWS_Drucken.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.buttonSWS_Drucken.Location = new System.Drawing.Point(622, 653); + this.buttonSWS_Drucken.Location = new System.Drawing.Point(698, 690); this.buttonSWS_Drucken.Name = "buttonSWS_Drucken"; this.buttonSWS_Drucken.Size = new System.Drawing.Size(300, 41); this.buttonSWS_Drucken.TabIndex = 36; @@ -378,7 +380,7 @@ namespace Deckungsbeitrag this.pictureBoxEntwurf.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pictureBoxEntwurf.Location = new System.Drawing.Point(0, 0); this.pictureBoxEntwurf.Name = "pictureBoxEntwurf"; - this.pictureBoxEntwurf.Size = new System.Drawing.Size(925, 647); + this.pictureBoxEntwurf.Size = new System.Drawing.Size(1001, 684); this.pictureBoxEntwurf.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBoxEntwurf.TabIndex = 16; this.pictureBoxEntwurf.TabStop = false; @@ -395,11 +397,11 @@ namespace Deckungsbeitrag this.tabPageUmsatz.Controls.Add(this.labelJahresumsatz); this.tabPageUmsatz.Controls.Add(this.chartJahresumsatz); this.tabPageUmsatz.Controls.Add(this.olvJahresumsatz); - this.tabPageUmsatz.Location = new System.Drawing.Point(4, 29); + this.tabPageUmsatz.Location = new System.Drawing.Point(4, 34); this.tabPageUmsatz.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.tabPageUmsatz.Name = "tabPageUmsatz"; this.tabPageUmsatz.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.tabPageUmsatz.Size = new System.Drawing.Size(925, 697); + this.tabPageUmsatz.Size = new System.Drawing.Size(925, 692); this.tabPageUmsatz.TabIndex = 0; this.tabPageUmsatz.Text = "Umsatz"; // @@ -410,7 +412,7 @@ namespace Deckungsbeitrag this.labelMonatsumsatz.ForeColor = System.Drawing.Color.White; this.labelMonatsumsatz.Location = new System.Drawing.Point(615, 53); this.labelMonatsumsatz.Name = "labelMonatsumsatz"; - this.labelMonatsumsatz.Size = new System.Drawing.Size(136, 20); + this.labelMonatsumsatz.Size = new System.Drawing.Size(164, 25); this.labelMonatsumsatz.TabIndex = 46; this.labelMonatsumsatz.Text = "Monatsumsätze"; // @@ -466,7 +468,7 @@ namespace Deckungsbeitrag this.labelQuartalsumsatz.ForeColor = System.Drawing.Color.White; this.labelQuartalsumsatz.Location = new System.Drawing.Point(309, 53); this.labelQuartalsumsatz.Name = "labelQuartalsumsatz"; - this.labelQuartalsumsatz.Size = new System.Drawing.Size(145, 20); + this.labelQuartalsumsatz.Size = new System.Drawing.Size(175, 25); this.labelQuartalsumsatz.TabIndex = 43; this.labelQuartalsumsatz.Text = "Quartalsumsätze"; // @@ -522,7 +524,7 @@ namespace Deckungsbeitrag this.labelJahresumsatz.ForeColor = System.Drawing.Color.White; this.labelJahresumsatz.Location = new System.Drawing.Point(7, 55); this.labelJahresumsatz.Name = "labelJahresumsatz"; - this.labelJahresumsatz.Size = new System.Drawing.Size(131, 20); + this.labelJahresumsatz.Size = new System.Drawing.Size(159, 25); this.labelJahresumsatz.TabIndex = 40; this.labelJahresumsatz.Text = "Jahresumsätze"; // @@ -576,11 +578,11 @@ namespace Deckungsbeitrag this.tabPageArtikel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); this.tabPageArtikel.Controls.Add(this.buttonSpeichern); this.tabPageArtikel.Controls.Add(this.dGArtikel); - this.tabPageArtikel.Location = new System.Drawing.Point(4, 29); + this.tabPageArtikel.Location = new System.Drawing.Point(4, 34); this.tabPageArtikel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.tabPageArtikel.Name = "tabPageArtikel"; this.tabPageArtikel.Padding = new System.Windows.Forms.Padding(4, 5, 4, 5); - this.tabPageArtikel.Size = new System.Drawing.Size(925, 697); + this.tabPageArtikel.Size = new System.Drawing.Size(1001, 734); this.tabPageArtikel.TabIndex = 1; this.tabPageArtikel.Text = "Artikelliste"; // @@ -592,7 +594,7 @@ namespace Deckungsbeitrag this.buttonSpeichern.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.buttonSpeichern.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.buttonSpeichern.ForeColor = System.Drawing.Color.White; - this.buttonSpeichern.Location = new System.Drawing.Point(618, 648); + this.buttonSpeichern.Location = new System.Drawing.Point(694, 685); this.buttonSpeichern.Name = "buttonSpeichern"; this.buttonSpeichern.Size = new System.Drawing.Size(300, 41); this.buttonSpeichern.TabIndex = 37; @@ -621,7 +623,8 @@ namespace Deckungsbeitrag this.dGArtikel.Location = new System.Drawing.Point(4, 5); this.dGArtikel.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.dGArtikel.Name = "dGArtikel"; - this.dGArtikel.Size = new System.Drawing.Size(913, 635); + this.dGArtikel.RowHeadersWidth = 51; + this.dGArtikel.Size = new System.Drawing.Size(989, 672); this.dGArtikel.TabIndex = 11; this.dGArtikel.CellBeginEdit += new System.Windows.Forms.DataGridViewCellCancelEventHandler(this.dGArtikel_CellBeginEdit); this.dGArtikel.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dGArtikel_CellValueChanged); @@ -629,59 +632,81 @@ namespace Deckungsbeitrag // KundeArtikelID // this.KundeArtikelID.HeaderText = "KundeArtikelID"; + this.KundeArtikelID.MinimumWidth = 6; this.KundeArtikelID.Name = "KundeArtikelID"; this.KundeArtikelID.Visible = false; + this.KundeArtikelID.Width = 125; // // KundeID // this.KundeID.HeaderText = "KundeID"; + this.KundeID.MinimumWidth = 6; this.KundeID.Name = "KundeID"; this.KundeID.Visible = false; + this.KundeID.Width = 125; // // ArtikelNR // this.ArtikelNR.HeaderText = "Art. Nr."; + this.ArtikelNR.MinimumWidth = 6; this.ArtikelNR.Name = "ArtikelNR"; + this.ArtikelNR.Width = 125; // // ArtikelName // this.ArtikelName.HeaderText = "Art. Name"; + this.ArtikelName.MinimumWidth = 6; this.ArtikelName.Name = "ArtikelName"; + this.ArtikelName.Width = 125; // // Stand // this.Stand.HeaderText = "Stand"; + this.Stand.MinimumWidth = 6; this.Stand.Name = "Stand"; + this.Stand.Width = 125; // // Fehlmenge // this.Fehlmenge.HeaderText = "Fehlmenge"; + this.Fehlmenge.MinimumWidth = 6; this.Fehlmenge.Name = "Fehlmenge"; + this.Fehlmenge.Width = 125; // // Reklamation // this.Reklamation.HeaderText = "Reklamation"; + this.Reklamation.MinimumWidth = 6; this.Reklamation.Name = "Reklamation"; + this.Reklamation.Width = 125; // // Korrektur // this.Korrektur.HeaderText = "Korrektur"; + this.Korrektur.MinimumWidth = 6; this.Korrektur.Name = "Korrektur"; + this.Korrektur.Width = 125; // // StandBearbeitet // this.StandBearbeitet.HeaderText = "Stand Bearbeitet"; + this.StandBearbeitet.MinimumWidth = 6; this.StandBearbeitet.Name = "StandBearbeitet"; + this.StandBearbeitet.Width = 125; // // FehlmengeBearbeitet // this.FehlmengeBearbeitet.HeaderText = "Fehlmenge Bearbeitet"; + this.FehlmengeBearbeitet.MinimumWidth = 6; this.FehlmengeBearbeitet.Name = "FehlmengeBearbeitet"; + this.FehlmengeBearbeitet.Width = 125; // // KorrekturBearbeitet // this.KorrekturBearbeitet.HeaderText = "Korrektur Bearbeitet"; + this.KorrekturBearbeitet.MinimumWidth = 6; this.KorrekturBearbeitet.Name = "KorrekturBearbeitet"; + this.KorrekturBearbeitet.Width = 125; // // buttonNextKunde // @@ -705,7 +730,7 @@ namespace Deckungsbeitrag this.label3.ForeColor = System.Drawing.Color.White; this.label3.Location = new System.Drawing.Point(9, 336); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(61, 20); + this.label3.Size = new System.Drawing.Size(78, 25); this.label3.TabIndex = 47; this.label3.Text = "Service"; // @@ -716,7 +741,7 @@ namespace Deckungsbeitrag this.comboBoxService.Location = new System.Drawing.Point(13, 361); this.comboBoxService.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.comboBoxService.Name = "comboBoxService"; - this.comboBoxService.Size = new System.Drawing.Size(315, 28); + this.comboBoxService.Size = new System.Drawing.Size(315, 33); this.comboBoxService.TabIndex = 48; this.comboBoxService.SelectedValueChanged += new System.EventHandler(this.comboBoxService_SelectedValueChanged); // @@ -729,7 +754,7 @@ namespace Deckungsbeitrag this.textBoxAnmerkung.Multiline = true; this.textBoxAnmerkung.Name = "textBoxAnmerkung"; this.textBoxAnmerkung.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBoxAnmerkung.Size = new System.Drawing.Size(352, 141); + this.textBoxAnmerkung.Size = new System.Drawing.Size(352, 183); this.textBoxAnmerkung.TabIndex = 50; this.textBoxAnmerkung.TextChanged += new System.EventHandler(this.textBoxAnmerkung_TextChanged); this.textBoxAnmerkung.Leave += new System.EventHandler(this.textBoxAnmerkung_Leave); @@ -741,7 +766,7 @@ namespace Deckungsbeitrag this.label4.ForeColor = System.Drawing.Color.White; this.label4.Location = new System.Drawing.Point(9, 529); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(109, 20); + this.label4.Size = new System.Drawing.Size(135, 25); this.label4.TabIndex = 51; this.label4.Text = "Anmerkungen"; // @@ -752,7 +777,7 @@ namespace Deckungsbeitrag this.labelAnzahlChars.ForeColor = System.Drawing.Color.White; this.labelAnzahlChars.Location = new System.Drawing.Point(312, 532); this.labelAnzahlChars.Name = "labelAnzahlChars"; - this.labelAnzahlChars.Size = new System.Drawing.Size(53, 16); + this.labelAnzahlChars.Size = new System.Drawing.Size(68, 20); this.labelAnzahlChars.TabIndex = 52; this.labelAnzahlChars.Text = "000/000"; // @@ -766,7 +791,7 @@ namespace Deckungsbeitrag 0, 0}); this.numericUpDownAufgabeCount.Name = "numericUpDownAufgabeCount"; - this.numericUpDownAufgabeCount.Size = new System.Drawing.Size(46, 29); + this.numericUpDownAufgabeCount.Size = new System.Drawing.Size(46, 34); this.numericUpDownAufgabeCount.TabIndex = 53; this.numericUpDownAufgabeCount.ValueChanged += new System.EventHandler(this.numericUpDownAufgabeCount_ValueChanged); this.numericUpDownAufgabeCount.Leave += new System.EventHandler(this.numericUpDownAufgabeCount_Leave); @@ -778,7 +803,7 @@ namespace Deckungsbeitrag this.comboBoxLRSommer.Location = new System.Drawing.Point(13, 435); this.comboBoxLRSommer.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.comboBoxLRSommer.Name = "comboBoxLRSommer"; - this.comboBoxLRSommer.Size = new System.Drawing.Size(170, 28); + this.comboBoxLRSommer.Size = new System.Drawing.Size(170, 33); this.comboBoxLRSommer.TabIndex = 55; this.comboBoxLRSommer.SelectedIndexChanged += new System.EventHandler(this.comboBoxLieferrhythmus_SelectedIndexChanged); // @@ -789,7 +814,7 @@ namespace Deckungsbeitrag this.label5.ForeColor = System.Drawing.Color.White; this.label5.Location = new System.Drawing.Point(9, 397); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(114, 20); + this.label5.Size = new System.Drawing.Size(140, 25); this.label5.TabIndex = 54; this.label5.Text = "Lieferrhythmus"; // @@ -800,7 +825,7 @@ namespace Deckungsbeitrag this.comboBoxLRWinter.Location = new System.Drawing.Point(195, 435); this.comboBoxLRWinter.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.comboBoxLRWinter.Name = "comboBoxLRWinter"; - this.comboBoxLRWinter.Size = new System.Drawing.Size(170, 28); + this.comboBoxLRWinter.Size = new System.Drawing.Size(170, 33); this.comboBoxLRWinter.TabIndex = 56; this.comboBoxLRWinter.SelectedIndexChanged += new System.EventHandler(this.comboBoxLieferrhythmus_SelectedIndexChanged); // @@ -811,7 +836,7 @@ namespace Deckungsbeitrag this.label6.ForeColor = System.Drawing.Color.White; this.label6.Location = new System.Drawing.Point(10, 417); this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(45, 13); + this.label6.Size = new System.Drawing.Size(60, 17); this.label6.TabIndex = 57; this.label6.Text = "Sommer"; // @@ -822,7 +847,7 @@ namespace Deckungsbeitrag this.label7.ForeColor = System.Drawing.Color.White; this.label7.Location = new System.Drawing.Point(192, 417); this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(38, 13); + this.label7.Size = new System.Drawing.Size(49, 17); this.label7.TabIndex = 58; this.label7.Text = "Winter"; // @@ -850,18 +875,32 @@ namespace Deckungsbeitrag // this.pictureBoxQRCode.BackColor = System.Drawing.Color.Transparent; this.pictureBoxQRCode.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pictureBoxQRCode.Location = new System.Drawing.Point(284, 76); + this.pictureBoxQRCode.Location = new System.Drawing.Point(297, 76); this.pictureBoxQRCode.Name = "pictureBoxQRCode"; - this.pictureBoxQRCode.Size = new System.Drawing.Size(81, 101); + this.pictureBoxQRCode.Size = new System.Drawing.Size(60, 60); this.pictureBoxQRCode.TabIndex = 27; this.pictureBoxQRCode.TabStop = false; // + // checkBoxNW + // + this.checkBoxNW.AutoSize = true; + this.checkBoxNW.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxNW.ForeColor = System.Drawing.Color.White; + this.checkBoxNW.Location = new System.Drawing.Point(297, 152); + this.checkBoxNW.Name = "checkBoxNW"; + this.checkBoxNW.Size = new System.Drawing.Size(68, 29); + this.checkBoxNW.TabIndex = 59; + this.checkBoxNW.Text = "NW"; + this.checkBoxNW.UseVisualStyleBackColor = true; + this.checkBoxNW.Click += new System.EventHandler(this.checkBoxNW_Click); + // // FormKundeVW // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(53)))), ((int)(((byte)(101))))); - this.ClientSize = new System.Drawing.Size(1318, 761); + this.ClientSize = new System.Drawing.Size(1394, 803); + this.Controls.Add(this.checkBoxNW); this.Controls.Add(this.label7); this.Controls.Add(this.label6); this.Controls.Add(this.comboBoxLRWinter); @@ -991,6 +1030,7 @@ namespace Deckungsbeitrag private System.Windows.Forms.DataGridViewTextBoxColumn StandBearbeitet; private System.Windows.Forms.DataGridViewTextBoxColumn FehlmengeBearbeitet; private System.Windows.Forms.DataGridViewTextBoxColumn KorrekturBearbeitet; + private System.Windows.Forms.CheckBox checkBoxNW; } } diff --git a/AA-Forms/FormMain.cs b/AA-Forms/FormMain.cs index eb39663..ace64db 100644 --- a/AA-Forms/FormMain.cs +++ b/AA-Forms/FormMain.cs @@ -322,7 +322,7 @@ namespace Deckungsbeitrag } private void tSBArtikelVW_Click(object sender, EventArgs e) { - FormArtikelVW artikelVW = new FormArtikelVW(); + FormArtikelVW artikelVW = new FormArtikelVW(this.benutzer); artikelVW.ShowDialog(); } private void tSBTourenplanung_Click(object sender, EventArgs e) @@ -1260,7 +1260,7 @@ namespace Deckungsbeitrag KundeArtikel kndart = KundeArtikel.GetItemIfAvailable(kundeid, sort.ArtNr); try { - Artikel art = Artikel.GetArtikel(sort.ArtNr); + Artikel art = Artikel.GetArtikel(sort.ArtNr, null); if (art == null) continue; if (kndart == null) { diff --git a/AA-Klassen/Artikel.cs b/AA-Klassen/Artikel.cs index fa81221..9af194c 100644 --- a/AA-Klassen/Artikel.cs +++ b/AA-Klassen/Artikel.cs @@ -22,7 +22,7 @@ namespace DatenDB public class Artikel { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 + // 0 1 2 3 4 5 6 7 public const string COLUMNS = "artikel_id, nummer, bezeichnung, short, nachwaesche, muellwaesche, last_reset, kategorie"; // aktive hinzufügen private const string TABLE = "kundenverwaltung.artikel"; @@ -67,13 +67,14 @@ namespace DatenDB return result; } - public static Artikel GetArtikel(int? artikelNr) + public static Artikel GetArtikel(int? artikelNr, int? artikelID) { DatenbankConnection.GetConnection().Open(); Artikel result = null; NpgsqlCommand command = new NpgsqlCommand(); command.Connection = DatenbankConnection.GetConnection(); - command.CommandText = $"select {COLUMNS} from {TABLE} where nummer = {artikelNr}"; + if (artikelNr != null) command.CommandText = $"select {COLUMNS} from {TABLE} where nummer = {artikelNr}"; + if (artikelID != null) command.CommandText = $"select {COLUMNS} from {TABLE} where artikel_id = {artikelID}"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) result = new Artikel(reader); reader.Close(); @@ -96,14 +97,15 @@ namespace DatenDB return resultList; } - public static List GetArtikelList() + public static List GetArtikelList(string s) { DatenbankConnection.GetConnection().Open(); List resultList = new List(); NpgsqlCommand command = new NpgsqlCommand(); command.Connection = DatenbankConnection.GetConnection(); - command.CommandText = $"select {COLUMNS} from {TABLE}"; + if (s == "Alle") command.CommandText = $"select {COLUMNS} from {TABLE}"; + if (s == "Nachwaesche") command.CommandText = $"select {COLUMNS} from {TABLE} where kategorie > 0 and SUBSTRING(nummer::text, 1, 1) = '6' order by kategorie ASC"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) resultList.Add(new Artikel(reader)); @@ -195,29 +197,33 @@ namespace DatenDB [OLVIgnore] public int? ArtikelID { get; set; } - [OLVColumn("ArtNr.", DisplayIndex = 0, TextAlign = System.Windows.Forms.HorizontalAlignment.Right)] + [OLVColumn("ArtNr.", DisplayIndex = 0, TextAlign = HorizontalAlignment.Right, IsEditable = false)] public int Nummer { get; set; } - [OLVColumn("Bezeichnung", DisplayIndex = 1)] + [OLVColumn("Bezeichnung", DisplayIndex = 1, IsEditable = false)] public string Bezeichnung { get; set; } [OLVColumn("Abkürzung", DisplayIndex = 2)] public string Short { get; set; } - [OLVColumn("Nachwäsche", DisplayIndex = 3, TextAlign = System.Windows.Forms.HorizontalAlignment.Center)] + //[OLVColumn("Nachwäsche", DisplayIndex = 3, TextAlign = System.Windows.Forms.HorizontalAlignment.Center)] + [OLVIgnore] public int Nachwaesche { get; set; } - [OLVColumn("Müll", DisplayIndex = 4, TextAlign = System.Windows.Forms.HorizontalAlignment.Center)] + //[OLVColumn("Müll", DisplayIndex = 4, TextAlign = System.Windows.Forms.HorizontalAlignment.Center)] + [OLVIgnore] public int Muellwaesche { get; set; } - [OLVColumn("Letzter Reset", DisplayIndex = 5, AspectToStringFormat = "{0:d}", TextAlign = System.Windows.Forms.HorizontalAlignment.Right)] + //[OLVColumn("Letzter Reset", DisplayIndex = 5, AspectToStringFormat = "{0:d}", TextAlign = System.Windows.Forms.HorizontalAlignment.Right)] + [OLVIgnore] public DateTime? LastReset { get; set; } [OLVColumn("Kategorie", DisplayIndex = 6)] public ArtikelKategorie Kategorie { get; set; } private string _reset; - [OLVColumn("Reset", DisplayIndex = 7)] + //[OLVColumn("Reset", DisplayIndex = 7)] + [OLVIgnore] public string Reset { get @@ -229,6 +235,7 @@ namespace DatenDB } set { } } + #endregion } } diff --git a/AA-Klassen/ArtikelNachwaesche.cs b/AA-Klassen/ArtikelNachwaesche.cs new file mode 100644 index 0000000..52f7a51 --- /dev/null +++ b/AA-Klassen/ArtikelNachwaesche.cs @@ -0,0 +1,102 @@ +using BrightIdeasSoftware; +using DatenDB; +using Deckungsbeitrag.UserControls; +using Npgsql; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deckungsbeitrag.AA_Klassen +{ + internal class ArtikelNachwaesche + { + // 0 1 2 3 4 5 + private static string COLUMNS = "nw_artikel_id, artikel_id, datum, nachwaesche, nw_muell, nw_sauber"; + private static string TABLE = "kundenverwaltung.nw_artikel"; + + #region Class-Standarts (Properties, Save, reader) + public ArtikelNachwaesche() { } + + [OLVColumn(IsVisible = false)] + public int? NachwaescheID { get; set; } + [OLVColumn(IsVisible = false)] + public int? ArtikelID { get; set; } + [OLVColumn(IsVisible = false)] + public DateTime Datum { get; set; } + [OLVColumn(IsVisible = false)] + public int Nachwaesche { get; set; } + [OLVColumn("Müll", DisplayIndex = 3)] + public int Muell { get; set; } + [OLVColumn("Sauber", DisplayIndex = 2)] + public int Sauber { get; set; } + + public int? Save() + { + int? result = 0; + DatenbankConnection.GetConnection().Open(); + + using (NpgsqlCommand command = new NpgsqlCommand()) + { + command.Connection = DatenbankConnection.GetConnection(); + + if (this.NachwaescheID.HasValue & this.NachwaescheID != 0) + { + command.CommandText = $"update {TABLE} set artikel_id = :p1, datum = :p2, nachwaesche = :p3, nw_muell = :p4, nw_sauber = :p5 WHERE nw_artikel_id = :p0"; + } + else + { + command.CommandText = "select nextval('kundenverwaltung.tour_seq')"; + this.NachwaescheID = (int)(long)command.ExecuteScalar(); + command.CommandText = $"insert into {TABLE} ({COLUMNS}) values (:p0, :p1, :p2, :p3, :p4, :p5)"; + } + + command.Parameters.AddWithValue("p0", this.NachwaescheID); + command.Parameters.AddWithValue("p1", this.ArtikelID); + command.Parameters.AddWithValue("p2", this.Datum); + command.Parameters.AddWithValue("p3", this.Nachwaesche); + command.Parameters.AddWithValue("p4", this.Muell); + command.Parameters.AddWithValue("p5", this.Sauber); + + + result = command.ExecuteNonQuery(); + DatenbankConnection.GetConnection().Close(); + return result; + } + } + + + public ArtikelNachwaesche(NpgsqlDataReader reader) + { + this.NachwaescheID = reader.GetInt32(0); + this.ArtikelID = reader.GetInt32(1); + this.Datum = reader.GetDateTime(2); + this.Nachwaesche = reader.IsDBNull(3) ? 0 : reader.GetInt32(3); + this.Muell = reader.IsDBNull(4) ? 0 : reader.GetInt32(4); + this.Sauber = reader.IsDBNull(5) ? 0 : reader.GetInt32(5); + } + + #endregion + + #region Konstruktors + internal static ArtikelNachwaesche FindeDatensatz(int? artikelID, DateTime timestamp) + { + ArtikelNachwaesche result = new ArtikelNachwaesche(); + DatenbankConnection.GetConnection().Open(); + NpgsqlCommand command = new NpgsqlCommand(); + + command.Connection = DatenbankConnection.GetConnection(); + command.CommandText = $"select {COLUMNS} from {TABLE} where artikel_id = {artikelID} and datum = '{timestamp}'"; + NpgsqlDataReader reader = command.ExecuteReader(); + while (reader.Read()) result = new ArtikelNachwaesche(reader); + reader.Close(); + DatenbankConnection.GetConnection().Close(); + + return result; + } + + #endregion + + } +} diff --git a/AA-Klassen/Auftrag.cs b/AA-Klassen/Auftrag.cs index 622cd7a..25b778c 100644 --- a/AA-Klassen/Auftrag.cs +++ b/AA-Klassen/Auftrag.cs @@ -83,9 +83,9 @@ namespace DatenDB public class Auftrag { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 public const string COLUMNS = "auftrag_id, benutzer_id, aufgabe_id, kunde_id, zusatz, liefertag, gedruckt, gedruckt_von, erledigt, erledigt_von, erstellt, erstellt_von, status, tour_id, container_dirt, maschine_id, container_clean, typ, aufgabe_erledigt, abteilungen_status, rhythmus, priority"; - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 public const string ACOLUMNS = "a.auftrag_id, a.benutzer_id, a.aufgabe_id, a.kunde_id, a.zusatz, a.liefertag, a.gedruckt, a.gedruckt_von, a.erledigt, a.erledigt_von, a.erstellt, a.erstellt_von, a.status, a.tour_id, a.container_dirt, a.maschine_id, a.container_clean, a.typ, a.aufgabe_erledigt, a.abteilungen_status, a.rhythmus, a.priority"; private const string TABLE = "kundenverwaltung.auftrag"; public const string ASPECTS = "FahrerID,AufgabeID,KundeID,ZusatzInfo,Wann,Gedruckt,Erledigt,Erstellt von,Erstellt Am"; @@ -593,7 +593,6 @@ namespace DatenDB this.Abteilungen = reader.IsDBNull(19) ? AbteilungsStatus.Keine : (AbteilungsStatus)reader.GetInt16(19); this.Rhythmus = reader.IsDBNull(20) ? RegRhythmen.Unbekannt : (RegRhythmen)reader.GetInt32(20); this.Priority = (AuftragPriority)reader.GetInt32(21); - } #region Properties diff --git a/AA-Klassen/DataClass.cs b/AA-Klassen/DataClass.cs new file mode 100644 index 0000000..ecf388e --- /dev/null +++ b/AA-Klassen/DataClass.cs @@ -0,0 +1,52 @@ +using BrightIdeasSoftware; +using DatenDB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Deckungsbeitrag.AA_Klassen +{ + internal class DataClass + { + } + /// + /// OLV-Model für Nachwäscheliste. Zeigt Kunden des in der ComboBox gewählten Artikels. + /// + public class NWData + { + [OLVColumn(IsVisible = false)] public int? KndArtID { get; set; } + [OLVColumn(IsVisible = false)] public int? KundeID { get; set; } + [OLVColumn("KndNr.", DisplayIndex = 0, IsEditable = false)] public string KndNummer { get; set; } + [OLVColumn("Kunde", DisplayIndex = 1, IsEditable = false)] public string Kunde { get; set; } + [OLVColumn("NW", DisplayIndex = 2, TextAlign = HorizontalAlignment.Center)] public int Nachwaesche { get; set; } + } + + /// + /// OLV-Model für Nachwäscheliste. Zeigt Alle "Miete (ArtNr. Start mit 6)"-Artikel und ermöglicht das erfassen von Müll und Sauber. + /// + public class NachwaescheArtikelData + { + [OLVColumn(IsVisible = false)] public int? ArtikelID { get; set; } + [OLVColumn("ArtNr.", IsEditable = false, DisplayIndex = 0)] public string ArtNummer { get; set; } + [OLVColumn("ArtName", IsEditable = false, DisplayIndex = 1)] public string ArtName { get; set; } + [OLVColumn("Abkürzung", IsEditable = false, DisplayIndex = 2)] public string Short { get; set; } + [OLVColumn("Sauber", TextAlign = HorizontalAlignment.Center, DisplayIndex = 3)] public int Sauber { get; set; } + [OLVColumn("Müll", TextAlign = HorizontalAlignment.Center, DisplayIndex = 4)] public int Muell { get; set; } + [OLVColumn("Kategorie", IsVisible = false, IsEditable = false, DisplayIndex = 6)] public ArtikelKategorie Kategorie { get; set; } + } + + /// + /// KundenDaten für die Tourenplanung. Notwendig damit die UserControls geladen werden können. + /// + public class KData + { + public string Name { get; set; } + public string Region { get; set; } + public string Tag { get; set; } // ← MO, DI, MI, DO, FR + public int KundeID { get; set; } + public int[] ContAnzahl { get; set; } = new int[3]; + } +} diff --git a/AA-Klassen/Funktionen.cs b/AA-Klassen/Funktionen.cs index 9f5d15a..99d5c70 100644 --- a/AA-Klassen/Funktionen.cs +++ b/AA-Klassen/Funktionen.cs @@ -1392,6 +1392,7 @@ namespace Deckungsbeitrag ObjectListView.ColumnHeaderCollection cc = olv.Columns; for (int i = 0; i < cc.Count; i++) { + cc[i].Width += 10; int colWidth = TextRenderer.MeasureText(cc[i].Text, olv.Font).Width + 30; if (colWidth > cc[i].Width) { @@ -1408,109 +1409,6 @@ namespace Deckungsbeitrag } } - /// - /// ListView_Load für AufgabenVW und BenutzerVW - /// - /// - /// - /// - /// - public static ListView ListView_Load(ListView lv, string colname, List objectlist) - { - ColumnHeader ch; - foreach (string s in colname.Split(',')) - { - ch = new ColumnHeader(); - ch.Name = s.Trim(); - if (ch.Name == "vorname") ch.DisplayIndex = 0; - if (ch.Name == "nachname") ch.DisplayIndex = 2; - if (ch.Name == "benutzer_name") - { - ch.DisplayIndex = 3; - ch.Name = "benutzername"; - } - if (ch.Name == "rolle") ch.DisplayIndex = 4; - if (ch.Name == "schein") ch.DisplayIndex = 5; - if (ch.Name == "gueltig_bis") - { - ch.DisplayIndex = 6; - ch.Name = "gültig bis"; - } - if (ch.Name == "ist_aktiv" || ch.Name == "aktive") - { - ch.DisplayIndex = 7; - ch.Name = "aktiv"; - } - - if (ch.Name == "bezeichnung") ch.DisplayIndex = 0; - if (ch.Name == "Beschreibung") ch.DisplayIndex = 1; - if (ch.Name == "kategorie") ch.DisplayIndex = 3; - if (ch.Name == "farbe") - { - ch.DisplayIndex = 4; - } - ch.Text = char.ToUpper(ch.Name[0]) + ch.Name.Substring(1); - if (ch.Name != "benutzer_id" && ch.Name != "passwort" && ch.Name != "aufgabe_id" && ch.Name != "rolle") lv.Columns.Add(ch); - } - - lv.Items.Clear(); - var element = objectlist.FirstOrDefault(); - - switch (element.GetType().Name) - { - case ("Benutzer"): - foreach (Benutzer ben in objectlist) - { - ListViewItem item; - item = new ListViewItem(); - item.Tag = ben; - item.Text = ben.Vorname; - item.SubItems.Add(ben.Nachname); - item.SubItems.Add(ben.BenutzerName); - item.SubItems.Add(ben.Rolle.ToString()); - item.SubItems.Add(ben.Schein.ToString()); - item.SubItems.Add(ben.GueltigBis.HasValue ? ben.GueltigBis.Value.ToShortDateString() : ""); - item.SubItems.Add(ben.Aktiv == true ? "JA" : "NEIN"); - - lv.Items.Add(item); - } - break; - case ("Aufgabe"): - foreach (Aufgabe auf in objectlist) - { - ListViewItem item = new ListViewItem(); - item.UseItemStyleForSubItems = false; - item.Tag = auf; - item.Text = auf.Bezeichnung; - item.SubItems.Add(auf.Beschreibung); - item.SubItems.Add(auf.Kategorie.ToString()); - item.SubItems.Add(""); - item.SubItems.Add(auf.Aktiv.ToString()); - - ColorConverter cc = new ColorConverter(); - item.SubItems[3].BackColor = (Color)cc.ConvertFromString(auf.Farbe.ToArgb().ToString()); //COLUMN FARBE SUBITEM BACKCOLOR == FARBE. - - lv.Items.Add(item); - } - break; - default: - break; - } - //RESIZE COLUMNS - lv = Columns_Resize(lv, null).lv; - //lv.Width = lv.Width + 22; - lv.AllowColumnReorder = true; - //lv.Height = 150; - - foreach (ListViewItem itm in lv.Items) - { - if (itm.Index % 2 == 0) itm.BackColor = Color.LightSteelBlue; - foreach (ListViewItem.ListViewSubItem subItem in itm.SubItems) if (!string.IsNullOrWhiteSpace(subItem.Text)) subItem.BackColor = itm.BackColor; - }//BACKCOLOR FÜR JEDES ZWEITE ANDERE FARBE - return lv; - } - //TODO: Eventuell auch andere ListViews einbinden? - /// /// Rahmen um die GroupBox erstellen. /// base.OnPaint(e) muss im GroupBox_Paint Event vor dem Aufruf der Funktionen stehen. @@ -1553,32 +1451,6 @@ namespace Deckungsbeitrag return gb; } - /// - /// Bei DataGridView die Größe an Zeilen und Spalten anpassen. - /// - /// - /// - public static DataGridView DGV_Size_Anpassen( DataGridView g) - { - - int totalWidth = g.RowHeadersVisible ? g.RowHeadersWidth : 0; - foreach (DataGridViewColumn col in g.Columns) - { - if (col.Visible) totalWidth += col.Width; - } - - int totalHeight = g.ColumnHeadersVisible ? g.ColumnHeadersHeight : 0; - foreach (DataGridViewRow row in g.Rows) - { - if (row.Visible) totalHeight += row.Height; - } - totalHeight += g.ColumnHeadersHeight; - - g.ClientSize = new Size(totalWidth, totalHeight); - - return g; - } - public static DateTime GetNextLiefertag(Liefertage rhythmus) { DateTime aktDatum = DateTime.Today; @@ -1796,9 +1668,5 @@ namespace Deckungsbeitrag } } - internal static void GetInventuren(Panel panelMain) - { - throw new NotImplementedException(); - } } } \ No newline at end of file diff --git a/AA-Klassen/Kunde.cs b/AA-Klassen/Kunde.cs index b1f17d5..2c86d20 100644 --- a/AA-Klassen/Kunde.cs +++ b/AA-Klassen/Kunde.cs @@ -17,8 +17,8 @@ namespace DatenDB public class Kunde { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - public const string COLUMNS = "kunde_id, tour_id, kunde_nr, name1, name2, straße, plz, bezeichnung, land, aktiv, bettenanzahl, kunde_gruppe, service, region, waescheart, suchtext, aufgabe, anmerkung, aufgabe_count, sommerlieferrhythmus, winterlieferrhythmus"; + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 + public const string COLUMNS = "kunde_id, tour_id, kunde_nr, name1, name2, straße, plz, bezeichnung, land, aktiv, bettenanzahl, kunde_gruppe, service, region, waescheart, suchtext, aufgabe, anmerkung, aufgabe_count, sommerlieferrhythmus, winterlieferrhythmus, nachwaesche"; private const string RED_COLUMNS = "kunde_id, tour_id, kunde_nr, name1, name2, straße, plz, bezeichnung, land, aktiv, bettenanzahl, kunde_gruppe, service, region, waescheart, jahr, umsatz"; public const string TABLE = "kundenverwaltung.kunde"; public const string VIEW = "kundenverwaltung.jahresumsaetze"; //RICHTIGE VIEW AUSSUCHEN FÜR INAKTIVE MIT LETZTEN UMSATZ... @@ -239,6 +239,7 @@ namespace DatenDB this.AufgabeCount = reader.IsDBNull(18) ? 0 : reader.GetInt32(18); this.SommerLieferRhythmus = reader.IsDBNull(19) ? (int)Lieferrhythmen.Unbekannt : reader.GetInt16(19); this.WinterLieferRhythmus = reader.IsDBNull(20) ? (int)Lieferrhythmen.Unbekannt : reader.GetInt16(20); + this.HatNachwaesche = reader.IsDBNull(21) ? (this.Waescheart == "Miete" ? true : false) : reader.GetBoolean(21); } } public Kunde(NpgsqlDataReader reader) @@ -264,6 +265,7 @@ namespace DatenDB this.AufgabeCount = reader.IsDBNull(18) ? 0 : reader.GetInt32(18); this.SommerLieferRhythmus = reader.IsDBNull(19) ? (int)Lieferrhythmen.Unbekannt : reader.GetInt16(19); this.WinterLieferRhythmus = reader.IsDBNull(20) ? (int)Lieferrhythmen.Unbekannt : reader.GetInt16(20); + this.HatNachwaesche = reader.IsDBNull(21) ? (this.Waescheart == "Miete" ? true : false) : reader.GetBoolean(21); } public int Save() { @@ -275,13 +277,13 @@ namespace DatenDB if (this.KundeID.HasValue & this.KundeID != 0) { - command.CommandText = $"update {TABLE} set tour_id = :p1, kunde_nr = :p2, name1 = :p3, name2 = :p4, straße = :p5, plz = :p6, bezeichnung = :p7, land = :p8, aktiv = :p9, bettenanzahl = :p10, kunde_gruppe = :p11, service = :p12, region = :p13, waescheart = :p14, suchtext = :p15, aufgabe = :p16, anmerkung = :p17, aufgabe_count = :p18, sommerlieferrhythmus = :p19, winterlieferrhythmus = :p20 WHERE kunde_id = :p0"; + command.CommandText = $"update {TABLE} set tour_id = :p1, kunde_nr = :p2, name1 = :p3, name2 = :p4, straße = :p5, plz = :p6, bezeichnung = :p7, land = :p8, aktiv = :p9, bettenanzahl = :p10, kunde_gruppe = :p11, service = :p12, region = :p13, waescheart = :p14, suchtext = :p15, aufgabe = :p16, anmerkung = :p17, aufgabe_count = :p18, sommerlieferrhythmus = :p19, winterlieferrhythmus = :p20, nachwaesche = :p21 WHERE kunde_id = :p0"; } else { command.CommandText = "select nextval('kundenverwaltung.kunde_seq')"; this.KundeID = (int)(long)command.ExecuteScalar(); - command.CommandText = $"insert into {TABLE} ({COLUMNS}) values (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13, :p14, :p15, :p16, :p17, :p18, :p19, :p20)"; + command.CommandText = $"insert into {TABLE} ({COLUMNS}) values (:p0, :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13, :p14, :p15, :p16, :p17, :p18, :p19, :p20, :p21)"; } command.Parameters.AddWithValue("p0", this.KundeID); @@ -305,6 +307,7 @@ namespace DatenDB command.Parameters.AddWithValue("p18", this.AufgabeCount ?? (object)DBNull.Value); command.Parameters.AddWithValue("p19", this.SommerLieferRhythmus); command.Parameters.AddWithValue("p20", this.WinterLieferRhythmus); + command.Parameters.AddWithValue("p21", this.HatNachwaesche); int result = command.ExecuteNonQuery(); DatenbankConnection.GetConnection().Close(); @@ -445,16 +448,8 @@ namespace DatenDB [OLVIgnore] public int SommerLieferRhythmus { get; set; } public int WinterLieferRhythmus { get; set; } - + public bool HatNachwaesche { get; set; } + #endregion } - public class KData - { - public string Name { get; set; } - public string Region { get; set; } - public string Tag { get; set; } // ← MO, DI, MI, DO, FR - public int KundeID { get; set; } - public int[] ContAnzahl { get; set; } = new int[3]; - } - } \ No newline at end of file diff --git a/AA-Klassen/KundeArtikel.cs b/AA-Klassen/KundeArtikel.cs index 8d9a880..e97abf8 100644 --- a/AA-Klassen/KundeArtikel.cs +++ b/AA-Klassen/KundeArtikel.cs @@ -1,12 +1,12 @@ -using Npgsql; +using BrightIdeasSoftware; +using Npgsql; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; using System.Text; using System.Threading.Tasks; -using System.Web.UI.WebControls; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using System.Windows.Forms; namespace DatenDB { @@ -49,13 +49,13 @@ namespace DatenDB DatenbankConnection.GetConnection().Close(); return resultList; } - public static KundeArtikel GetItem(int i) + public static KundeArtikel GetItem(int kndartID) { DatenbankConnection.GetConnection().Open(); KundeArtikel result = new KundeArtikel(); NpgsqlCommand command = new NpgsqlCommand(); command.Connection = DatenbankConnection.GetConnection(); - command.CommandText = $"SELECT {COLUMNS} from {TABLE} where kunde_artikel_id = {i}"; + command.CommandText = $"SELECT {COLUMNS} from {TABLE} where kunde_artikel_id = {kndartID}"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) result = new KundeArtikel(reader); reader.Close(); @@ -91,13 +91,14 @@ namespace DatenDB return result; } - public static List GetFehlmengeList(string kundeid) + public static List GetFehlmengeList(string kundeid, int? artikelID) { DatenbankConnection.GetConnection().Open(); List resultList = new List(); NpgsqlCommand command = new NpgsqlCommand(); command.Connection = DatenbankConnection.GetConnection(); - command.CommandText = $"select {COLUMNS} from {TABLE} where kunde_id = {kundeid} and SUBSTRING(artikel_nr::text, 1, 1) = '6' order by reihung asc"; + if (!string.IsNullOrWhiteSpace(kundeid)) command.CommandText = $"select {COLUMNS} from {TABLE} where kunde_id = {kundeid} order by reihung asc"; + else command.CommandText = $"select {COLUMNS} from {TABLE} where artikel_id = {artikelID}"; NpgsqlDataReader reader = command.ExecuteReader(); while (reader.Read()) resultList.Add(new KundeArtikel(reader)); reader.Close(); @@ -238,11 +239,17 @@ namespace DatenDB this.Reihung = reader.IsDBNull(12) ? 0 : reader.GetInt32(12); } + [OLVColumn(IsVisible = false)] public int? KundeArtikelID { get; set; } + [OLVIgnore] public int? KundeID { get; set; } + [OLVColumn("ArtNr.", DisplayIndex = 2, TextAlign = HorizontalAlignment.Left)] public int ArtikelNR { get; set; } + [OLVColumn("Artikel", DisplayIndex = 3, TextAlign = HorizontalAlignment.Left)] public string ArtikelName { get; set; } + [OLVIgnore] public int Stand { get; set; } + [OLVColumn("Nachwäsche", DisplayIndex = 4, TextAlign = HorizontalAlignment.Center)] public int Fehlmenge { get; set; } public string StandBearbeitet { get; set; } public string FehlmengeBearbeitet { get; set; } @@ -250,6 +257,7 @@ namespace DatenDB public string KorrekturBearbeitet { get; set; } public int Reklamation { get; set; } public int? ArtikelID { get; set; } + [OLVColumn("Reihung", IsVisible = false)] public int Reihung { get; set; } } diff --git a/Program.cs b/Program.cs index f39b818..1341634 100644 --- a/Program.cs +++ b/Program.cs @@ -242,7 +242,7 @@ namespace Deckungsbeitrag { Array.Resize(ref rows, idx); row = streamReader.ReadLine(); - if (row.StartsWith("60") || row.StartsWith("20")) + if (row.StartsWith("60") || row.StartsWith("10")) { rows[idx - 1] = row; idx++; @@ -255,13 +255,13 @@ namespace Deckungsbeitrag { string[] linedata = line.Split(';'); - // ArtikelGruppen 60 und 20 werden weiterverarbeitet. - if (linedata[0] == "60" || linedata[0] == "20") + // ArtikelGruppen 60 und 10 werden weiterverarbeitet. + if (linedata[0] == "60" || linedata[0] == "10") { tosave++; // Artikel wird in DB gesucht und geholt. - Artikel art = Artikel.GetArtikel(Convert.ToInt32(linedata[1])); + Artikel art = Artikel.GetArtikel(Convert.ToInt32(linedata[1]), null); if (art == null) art = new Artikel(); art.Nummer = Convert.ToInt32(linedata[1]); @@ -431,9 +431,14 @@ namespace Deckungsbeitrag kunde.Ort = linedata[10]; kunde.Bettenanzahl = int.TryParse(linedata[45], out int bett) ? bett : 0; kunde.Waescheart = linedata[46]; - kunde.Service = linedata[47]; + if (kunde.Waescheart == "Miete") kunde.HatNachwaesche = true; + else kunde.HatNachwaesche = false; + if (kunde.Service != linedata[47]) + { + if (MessageBox.Show($"Beim Kunde {kunde.KundeName} hat sich der Service geändert. Welcher Service soll gespeichert werden?\n\n{kunde.Service} => [JA]\n{linedata[47]} => [NEIN]", "SERVICE WÄHLEN", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) kunde.Service = linedata[47]; + } kunde.Region = linedata[48]; - kunde.Suchtext = linedata[55]; + if (kunde.Suchtext != linedata[55]) kunde.Suchtext = linedata[55]; kunde.Aktiv = linedata[56] == "1" ? true : false; if (kunde.Save() == 1) saved++; diff --git a/UserControls/UCInventur.cs b/UserControls/UCInventur.cs index b82593a..9d3e4ca 100644 --- a/UserControls/UCInventur.cs +++ b/UserControls/UCInventur.cs @@ -29,11 +29,11 @@ namespace Deckungsbeitrag.UserControls private bool neueinventur = false; private string[] lines; private bool formLoading = false; - private bool _tosave = false; public event Action SizeChangedForParent; public event Action UCInventur_Update; public event Action UCInventur_Delete; private Point uci_loc; + private bool _tosave = false; public bool tosave { get { return _tosave; } diff --git a/Verwaltung.csproj b/Verwaltung.csproj index 5968d67..89550aa 100644 --- a/Verwaltung.csproj +++ b/Verwaltung.csproj @@ -209,12 +209,14 @@ FormWSVerfolgung.cs + + diff --git a/Verwaltung_ReadMe.txt b/Verwaltung_ReadMe.txt index ac3ff4b..6779745 100644 --- a/Verwaltung_ReadMe.txt +++ b/Verwaltung_ReadMe.txt @@ -4,8 +4,8 @@ NEUIGKEITEN - Version 1.0.8.5 Build-Info: - Build-Typ: Release Build -- Erledigte TODOs: 16 -- Offene TODOs: 46 +- Erledigte TODOs: 18 +- Offene TODOs: 44 - Install-Reminders: 4 - Changes: 15 @@ -34,7 +34,7 @@ Build-Info: - ✨ Winter und Sommer wird getrennt geändert und gespeichert. [UCTabPageLKW.cs] -=== ✅ ERLEDIGTE TODOs (16) === +=== ✅ ERLEDIGTE TODOs (18) === - ✅ : Auftrag über FormListe holen und daraus den Kunden für Fehlmenge holen. [FormFehlmengeCount.cs] - ✅ : Auftragliste bei Fahrer anzeigen wenn Login. [FormMain.cs] - ✅ : Bei Transport wir ein Fach mit Aktuellem Auftrag erstellt. Das Alte wird bei Transport gespeichert. [FormAusschlager.cs] @@ -42,6 +42,8 @@ Build-Info: - ✅ : Container schmutzig bearbeitbar machen [FormAuftragDetail.cs] - ✅ : Feedback Button hinzufügen [FormAuftragDetail.cs] - ✅ : HILFE zeigt OnBoarding. [FormMain.cs] +- ✅ : Inventur freigeben nur für Admin oder Verwaltung. [UCInventur.cs] +- ✅ : Inventur für Expedit zugänglich machen. [UCInventur.cs] - ✅ : Korrigiere Bestand: Wenn -Zahl dann Stand - Zahl. [FormAuftragDetail.cs] - ✅ : Logik überlegen wie ein bearbeiteter Auftrag nicht doppelt gewählt werden kann. (Abteilungen zu Auftrag hinzufügen und bei Ausschlager Druck definieren?) [FormFehlmengeCount.cs] - ✅ : Mit AddFehler können Fehler aus try/chatch in Obsidian eingefügt werden. (Timestamp, PC-Name, Ex-Message) [Program.cs] @@ -53,7 +55,7 @@ Build-Info: - ✅ : Wenn RegAuftrag wird als augeliefert markiert, wird dieser automatisch neu erstellt laut hinterlegtem Rhythmus. [FormMain.cs] -=== 🔄 OFFENE TODOs (46) === +=== 🔄 OFFENE TODOs (44) === - 🔄 !!ÜBERLEGE!! DB-Query für Kundenanzahl und Containeranzahl Abgleich. (Aufträge haben TourID hinterlegt. So sollte alles vergleichbar sein.) [Tour.cs] - 🔄 !!ÜBERLEGE!! Tour Start und Ende automatisch erfassen. [Tour.cs] - 🔄 Alle Icons in einer Spalte anzeigen? I für Anmerkung und ! für Aufgabe?? [FormExpedit.cs] @@ -68,15 +70,13 @@ Build-Info: - 🔄 Dateinamen aus Tikos anschauen. Eventuell Datum von letztem Import über Dateiname wählen? [FormMain.cs] - 🔄 Deaktivieren wenn SPS funktioniert. Transport wird simuliert. [FormWSVerfolgung.cs] - 🔄 Design des Controls anpassen. Eventuell im Designer erstellen. [UCKunde.cs] +- 🔄 Einbinden der NachwaescheArtikelData... [FormArtikelVW.cs] - 🔄 Eingabemöglichkeit von Tour Start und Ende muss erledigt werden. [Tour.cs] - 🔄 Erstellen von SonderAuftrag und Drucken von Etikett testen. [FormAuftragDetail.cs] -- 🔄 Eventuell auch andere ListViews einbinden? [Funktionen.cs] - 🔄 Eventuell die Zahlen in CSV speichern und von dort für Druck verwenden?! [FormAuftragDetail.cs] - 🔄 Funktioniert mehrere KundenControls auf einmal DragDrop? [FormTourenplanung.cs] - 🔄 Gesamt soll immer 100% sein. [Funktionen.cs] - 🔄 Hier Settings speichern mit UserSettingsManager Klasse. [FormEinstellung.cs] -- 🔄 Inventur freigeben nur für Admin oder Verwaltung. [UCInventur.cs] -- 🔄 Inventur für Expedit zugänglich machen. [UCInventur.cs] - 🔄 JSON nach angemeldeten Fahrer durchsuchen und Kundenliste des aktuellen Wochentag anzeigen. [FormMain.cs] - 🔄 Kundenanzahl bei Tourenliste erstellen vergleichen und anpassen. [Tour.cs] - 🔄 Liste vorher/nachher durchdenken [FormAuftragDetail.cs] @@ -101,5 +101,5 @@ Build-Info: - 🔄 Wenn Nachwäsche oder Müllwäsche alle Artikel anzeigen. [FormFehlmengeCount.cs] - 🔄 Zuweisung zu Fahrer muss geklärt werden. [Funktionen.cs] -Installation: 02.04.2026 09:58 +Installation: 03.04.2026 16:05 =====================================