public void CalculateReport_AtleastOneRequestFound_And_ActualMonth_ReturnsAReportFilledInWithEstimates()
        {
            const string specificId        = "BBCED7DB-6972-46D4-B6CF-D2C733E4B23D";
            var          reportServiceMock = new Mock <IRequestCounterService>();

            reportServiceMock
            .Setup(moq =>
                   moq._api_requests_year_month_getAsync(It.IsAny <int>(), It.IsAny <int>()))
            .Returns(
                Task.FromResult <Requests>(
                    new Requests()
            {
                Requests1 = new List <Request>()
                {
                    new Request()
                    {
                        SubscriptionId = specificId,
                        Requested      = DateTime.Now.ToString()
                    }
                }
            }));

            var service = new ReportCalculatorService(reportServiceMock.Object);

            MonthlyReport result = service.CalculateReport(specificId, DateTime.Now.Year, DateTime.Now.Month).Result;

            Assert.AreNotEqual(result.EstimatesForMonth, null);
        }
        public void CalculateReport_AtleastOneRequestFound_ReturnsAReportFilledIn()
        {
            const string specificId        = "BBCED7DB-6972-46D4-B6CF-D2C733E4B23D";
            var          reportServiceMock = new Mock <IRequestCounterService>();

            reportServiceMock
            .Setup(moq =>
                   moq._api_requests_year_month_getAsync(It.IsAny <int>(), It.IsAny <int>()))
            .Returns(
                Task.FromResult <Requests>(
                    new Requests()
            {
                Requests1 = new List <Request>()
                {
                    new Request()
                    {
                        SubscriptionId = specificId
                    }
                }
            }));

            var service = new ReportCalculatorService(reportServiceMock.Object);

            MonthlyReport result = service.CalculateReport(specificId, 1, 1).Result;

            Assert.IsTrue(result.TotalNumberOfRequests > 0);
            Assert.AreEqual(result.SubscriptionId, specificId);
            Assert.IsTrue(result.StartDate.CompareTo(new DateTime(1, 1, 1)) == 0);
            Assert.IsTrue(result.EndDate.CompareTo(new DateTime(1, 1, 31)) == 0);
            Assert.AreNotEqual(result.Costs, null);
            Assert.AreEqual(result.EstimatesForMonth, null);
        }
