Example #1
0
        public void Exporteer(string path, BTWTarief tarief)
        {
            using (StreamWriter writer = new StreamWriter(path))
            {
                List <IInkomsten> overzicht = this.Overzicht(tarief);

                decimal totaal     = 0;
                decimal totaalHoog = 0;
                decimal totaalLaag = 0;

                foreach (IInkomsten iInkomst in overzicht)
                {
                    writer.WriteLine(string.Format("{0} - {1} - EUR {2}", iInkomst.Tijdstip.ToString(), iInkomst.BTWTarief, iInkomst.Bedrag.ToString()));
                    totaal += iInkomst.Bedrag;

                    if (iInkomst.BTWTarief == BTWTarief.Hoog)
                    {
                        totaalHoog += iInkomst.Bedrag;
                    }

                    if (iInkomst.BTWTarief == BTWTarief.Laag)
                    {
                        totaalLaag += iInkomst.Bedrag;
                    }
                }

                if (tarief == BTWTarief.Ongespecificeerd)
                {
                    writer.WriteLine("Totaal laag = EUR " + totaalLaag.ToString());
                    writer.WriteLine("Totaal hoog = EUR " + totaalHoog.ToString());
                }

                writer.WriteLine("Totaal = EUR " + totaal.ToString());
            }
        }
        public List<IInkomsten> Overzicht(BTWTarief tarief)
        {
            // Opgelet: je methode geeft geen inkomsten terug.

            List<IInkomsten> inkomsten = new List<IInkomsten>();
            foreach (Verkoop v in verkopen)
               //Fout gevonden, om een van der reden is het tarief niet zichtbaar
               // in de hoofdklasse maar wel in de subklasse.
            {
                string test = v.BTWTarief.ToString();
                string testTarief = tarief.ToString();

                if (v.BTWTarief == tarief || tarief == BTWTarief.Ongespecifeerd)
                {
                    inkomsten.Add(v);
                }
            }

            foreach (Verhuur v in verhuringen)
            {
                if (v.BTWTarief == tarief || tarief == BTWTarief.Ongespecifeerd)
                {
                    inkomsten.Add(v);
                }
            }

            inkomsten.OrderByDescending(i => i.Tijdstip).ToList(); //gebruik maken van Icomparable in verhuur en verkoop i.p.v lambda

            return inkomsten;
        }
