public void OnClickAddSingleData() { EditDailyDataPanel.SetActive(true); SingleSalesData data = new SingleSalesData(); data.Index = SalesDataSystem.SystemDatas.DailySysData.LoadAllSingleProductData(CurDateTime).Count + 1; EditorDailyPrefabInfo.SetValue(CurDateTime, data); }
private void CreateSingleSaleDataPrefab(SingleSalesData info) { GameObject newGo = GameObject.Instantiate(SingleSaleDataPrefab); newGo.transform.SetParent(DailySingleSaleDataContent); newGo.transform.localScale = Vector3.one; newGo.transform.SetAsLastSibling(); SingleSaleDataPrefabInfo prefabInfo = newGo.GetComponent <SingleSaleDataPrefabInfo>(); prefabInfo.SetValue(info); singleDataInfosPrefabList.Add(prefabInfo); newGo.SetActive(true); }
public void AddSingleSaleData(string date, SingleSalesData info) { LoadDailyData(date); for (int i = 0; i < allDailydataSaleDataDict[date].AllSingleSalesData.Count; i++) { SingleSalesData data = allDailydataSaleDataDict[date].AllSingleSalesData[i]; if (data.Index == info.Index) { data = info; return; } } allDailydataSaleDataDict[date].AllSingleSalesData.Add(info); }
public void SetValue(SingleSalesData value) { data = value; Text_Index.text = value.Index.ToString(); Text_StoreID.text = value.StoreID.ToString(); Text_StoreName.text = value.StoreName; Text_Transactionpercent.text = value.TransactionPercent.ToString(); Text_CustomerName.text = value.CustomerName; Text_CustormerDetailInfo.text = value.CustomerDetailInfo; Text_IsNewCustomer.text = value.IsNewCustomer ? "是" : "否"; Text_ProductID.text = value.ProductID.ToString(); Text_ProductName.text = value.ProductName; Text_UnitPrice.text = value.UnitPrice.ToString(); Text_SaleCount.text = value.SaleCount.ToString(); Text_TotalPrice.text = value.TotalPrice.ToString(); Text_SalesPerson1.text = value.SalesPerson1; Text_SalesPerson2.text = value.SalesPersion2; Toggle.group = gameObject.GetComponentInParent <ToggleGroup>(); }
/// <summary> /// 根据输入的数据计算每日销售信息 /// 门店销售信息,月销售信息 /// </summary> /// <param name="date"></param> public void CalculateData(string date) { string day = date.Substring(6, 2); DailySalesData thisDayData = LoadDailyData(date); if (int.Parse(day) == 1) { thisDayData.Reset(); } else { DailySalesData lastDayData = LoadLastDailyData(date); thisDayData.TotalSales = 0; thisDayData.MonthSaleDataToDate = lastDayData.MonthSaleDataToDate.Clone(); thisDayData.ProductTransactionInfos.Clear(); #region storeDailyDate for (int i = 0; i < lastDayData.AllStoreDailySaleData.Count; i++) { StoreDailyInfo lastStoreDayInfo = lastDayData.AllStoreDailySaleData[i]; StoreDailyInfo todaystoreDayinfo = thisDayData.GetStoreDailyInfo(lastStoreDayInfo.StoreID); todaystoreDayinfo.MonthEnterCustomerNubmer = lastStoreDayInfo.MonthEnterCustomerNubmer + todaystoreDayinfo.TodayEnterCustomerNumber; todaystoreDayinfo.MonthTransaction = lastStoreDayInfo.MonthTransaction; todaystoreDayinfo.MonthTotalSales = lastStoreDayInfo.MonthTotalSales; todaystoreDayinfo.OldCustomerCount = lastStoreDayInfo.OldCustomerCount;; todaystoreDayinfo.OldCustomerSales = lastStoreDayInfo.OldCustomerSales; todaystoreDayinfo.NewCustomerCount = lastStoreDayInfo.NewCustomerCount; todaystoreDayinfo.NewCustomerSales = lastStoreDayInfo.NewCustomerSales; todaystoreDayinfo.CompletionRate = lastStoreDayInfo.CompletionRate; } for (int i = 0; i < thisDayData.AllStoreDailySaleData.Count; i++) { StoreDailyInfo todayStoreDayInfo = thisDayData.AllStoreDailySaleData[i]; todayStoreDayInfo.TodaySales = 0; todayStoreDayInfo.TodyTransaction = 0; todayStoreDayInfo.TodayProductTransactions.Clear(); } #endregion #region RankingInfo for (int i = 0; i < lastDayData.AllSalesPersonRankInfos.Count; i++) { SalesPersonRankInfo lastRankingInfo = lastDayData.AllSalesPersonRankInfos[i]; SalesPersonRankInfo todayRankingInfo = thisDayData.GetSalePersonRankInfo(lastRankingInfo.SalePersonID); if (todayRankingInfo == null) { continue; } todayRankingInfo.Ranking = lastRankingInfo.Ranking; todayRankingInfo.PerformanceSales = lastRankingInfo.PerformanceSales; todayRankingInfo.CompleteRate = lastRankingInfo.CompleteRate; } for (int i = 0; i < thisDayData.AllSalesPersonRankInfos.Count; i++) { SalesPersonRankInfo todayRankinfo = thisDayData.AllSalesPersonRankInfos[i]; SalesPersonRankInfo lastRankingInfo = lastDayData.GetSalePersonRankInfo(todayRankinfo.SalePersonID); todayRankinfo.Ranking = lastRankingInfo.Ranking; todayRankinfo.PerformanceSales = lastRankingInfo.PerformanceSales; todayRankinfo.CompleteRate = lastRankingInfo.CompleteRate; } #endregion } for (int i = 0; i < thisDayData.AllSingleSalesData.Count; i++) { SingleSalesData singleSaleData = thisDayData.AllSingleSalesData[i]; thisDayData.TotalSales += singleSaleData.TotalPrice; ProductTransactionInfo trans = thisDayData.GetTransactionInfo(singleSaleData.ProductID, singleSaleData.ProductName); trans.TransactionCount += singleSaleData.SaleCount; #region 计算门店每日数据 StoreDailyInfo storeDayInfo = thisDayData.GetStoreDailyInfo(singleSaleData.StoreID); if (singleSaleData.TransactionPercent > 0) { storeDayInfo.TodyTransaction += 1; } if (singleSaleData.TransactionPercent > 0) { storeDayInfo.MonthTransaction += 1; } storeDayInfo.TodaySales += singleSaleData.TotalPrice; ProductTransactionInfo transaction = storeDayInfo.GetTransactionInfo(singleSaleData.ProductID, singleSaleData.ProductName); transaction.TransactionCount += singleSaleData.SaleCount; storeDayInfo.MonthTotalSales += singleSaleData.TotalPrice; storeDayInfo.CompletionRate = storeDayInfo.MonthTotalSales / storeDayInfo.TargetSales; if (singleSaleData.IsNewCustomer) { if (singleSaleData.TransactionPercent > 0) { storeDayInfo.NewCustomerCount += 1; } storeDayInfo.NewCustomerSales += singleSaleData.TotalPrice; } else { if (singleSaleData.TransactionPercent > 0) { storeDayInfo.OldCustomerCount += 1; } storeDayInfo.OldCustomerSales += singleSaleData.TotalPrice; } #endregion #region 计算本月数据 thisDayData.MonthSaleDataToDate.TotalSales += singleSaleData.TotalPrice; if (singleSaleData.IsNewCustomer) { thisDayData.MonthSaleDataToDate.NewCustomerTransactions += (1 * singleSaleData.TransactionPercent); thisDayData.MonthSaleDataToDate.NewCustomerSales += singleSaleData.TotalPrice; } else { thisDayData.MonthSaleDataToDate.OldCustomerTransactions += (1 * singleSaleData.TransactionPercent); thisDayData.MonthSaleDataToDate.OldCustomerSales += singleSaleData.TotalPrice; } #endregion #region int salesPersonId = SalesDataSystem.SystemDatas.SalesPersonData.GetSalesPersonIdByName(singleSaleData.SalesPerson1); SalesPersonRankInfo salesPersonRankingInfo = thisDayData.GetSalePersonRankInfo(salesPersonId); salesPersonRankingInfo.PerformanceSales += singleSaleData.TotalPrice; #endregion } for (int i = 0; i < thisDayData.AllStoreDailySaleData.Count; i++) { StoreDailyInfo todayStoreDayInfo = thisDayData.AllStoreDailySaleData[i]; todayStoreDayInfo.CompletionRate = todayStoreDayInfo.MonthTotalSales / todayStoreDayInfo.TargetSales; } thisDayData.AllSalesPersonRankInfos.Sort((a, b) => { if (a.PerformanceSales > b.PerformanceSales) { return(-1); } else if (a.PerformanceSales == b.PerformanceSales) { return(0); } else { return(1); } }); for (int i = 0; i < thisDayData.AllSalesPersonRankInfos.Count; i++) { SalesPersonRankInfo rankinginfo = thisDayData.AllSalesPersonRankInfos[i]; rankinginfo.Ranking = i + 1; rankinginfo.CompleteRate = rankinginfo.PerformanceSales / rankinginfo.TargetSales; } }
public void SetValue(string date, SingleSalesData data) { curDate = date; prefabdata = data; Index = data.Index; Input_Index.text = Index.ToString(); StoreName = data.StoreName; int index = 0; if (!string.IsNullOrEmpty(StoreName)) { for (int i = 0; i < DropDown_StoreName.options.Count; i++) { if (DropDown_StoreName.options[i].text == StoreName) { index = i; break; } } } DropDown_StoreName.value = index; DropDown_StoreName.RefreshShownValue(); StoreName = DropDown_StoreName.options[index].text; StoreID = SalesDataSystem.SystemDatas.StoreSysData.GetStoreIDByName(StoreName); Text_StoreID.text = StoreID.ToString(); CustomerName = data.CustomerName; if (!string.IsNullOrEmpty(CustomerName)) { Input_CustomerName.text = CustomerName; } TransactionPercent = data.TransactionPercent; Input_TransactionPercent.text = TransactionPercent.ToString(); CustomerDetailInfo = data.CustomerDetailInfo; if (!string.IsNullOrEmpty(CustomerDetailInfo)) { Input_CustomerDetailInfo.text = CustomerDetailInfo; } IsNewCustomer = data.IsNewCustomer; index = 0; if (IsNewCustomer) { index = 0; } else { index = 1; } DropDown_IsNewCustomer.value = index; DropDown_IsNewCustomer.RefreshShownValue(); ProductName = data.ProductName; index = 0; if (!string.IsNullOrEmpty(ProductName)) { for (int i = 0; i < DropDown_ProductName.options.Count; i++) { if (ProductName == DropDown_ProductName.options[i].text) { index = i; break; } } } DropDown_ProductName.value = index; DropDown_ProductName.RefreshShownValue(); ProductName = DropDown_ProductName.options[index].text; ProductId = SalesDataSystem.SystemDatas.ProductSysData.GetProductIdByName(ProductName); if (ProductId != 0) { Text_ProductId.text = ProductId.ToString(); } ProductUnitPrice = SalesDataSystem.SystemDatas.ProductSysData.GetProductPrice(ProductId); if (ProductUnitPrice != 0) { Input_ProductPrice.text = ProductUnitPrice.ToString(); } TransactionCount = data.SaleCount; Input_TransactionCount.text = TransactionCount.ToString(); TotalSales = data.TotalPrice; Input_TotalSales.text = TotalSales.ToString(); SalePerson1 = data.SalesPerson1; index = 0; if (!string.IsNullOrEmpty(SalePerson1)) { for (int i = 0; i < DropDown_SalePerspon1.options.Count; i++) { if (SalePerson1 == DropDown_SalePerspon1.options[i].text) { index = i; break; } } } DropDown_SalePerspon1.value = index; DropDown_SalePerspon1.RefreshShownValue(); SalePerson1 = DropDown_SalePerspon1.options[index].text; SalePerson2 = data.SalesPersion2; index = 0; if (!string.IsNullOrEmpty(SalePerson2)) { for (int i = 0; i < DropDown_SalePerson2.options.Count; i++) { if (SalePerson2 == DropDown_SalePerson2.options[i].text) { index = i; break; } } } DropDown_SalePerson2.value = index; DropDown_SalePerson2.RefreshShownValue(); SalePerson2 = DropDown_SalePerson2.options[index].text; }