Ejemplo n.º 1
0
 private void DruckeAuftrag()
 {
     if (AktuellerAuftrag == null || AktuellerAuftrag.ID == -1)
     {
         MessageBox.Show("Der Auftrag kann nicht gedruckt werden. Speichern sie zuerst den Auftrag!", "Drucken Abgebrochen",
                         MessageBoxButton.OK, MessageBoxImage.Information);
         return;
     }
     if (AktuellerAuftrag.KundeID == -1)
     {
         MessageBox.Show("Der Auftrag kann nicht gedruckt werden. Der Kunde wurde nicht gefunden", "Drucken Abgebrochen",
                         MessageBoxButton.OK, MessageBoxImage.Information);
         return;
     }
     try
     {
         AktuellerAuftrag.Kunde = model.LadeKunden("").First(i => i.ID == AktuelleKundenId);
         AktuellerAuftrag.Print(PositionsListe.ToList());
     }
     catch (Exception)
     {
         MessageBox.Show("Rechnung konnte nicht erstellt werden, versuchen Sie es erneut",
                         "Fehler beim erstellen", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
Ejemplo n.º 2
0
        private void UpdateFelder()
        {
            List <Option> _tempPositionen = new List <Option>();

            AktuellerAuftrag.Positionen.ForEach(_tempPositionen.Add);
            PositionsListe.Clear();
            if (_tempPositionen.All(i => i.Name != "Steinchen"))
            {
                Steinchen = 0;
            }
            if (_tempPositionen.All(i => i.Name != "Reperatur"))
            {
                Reperatur = 0;
            }
            if (_tempPositionen.All(i => i.Name != "Nailart"))
            {
                Nailart = 0.0m;
            }
            if (_tempPositionen.All(i => i.Name != "Stamping"))
            {
                Stamping = 0.0m;
            }
            if (_tempPositionen.All(i => (i.Name == "Steinchen") || (i.Name == "Stamping") || (i.Name == "Reperatur") || (i.Name == "Nailart")))
            {
                SonstigesAktiv = false;
                SonstigesPreis = 0.0m;
                SonstigesText  = string.Empty;
            }

            foreach (var option in _tempPositionen)
            {
                if (option.Name == "Steinchen")
                {
                    int anz = 0;
                    if (Int32.TryParse(option.Anzahl.ToString(), out anz))
                    {
                        Steinchen = anz;
                    }
                }
                if (option.Name == "Reperatur")
                {
                    int anz = 0;
                    if (Int32.TryParse(option.Anzahl.ToString(), out anz))
                    {
                        Reperatur = anz;
                    }
                }
                if (option.Name == "Nailart")
                {
                    Nailart = option.PreisInFranken;
                }
                if (option.Name == "Stamping")
                {
                    Stamping = option.PreisInFranken;
                }
                if (option.Name != "Stamping" && option.Name != "Nailart" && option.Name != "Reperatur" && option.Name != "Steinchen")
                {
                    SonstigesAktiv = true;
                    SonstigesPreis = option.PreisInFranken;
                    SonstigesText  = option.Name;
                }
            }

            if (AktuellerAuftrag.Dienstleistung.Name == "Neuset")
            {
                IstNeuset = true;
            }
            if (AktuellerAuftrag.Dienstleistung.Name == "Auffüllen")
            {
                IstAuffuellen = true;
            }
            if (AktuellerAuftrag.Dienstleistung.Name == "Gellack")
            {
                IstGellack = true;
            }
            RabattInProzent = AktuellerAuftrag.RabattInProzent;
        }
Ejemplo n.º 3
0
        private void UpdatePositionList()
        {
            PositionsListe.Clear();
            //Dienstleistung
            Position dienstleistung = new Position
            {
                Anzahl            = 1,
                Beschreibung      = AktuellerAuftrag.Dienstleistung.Name,
                Einheitspreis     = AktuellerAuftrag.Dienstleistung.Preis,
                Preis             = AktuellerAuftrag.Dienstleistung.Preis,
                IstDienstleistung = true,
                IstOption         = false,
                IstRabatt         = false
            };

            PositionsListe.Add(dienstleistung);

            //Optionen
            foreach (var option in AktuellerAuftrag.Positionen)
            {
                if (option.WurdeGeloescht == false)
                {
                    Position opt = new Position
                    {
                        Anzahl            = option.Anzahl,
                        Beschreibung      = option.Name,
                        Einheitspreis     = option.Einheitspreis,
                        Preis             = option.PreisInFranken,
                        IstDienstleistung = false,
                        IstOption         = true,
                        IstRabatt         = false
                    };
                    PositionsListe.Add(opt);
                }
            }
            //Berechne Total vor Rabatt
            AktuellerAuftrag.Total = 0.0m;
            foreach (var position in PositionsListe)
            {
                AktuellerAuftrag.Total += position.Preis;
            }

            //Rabatt
            decimal _tempRabatt = 0.0m;

            if (AktuellerAuftrag.Rabatt > 0)
            {
                if (AktuellerAuftrag.RabattInProzent)
                {
                    _tempRabatt = AktuellerAuftrag.Total * ((AktuellerAuftrag.Rabatt / 100));
                }
                else
                {
                    _tempRabatt = AktuellerAuftrag.Rabatt;
                }
                if (_tempRabatt > AktuellerAuftrag.Total)
                {
                    _tempRabatt             = AktuellerAuftrag.Total;
                    AktuellerAuftrag.Rabatt = _tempRabatt;
                }
                _tempRabatt = _tempRabatt * (-1);
                _tempRabatt = Math.Round(_tempRabatt * 20.0M, MidpointRounding.AwayFromZero) * 0.05M;

                Position rabatt = new Position
                {
                    Anzahl            = 1,
                    Beschreibung      = "Rabatt",
                    Einheitspreis     = _tempRabatt,
                    Preis             = _tempRabatt,
                    IstDienstleistung = false,
                    IstOption         = false,
                    IstRabatt         = true
                };
                PositionsListe.Add(rabatt);
                AktuellerAuftrag.Total += _tempRabatt;
            }
            else
            {
                AktuellerAuftrag.Rabatt = 0.0m;
            }
            AktuellerAuftrag = AktuellerAuftrag;
        }