Example #3
0
        public List <IInkomsten> Overzicht(BTWTarief tarief)
        {
            List <IInkomsten> temp = new List <IInkomsten>();
            List <IInkomsten> ret  = new List <IInkomsten>();

            foreach (Verkoop k in verkopen)
            {
                temp.Add(k);
            }
            foreach (Verhuur h in verhuringen)
            {
                temp.Add(h);
            }
            foreach (IInkomsten i in temp)
            {
                if (tarief == BTWTarief.Ongespecificeerd)
                {
                    ret.Add(i);
                }

                if (i.BTWTarief == tarief)
                {
                    ret.Add(i);
                }
            }
            ret.Sort((x, y) => y.Tijdstip.CompareTo(x.Tijdstip));
            return(ret);
        }
        public void Exporteer(string path, BTWTarief tarief)
        {
            List <IInkomsten> overzicht = new List <IInkomsten>();
            List <IInkomsten> verhTemp  = this.verhuringen.Cast <IInkomsten>().ToList();
            List <IInkomsten> verkTemp  = this.verkopen.Cast <IInkomsten>().ToList();

            foreach (IInkomsten i in verkTemp)
            {
                verhTemp.Add(i);
            }
            var           overzichtTemp = from v in verhTemp where (v.BTWTarief == tarief) orderby v.Tijdstip descending select v;
            List <string> stringList    = new List <string>();

            foreach (IInkomsten i in overzichtTemp)
            {
                stringList.Add(i.ToString());
            }

            //BRON: https://msdn.microsoft.com/en-us/library/system.io.file.createtext(v=vs.110).aspx
            if (!File.Exists(path + "test.txt"))
            {
                using (StreamWriter sw = File.CreateText(path + "test.txt"))
                {
                    foreach (string s in stringList)
                    {
                        sw.WriteLine(s);
                    }
                }
            }
        }
        public void Exporteer(string path, BTWTarief tarief)
        {
            List<IInkomsten> overzicht = new List<IInkomsten>();
            List<IInkomsten> verhTemp = this.verhuringen.Cast<IInkomsten>().ToList();
            List<IInkomsten> verkTemp = this.verkopen.Cast<IInkomsten>().ToList();
            foreach (IInkomsten i in verkTemp)
            {
                verhTemp.Add(i);
            }
            var overzichtTemp = from v in verhTemp where (v.BTWTarief == tarief) orderby v.Tijdstip descending select v;
            List<string> stringList = new List<string>();
            foreach(IInkomsten i in overzichtTemp)
            {
                stringList.Add(i.ToString());
            }

            //BRON: https://msdn.microsoft.com/en-us/library/system.io.file.createtext(v=vs.110).aspx
            if (!File.Exists(path + "test.txt"))
            {
                using (StreamWriter sw = File.CreateText(path + "test.txt"))
                {
                    foreach (string s in stringList)
                    {
                        sw.WriteLine(s);
                    }
                }
            }
        }
        public void Exporteer(string path, BTWTarief tarief)
        {
            using (StreamWriter writer = new StreamWriter(path))
            {
                List<IInkomsten> overzicht = this.Overzicht(tarief);

                decimal totaal = 0;
                decimal totaalHoog = 0;
                decimal totaalLaag = 0;

                foreach (IInkomsten iInkomst in overzicht)
                {
                    writer.WriteLine(string.Format("{0} - {1} - EUR {2}", iInkomst.Tijdstip.ToString(), iInkomst.BTWTarief, iInkomst.Bedrag.ToString()));
                    totaal += iInkomst.Bedrag;

                    if (iInkomst.BTWTarief == BTWTarief.Hoog)
                    {
                        totaalHoog += iInkomst.Bedrag;
                    }

                    if (iInkomst.BTWTarief == BTWTarief.Laag)
                    {
                        totaalLaag += iInkomst.Bedrag;
                    }
                }

                if (tarief == BTWTarief.Ongespecificeerd)
                {
                    writer.WriteLine("Totaal laag = EUR " + totaalLaag.ToString());
                    writer.WriteLine("Totaal hoog = EUR " + totaalHoog.ToString());
                }

                writer.WriteLine("Totaal = EUR " + totaal.ToString());
            }
        }
        public void Exporteer(string path, BTWTarief tarief)
        {
            //Codeerstijl matig: veel dubbele code.

            List<IInkomsten> exportList = this.Overzicht(tarief);
            decimal totaalBedrag = 0;
            decimal totaalBedragHoog = 0;
            decimal totaalBedragLaag = 0;

            foreach (IInkomsten item in exportList)
            {
                totaalBedrag = totaalBedrag + item.Bedrag;
            }

            foreach (IInkomsten item in exportList.Where(i => i.BTWTarief == BTWTarief.Hoog))
            {
                totaalBedragHoog = totaalBedragHoog + item.Bedrag;
            }

            foreach (IInkomsten item in exportList.Where(i => i.BTWTarief == BTWTarief.Laag))
            {
                totaalBedragLaag = totaalBedragLaag + item.Bedrag;
            }
            using (StreamWriter sw = new StreamWriter(path))
            {
                switch (tarief)
                {
                    case BTWTarief.Ongespecificeerd:
                        foreach (IInkomsten item in exportList)
                        {
                            sw.WriteLine(string.Format("{0} - {1} EUR {2}", item.Tijdstip, item.BTWTarief, item.Bedrag));
                        }
                        sw.WriteLine(string.Format("Totaal Laag: {0}", totaalBedragLaag));
                        sw.WriteLine(string.Format("Totaal Hoog: {0}", totaalBedragHoog));
                        sw.WriteLine(string.Format("Totaal : {0}", totaalBedrag));
                        break;
                    case BTWTarief.Laag:
                        foreach (IInkomsten item in exportList.Where(i => i.BTWTarief == BTWTarief.Laag))
                        {
                            sw.WriteLine(string.Format("{0} - {1} EUR {2}", item.Tijdstip, item.BTWTarief, item.Bedrag));
                            sw.WriteLine(string.Format("Totaal : {0}", totaalBedrag));
                        }
                        break;
                    case BTWTarief.Hoog:
                        foreach (IInkomsten item in exportList.Where(i => i.BTWTarief == BTWTarief.Hoog))
                        {
                            sw.WriteLine(string.Format("{0} - {1} EUR {2}", item.Tijdstip, item.BTWTarief, item.Bedrag));
                            sw.WriteLine(string.Format("Totaal : {0}", totaalBedrag));
                        }
                        break;
                }
            }
        }