Example #3
0
        public async Task <IActionResult> PutMonthlyReport(long id, MonthlyReport monthlyReport)
        {
            if (id != monthlyReport.Id)
            {
                return(BadRequest());
            }

            _context.Entry(monthlyReport).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MonthlyReportExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #4
0
        public MonthlyReport GetMonthlyReport(int pastureID, int year, int month)
        {
            MonthlyReport  report     = new MonthlyReport();
            DateTime       reportDate = (new DateTime(year, month, 1)).AddMonths(1).AddDays(-1);//取本月最后一天
            DailyReportBLL drBLL      = new DailyReportBLL(pastureID);
            //取该月日报
            List <DailyReport> dailyReports = drBLL.GetDailyReport(pastureID, new DateTime(year, month, 1), reportDate);
            var sorted = dailyReports.OrderByDescending(a => a.ReportDate);

            dailyReports = sorted.ToList();
            DailyReport latestDailyReport = dailyReports.First();

            //牛群结构按最后一天
            report.CalfNumber        = latestDailyReport.CalfNumber;
            report.BredCattleNumber  = latestDailyReport.BredCattleNumber;
            report.NullParityNumber  = latestDailyReport.NullParityNumber;
            report.MultiParityNumber = latestDailyReport.MultiParityNumber;
            report.DryCowNumber      = latestDailyReport.DryCowNumber;
            report.MilkCowNumber     = latestDailyReport.MilkCowNumber;
            report.ReportMonth       = month;
            report.ReportYear        = year;

            int   calvingNum = 0, maleCalf = 0, femaleCalf = 0;
            float saleMilk = 0, milkForCalf = 0, abnormal = 0, badMilk = 0, leftMilk = 0, amount = 0;
            int   soldCow = 0, deadCow = 0, eliminatedCow = 0;

            foreach (DailyReport item in dailyReports)
            {
                calvingNum = calvingNum + item.CalvingNumber;
                maleCalf   = maleCalf + item.MaleCalfNumber;
                femaleCalf = femaleCalf + item.FemaleCalfNumber;

                saleMilk    = saleMilk + item.SaleMilk;
                milkForCalf = milkForCalf + item.MilkForCalf;
                abnormal    = abnormal + item.AbnormalSaleMilk;
                badMilk     = badMilk + item.BadMilk;
                leftMilk    = leftMilk + item.LeftMilk;
                amount      = amount + item.Amount;

                soldCow       = soldCow + item.SoldCowNum;
                deadCow       = deadCow + item.DeadCowNum;
                eliminatedCow = eliminatedCow + item.ElimintedCowNum;
            }
            report.CalfNumber       = calvingNum;
            report.MaleCalfNumber   = maleCalf;
            report.FemaleCalfNumber = femaleCalf;

            report.SaleMilk         = saleMilk;
            report.AbnormalSaleMilk = abnormal;
            report.MilkForCalf      = milkForCalf;
            report.LeftMilk         = leftMilk;
            report.Amount           = amount;

            //离群
            report.SoldCowNum      = soldCow;
            report.DeadCowNum      = deadCow;
            report.ElimintedCowNum = eliminatedCow;

            return(report);
        }
        public List <DictionaryVmodel> GetSummaryRptDataSource(ReportInstance RptModel, bool IsTargetPlan)
        {
            _Target       = RptModel._Target;
            Report        = RptModel.Report;
            _System       = RptModel._System;
            FinYear       = RptModel.FinYear;
            FinMonth      = RptModel.FinMonth;
            ReportDetails = RptModel.ReportDetails;
            string MonthlyReportIDs = "";

            ReportDetails.GroupBy(x => x.MonthlyReportID).Select(x => x.Key).ToList().ForEach(x => MonthlyReportIDs += "," + x);
            MonthlyReportIDs = MonthlyReportIDs.Trim(',');
            if (ReportDetails != null && ReportDetails.Count() > 0)
            {
                _System = StaticResource.Instance[_System.ID, ReportDetails[0].CreateTime];
                _Target = StaticResource.Instance.GetTargetList(_System.ID, ReportDetails[0].CreateTime).ToList();
            }

            List <MonthReportSummaryViewModel> listMRSVM = GetMonthlyReportDetailSummaryList();
            //List<B_Attachment> listAtt = GetListAtt(_System.ID);
            List <B_Attachment>     listAtt = GetListAtt(MonthlyReportIDs);
            List <DictionaryVmodel> listMonthReportSummary = new List <DictionaryVmodel>();
            string strReportDescription = "";

            if (Report != null)
            {
                strReportDescription = Report.Description;
            }
            listMonthReportSummary.Add(new DictionaryVmodel("ReportInstance", RptModel));
            listMonthReportSummary.Add(new DictionaryVmodel("月报说明", strReportDescription));
            listMonthReportSummary.Add(new DictionaryVmodel("月度经营报告", listMRSVM, "", GetSummaryMonthlyReportHtmlTemplate(_System.Configuration)));
            listMonthReportSummary.Add(new DictionaryVmodel("附件", listAtt));
            listMonthReportSummary.Add(new DictionaryVmodel("完成情况明细查询条件", SpliteCompanyPropertyXml("Search", _System.Configuration)));
            return(listMonthReportSummary);
        }
        public void CalculateReport_AtleastOneRequestFound_ReturnsAReportCreated()
        {
            var reportServiceMock = new Mock <IRequestCounterService>();

            reportServiceMock
            .Setup(moq =>
                   moq._api_requests_year_month_getAsync(It.IsAny <int>(), It.IsAny <int>()))
            .Returns(
                Task.FromResult <Requests>(
                    new Requests()
            {
                Requests1 = new List <Request>()
                {
                    new Request()
                    {
                        SubscriptionId = Guid.Empty.ToString()
                    }
                }
            }));

            var service = new ReportCalculatorService(reportServiceMock.Object);

            MonthlyReport result = service.CalculateReport(Guid.Empty.ToString(), 1, 1).Result;

            Assert.AreNotEqual(result, null);
        }
Example #7
0
        protected virtual MonthlyReportCollection ConvertToYearMonthResult(int year, MonthlyReportCollection reports)
        {
            MonthlyReportCollection rv = new MonthlyReportCollection();
            DateTime today             = DateTime.Today;
            int      months;

            if (today.Year == year)
            {
                months = today.Month;
            }
            else
            {
                months = 12;
            }

            for (int i = months; i > 0; i--)
            {
                MonthlyReport report = reports.TryGetItem(year, i);
                if (report == null)
                {
                    report         = new MonthlyReport();
                    report.IsEmpty = true;
                    report.ItemID  = -i;
                    report.TaskID  = -1;
                    report.Date    = new DateTime(year, i, 1);
                }
                rv.Add(report);

                report["Month"] = i;
            }

            return(rv);
        }
        private async Task <IActionResult> GetReportInResult(string subscriptionId, int year, int month)
        {
            MonthlyReport report = null;

            try
            {
                report = await _requestCounterService.CalculateReport(subscriptionId, year, month);
            }
            catch (ApiException <Error> error)
            {
                if (error.StatusCode == 400)
                {
                    return(BadRequest(error.Message));
                }

                if (error.StatusCode == 404)
                {
                    return(NotFound(error.Message));
                }
            }
            catch (ApiException)
            {
                throw new ApplicationException("Unexpected error orrured, please contact an administrator of the service");
            }

            if (report == null)
            {
                return(NotFound("There were no related service request in the given month"));
            }

            return(Ok(report));
        }
Example #9
0
        public async Task <ActionResult <MonthlyReport> > PostMonthlyReport(MonthlyReport monthlyReport)
        {
            _context.MonthlyReports.Add(monthlyReport);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMonthlyReport", new { id = monthlyReport.Id }, monthlyReport));
        }
        public async Task <MonthlyReport> CalculateReport(string subscriptionId, int year, int month)
        {
            if (DateTime.Now.Year < year ||
                (DateTime.Now.Year == year && DateTime.Now.Month < month))
            {
                return(null);
            }

            var allRequests = await _requestCounterService._api_requests_year_month_getAsync(year, month);

            var requestsForSubscription =
                RequestsOfSubscription(subscriptionId, allRequests)
                .ToArray();

            MonthlyReport result = null;

            if (requestsForSubscription.Any())
            {
                IEnumerable <CostPerService> calculatedCosts =
                    CalculateCostPerServices(requestsForSubscription)
                    .ToArray();

                IEnumerable <CostPerService> estimatesForMonth = null;
                if (DateTime.Now.Year == year && DateTime.Now.Month == month)
                {
                    estimatesForMonth =
                        calculatedCosts
                        .Select(costPerService =>
                    {
                        double multiplier =
                            MultiplierForAllMonth(requestsForSubscription.Select(request => DateTime.Parse(request.Requested)));

                        return(new CostPerService()
                        {
                            ServiceName = costPerService.ServiceName,
                            NumberOfRequests = (int)Math.Ceiling(costPerService.NumberOfRequests * multiplier),
                            TotalPrice = Math.Ceiling(costPerService.TotalPrice * (decimal)multiplier)
                        });
                    })
                        .ToArray();
                }

                var startDate = new DateTime(year, month, 1);

                result =
                    new MonthlyReport()
                {
                    TotalNumberOfRequests = requestsForSubscription.Count(),
                    SubscriptionId        = requestsForSubscription.First().SubscriptionId,
                    StartDate             = startDate,
                    EndDate           = LastDateOfMonth(startDate),
                    Costs             = calculatedCosts,
                    EstimatesForMonth = estimatesForMonth
                };
            }

            return(result);
        }
        public List <DictionaryVmodel> GetSummaryRptDataSource(ReportInstance RptModel, bool IsTargetPlan)
        {
            _Target       = RptModel._Target;
            Report        = RptModel.Report;
            _System       = RptModel._System;
            FinYear       = RptModel.FinYear;
            FinMonth      = RptModel.FinMonth;
            ReportDetails = RptModel.ReportDetails;
            string MonthlyReportIDs = "";

            ReportDetails.GroupBy(x => x.MonthlyReportID).Select(x => x.Key).ToList().ForEach(x => MonthlyReportIDs += "," + x);
            MonthlyReportIDs = MonthlyReportIDs.Trim(',');
            //这里对系统和指标再次做一次验证
            //if (ReportDetails != null && ReportDetails.Count() > 0)
            //{
            //    B_MonthlyReport bm = B_MonthlyreportOperator.Instance.GetMonthlyreport(RptModel.ReportDetails[0].MonthlyReportID);
            //    _System = StaticResource.Instance[_System.ID, bm.CreateTime];
            //    _Target = StaticResource.Instance.GetTargetList(_System.ID, bm.CreateTime).ToList();
            //}

            List <MonthReportSummaryViewModel> listMRSVM = GetMonthlyReportDetailSummaryList(IsTargetPlan);
            // List<B_Attachment> listAtt = GetListAtt(_System.ID);
            List <B_Attachment>     listAtt = GetListAtt(MonthlyReportIDs);
            List <DictionaryVmodel> listMonthReportSummary = new List <DictionaryVmodel>();
            string strReportDescription = "";

            #region 月报说明
            if (RptModel.ReportDetails.Any())
            {
                XElement element = _System.Configuration;
                if (element.Elements("Report").Elements("Rgroup") != null)
                {
                    strReportDescription = element.Element("Report").GetElementValue("Rgroup", "");
                    if (!string.IsNullOrEmpty(strReportDescription))
                    {
                        System.Collections.Hashtable p = MonthDescriptionValueEngine.MonthDescriptionValueService.GetMonthDescriptionValue(RptModel.ReportDetails, _System.ID, RptModel.CurrentLoginName);
                        foreach (string key in p.Keys)
                        {
                            strReportDescription = strReportDescription.Replace("【" + key + "】", p[key].ToString());
                        }
                    }
                }
            }
            #endregion

            //if (Report != null)
            //{
            //    strReportDescription = Report.Description;
            //}
            listMonthReportSummary.Add(new DictionaryVmodel("ReportInstance", RptModel));
            listMonthReportSummary.Add(new DictionaryVmodel("月报说明", strReportDescription));
            listMonthReportSummary.Add(new DictionaryVmodel("月度经营报告", listMRSVM, "", GetSummaryMonthlyReportHtmlTemplate(_System.Configuration)));
            listMonthReportSummary.Add(new DictionaryVmodel("附件", listAtt));
            listMonthReportSummary.Add(new DictionaryVmodel("完成情况明细查询条件", SpliteCompanyPropertyXml("Search", _System.Configuration)));
            listMonthReportSummary.Add(new DictionaryVmodel("是否包含区域", StaticResource.Instance.GetSystem_Regional(_System.ID)));
            return(listMonthReportSummary);
        }
Example #12
0
        public void update(MonthlyReport report, DateTime date)
        {
            report.setMonth(updateMonth(date));
            financeSystem funds = retrieveFinances(new DateTime(date.Year, date.Month, 1), new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month)));

            double amountOwedIHSP = 0;
            double amountOwedOHSP = 0;

            report.setBasicEnrollNum(funds.numBasicEnrollees);
            report.setExtendedErollNum(funds.numExtendedEnrollees);

            report.setBasicTotalIncome(funds.totalBasicIncome);
            report.setExtendTotalIncome(funds.totalExtendedIncome);
            report.setTotalEnrolleePayments(funds.numEnrolleeBills);

            report.setIHSPNumHospBills(funds.numIHSPHospitalBills);
            report.setOHSPNumHospBills(funds.numOHSPHospitalBills);

            report.setIHSPNumPhysBills(funds.numIHSPPhysicianBills);
            report.setOHSPNumPhysBills(funds.numOHSPPhysicianBills);

            report.setIHSPNumOtherBills(funds.numIHSPOtherBills);
            report.setOHSPNumOtherBills(funds.numOHSPOtherBills);

            report.setHospitalIHSP(funds.IHSPhospitalCosts);
            report.setHospitalOHSP(funds.OHSPhospitalCosts);
            amountOwedIHSP += funds.IHSPhospitalCosts;
            amountOwedOHSP += funds.OHSPhospitalCosts;

            report.setPhysicianIHSP(funds.IHSPPhysicianCosts);
            report.setPhysicianOHSP(funds.OHSPPhysicianCosts);
            amountOwedIHSP += funds.IHSPPhysicianCosts;
            amountOwedOHSP += funds.OHSPPhysicianCosts;

            report.setOtherIHSP(funds.IHSPOtherCosts);
            report.setOtherOHSP(funds.OHSPOtherCosts);
            amountOwedIHSP += funds.IHSPOtherCosts;
            amountOwedOHSP += funds.OHSPOtherCosts;

            report.setAmountOwedIHSP(amountOwedIHSP);
            report.setAmountOwedOHSP(amountOwedOHSP);

            double paidPercentage = 0;

            paidPercentage = (amountOwedIHSP + amountOwedOHSP) / (2000 * funds.numIHSPHospitalBills + 150 * funds.numIHSPPhysicianBills
                                                                  + 300 * funds.numIHSPOtherBills + amountOwedOHSP);

            paidPercentage = paidPercentage * 100;
            report.setMaxPercentBillable(paidPercentage);

            double totalCosts = 0;

            totalCosts += amountOwedIHSP;
            totalCosts += amountOwedOHSP;

            report.setTotalCosts(totalCosts);
        }
