예제 #1
0
        protected String GetTotalExpenses(Int32 TimesheetID)
        {
            int PeriodID = Int32.Parse(Request.Params["id"]);
            String Username = Request.Params["username"];

            TFS.Intranet.Data.Billing.ExpenseEntryCollection col = new TFS.Intranet.Data.Billing.ExpenseEntryController().FetchByTimesheetID(TimesheetID);

            Double total = 0;
            foreach (TFS.Intranet.Data.Billing.ExpenseEntry expenseentry in col)
            {
                total += expenseentry.Cost;
            }

            return total.ToString();
        }
예제 #2
0
        protected String GetTotalExpenses(Int32 TimesheetID)
        {
            int    PeriodID = Int32.Parse(Request.Params["id"]);
            String Username = Request.Params["username"];

            TFS.Intranet.Data.Billing.ExpenseEntryCollection col = new TFS.Intranet.Data.Billing.ExpenseEntryController().FetchByTimesheetID(TimesheetID);

            Double total = 0;

            foreach (TFS.Intranet.Data.Billing.ExpenseEntry expenseentry in col)
            {
                total += expenseentry.Cost;
            }

            return(total.ToString());
        }
예제 #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);
        }
        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;
        }