Example #8
0
        public void BTWTarief_wordt_onafhankelijk_van_overerving_teruggegeven()
        {
            IInkomsten s             = new Feestzaal(new DateTime(2015, 03, 03), 3);
            BTWTarief  teControleren = BTWTarief.Hoog;

            Assert.AreEqual(teControleren, s.BTWTarief);
            Assert.AreEqual(teControleren, ((Verhuur)s).BTWTarief);
            Assert.AreEqual(teControleren, ((Feestzaal)s).BTWTarief);

            // Illustration: can not be changed from outside the class.
            // Enforced at compile time.
            // s.BTWTarief = BTWTarief.Laag;
        }
 public void Exporteer(string path, BTWTarief tarief)
 {
     using (StreamWriter sw = new StreamWriter(path))
     {
         sw.WriteLine("Tarieven op basis van het gegeven tarief:");
         List<IInkomsten> inkomsten = Overzicht(tarief);
         foreach (IInkomsten i in inkomsten)
         {
             sw.WriteLine(i.ToString());
             // TODO tostring methode gebruiken van i.
         }
     }
 }
Example #10
0
        private void btnOverzichtExporteer_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Filter           = "Text file|*.txt|All files|*.*";
            sfd.AddExtension     = true;
            sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            sfd.OverwritePrompt  = true;

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                BTWTarief tarief = (BTWTarief)cbOverzichtBTW.SelectedValue;
                this.administratie.Exporteer(sfd.FileName, tarief);
            }
        }
