/// <summary> /// /// </summary> /// <param name="modelType">1:交班 2:日结</param> /// <param name="recordId"></param> public FormSalesReport(int modelType, object recordId) { InitializeComponent(); this.lbWeather.Visible = false; this.cmbWeather.Visible = false; this.dgvSalesReport.BackgroundColor = SystemColors.ButtonFace; m_ModelType = modelType; if (modelType == 1) { btnSalesReport.Text = "交班"; btnSalesReport.Enabled = false; btnSalesReport.BackColor = ConstantValuePool.DisabledColor; this.Text = "交班报表"; Guid handoverRecordId = recordId == null ? Guid.Empty : (Guid)recordId; bizReport = BusinessReportService.GetInstance().GetReportDataByHandoverRecordId(handoverRecordId); } else if (modelType == 2) { btnSalesReport.Text = "日结"; btnSalesReport.Enabled = false; btnSalesReport.BackColor = ConstantValuePool.DisabledColor; this.Text = "日结报表"; string dailyStatementNo = recordId.ToString(); bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(dailyStatementNo); } }
/// <summary> /// /// </summary> /// <param name="modelType">1:交班 2:日结</param> public FormSalesReport(int modelType) { InitializeComponent(); this.dgvSalesReport.BackgroundColor = SystemColors.ButtonFace; m_ModelType = modelType; if (modelType == 1) { this.lbWeather.Visible = false; this.cmbWeather.Visible = false; btnSalesReport.Text = "交班"; this.Text = "交班报表"; bizReport = BusinessReportService.GetInstance().GetReportDataByHandover(ConstantValuePool.BizSettingConfig.DeviceNo); } else if (modelType == 2) { this.cmbWeather.SelectedIndex = 0; btnSalesReport.Text = "日结"; this.Text = "日结报表"; bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(string.Empty); } }
/// <summary> /// 获取日结营业额统计 /// </summary> /// <param name="dailyStatementNo">日结号</param> /// <returns></returns> public BusinessReport GetReportDataByDailyStatement(string dailyStatementNo) { BusinessReport reportData = null; try { _daoManager.OpenConnection(); //日结 if (string.IsNullOrEmpty(dailyStatementNo)) { dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo(); } if (!string.IsNullOrEmpty(dailyStatementNo)) { BusinessReport businessReport = _businessReportDao.GetTurnoverByDailyStatement(dailyStatementNo); IList<OrderDiscountSum> orderDiscountSumList = _businessReportDao.GetOrderDiscountSumByDailyStatement(dailyStatementNo); IList<VIPCardTrade> cardStoredValueList = _VIPCardTradeDao.GetAllStoredAmount(dailyStatementNo); IList<OrderPayoffSum> orderPayoffSumList = _businessReportDao.GetOrderPayoffSumByDailyStatement(dailyStatementNo); IList<ItemsPrice> itemsPriceList = _businessReportDao.GetItemsPriceByDailyStatement(dailyStatementNo); IList<SalesPriceByDepart> priceByDepartList = new List<SalesPriceByDepart>(); if (itemsPriceList.Count > 0) { string curDepartName = itemsPriceList[0].DepartName; decimal totalDepartPrice = 0; decimal totalItemsNum = 0; IList<ItemsPrice> tempItemsPriceList = new List<ItemsPrice>(); foreach (ItemsPrice item in itemsPriceList) { if (item.DepartName != curDepartName) { SalesPriceByDepart salesPrice = new SalesPriceByDepart(); salesPrice.DepartName = curDepartName; salesPrice.TotalDepartPrice = totalDepartPrice; salesPrice.TotalItemsNum = totalItemsNum; salesPrice.ItemsPriceList = tempItemsPriceList; priceByDepartList.Add(salesPrice); curDepartName = item.DepartName; totalDepartPrice = item.ItemsTotalPrice; totalItemsNum = item.ItemsTotalQty; tempItemsPriceList = new List<ItemsPrice>(); } else { totalDepartPrice += item.ItemsTotalPrice; totalItemsNum += item.ItemsTotalQty; } tempItemsPriceList.Add(item); } SalesPriceByDepart tempSalesPrice = new SalesPriceByDepart { DepartName = curDepartName, TotalDepartPrice = totalDepartPrice, TotalItemsNum = totalItemsNum, ItemsPriceList = tempItemsPriceList }; priceByDepartList.Add(tempSalesPrice); } reportData = new BusinessReport { DailyStatementNo = dailyStatementNo, LastDailyStatementTime = businessReport.LastDailyStatementTime, TotalRevenue = businessReport.TotalRevenue, CutOffTotalPrice = businessReport.CutOffTotalPrice, DiscountTotalPrice = businessReport.DiscountTotalPrice, ActualTotalIncome = businessReport.ActualTotalIncome, TotalServiceFee = businessReport.TotalServiceFee, BillTotalQty = businessReport.BillTotalQty, PeopleTotalNum = businessReport.PeopleTotalNum, orderDiscountSumList = orderDiscountSumList, cardStoredValueList = cardStoredValueList, orderPayoffSumList = orderPayoffSumList, salesPriceByDepartList = priceByDepartList }; } } catch (Exception exception) { LogHelper.GetInstance().Error("[GetReportDataByDailyStatement]参数:dailyStatementNo_" + dailyStatementNo, exception); } finally { _daoManager.CloseConnection(); } return reportData; }
/// <summary> /// 获取营业额统计 /// </summary> /// <param name="handoverRecordId">交班Id</param> /// <returns></returns> public BusinessReport GetReportDataByHandoverRecordId(Guid handoverRecordId) { BusinessReport businessReport = null; IList<OrderDiscountSum> orderDiscountSumList = null; IList<OrderPayoffSum> orderPayoffSumList = null; IList<ItemsPrice> itemsPriceList = null; try { _daoManager.OpenConnection(); businessReport = _businessReportDao.GetTurnoverByHandoverRecordID(handoverRecordId); string dailyStatementNo = businessReport.DailyStatementNo; int workSequence = businessReport.WorkSequence; orderDiscountSumList = _businessReportDao.GetOrderDiscountSumByHandover(dailyStatementNo, workSequence); orderPayoffSumList = _businessReportDao.GetOrderPayoffSumByHandover(dailyStatementNo, workSequence); itemsPriceList = _businessReportDao.GetItemsPriceByHandover(dailyStatementNo, workSequence); } catch (Exception exception) { businessReport = null; LogHelper.GetInstance().Error("[GetReportDataByHandoverRecordID]参数:handoverRecordId_" + handoverRecordId, exception); } finally { _daoManager.CloseConnection(); } if (itemsPriceList == null || itemsPriceList.Count <= 0 || businessReport == null) return null; IList<SalesPriceByDepart> priceByDepartList = new List<SalesPriceByDepart>(); if (itemsPriceList.Count > 0) { string curDepartName = itemsPriceList[0].DepartName; decimal totalDepartPrice = 0; decimal totalItemsNum = 0; IList<ItemsPrice> tempItemsPriceList = new List<ItemsPrice>(); foreach (ItemsPrice item in itemsPriceList) { if (item.DepartName != curDepartName) { SalesPriceByDepart salesPrice = new SalesPriceByDepart(); salesPrice.DepartName = curDepartName; salesPrice.TotalDepartPrice = totalDepartPrice; salesPrice.TotalItemsNum = totalItemsNum; salesPrice.ItemsPriceList = tempItemsPriceList; priceByDepartList.Add(salesPrice); curDepartName = item.DepartName; totalDepartPrice = item.ItemsTotalPrice; totalItemsNum = item.ItemsTotalQty; tempItemsPriceList = new List<ItemsPrice>(); } else { totalDepartPrice += item.ItemsTotalPrice; totalItemsNum += item.ItemsTotalQty; } tempItemsPriceList.Add(item); } SalesPriceByDepart tempSalesPrice = new SalesPriceByDepart(); tempSalesPrice.DepartName = curDepartName; tempSalesPrice.TotalDepartPrice = totalDepartPrice; tempSalesPrice.TotalItemsNum = totalItemsNum; tempSalesPrice.ItemsPriceList = tempItemsPriceList; priceByDepartList.Add(tempSalesPrice); } BusinessReport reportData = new BusinessReport { WorkSequence = businessReport.WorkSequence, LastHandoverTime = businessReport.LastHandoverTime, TotalRevenue = businessReport.TotalRevenue, CutOffTotalPrice = businessReport.CutOffTotalPrice, DiscountTotalPrice = businessReport.DiscountTotalPrice, ActualTotalIncome = businessReport.ActualTotalIncome, TotalServiceFee = businessReport.TotalServiceFee, BillTotalQty = businessReport.BillTotalQty, PeopleTotalNum = businessReport.PeopleTotalNum, orderDiscountSumList = orderDiscountSumList, orderPayoffSumList = orderPayoffSumList, salesPriceByDepartList = priceByDepartList }; return reportData; }