using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace JAMM.Kasse.Pages
{
    /// <summary>
    /// Interaktionslogik für ReportsThisYear.xaml
    /// </summary>
    public partial class ReportsThisYear : Page
    {
        // Variable to save the report values
        float sum = 0.0f;

        // The construktor
        public ReportsThisYear()
        {
            InitializeComponent();
            List<float> summe = new DB().getSalesReportThisYear();
            for (int i = 0; i < summe.Count; i++)
            {
                sum = sum + summe[i];
            }

            refresh();
            
        }

        /// <summary>
        /// Write the new value to the Gui
        /// </summary>
        private void refresh()
        {
            setThisYearSumme(sum);
            //add the items ource here
        }


        /// <summary>
        /// Set the label content
        /// </summary>
        /// <param name="summe">Sum of this year</param>
        private void setThisYearSumme(float summe)
        {
            this.thisYearSumme.Content = summe + " Euro";
        }
    }
}