Example #11
0
        public List <IInkomsten> Overzicht(BTWTarief tarief)
        {
            List <IInkomsten> overzicht = new List <IInkomsten>();

            overzicht.AddRange(this.Verhuringen);
            overzicht.AddRange(this.Verkopen);

            if (tarief != BTWTarief.Ongespecificeerd)
            {
                overzicht = overzicht.Where(i => i.BTWTarief == tarief).ToList();
            }

            overzicht.Sort(new CompareIInkomstenByDateDescending());

            return(overzicht);
        }
 public List<IInkomsten> Overzicht(BTWTarief tarief)
 {
     List<IInkomsten> overzicht = new List<IInkomsten>();
     List<IInkomsten> verhTemp = this.verhuringen.Cast<IInkomsten>().ToList();
     List<IInkomsten> verkTemp = this.verkopen.Cast<IInkomsten>().ToList();
     foreach (IInkomsten i in verkTemp)
     {
         verhTemp.Add(i);
     }
     var overzichtTemp = from v in verhTemp where (v.BTWTarief == tarief) orderby v.Tijdstip descending select v;
     foreach (IInkomsten o in overzichtTemp)
     {
         overzicht.Add(o);
     }
     return overzicht;
 }
        /// <summary>
        /// genereert specifieke lijst van verschillende btw-tarieven
        /// </summary>
        /// <param name="tarief">te zoeken tarief</param>
        /// <returns>stuurt interface lijst terug van de verschillende btw-tarieven</returns>
        public List<IInkomsten> Overzicht(BTWTarief tarief)
        {
            List<IInkomsten> LijstTarieven = new List<IInkomsten>();
            List<Verkoop> sortedList = verkopen;
             // de = statement kopieert de referentie naar de verzameling
             // die maakt GEEN nieuwe verzameling met dezelfde referenties
             // naar de objecten erin.

            // Gemeenschappelijke code buiten de switch plaatsen
            // kijk ook eens naar de filter methode die je bij lambda kunt
            // gebruiken.
            switch (tarief)
            {
                case BTWTarief.Ongespecificeerd:
                    sortedList.Sort((x, y) => x.Tijdstip.CompareTo(y.Tijdstip));
                    sortedList.Reverse();
                    foreach (Verkoop v in sortedList)
                    {
                        LijstTarieven.Add((IInkomsten)v);
                    }
                    goto default;
                case BTWTarief.Laag:
                    sortedList.Sort((x, y) => x.Tijdstip.CompareTo(y.Tijdstip));
                    sortedList.Reverse();
                    foreach (Verkoop v in sortedList)
                    {
                        if (v.BTWTarief == BTWTarief.Laag)
                            LijstTarieven.Add((IInkomsten)v);
                    }
                    goto default;
                case BTWTarief.Hoog:
                    sortedList.Sort((x, y) => x.Tijdstip.CompareTo(y.Tijdstip));
                    sortedList.Reverse();
                    foreach (Verkoop v in sortedList)
                    {
                        if (v.BTWTarief == BTWTarief.Hoog)
                            LijstTarieven.Add((IInkomsten)v);
                    }
                    goto default;
                default:
                    return LijstTarieven;
            }

            // sorteren
            // teruggeven
        }
        public List <IInkomsten> Overzicht(BTWTarief tarief)
        {
            List <IInkomsten> overzicht = new List <IInkomsten>();
            List <IInkomsten> verhTemp  = this.verhuringen.Cast <IInkomsten>().ToList();
            List <IInkomsten> verkTemp  = this.verkopen.Cast <IInkomsten>().ToList();

            foreach (IInkomsten i in verkTemp)
            {
                verhTemp.Add(i);
            }
            var overzichtTemp = from v in verhTemp where (v.BTWTarief == tarief) orderby v.Tijdstip descending select v;

            foreach (IInkomsten o in overzichtTemp)
            {
                overzicht.Add(o);
            }
            return(overzicht);
        }
 /// <summary>
 /// Exporteert een file
 /// </summary>
 /// <param name="path">Het pad van de file</param>
 /// <param name="tarief">Welke tarieven worden geexporteerd</param>
 /// <param name="error">De error mits het fout gaat</param>
 /// <returns>Of het is foutgegaan of niet</returns>
 public bool Exporteer(string path, BTWTarief tarief, out string error)
 {
     error = string.Empty;
     try
     {
         StreamWriter sw = new StreamWriter(path);
         Overzicht(tarief).ForEach(i => sw.WriteLine(String.Format("{0} - {1}", i.ToString(), i.BTWTarief)));
         sw.WriteLine();
         sw.WriteLine("Totaal Laag: EUR " + LaagBTW);
         sw.WriteLine("Totaal Hoog: EUR " + HoogBTW);
         sw.WriteLine("Totaal: EUR " + Convert.ToDecimal(LaagBTW + HoogBTW));
         sw.Close();
         return false;
     }
     catch (Exception e)
     {
         error = "Oeps, de volgende error heeft zich voortgedaan: \n" + e.Message;
         return true;
     }
 }
        private void btnOverzichtExporteer_Click(object sender, EventArgs e)
        {
            SaveFileDialog Save = new SaveFileDialog();

            Save.DefaultExt = ".txt";
            Save.Filter     = "Text file (*.txt)|*.txt|Alle bestanden|*.*";
            BTWTarief temp = new BTWTarief();

            switch (cbOverzichtBTW.SelectedItem.ToString())
            {
            case "Ongespecificeerd":
            {
                temp = BTWTarief.Ongespecificeerd;
                break;
            }

            case "Laag":
            {
                temp = BTWTarief.Laag;
                break;
            }

            case "Hoog":
            {
                temp = BTWTarief.Hoog;
                break;
            }
            }
            if (cbOverzichtBTW.SelectedIndex == -1)
            {
                if (Save.ShowDialog() == DialogResult.OK)
                {
                    administratie.Exporteer(Save.FileName, temp);
                }
            }
            else
            {
                MessageBox.Show("Selecteer een BTW Tarief");
            }
        }
        public List<IInkomsten> Overzicht(BTWTarief tarief)
        {
            List<IInkomsten> overzicht = new List<IInkomsten>();

            if (tarief == BTWTarief.Ongespecificeerd)
            {
                overzicht.AddRange(Verkopen);
            }
            else if (tarief != BTWTarief.Ongespecificeerd)
            {
                foreach (Verkoop a in Verkopen)
                {
                    if (a.BTWTarief == tarief)
                    {
                        overzicht.Add(a);
                    }
                }
            }

            if (tarief == BTWTarief.Ongespecificeerd)
            {
                overzicht.AddRange(Verhuringen);
            }
            else if (tarief != BTWTarief.Ongespecificeerd)
            {
                foreach (Verhuur v in Verhuringen)
                {
                    if (v.BTWTarief == tarief)
                    {
                        overzicht.Add(v);
                    }
                }
            }

            overzicht.Sort();
            return overzicht;
        }
        public List <IInkomsten> Overzicht(BTWTarief tarief)
        {
            List <IInkomsten> overzicht = new List <IInkomsten>();

            if (tarief == BTWTarief.Ongespecificeerd)
            {
                overzicht.AddRange(Verkopen);
            }
            else if (tarief != BTWTarief.Ongespecificeerd)
            {
                foreach (Verkoop a in Verkopen)
                {
                    if (a.BTWTarief == tarief)
                    {
                        overzicht.Add(a);
                    }
                }
            }

            if (tarief == BTWTarief.Ongespecificeerd)
            {
                overzicht.AddRange(Verhuringen);
            }
            else if (tarief != BTWTarief.Ongespecificeerd)
            {
                foreach (Verhuur v in Verhuringen)
                {
                    if (v.BTWTarief == tarief)
                    {
                        overzicht.Add(v);
                    }
                }
            }

            overzicht.Sort();
            return(overzicht);
        }
 public SterkeDrank(int aantal)
     : base(aantal)
 {
     this.btwTarief = BTWTarief.Laag;
 }
