public JsonResult Next(int no, int locationId)
        {
            today = today.AddDays(no);

            GetDate();
            GetMonth();
            period = string.Format("{0}{1}", today.Year, bulan);
            IList<TenantSubterminalDailySales> dailySales = subTerminalRepo.FindTenantSubTerminalDailySaleByPeriod(today, locationId);
            var _previousDayDate = today.AddDays(-1);
            var _twoDaysBeforeDate = today.AddDays(-2);
            IList<TenantSubterminalDailySales> previousDay = subTerminalRepo.FindTenantSubTerminalDailySaleByPeriod(_previousDayDate, locationId);
            IList<TenantSubterminalDailySales> twoDaysBefore = subTerminalRepo.FindTenantSubTerminalDailySaleByPeriod(_twoDaysBeforeDate, locationId);
            SalesAmountDay salesAmount = new SalesAmountDay()
            {
                CompanyName = "",
                LocationId = locationId,
                TotalSaleIDR = subTerminalRepo.TotalTenanSubTerminalSalePerDay(dailySales).ToString("N"),
                TotalSaleUSD = dailySales.Sum<TenantSubterminalDailySales>(y => y.TotalSalesPerTenantInUSD).ToString("N"),
                Transactiondate = today.ToString("dd MMMM yyyy"),
                PreviousDay = _previousDayDate.ToString("dd MMMM yyyy"),
                TwoDaysBefore = _twoDaysBeforeDate.ToString("dd MMMM yyyy"),
                TotalSaleIDRPreviousDay = previousDay.Sum<TenantSubterminalDailySales>(y => y.TotalSalePerTenan).ToString("N"),
                TotalSaleUSDPreviousDay = previousDay.Sum<TenantSubterminalDailySales>(y => y.TotalSalesPerTenantInUSD).ToString("N"),
                TotalSaleIDRTwoDaysBefore = twoDaysBefore.Sum<TenantSubterminalDailySales>(y => y.TotalSalePerTenan).ToString("N"),
                TotalSaleUSDTwoDaysBefore = twoDaysBefore.Sum<TenantSubterminalDailySales>(y => y.TotalSalesPerTenantInUSD).ToString("N")

            };

            return Json(salesAmount, JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 2
0
        public JsonResult PreviousPenjualanHarian(int no, int locationId)
        {
            today = today.AddDays(no);
            GetDate();
            GetMonth();
            period = string.Format("{0}{1}{2}", today.Year, bulan, hari);
            IList<DailySales> dailySales = _apRepo.FindDailySaleByPeriodAndLocationId(today, locationId);
            var _previousDayDate = today.AddDays(-1);
            var _twoDaysBeforeDate = today.AddDays(-2);
            IList<DailySales> previousDay = _apRepo.FindDailySaleByPeriodAndLocationId(_previousDayDate, locationId);
            IList<DailySales> twoDaysBefore = _apRepo.FindDailySaleByPeriodAndLocationId(_twoDaysBeforeDate, locationId);

            SalesAmountDay salesAmount = new SalesAmountDay()
            {
                CompanyName = "",
                LocationId = locationId,
                TotalSaleIDR = _apRepo.TotalSalePerDay(dailySales).ToString("N"),
                TotalSaleUSD = dailySales.Sum<DailySales>(y => y.TotalSaleInUSD).ToString("N"),
                Transactiondate = today.ToString("dd MMMM yyyy"),
                PreviousDay = _previousDayDate.ToString("dd MMMM yyyy"),
                TwoDaysBefore = _twoDaysBeforeDate.ToString("dd MMMM yyyy"),
                TotalSaleIDRPreviousDay = previousDay.Sum<DailySales>(y => y.TotalSale).ToString("N"),
                TotalSaleUSDPreviousDay = previousDay.Sum<DailySales>(y => y.TotalSaleInUSD).ToString("N"),
                TotalSaleIDRTwoDaysBefore = twoDaysBefore.Sum<DailySales>(y => y.TotalSale).ToString("N"),
                TotalSaleUSDTwoDaysBefore = twoDaysBefore.Sum<DailySales>(y => y.TotalSaleInUSD).ToString("N")

            };
            return Json(salesAmount, JsonRequestBehavior.AllowGet);
        }