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 ReportsThisMonth.xaml
    /// </summary>
    public partial class ReportsThisMonth : Page
    {
        // Variable to save the report values
        float sum = 0.0f;
        //Konstruktor
        public ReportsThisMonth()
        {
            InitializeComponent();
            List<float> summe = new DB().getSalesReportThisMonth();
            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()
        {
            setThisMonthSumme(sum);
        }

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