Example #13
0
        public virtual object GetTeamReports(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    myaccount = request.GetString("account", YZAuthHelper.LoginUserAccount);
            DateTime  date      = request.GetDateTime("date");

            BPMObjectNameCollection accounts = new BPMObjectNameCollection();

            accounts.Add(myaccount);

            using (BPMConnection bpmcn = new BPMConnection())
            {
                bpmcn.WebOpen();

                MemberCollection positions = OrgSvr.GetUserPositions(bpmcn, myaccount);
                foreach (Member position in positions)
                {
                    DirectXSCollection xss = position.GetDirectXSs(bpmcn);
                    foreach (DirectXS xs in xss)
                    {
                        if (!accounts.Contains(xs.UserAccount))
                        {
                            accounts.Add(xs.UserAccount);
                        }
                    }
                }

                MonthlyReportCollection rv = new MonthlyReportCollection();
                foreach (string account in accounts)
                {
                    MonthlyReport monthlyReport;

                    using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
                    {
                        using (IDbConnection cn = provider.OpenConnection())
                        {
                            monthlyReport = MonthlyReportManager.TryGetReport(provider, cn, account, date);

                            if (monthlyReport == null)
                            {
                                monthlyReport         = new MonthlyReport();
                                monthlyReport.Account = account;
                                monthlyReport.Date    = date;
                            }

                            rv.Add(monthlyReport);
                        }
                    }

                    User user = User.TryGetUser(bpmcn, account);
                    monthlyReport["ShortName"] = user == null ? "" : user.ShortName;
                }

                return(rv);
            }
        }
