Ejemplo n.º 1
0
        public DataTable GetBillingAccountsByBillingPeriodID(Int32 id)
        {
            EmployeeTimesheetInfoCollection col = FetchByBillingPeriodID(id);

            System.Collections.ArrayList accounts = new System.Collections.ArrayList();


            DataTable accountstable = new DataTable();

            accountstable.Columns.Add("AccountName");
            accountstable.Columns.Add("AccountID");
            foreach (EmployeeTimesheetInfo timesheetinfo in col)
            {
                if (accounts.Contains(timesheetinfo.Billingaccountid))
                {
                    continue;
                }
                DataRow newrow = accountstable.NewRow();
                newrow["AccountName"] = timesheetinfo.Accountname;
                newrow["AccountID"]   = timesheetinfo.Billingaccountid;
                accountstable.Rows.Add(newrow);
                accounts.Add(timesheetinfo.Billingaccountid);
            }
            return(accountstable);
        }
Ejemplo n.º 2
0
        public DataTable GetUsernamesByBillingPeriodID(Int32 id)
        {
            EmployeeTimesheetInfoCollection col = FetchByBillingPeriodID(id);

            System.Collections.ArrayList users = new System.Collections.ArrayList();
            foreach (EmployeeTimesheetInfo employeeinfo in col)
            {
                if (!users.Contains(employeeinfo.Username))
                {
                    users.Add(employeeinfo.Username);
                }
            }
            DataTable userstable = new DataTable();

            userstable.Columns.Add("Username");
            foreach (String username in users)
            {
                DataRow newrow = userstable.NewRow();
                newrow["Username"] = username;
                userstable.Rows.Add(newrow);
            }
            return(userstable);
        }
Ejemplo n.º 3
0
        public DataTable GetAccountSummaryTotals(Int32 Billingaccountid, Int32 PeriodID)
        {
            BillingPeriodAccountsJoin billingperiodaccount = new BillingPeriodAccountsJoinCollection().Where(BillingPeriodAccountsJoin.Columns.Periodid, PeriodID).Where(BillingPeriodAccountsJoin.Columns.Accountid, Billingaccountid).Load()[0];
            Int32 billingperiodaccountid = billingperiodaccount.Id;
            var   timeSheetController    = new TimesheetController();

            DataTable summaryTotals = new DataTable();

            summaryTotals.Columns.Add("RateGroupID");
            summaryTotals.Columns.Add("RateGroupName");
            summaryTotals.Columns.Add("Rate");
            summaryTotals.Columns.Add("TotalHours");

            summaryTotals.Columns.Add("PerDiemRate");
            summaryTotals.Columns.Add("PerDiemTotal");

            summaryTotals.Columns.Add("MileageRate");
            summaryTotals.Columns.Add("MileageTotal");

            summaryTotals.Columns.Add("ExpenseTotal");

            Double perdiemrate            = billingperiodaccount.Perdiemrate;
            Double cityPerdiemRateAverage =
                timeSheetController.GetPerCityDiemRateAverageByBillingPeriodAccountID(billingperiodaccountid);
            Double perdiemtotal = timeSheetController.GetPerDiemCountByBillingPeriodAccountID(billingperiodaccountid);
            Double expensetotal = new ExpenseEntryController().GetTotalByBillingPeriodAccountID(billingperiodaccountid);
            Double mileagerate  = billingperiodaccount.Mileagerate;
            Double mileagetotal = timeSheetController.GetMileageCountByBillingPeriodAccountID(billingperiodaccountid);

            if (cityPerdiemRateAverage > 0)
            {
                perdiemrate = cityPerdiemRateAverage;
            }

            RateGroupCollection rategroups = new RateGroupController().FetchAll();

            foreach (RateGroup rategroup in rategroups)
            {
                DataRow newrow = summaryTotals.NewRow();
                newrow["RateGroupID"]   = rategroup.Id;
                newrow["RateGroupName"] = rategroup.Name;
                BillingRateCollection billingratecollection = new BillingRateCollection().Where(BillingRate.Columns.Periodaccountid, billingperiodaccountid).Where(BillingRate.Columns.Groupid, rategroup.Id).Load();
                newrow["Rate"] = billingratecollection[0].Rate;

                Double totalHours = 0;

                EmployeeTimesheetInfoCollection col = GetTimesheets(Billingaccountid, PeriodID, rategroup.Id);
                foreach (EmployeeTimesheetInfo timesheet in col)
                {
                    totalHours += new TimeEntriesTotalController().GetTotalHoursByTimesheetID(timesheet.Timesheetid);
                }

                newrow["TotalHours"] = totalHours;

                newrow["PerDiemRate"]  = perdiemrate;
                newrow["PerDiemTotal"] = perdiemtotal;
                newrow["MileageRate"]  = mileagerate;
                newrow["MileageTotal"] = mileagetotal;
                newrow["ExpenseTotal"] = expensetotal;

                summaryTotals.Rows.Add(newrow);
            }


            return(summaryTotals);
        }
Ejemplo n.º 4
0
        public EmployeeTimesheetInfoCollection GetTimesheets(Int32 Billingaccountid, Int32 PeriodID, Int32 RateGroupID)
        {
            EmployeeTimesheetInfoCollection col = (new EmployeeTimesheetInfoCollection()).Where(EmployeeTimesheetInfo.Columns.Billingaccountid, Billingaccountid).Where(EmployeeTimesheetInfo.Columns.Billingperiodid, PeriodID).Where(EmployeeTimesheetInfo.Columns.Rategroupid, RateGroupID).OrderByAsc(EmployeeTimesheetInfo.Columns.Username).Load();

            return(col);
        }
Ejemplo n.º 5
0
        public EmployeeTimesheetInfoCollection GetTimesheets(String Username, Int32 PeriodID)
        {
            EmployeeTimesheetInfoCollection col = (new EmployeeTimesheetInfoCollection()).Where(EmployeeTimesheetInfo.Columns.Username, Username).Where(EmployeeTimesheetInfo.Columns.Billingperiodid, PeriodID).OrderByAsc(EmployeeTimesheetInfo.Columns.Accountname).Load();

            return(col);
        }