Example #20
0
 //Methodes
 public override string ToString()
 {
     return(Aantal.ToString() + ", " + Bedrag.ToString() + ", " + Tijdstip.ToString() + ", " + BTWTarief.ToString() + ", " + Prijs.ToString());
 }
Example #21
0
 //Constructor
 public Frisdrank(int aantal)
     : base(aantal)
 {
     btwTarief = BTWTarief.Hoog;
     prijs     = 6;
 }
 //Constructor
 public Vergaderruimte(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     btwTarief = BTWTarief.Laag;
     prijsPerUur = 18;
 }
Example #23
0
 public SterkeDrank(int aantal) : base(aantal)
 {
     this.btwTarief = BTWTarief.Hoog;
     this.prijs     = 3.00M;
 }
Example #24
0
 public Fris(int aantal)
     : base(aantal)
 {
     this.btwTarief = BTWTarief.Laag;
 }
 public FitnesZaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     this.btwTarief = BTWTarief.Laag;
 }
 //Constructor
 public Sterkedrank(int aantal)
     : base(aantal)
 {
     btwTarief = BTWTarief.Laag;
     prijs = 9;
 }
 public Sterkedrank(int aantal)
     : base(aantal)
 {
     this.BTWtarief = BTWTarief.Hoog;
     this.prijs = Convert.ToDecimal(10);
 }
Example #28
0
 //Constructor
 public Feestzaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     btwTarief   = BTWTarief.Hoog;
     prijsPerUur = 10;
 }
 public Frisdrank(int aantal)
     : base(aantal)
 {
     this.btwTarief = BTWTarief.Laag;
     this.prijs = 2.00M;
 }
        public List<IInkomsten> Overzicht(BTWTarief tarief)
        {
            List<IInkomsten> overzicht = new List<IInkomsten>();
            overzicht.AddRange(this.Verhuringen);
            overzicht.AddRange(this.Verkopen);

            if (tarief != BTWTarief.Ongespecificeerd)
            {
                overzicht = overzicht.Where(i => i.BTWTarief == tarief).ToList();
            }

            overzicht.Sort(new CompareIInkomstenByDateDescending());

            return overzicht;
        }
 public Feestzaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     this.btwTarief = BTWTarief.Hoog;
     this.prijsPerUur = 80m;
 }
Example #32
0
 public Feestzaal(DateTime tijdstip, int urenVerhuurd) : base(tijdstip, urenVerhuurd)
 {
     this.btwTarief   = BTWTarief.Hoog;
     this.prijsPerUur = 80m;
 }
 public void Exporteer(string path, BTWTarief tarief)
 {
 }
Example #34
0
 //Constructor
 public Sportzaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     btwTarief   = BTWTarief.Laag;
     prijsPerUur = 15;
 }
 public List<IInkomsten> Overzicht(BTWTarief tarief)
 {
     return null;
 }
 public SterkeDrank(int aantal)
     : base(aantal)
 {
     this.btwTarief = BTWTarief.Hoog;
     this.prijs = 3.00M;
 }
Example #37
0
 public Theaterzaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     this.btwTarief   = BTWTarief.Laag;
     this.prijsPerUur = 250m;
 }
