/// <summary>
        /// Gets the statistics.
        /// </summary>
        /// <param name="sessionID">The sessionID of the current session</param>
        /// <param name="stat">The stat.</param>
        /// <param name="typeOfStat">The type of stat.</param>
        /// <param name="productID">The product ID.</param>
        /// <param name="start">The start date and time </param>
        /// <param name="end">The end date and time</param>
        /// <returns></returns>
        public List<double> GetStatistics(string sessionID, StatObject stat, StatType typeOfStat, int productID, DateTime start, DateTime end)
        {
            if (stat == StatObject.Income)
            {
                if (typeOfStat == StatType.ForEachDay)
                {

                    BillItemsTableAdapter bia = new BillItemsTableAdapter();
                    CustomerTransactionsTableAdapter cta = new CustomerTransactionsTableAdapter();
                    var transactions = cta.GetDataByTimeFrame(start, end);
                    int numOfDays = (int)(end.Date.Subtract(start.Date).TotalDays);

                    double[] re = new double[numOfDays+1];
                    foreach (var trans in transactions)
                    {
                        if (!trans.IsEndTimeNull())
                        {
                            int dayVal = (int)(trans.EndTime.Date.Subtract(start.Date).TotalDays);
                            var bills = bia.GetDataByWorkflowID(trans.WorkflowInstID);
                            re[dayVal] += (double)(from p in bills select p.Price).Sum();
                        }
                    }
                    return re.ToList();

                }
            }
            else if (stat == StatObject.PayroleExpence)
            {
                if (typeOfStat == StatType.ForEachDay)
                {
                    WorkerShiftsTableAdapter wta = new WorkerShiftsTableAdapter();
                    var shifts = wta.GetDataByTimeFrame(start, end);
                    int numOfDays = (int)(end.Date.Subtract(start.Date).TotalDays);
                    RolePayrateTableAdapter rta = new RolePayrateTableAdapter();
                    var payoutTable = rta.GetData();
                    List<double> re = new List<double>();

                    DateTime i_start = start.Date;
                    DateTime i_end = i_start.Add(new TimeSpan(1, 0, 0, 0));
                    for (int i = 0; i < numOfDays; i++)
                    {
                        decimal v = (from p in shifts
                                     where p.StartTime > i_start && p.StartTime < i_end &&
                                     p.IsEndTimeNull() == false
                                     select (from q in payoutTable where q.Role == p.Role select q.PayPerHour).FirstOrDefault()
                                     * (decimal)(p.EndTime.Subtract(p.StartTime).TotalHours)).Sum();
                        re.Add((double)v);
                        i_start = i_end;
                        i_end = i_start.Add(new TimeSpan(1, 0, 0, 0));

                    }
                    return re;
                }
            }
            return null;
        }
 /// <summary>
 /// Gets the payrole report.
 /// </summary>
 /// <param name="sessionID">The sessionID of the current session</param>
 /// <param name="startTime">The start time of the report.</param>
 /// <param name="endTime">The end time of the report.</param>
 /// <returns></returns>
 public PayroleReport GetPayroleReport(string sessionID, DateTime startTime, DateTime endTime)
 {
     PayroleReport re = new PayroleReport();
     UsersTableAdapter uta = new UsersTableAdapter();
     RolePayrateTableAdapter rta = new RolePayrateTableAdapter();
     var payoutTable = rta.GetData();
     var employees = uta.GetData();
     decimal totalPayout = 0;
     re.Employees = new List<EmployeePayout>();
     foreach (var employee in employees)
     {
         EmployeePayout ep = GetEmployeePayout(employee, startTime, endTime, payoutTable);
         if (ep != null)
         {
             totalPayout += ep.TotalPayment;
             re.Employees.Add(ep);
         }
     }
     re.TotalPayout = totalPayout;
     re.StartReportTimeframe = startTime;
     re.EndReportTimeframe = endTime;
     return re;
 }