private void buttonManualEntry_Click(object sender, EventArgs e) { UpdateScrollingText(); ReportDetailed dlg = new ReportDetailed(); dlg.m_mode = ReportMode.EditMode; dlg.Show(); }
public List <ReportDetailed> Run(Category category, DateTime sinceDate, DateTime toDate) { List <ReportDetailed> reportDetaileds = new List <ReportDetailed>(); int id = 0; classRepository.GetNewAll(); foreach (Class curClass in classRepository.GetAll()) { id++; int arrivedCount = 0; int saledCount = 0; int returnedCount = 0; float sum = 0.0f; float revenue = 0.0f; float percentRevenue = 0.0f; productRepository.GetNewAll(); foreach (Product curProduct in productRepository.GetAll()) { if (curClass.Id == curProduct.Class.Id && category.Id == curProduct.Category.Id) { if (sinceDate <= curProduct.ArrivedGoods.DateTime && toDate >= curProduct.ArrivedGoods.DateTime) { arrivedCount += curProduct.ArrivedGoods.Count; } if (curProduct.ReturnedDate != null) { if (sinceDate <= curProduct.ReturnedDate.Value && toDate >= curProduct.ReturnedDate.Value && curProduct.Returned) { returnedCount++; } } } } saleRepository.GetNewAll(); foreach (Sale curSale in saleRepository.GetAll()) { if (sinceDate <= curSale.Datetime && toDate >= curSale.Datetime && curClass.Id == curSale.Product.Class.Id && category.Id == curSale.Product.Category.Id) { saledCount += curSale.Count; sum += curSale.Price; revenue += curSale.Price - curSale.Product.PurchasePrice; } } foreach (Sale curSale in saleRepository.GetAll()) { if (sinceDate <= curSale.Datetime && toDate >= curSale.Datetime && curClass.Id == curSale.Product.Class.Id && category.Id == curSale.Product.Category.Id) { float curRevenue = curSale.Price - curSale.Product.PurchasePrice; percentRevenue = (revenue * curRevenue) / 100f; } } ReportDetailed reportDetailed = new ReportDetailed() { Id = id, Category = category, Class = curClass, ArrivedCount = arrivedCount, SaledCount = saledCount, ReturnedCount = returnedCount, Sum = sum, Revenue = revenue, PercentRevenue = percentRevenue, }; reportDetaileds.Add(reportDetailed); } return(reportDetaileds); }