Example #14
0
        public void 正しい日付にセットされているか()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(12);
            DataSet _ds = _mr.getMonthlyWorkReport();

            Assert.AreEqual(1.0, _ds.Tables[this.listTableName].Rows[1]["overtime125"]);
        }
Example #15
0
        public void 年月の文字列生成のテスト()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(4);
            Assert.AreEqual("2013年04月", _mr.getStringYearMonth());
            _mr.setMonth(11);
            Assert.AreEqual("2013年11月", _mr.getStringYearMonth());
            _mr.setMonth(3);
            Assert.AreEqual("2014年03月", _mr.getStringYearMonth());
        }
Example #16
0
        public void 祝日のデータセットを取得できるか()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(12);
            DataSet _ds = _mr.getHolidayListDs();

            Assert.AreEqual(1, _ds.Tables[0].Rows[0]["day"]);
            Assert.AreEqual(7, _ds.Tables[0].Rows[1]["day"]);
            Assert.AreEqual(8, _ds.Tables[0].Rows[2]["day"]);
            Assert.AreEqual(12, _ds.Tables[0].Rows.Count);
        }
Example #17
0
        public void ユーザID異常系のテスト()
        {
            // コンストラクタで落とす
            MonthlyReport _mr = new MonthlyReport(2013, -1);

            // 例外を出さずに返ること
            Assert.AreEqual("不明なユーザ", _mr.getUserName());
            // 例外を出さずに返ること
            _mr.setMonth(12);
            DataSet _ds = _mr.getMonthlyWorkReport();

            Assert.AreEqual(1, _ds.Tables[this.listTableName].Rows[0]["day"]);
        }
        internal static int GetMonthlyStockbalanceByMonthAndItemId(string m, int id)
        {
            MonthlyReport monthlyreport = new MonthlyReport();
            int           mstockbalance = 0;

            using (var db = new ADDbContext())
            {
                if (db.MonthlyReport.Where(x => x.date.Equals(m) && x.itemId == id).Any())
                {
                    mstockbalance = db.MonthlyReport.Where(x => x.date.Equals(m) && x.itemId == id).FirstOrDefault().stockbalance;
                }
            }
            return(mstockbalance);
        }
