Exemple #1
0
        public ActionResult Index(int id = 0)
        {
            UserAccount.UploadImageMode = false;
            UserAccount.UserCode        = id;
            using (Sale sale = new Sale(DateTime.Today))
            {
                sale.CountAmount("M");
                ViewBag.MonthAmount        = sale.AmountData;
                ViewBag.MonthAmountPercent = sale.PercentData;

                sale.CountQty("M");
                ViewBag.MonthCount        = sale.AmountData;;
                ViewBag.MonthCountPercent = sale.PercentData;

                sale.CountAmount("Y");
                ViewBag.YearAmount        = sale.AmountData;
                ViewBag.YearAmountPercent = sale.PercentData;

                sale.CountQty("Y");
                ViewBag.YearCount        = sale.AmountData;;
                ViewBag.YearCountPercent = sale.PercentData;

                List <string> arrYearMonthName   = sale.GetYearMonthNameList();
                List <int>    arrYearMonthAmount = sale.GetYearMonthAmountList("Base");
                ViewBag.BaseYearAmountRank  = sale.GetSaleRank("Base", "Amount", 20);
                ViewBag.BaseYearQtyRank     = sale.GetSaleRank("Base", "Qty", 20);
                ViewBag.BaseYearMonthName   = Newtonsoft.Json.JsonConvert.SerializeObject(arrYearMonthName);
                ViewBag.BaseYearMonthAmount = Newtonsoft.Json.JsonConvert.SerializeObject(arrYearMonthAmount);

                sale.CountAmount("W");
                List <string> arrPriorWeekName   = sale.GetWeekNameList("Prior");
                List <int>    arrPriorWeekAmount = sale.GetWeekAmountList("Prior");
                ViewBag.PriorWeekName   = Newtonsoft.Json.JsonConvert.SerializeObject(arrPriorWeekName);
                ViewBag.PriorWeekAmount = Newtonsoft.Json.JsonConvert.SerializeObject(arrPriorWeekAmount);

                List <string> arrBaseWeekName   = sale.GetWeekNameList("Base");
                List <int>    arrBaseWeekAmount = sale.GetWeekAmountList("Base");
                ViewBag.BaseWeekName   = Newtonsoft.Json.JsonConvert.SerializeObject(arrBaseWeekName);
                ViewBag.BaseWeekAmount = Newtonsoft.Json.JsonConvert.SerializeObject(arrBaseWeekAmount);

                return(View());
            }
        }