public List <MorrisChartModel.DonutChart> GetTotalCustomerTypeChartData(int[] CustType = null, int Duration = 30) { CustType = CustType ?? new int[5] { 0, 0, 0, 0, 0 }; int[] CustTypeId = new int[5] { 0, 0, 0, 0, 0 }; for (int i = 0; i < CustType.Length; i++) { CustTypeId[i] = CustType[i]; } List <MorrisChartModel.DonutChart> data = new List <MorrisChartModel.DonutChart>(); myshop = new MyshopDb(); DateTime lastDate = DateTime.Now.AddDays(-Duration); Array.Sort(CustTypeId); foreach (int custid in CustTypeId) { MorrisChartModel.DonutChart item = new MorrisChartModel.DonutChart(); var CustCollection = myshop.Gbl_Master_Customer.Where(x => x.CustomerTypeId.Equals(custid) && x.IsDeleted == false && x.CreatedDate > lastDate).ToList(); if (CustCollection != null && CustCollection.Count > 0) { item.label = myshop.Gbl_Master_CustomerType.Where(x => x.CustomerTypeId == custid && x.IsDeleted == false).FirstOrDefault().CustomerType; item.value = CustCollection.Count(); data.Add(item); } } //var products = myshop.Stk_Dtl_Entry.Where(x => CustTypeId.Contains(x.ProductId) && x.IsDeleted == false).ToList(); return(data); }
public List <MorrisChartModel.DonutChart> GetSalesStatusData(int Duration = 30) { List <MorrisChartModel.DonutChart> donutCharts = new List <MorrisChartModel.DonutChart>(); myshop = new MyshopDb(); var sales = myshop.Sale_Tr_Invoice.Where(x => x.ShopId.Equals(WebSession.ShopId) && !x.IsDeleted).ToList(); MorrisChartModel.DonutChart cancelled = new MorrisChartModel.DonutChart(); cancelled.label = "Cancelled"; cancelled.labelColor = "red"; cancelled.value = sales.Where(x => x.IsCancelled).Count(); MorrisChartModel.DonutChart billed = new MorrisChartModel.DonutChart(); billed.label = "Billed"; billed.labelColor = "green"; billed.value = sales.Where(x => !x.IsCancelled && !x.IsAmountRefunded).Count(); MorrisChartModel.DonutChart returned = new MorrisChartModel.DonutChart(); returned.label = "Returned"; returned.labelColor = "orange"; returned.value = sales.Where(x => !x.IsCancelled).Count(); donutCharts.Add(billed); donutCharts.Add(cancelled); donutCharts.Add(returned); return(donutCharts); }
public List <MorrisChartModel.DonutChart> GetStockEntryTotalQuantityChartData(int[] ProArry = null, int Duration = 30) { ProArry = ProArry ?? new int[5] { 0, 0, 0, 0, 0 }; int[] ProductId = new int[5] { 0, 0, 0, 0, 0 }; for (int i = 0; i < ProArry.Length; i++) { ProductId[i] = ProArry[i]; } List <MorrisChartModel.DonutChart> data = new List <MorrisChartModel.DonutChart>(); myshop = new MyshopDb(); DateTime lastDate = DateTime.Now.AddDays(-Duration); Array.Sort(ProductId); foreach (int proid in ProductId) { MorrisChartModel.DonutChart item = new MorrisChartModel.DonutChart(); var proColl = myshop.Stk_Dtl_Entry.Where(x => x.ProductId.Equals(proid) && x.IsDeleted == false && x.CreatedDate > lastDate).ToList(); if (proColl != null && proColl.Count > 0) { item.label = myshop.Gbl_Master_Product.Where(x => x.ProductId == proid && x.IsDeleted == false).FirstOrDefault().ProductName; item.value = proColl.Sum(x => x.Qty); data.Add(item); } } var products = myshop.Stk_Dtl_Entry.Where(x => ProductId.Contains(x.ProductId) && x.IsDeleted == false).ToList(); return(data); }