Example #19
0
        public void 前の月があるかのテスト()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(3);
            Assert.AreEqual(true, _mr.existsPrevMonth());
            _mr.setMonth(1);
            Assert.AreEqual(true, _mr.existsPrevMonth());
            _mr.setMonth(12);
            Assert.AreEqual(true, _mr.existsPrevMonth());
            _mr.setMonth(4);
            Assert.AreEqual(false, _mr.existsPrevMonth());
        }
Example #20
0
        public int GetAccumulatedHours(string enrollment)
        {
            MonthlyReport monthlyReports = new MonthlyReport();

            try
            {
                monthlyReports = _context.Set <MonthlyReport>().OrderByDescending(Reports => Reports.DeliveryDate).First(Reports => Reports.Enrollment == enrollment);
            }
            catch (InvalidOperationException)
            {
                monthlyReports.HoursCumulative = 0;
            }
            return(monthlyReports.HoursCumulative);
        }
Example #21
0
        public void 月カウントアップのテスト()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(11);
            _mr.incrMonth();
            Assert.AreEqual("2013年12月", _mr.getStringYearMonth());
            _mr.incrMonth();
            Assert.AreEqual("2014年01月", _mr.getStringYearMonth());
            // はみ出してもカウントせず、エラーにもならないこと
            _mr.setMonth(3);
            _mr.incrMonth();
            Assert.AreEqual("2014年03月", _mr.getStringYearMonth());
        }
        internal static void CreateMonthlyReport(int itemId, string dt, int mcons, int sbalance)
        {
            MonthlyReport monthlyreport = new MonthlyReport();


            using (var db = new ADDbContext())
            {
                monthlyreport.date         = dt;
                monthlyreport.itemId       = itemId;
                monthlyreport.consumption  = mcons;
                monthlyreport.stockbalance = sbalance;
                db.MonthlyReport.Add(monthlyreport);
                db.SaveChanges();
            }
        }
Example #23
0
        public void カレンダーイヤー計算のテスト()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(4);
            Assert.AreEqual(2013, _mr.getCalYear());
            _mr.setMonth(12);
            Assert.AreEqual(2013, _mr.getCalYear());
            _mr.setMonth(1);
            Assert.AreEqual(2014, _mr.getCalYear());
            _mr.setMonth(2);
            Assert.AreEqual(2014, _mr.getCalYear());
            _mr.setMonth(3);
            Assert.AreEqual(2014, _mr.getCalYear());
        }