Example #38
0
 //Constructor
 public Vergaderruimte(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     btwTarief   = BTWTarief.Laag;
     prijsPerUur = 18;
 }
        public List<IInkomsten> Overzicht(BTWTarief tarief)
        {
            List<IInkomsten> inkomsten = new List<IInkomsten>();

            //Codeerstijl matig: veel dubbele code.
            if (tarief == BTWTarief.Ongespecificeerd)
            {
                foreach (Verkoop item in Verkopen)
                {
                    inkomsten.Add(item);
                }

                foreach (Verhuur item in Verhuringen)
                {
                    inkomsten.Add(item);
                }
            }
            else
            {
                foreach (Verkoop item in Verkopen.Where(v => v.BTWTarief == tarief))
                {
                    inkomsten.Add(item);
                }
                foreach (Verhuur item in Verhuringen.Where(v => v.BTWTarief == tarief))
                {
                    inkomsten.Add(item);
                }
            }

            inkomsten = inkomsten.OrderByDescending(v => v.Tijdstip).ToList();
            return inkomsten;
        }
Example #40
0
 //Constructor
 public Frisdrank(int aantal)
     : base(aantal)
 {
     btwTarief = BTWTarief.Hoog;
     prijs = 6;
 }
Example #41
0
 public Pringles(int aantal)
     : base(aantal)
 {
     this.btwTarief = BTWTarief.Hoog;
     this.prijs     = 1.00M;
 }
 public Theaterzaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     this.btwTarief = BTWTarief.Laag;
     this.prijsPerUur = 250m;
 }
Example #43
0
 //Methodes
 public override string ToString()
 {
     return(UrenVerhuurd.ToString() + ", " + Bedrag.ToString() + ", " + Tijdstip.ToString() + ", " + BTWTarief.ToString() + ", " + PrijsPerUur.ToString());
 }
Example #44
0
 //Constructor
 public Broodje(int aantal)
     : base(aantal)
 {
     btwTarief = BTWTarief.Laag;
     prijs     = 4;
 }
 public Frisdrank(int aantal)
     : base(aantal)
 {
     this.btwTarief = BTWTarief.Laag;
     this.prijs     = 2.00M;
 }
 //Constructor
 public Sterkedrank(int aantal)
     : base(aantal)
 {
     btwTarief = BTWTarief.Laag;
     prijs     = 9;
 }
 public Feestzaal(DateTime tijdstip, int urenVerhuurd)
     : base(tijdstip, urenVerhuurd)
 {
     this.BTWtarief = BTWTarief.Hoog;
     this.prijsPerUur = Convert.ToDecimal(100.00);
 }
        public List<IInkomsten> Overzicht(BTWTarief tarief)
        {
            List<IInkomsten> temp = new List<IInkomsten>();
            List<IInkomsten> ret = new List<IInkomsten>();
            foreach (Verkoop k in verkopen)
            {
                temp.Add(k);
            }
            foreach (Verhuur h in verhuringen)
            {
                temp.Add(h);
            }
            foreach (IInkomsten i in temp)
            {
                if (tarief == BTWTarief.Ongespecificeerd)
                {
                    ret.Add(i);
                }

                if (i.BTWTarief == tarief)
                {
                    ret.Add(i);
                }
            }
            ret.Sort((x, y) => y.Tijdstip.CompareTo(x.Tijdstip));
            return ret;
        }
