using System;
using System.Collections.Generic;
using BeWo.Data.Entities;
using BeWo.Report.ReportObjects;


namespace BeWo.VereinDuerenerChristenReports
{
	public class CustomMitarbeiterstundenkontoBerechnung : MitarbeiterstundenkontoBerechnung
	{
	    public override void HandleServiceRecord(MitarbeiterstundenkontoRO.EmployeeDetail emp, ServiceRecord item)
	    {
            if (item.ServiceDescription != null)
            {
                decimal duration = 0;
                if (item.GroupRoundedDuration.HasValue)
                {
                    duration = item.GroupRoundedDuration.Value;
                }
                else
                {
                    duration = item.RoundedDuration;
                }

                if (item.ServiceDescription.Name == "Assistenzstunden")
                {
                    emp.Custom1 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "Fahrtzeit")
                {
                    emp.Custom2 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "Büro/Orga")
                {
                    emp.Custom3 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "Leitung")
                {
                    emp.Custom4 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "UMF")
                {
                    emp.Custom5 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "Familienhilfe")
                {
                    emp.Custom6 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "ohne Terminabsage ausgefallene FLS")
                {
                    emp.Custom7 += duration / 60;
                }
                else if (item.ServiceDescription.Name == "Pause")
                {
                    emp.Custom8 += duration / 60;
                }
            }
        }

        public override bool AddServiceRecordToDuration(ServiceRecord item)
		{
			if (item.ServiceDescription != null && item.ServiceDescription.Name == "ohne Terminabsage ausgefallene FLS")
			{
                return false;
			}
			return true;
		}
	}
}