Example #24
0
    void WriteMonthlyReport(MonthlyReport toDisplay)
    {
        scrollableMonthlyReport.text = "";

        scrollableMonthlyReport.text += "Report ending: " +  toDisplay.currentMonth.month + " " +toDisplay.currentMonth.year;
        scrollableMonthlyReport.text += "\n" + "Hotel Occupancy: "+toDisplay.occupancy().ToString()+"%";
        scrollableMonthlyReport.text += "\n" + "Restaurant Revenue: $" + toDisplay.restaurantTake.ToString();

        scrollableMonthlyReport.text += "\n" + "Standard Rooms: $" + toDisplay.revenueRoomLvl1.ToString();
        scrollableMonthlyReport.text += " " + "Number: " + toDisplay.numbRoomLvl1.ToString();
        scrollableMonthlyReport.text += " " + "Occupancy: " + toDisplay.occupancyRoomLvl1().ToString()+"%";
        scrollableMonthlyReport.text += " " + "Number Of Bookings: " + toDisplay.numbRoomLvl1Booked.ToString();

        scrollableMonthlyReport.text += "\n" + "Double Rooms: $" +  toDisplay.revenueRoomLvl2.ToString();
        scrollableMonthlyReport.text += "  " +  "Number: " + toDisplay.numbRoomLvl2.ToString();
        scrollableMonthlyReport.text += "  " + "Number Of Bookings: " + toDisplay.numbRoomLvl2Booked.ToString();
        scrollableMonthlyReport.text += "  " + "Occupancy: " + toDisplay.occupancyRoomLvl2().ToString()+"%";

        scrollableMonthlyReport.text += "\n" + "Deluxe Rooms: $" +  toDisplay.revenueRoomLvl3.ToString();
        scrollableMonthlyReport.text += "  " +  "Number: " + toDisplay.numbRoomLvl3.ToString();
        scrollableMonthlyReport.text += "  " + "Number Of Bookings: " + toDisplay.numbRoomLvl3Booked.ToString();
        scrollableMonthlyReport.text += "  " + "Occupancy: " + toDisplay.occupancyRoomLvl3().ToString()+"%";

        scrollableMonthlyReport.text += "\n" + "Suites: $" +  toDisplay.revenueRoomLvl4.ToString();
        scrollableMonthlyReport.text += "  " +  "Number: " + toDisplay.numbRoomLvl4.ToString();
        scrollableMonthlyReport.text += "  " + "Number Of Bookings: " + toDisplay.numbRoomLvl4Booked.ToString();
        scrollableMonthlyReport.text += "  " + "Occupancy: " + toDisplay.occupancyRoomLvl4().ToString()+"%";

        scrollableMonthlyReport.text += "\n" + "Master Suites: $" +  toDisplay.revenueRoomLvl5.ToString();
        scrollableMonthlyReport.text += "  " +  "Number: " + toDisplay.numbRoomLvl5.ToString();
        scrollableMonthlyReport.text += "  " + "Number Of Bookings: " + toDisplay.numbRoomLvl5Booked.ToString();
        scrollableMonthlyReport.text += "  " + "Occupancy: " + toDisplay.occupancyRoomLvl5().ToString()+"%";

        scrollableMonthlyReport.text += "\n" + "Staff: ";
        scrollableMonthlyReport.text += "\n" +  "Department Heads: "+toDisplay.numbDepartmentHead.ToString();
        scrollableMonthlyReport.text += "\n" + "Service Staff: "+toDisplay.numbHotelServicesStaff.ToString();
        scrollableMonthlyReport.text += "\n" +  "Food And Beverage: "+toDisplay.numbFoodAndBeverageStaff.ToString();
        scrollableMonthlyReport.text += "\n" +  "Front Desk: "+toDisplay.numbFrontDeskStaff.ToString();
        scrollableMonthlyReport.text += "\n" +   "Conference: "+toDisplay.numbConferenceStaff.ToString();
        scrollableMonthlyReport.text += "\n" +  "Other: "+toDisplay.numbOtherStaff.ToString();

        scrollableMonthlyReport.text += "\n" + "Expenses: ";
        scrollableMonthlyReport.text += "\n" + "Staffing: "+toDisplay.expenseEmployeeTotal().ToString();
        scrollableMonthlyReport.text += "\n" + "Repairs: "+toDisplay.expenseRepairCost.ToString();
        scrollableMonthlyReport.text += "\n" + "Upgrade: "+toDisplay.expenseUpgradeCost.ToString();
    }
        internal static int GetMonthlyConsByMonthAndItemId(string m, int id)
        {
            MonthlyReport monthlyreport = new MonthlyReport();
            int           mcons         = 0;

            using (var db = new ADDbContext())
            {
                if (db.MonthlyReport.Where(x => x.date.Equals(m) && x.itemId == id).Any())
                {
                    mcons = db.MonthlyReport.Where(x => x.date.Equals(m) && x.itemId == id).FirstOrDefault().consumption;
                }
                else
                {
                    mcons = 0;//it's not the end of the month, monthly consumption is not available.
                }
            }
            return(mcons);
        }
        public void ValidInformationTest()
        {
            MonthlyReport monthlyReport = new MonthlyReport
            {
                IdMonthlyReport     = 1,
                DeliveryDate        = DateTime.Now,
                PerformedActivities = "Acordar con la organización vinculada las tareas que se realizarán",
                ResultsObtained     = "Documento de calendario de actividades",
                HoursReported       = 20,
                HoursCumulative     = 20,
                Enrollment          = "zS18012124",
                IdProject           = 1
            };
            MonthlyReportValidator monthlyReportValidator = new MonthlyReportValidator();
            ValidationResult       validationResult       = monthlyReportValidator.Validate(monthlyReport);

            Assert.IsTrue(validationResult.IsValid);
        }
        public void InvalidInformationTest()
        {
            MonthlyReport monthlyReport = new MonthlyReport
            {
                IdMonthlyReport     = 1,
                DeliveryDate        = DateTime.Now,
                PerformedActivities = null,
                ResultsObtained     = null,
                HoursCumulative     = 20,
                Enrollment          = "zS18012124",
                IdProject           = 1
            };
            MonthlyReportValidator monthlyReportValidator = new MonthlyReportValidator();
            ValidationResult       validationResult       = monthlyReportValidator.Validate(monthlyReport);
            int errors = validationResult.Errors.Count;

            Assert.AreNotEqual(errors, 0);
        }
        public async Task <WrapperMonthProductionListVM> MonthlyProduction(MonthlyReport vm)
        {
            vm.To   = vm.To.ToLocalTime();
            vm.From = vm.From.ToLocalTime();
            WrapperMonthProductionListVM returnData = new WrapperMonthProductionListVM();
            Task <List <Production> >    prodT      = _repositoryWrapper
                                                      .Production
                                                      .FindAll()
                                                      .Where(x => x.EntryDate >= vm.From)
                                                      .Where(x => x.EntryDate <= vm.To)
                                                      .Where(x => x.FactoryId == vm.FactoryId)
                                                      // .Where(x => x.Month == vm.Month)
                                                      .Include(x => x.Item)
                                                      .Include(x => x.ItemCategory)
                                                      .Include(x => x.Staff)
                                                      .ToListAsync();

            await Task.WhenAll(prodT);

            List <MonthlyProduction> monthlyProductions = new List <MonthlyProduction>();

            monthlyProductions = _utilService.Mapper.Map <List <Production>, List <MonthlyProduction> >(prodT.Result.ToList());


            returnData.TotalRecords = monthlyProductions.ToList().Count();
            returnData.ListOfData   = monthlyProductions;
            MonthlyProduction lastRow = new MonthlyProduction();

            lastRow.TotalAmount = returnData.ListOfData.Sum(x => (x.Quantity));

            returnData.ListOfData = monthlyProductions
                                    .OrderByDescending(x => x.CreatedDateTime)
                                    .Skip((vm.PageNumber - 1) * (vm.PageSize))
                                    .Take(vm.PageSize)

                                    .ToList();

            returnData.Total_TillNow = lastRow.TotalAmount;
            returnData.Total_Monthly = returnData.ListOfData.Sum(x => (x.Quantity));

            returnData.ListOfData.Add(lastRow);

            return(returnData);
        }