Example #49
0
 //Constructor
 public Broodje(int aantal)
     : base(aantal)
 {
     btwTarief = BTWTarief.Laag;
     prijs = 4;
 }
        public void Exporteer(string path, BTWTarief tarief)
        {
            decimal hoog = 0M;
            decimal laag = 0M;
            decimal totaal = 0M;
            List<IInkomsten> templist = Overzicht(tarief);
            StreamWriter writer = new StreamWriter(path);
            if (tarief == BTWTarief.Ongespecificeerd)
            {
                foreach (IInkomsten i in templist)
                {
                    writer.WriteLine(String.Format("{0} - {1}", i.ToString(), i.BTWTarief));
                    if (i.BTWTarief == BTWTarief.Laag)
                    {
                        laag += i.Bedrag;
                    }
                    if (i.BTWTarief == BTWTarief.Hoog)
                    {
                        hoog += i.Bedrag;
                    }
                    totaal += i.Bedrag;
                }
                writer.WriteLine();
                writer.WriteLine("Totaal Laag: EUR " + laag);
                writer.WriteLine("Totaal Hoog: EUR " + hoog);
                writer.WriteLine("Totaal: EUR " + totaal);
                writer.Close();
            }
            else
            {
                foreach (IInkomsten i in templist)
                {
                    writer.WriteLine(String.Format("{0}", i.ToString()));
                    switch (tarief)
                    {
                        case BTWTarief.Hoog:
                            {
                                if (i.BTWTarief == BTWTarief.Hoog)
                                {

                                    hoog += i.Bedrag;
                                }
                                break;
                            }
                        case BTWTarief.Laag:
                            {
                                if (i.BTWTarief == BTWTarief.Laag)
                                {
                                    laag += i.Bedrag;
                                }
                                break;
                            }
                    }
                                   totaal += i.Bedrag;
                }
                switch(tarief)
                {
                    case BTWTarief.Hoog:
                        {
                            writer.WriteLine();
                            writer.WriteLine("Totaal Hoog: EUR " + hoog);
                            writer.WriteLine("Totaal: EUR " + totaal);
                            writer.Close();
                            break;
                        }
                    case BTWTarief.Laag:
                        {
                            writer.WriteLine();
                            writer.WriteLine("Totaal Laag: EUR " + laag);
                            writer.WriteLine("Totaal: EUR " + totaal);
                            writer.Close();
                            break;
                        }
                }

            }
        }
 public Snack(int aantal)
     : base(aantal)
 {
     this.BTWtarief = BTWTarief.Laag;
     this.prijs = Convert.ToDecimal(3);
 }
 public Frisdrank(int aantal)
     : base(aantal)
 {
     this.BTWtarief = BTWTarief.Laag;
     this.prijs = Convert.ToDecimal(5);
 }
Example #53
0
        public void Exporteer(string path, BTWTarief tarief)
        {
            decimal           hoog     = 0M;
            decimal           laag     = 0M;
            decimal           totaal   = 0M;
            List <IInkomsten> templist = Overzicht(tarief);
            StreamWriter      writer   = new StreamWriter(path);

            if (tarief == BTWTarief.Ongespecificeerd)
            {
                foreach (IInkomsten i in templist)
                {
                    writer.WriteLine(String.Format("{0} - {1}", i.ToString(), i.BTWTarief));
                    if (i.BTWTarief == BTWTarief.Laag)
                    {
                        laag += i.Bedrag;
                    }
                    if (i.BTWTarief == BTWTarief.Hoog)
                    {
                        hoog += i.Bedrag;
                    }
                    totaal += i.Bedrag;
                }
                writer.WriteLine();
                writer.WriteLine("Totaal Laag: EUR " + laag);
                writer.WriteLine("Totaal Hoog: EUR " + hoog);
                writer.WriteLine("Totaal: EUR " + totaal);
                writer.Close();
            }
            else
            {
                foreach (IInkomsten i in templist)
                {
                    writer.WriteLine(String.Format("{0}", i.ToString()));
                    switch (tarief)
                    {
                    case BTWTarief.Hoog:
                    {
                        if (i.BTWTarief == BTWTarief.Hoog)
                        {
                            hoog += i.Bedrag;
                        }
                        break;
                    }

                    case BTWTarief.Laag:
                    {
                        if (i.BTWTarief == BTWTarief.Laag)
                        {
                            laag += i.Bedrag;
                        }
                        break;
                    }
                    }
                    totaal += i.Bedrag;
                }
                switch (tarief)
                {
                case BTWTarief.Hoog:
                {
                    writer.WriteLine();
                    writer.WriteLine("Totaal Hoog: EUR " + hoog);
                    writer.WriteLine("Totaal: EUR " + totaal);
                    writer.Close();
                    break;
                }

                case BTWTarief.Laag:
                {
                    writer.WriteLine();
                    writer.WriteLine("Totaal Laag: EUR " + laag);
                    writer.WriteLine("Totaal: EUR " + totaal);
                    writer.Close();
                    break;
                }
                }
            }
        }
 /// <summary>
 /// Retourneert een overzicht van de geselecteerde btw tarieven. Indien ongespecifieerd, retourneer alles.
 /// </summary>
 /// <param name="tarief"></param>
 /// <returns></returns>
 public List<IInkomsten> Overzicht(BTWTarief tarief)
 {
     return tarief != BTWTarief.Ongespecificeerd ?
         ListAankopen.FindAll(i => i.BTWTarief == tarief).OrderByDescending(i => i.Tijdstip).ToList() :
         ListAankopen.OrderByDescending(i => i.Tijdstip).ToList();
 }