Example #1
0
        public void TestGeefTotalenBaten_LegeAnalyse_Allemaal0()
        {
            _analyse = new Analyse();
            IDictionary <Soort, decimal> totalen = _analyse.GeefTotalenBaten();

            Assert.False(totalen.Any(t => t.Value > 0)); // er mag geen enkel totaal groter zijn dan 0
        }
Example #2
0
        public void TestGeefTotalenBaten_11SoortenInDictionary()
        {
            _analyse = new Analyse();
            IDictionary <Soort, decimal> totalen = _analyse.GeefTotalenBaten();

            int aantalSoorten = totalen.Count;

            Assert.Equal(11, aantalSoorten);
        }
Example #3
0
        public void TestGeefTotalenBaten()
        {
            DummyApplicationDbContext dbContext = new DummyApplicationDbContext();

            IDictionary <Soort, decimal> expected = new Dictionary <Soort, decimal>
            {
                { Soort.LoonkostSubsidies, 22593.68M },
                { Soort.MedewerkersZelfdeNiveau, 266516.27M },
                { Soort.MedewerkersHogerNiveau, 266516.27M },
                { Soort.UitzendkrachtBesparing, 17570.00M },
                { Soort.ExtraOmzet, 600M },
                { Soort.ExtraProductiviteit, 6470M },
                { Soort.OverurenBesparing, 34570M },
                { Soort.ExterneInkoop, 6500M },
                { Soort.Subsidie, 3500M },
                { Soort.LogistiekeBesparing, 5000M },
                { Soort.ExtraBesparing, 4996M }
            };

            _analyse = new Analyse
            {
                Departement = dbContext.Aldi,

                /* KOSTEN */
                Loonkosten           = dbContext.Loonkosten,
                ExtraKosten          = dbContext.ExtraKosten,
                BegeleidingsKosten   = dbContext.BegeleidingsKosten,
                OpleidingsKosten     = dbContext.OpleidingsKosten,
                PersoneelsKosten     = dbContext.PersoneelsKosten,
                GereedschapsKosten   = dbContext.GereedschapsKosten,
                VoorbereidingsKosten = dbContext.VoorbereidingsKosten,
                EnclaveKosten        = dbContext.EnclaveKosten,

                /* BATEN */
                MedewerkersZelfdeNiveauBaten = dbContext.MedewerkerNiveauBaten,
                MedewerkersHogerNiveauBaten  = dbContext.MedewerkerNiveauBaten,
                UitzendKrachtBesparingen     = dbContext.UitzendKrachtBesparingen,
                ExterneInkopen      = dbContext.ExterneInkopen,
                ExtraOmzet          = dbContext.ExtraOmzet,
                ExtraProductiviteit = dbContext.ExtraProductiviteit,
                OverurenBesparing   = dbContext.OverurenBesparing,
                Subsidie            = dbContext.Subsidie,
                LogistiekeBesparing = dbContext.LogistiekeBesparing,
                ExtraBesparingen    = dbContext.ExtraBesparingen
            };

            IDictionary <Soort, decimal> totalen = _analyse.GeefTotalenBaten();

            foreach (KeyValuePair <Soort, decimal> pair in totalen)
            {
                decimal totaal = Math.Round(pair.Value, 2);
                Assert.Equal(expected[pair.Key], totaal);
            }
        }
Example #4
0
        public void VulBatenIn(Analyse analyse, ExcelWorksheet ws)
        {
            foreach (var pair in analyse.GeefTotalenBaten())
            {
                Soort   soort  = pair.Key;
                decimal waarde = pair.Value;

                if (tabelBedragen.ContainsKey(soort))
                {
                    ws.Cells[tabelBedragen[soort]].Value = waarde;
                }
            }
        }
Example #5
0
        public IActionResult Index(Analyse analyse)
        {
            ResultaatViewModel model = new ResultaatViewModel();

            try
            {
                analyse            = _analyseRepository.GetByIdAll(analyse.AnalyseId);
                model.AnalyseKlaar = analyse.InArchief;
                model.AnalyseId    = analyse.AnalyseId;

                if (analyse.Departement != null)
                {
                    IDictionary <Soort, decimal> kostenResultaat = analyse.GeefTotalenKosten();
                    IDictionary <Soort, decimal> batenResultaat  = analyse.GeefTotalenBaten();

                    decimal kostenTotaal = kostenResultaat.Sum(t => t.Value);
                    decimal batenTotaal  = batenResultaat.Sum(t => t.Value);

                    model.Resultaten = kostenResultaat;
                    foreach (var rij in batenResultaat)
                    {
                        model.Resultaten.Add(rij);
                    }

                    model.KostenTotaal = kostenTotaal;
                    model.BatenTotaal  = batenTotaal;
                    model.Totaal       = batenTotaal - kostenTotaal;

                    ViewData["SubTotaalBaten"] = model.BatenTotaal;


                    // kleur voor nettoresultaat bepalen
                    if (model.Totaal < 0)
                    {
                        ViewData["klasseTotaal"] = "alert-danger";
                    }
                    else if (model.Totaal == 0)
                    {
                        ViewData["klasseTotaal"] = "alert-warning";
                    }
                    else
                    {
                        ViewData["klasseTotaal"] = "alert-success";
                    }
                }
                else
                {
                    TempData["error"] =
                        "Opgelet! U heeft nog geen werkgever geselecteerd. Er zal dus nog geen resultaat " +
                        "berekend worden voor deze analyse.";
                }
            }
            catch (Exception e)
            {
                _exceptionLogRepository.Add(new ExceptionLog(e, "Resultaat", "Index"));
                _exceptionLogRepository.Save();
                TempData["error"] = "Er ging onverwachts iets fout, probeer later opnieuw";
            }


            return(View(model));
        }