Example #29
0
        public void DataSetがカレンダーになっているか()
        {
            int           userID = this.getUserID(testLoginNo);
            MonthlyReport _mr    = new MonthlyReport(2013, userID);

            _mr.setMonth(12);
            DataSet _ds = _mr.getMonthlyWorkReport();

            Assert.AreEqual(1, _ds.Tables[this.listTableName].Rows[0]["day"]);
            Assert.AreEqual("日", _ds.Tables[this.listTableName].Rows[0]["week"]);
            Assert.AreEqual(31, _ds.Tables[this.listTableName].Rows[30]["day"]);
            Assert.AreEqual(31, _ds.Tables[this.listTableName].Rows.Count);
            _mr.setMonth(2);
            _ds = _mr.getMonthlyWorkReport();
            Assert.AreEqual(1, _ds.Tables[this.listTableName].Rows[0]["day"]);
            Assert.AreEqual("土", _ds.Tables[this.listTableName].Rows[0]["week"]);
            Assert.AreEqual(28, _ds.Tables[this.listTableName].Rows[27]["day"]);
            Assert.AreEqual(28, _ds.Tables[this.listTableName].Rows.Count);
        }
Example #30
0
        public static A_MonthlyReport ToAModel(this MonthlyReport value)
        {
            A_MonthlyReport result = new A_MonthlyReport
            {
                ID            = value.ID,
                SystemID      = value.SystemID,
                Description   = value.Description,
                IsDeleted     = value.IsDeleted,
                FinMonth      = value.FinMonth,
                FinYear       = value.FinYear,
                CreateTime    = value.CreateTime,
                CreatorName   = value.CreatorName,
                ModifierName  = value.ModifierName,
                ModifyTime    = value.ModifyTime,
                Status        = value.Status,
                SystemBatchID = value.SystemBatchID
            };

            return(result);
        }
        public void RegisterInformationTest()
        {
            MonthlyReport monthlyReport = new MonthlyReport
            {
                IdMonthlyReport     = 1,
                DeliveryDate        = DateTime.Now,
                PerformedActivities = "Acordar con la organización vinculada las tareas que se realizarán",
                ResultsObtained     = "Documento de calendario de actividades",
                HoursReported       = 20,
                HoursCumulative     = 20,
                Enrollment          = "zS18012124",
                IdProject           = 1
            };

            _unitOfWork.MonthlyReports.Add(monthlyReport);
            int expected = 2;
            int actual   = _monthlyReports.Count;

            Assert.AreEqual(expected, actual);
        }
Example #32
0
    public MonthlyReport DeepCopy()
    {
        MonthlyReport newReport = new MonthlyReport();

        newReport.currentMonth = this.currentMonth;
        newReport.restaurantTake = this.restaurantTake;
        newReport.revenueRoomLvl1 = this.revenueRoomLvl1;
        newReport.revenueRoomLvl2 = this.revenueRoomLvl2;
        newReport.revenueRoomLvl3 = this.revenueRoomLvl3;
        newReport.revenueRoomLvl4 = this.revenueRoomLvl4;
        newReport.revenueRoomLvl5 = this.revenueRoomLvl5;

        newReport.revenueConferences = this.revenueConferences;
        newReport.revenueEvents = this.revenueEvents;
        newReport.revenueGroups = this.revenueGroups;

        newReport.restaurantCost = this.restaurantCost;
        newReport.expenseDepartmentHeadStaff = this.expenseDepartmentHeadStaff;
        newReport.expenseHotelServicesStaff = this.expenseHotelServicesStaff;
        newReport.expenseFoodAndBeverageStaff = this.expenseFoodAndBeverageStaff;
        newReport.expenseFrontDeskStaff = this.expenseFrontDeskStaff;
        newReport.expenseConferenceStaff = this.expenseConferenceStaff;
        newReport.expenseOtherStaff = this.expenseOtherStaff;

        newReport.expenseRepairCost = this.expenseRepairCost;
        newReport.expenseUpgradeCost = this.expenseUpgradeCost;

        newReport.outOfOrderRepair = this.outOfOrderRepair;
        newReport.outOfOrderUpgrade = this.outOfOrderUpgrade;
        newReport.outOfOrderUnusable = this.outOfOrderUnusable;

        newReport.numbDepartmentHead = this.numbDepartmentHead;
        newReport.numbHotelServicesStaff = this.numbHotelServicesStaff;
        newReport.numbFoodAndBeverageStaff = this.numbFoodAndBeverageStaff;
        newReport.numbFrontDeskStaff = this.numbFrontDeskStaff;
        newReport.numbConferenceStaff = this.numbConferenceStaff;
        newReport.numbOtherStaff = this.numbOtherStaff;

        newReport.numbRoomLvl1 = this.numbRoomLvl1;
        newReport.numbRoomLvl2 = this.numbRoomLvl2;
        newReport.numbRoomLvl3 = this.numbRoomLvl3;
        newReport.numbRoomLvl4 = this.numbRoomLvl4;
        newReport.numbRoomLvl5 = this.numbRoomLvl5;

        newReport.numbRoomLvl1Booked = this.numbRoomLvl1Booked;
        newReport.numbRoomLvl2Booked = this.numbRoomLvl2Booked;
        newReport.numbRoomLvl3Booked = this.numbRoomLvl3Booked;
        newReport.numbRoomLvl4Booked = this.numbRoomLvl4Booked;
        newReport.numbRoomLvl5Booked = this.numbRoomLvl5Booked;

        return newReport;
    }
Example #33
0
 public void Add(MonthlyReport report)
 {
     monthlyReportList.Add(report);
 }
Example #34
0
    //create monthly reports
    public void GenerateNewMonthReports()
    {
        newMonthlyReport = new MonthlyReport(Calendar.GetDate());
        monthlyReports.Add(newMonthlyReport);

        //-----------------------------------------reception log
        currentLog = new ReceptionLog();
        currentLog = GameObject.FindGameObjectWithTag("RatesInput").GetComponent<RatesSetup>().newReceptionLog.DeepCopy();
        //Adds a new ReceptionLog to the list and Reference to the log we're currently editing.
        receptionLogs.Add (currentLog);
        currentLog.month = receptionLogs.Count;
    }