public void AddOfflineData(ref List <OperatingCostData> list, DateTime begin, DateTime end, string format, int project) { List <XMJDSaleRejected> RejectedList = new List <XMJDSaleRejected>(); List <XMSaleReturn> ReturnList = new List <XMSaleReturn>(); var wareHousesList = base.XMWareHousesService.GetXMWarehouseListByProjectId(project); List <int> WareHousesList = wareHousesList.Select(x => x.Id).ToList(); List <int?> WarehousesList = WareHousesList.Select <int, int?>(q => Convert.ToInt32(q)).ToList(); var SaleList = base.XMSaleDeliveryService.GetXMSaleDeliveryListOtherProject(begin, end, WareHousesList); if (project == 2) { RejectedList = base.XMJDSaleRejectedService.GetXMJDSaleRejectedListOtherProject(begin, end);//京东自营退货 } else { ReturnList = base.XMSaleReturnService.GetXMSaleReturnListByDate(begin, end, WarehousesList); } for (int i = 0; i < list.Count; i++) { OperatingCostData Info = list[i]; if (SaleList.Count > 0) { foreach (XMSaleDelivery info in SaleList) { if (Info.Date == ((DateTime)info.BizDt).ToString(format)) { Info.CountMoneySum1 += (decimal)(info.SaleMoney == null ? 0 : info.SaleMoney); } } } if (RejectedList.Count > 0) { foreach (XMJDSaleRejected info in RejectedList) { if (Info.Date == ((DateTime)info.BizDt).ToString(format)) { Info.CountMoneySum1 -= (decimal)(info.ReturnMoney == null ? 0 : info.ReturnMoney); } } } if (ReturnList.Count > 0) { foreach (XMSaleReturn info in ReturnList) { if (Info.Date == ((DateTime)info.BizDt).ToString(format)) { Info.CountMoneySum1 -= (decimal)(info.RejectionsaleMoney == null ? 0 : info.RejectionsaleMoney); } } } } }
private List <OperatingCostData> GetDataTotal(string Year, string PageType, string ProjectID) { List <OperatingCostData> list = new List <OperatingCostData>(); int Month = 0; string Now = ""; if (Year == DateTime.Now.Year.ToString()) { Month = DateTime.Now.Month; Now = DateTime.Now.Month.ToString().PadLeft(2, '0') + "/" + DateTime.Now.Day.ToString().PadLeft(2, '0'); } else { Month = 12; Now = "12/31"; } for (int i = 1; i <= Month; i++) { OperatingCostData Item = new OperatingCostData(); Item.Date = Year + "/" + i.ToString().PadLeft(2, '0'); list.Add(Item); } DateTime begin = DateTime.Parse(Year + "/01/01"); DateTime end = DateTime.Parse(Year + "/" + Now).AddDays(1); if (ProjectID == "B2B" || ProjectID == "B2C") { list = B2BOrB2C(ProjectID, begin, end, list); } else { list = GetDayTotal(PageType, ProjectID, begin, end, list); } return(list); }
private List <OperatingCostData> GetDataTotal(string DateType, string PageType, string ProjectID) { List <OperatingCostData> list = new List <OperatingCostData>(); string now = DateTime.Now.ToLongDateString(); for (int i = 1; i <= DateTime.Now.Month; i++) { OperatingCostData Item = new OperatingCostData(); Item.Date = DateTime.Now.Year + "/" + i.ToString().PadLeft(2, '0'); list.Add(Item); } DateTime begin = DateTime.Parse(DateTime.Now.Year + "/01/01"); DateTime end = DateTime.Parse(now).AddDays(1).AddSeconds(-1); if (ProjectID == "B2B" || ProjectID == "B2C") { list = B2BOrB2C(DateType, ProjectID, begin, end, list); } else { list = GetDayTotal(DateType, PageType, ProjectID, begin, end, list); } return(list); }
public List <OperatingCostData> AddOfflineData(ref List <OperatingCostData> list, DateTime begin, DateTime end, string format, int project) { List <JDSelfModel> List = new List <JDSelfModel>(); List <XMJDSaleRejectedProductDetail> RejectedList = new List <XMJDSaleRejectedProductDetail>(); List <XMSaleReturnProductDetails> ReturnList = new List <XMSaleReturnProductDetails>(); var wareHousesList = IoC.Resolve <IXMWareHousesService>().GetXMWarehouseListByProjectId(project); List <int> WareHousesList = wareHousesList.Select(x => x.Id).ToList(); List <int?> WarehousesList = WareHousesList.Select <int, int?>(q => Convert.ToInt32(q)).ToList(); var SaleList = IoC.Resolve <IXMSaleDeliveryProductDetailsService>().GetXMSaleDeliveryListJDSelf(begin, end, WareHousesList);//线下无订单的销售出库数据 if (project == 2) { RejectedList = IoC.Resolve <IXMJDSaleRejectedProductDetailService>().GetXMJDSaleRejectedProductDetailListJDSelf(begin, end);//京东自营退货 } else { ReturnList = IoC.Resolve <IXMSaleReturnProductDetailsService>().GetXMSaleReturnProductDetailsListByDate(begin, end, WarehousesList); } var InventoryList = IoC.Resolve <IXMInventoryInfoService>().GetXMInventoryInfoListByWfIds(WareHousesList);//京东自营库存 GetJDProductsPriceList(ref List, SaleList, RejectedList, ReturnList, InventoryList, WareHousesList); for (int i = 0; i < list.Count; i++) { OperatingCostData Info = list[i]; if (SaleList.Count > 0) { foreach (XMSaleDeliveryProductDetails info in SaleList) { if (Info.Date == ((DateTime)info.XM_SaleDelivery.BizDt).ToString(format)) { decimal cost = GetCost(List, info.XM_SaleDelivery.WareHouseId, info.PlatformMerchantCode); Info.CountMoneySum4 += cost * decimal.Parse(info.SaleCount.ToString()); Info.YYCBMonthMoney += cost * decimal.Parse(info.SaleCount.ToString()); } } } if (RejectedList.Count > 0) { foreach (XMJDSaleRejectedProductDetail info in RejectedList) { if (Info.Date == ((DateTime)info.XM_JDSaleRejected.BizDt).ToString(format)) { decimal cost = GetCost(List, -1, info.PlatformMerchantCode); Info.CountMoneySum4 -= cost * decimal.Parse(info.RejectionCount.ToString()); Info.YYCBMonthMoney -= cost * decimal.Parse(info.RejectionCount.ToString()); } } } if (ReturnList.Count > 0) { foreach (XMSaleReturnProductDetails info in ReturnList) { if (Info.Date == ((DateTime)info.XM_SaleReturn.BizDt).ToString(format)) { string PlatformMerchantCode = ""; if (info.DeliveryProductsDetailID != null) { var ProductDetail = IoC.Resolve <IXMSaleDeliveryProductDetailsService>().GetXMSaleDeliveryProductDetailsById(info.DeliveryProductsDetailID.Value); if (ProductDetail != null) { PlatformMerchantCode = ProductDetail.PlatformMerchantCode; } } decimal cost = GetCost(List, (int)info.XM_SaleReturn.WarehouseId, PlatformMerchantCode); Info.CountMoneySum4 -= cost * decimal.Parse(info.RejectionProdcutsCount.ToString()); Info.YYCBMonthMoney -= cost * decimal.Parse(info.RejectionProdcutsCount.ToString()); } } } } return(list); }
private List <OperatingCostData> GetDataTotal(string DateType, string PageType, string ProjectID) { List <OperatingCostData> list = new List <OperatingCostData>(); List <OperatingCostData> List = new List <OperatingCostData>(); string now = DateTime.Now.ToLongDateString(); if (DateType == "week") { for (int i = 6; i >= 0; i--) { OperatingCostData Item = new OperatingCostData(); if (DateTime.Now.Day < 7 && DateTime.Now.AddDays(-i).Day > 7) { Item.Date = (DateTime.Now.Month - 1).ToString().PadLeft(2, '0') + "/" + (DateTime.Now.AddDays(-i).Day).ToString().PadLeft(2, '0'); } else { Item.Date = DateTime.Now.Month.ToString().PadLeft(2, '0') + "/" + (DateTime.Now.AddDays(-i).Day).ToString().PadLeft(2, '0'); } list.Add(Item); } DateTime begin = DateTime.Parse(now).AddDays(-6); DateTime end = DateTime.Parse(now).AddDays(1).AddSeconds(-1); if (ProjectID == "B2B" || ProjectID == "B2C") { List = B2BOrB2C(DateType, ProjectID, begin, end, list); } else { List = GetDayTotal(DateType, PageType, ProjectID, begin, end, list); } } else if (DateType == "month") { for (int i = DateTime.Now.Day - 1; i >= 0; i--) { OperatingCostData Item = new OperatingCostData(); Item.Date = DateTime.Now.Month.ToString().PadLeft(2, '0') + "/" + (DateTime.Now.AddDays(-i).Day).ToString().PadLeft(2, '0'); list.Add(Item); } DateTime begin = DateTime.Parse(now).AddDays(-DateTime.Now.Day + 1); DateTime end = DateTime.Parse(now).AddDays(1).AddSeconds(-1); if (ProjectID == "B2B" || ProjectID == "B2C") { List = B2BOrB2C(DateType, ProjectID, begin, end, list); } else { List = GetDayTotal(DateType, PageType, ProjectID, begin, end, list); } } else if (DateType == "year") { for (int i = 1; i <= DateTime.Now.Month; i++) { OperatingCostData Item = new OperatingCostData(); Item.Date = DateTime.Now.Year + "/" + i.ToString().PadLeft(2, '0'); list.Add(Item); } DateTime begin = DateTime.Parse(DateTime.Now.Year + "/01/01"); DateTime end = DateTime.Parse(now).AddDays(1).AddSeconds(-1); if (ProjectID == "B2B" || ProjectID == "B2C") { List = B2BOrB2C(DateType, ProjectID, begin, end, list); } else { List = GetDayTotal(DateType, PageType, ProjectID, begin, end, list); } } return(list); }
private List <OperatingCostData> GetDataTotal(string DateType, string PageType, bool Repeat) { string Format = "yyyy/MM"; CompanyTool tool = new CompanyTool(); string ProjectId = this.ddlXMProjectNameId.SelectedValue; string NickId = this.ddlNickList.SelectedValue; string Year = this.ddlYear.SelectedValue; int Month; if (DateType == "year") { Month = DateTime.Now.Month; } else { Month = 12; } List <OperatingCostData> list = new List <OperatingCostData>(); string now = DateTime.Now.ToLongDateString(); for (int i = 1; i <= Month; i++) { OperatingCostData Item = new OperatingCostData(); Item.Date = Year + "/" + i.ToString().PadLeft(2, '0'); list.Add(Item); } DateTime begin = DateTime.Parse(Year + "/01/01"); DateTime end; if (Year == DateTime.Now.Year.ToString()) { end = DateTime.Parse(now).AddDays(1); } else { end = DateTime.Parse((int.Parse(Year) + 1) + "/01/01"); } string mark = ""; if (Session["Mark"] != null) { mark = Session["Mark"].ToString(); } if (Repeat) { tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId, "Table"); } else { if (mark == DateType + "," + ProjectId + "," + NickId) { if (Session["HightChartsLineYear"] != null) { list = (List <OperatingCostData>)Session["HightChartsLineYear"]; } } else { tool.GetTableDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); if (Session["HightChartsLine"] != null) { list = (List <OperatingCostData>)Session["HightChartsLine"]; } } } return(list); }
private void GetDataTotal(string DateType, string PageType, string Year, string Month, string ProjectId, string NickId) { CompanyTool tool = new CompanyTool(); string Format = ""; if ((DateType == "year") || DateType == "custom_year") { Format = "yyyy/MM"; } else { Format = "MM/dd"; } List <OperatingCostData> list = new List <OperatingCostData>(); //List<List<HighChart>> List = new List<List<HighChart>>(); string now = DateTime.Now.ToLongDateString(); DateTime begin = new DateTime(); DateTime end = new DateTime(); if (DateType == "week") { for (int i = 6; i >= 0; i--) { OperatingCostData Item = new OperatingCostData(); if (DateTime.Now.Day < 7 && DateTime.Now.AddDays(-i).Day > 7) { Item.Date = (DateTime.Now.Month - 1).ToString().PadLeft(2, '0') + "/" + (DateTime.Now.AddDays(-i).Day).ToString().PadLeft(2, '0'); } else { Item.Date = DateTime.Now.Month.ToString().PadLeft(2, '0') + "/" + (DateTime.Now.AddDays(-i).Day).ToString().PadLeft(2, '0'); } list.Add(Item); } begin = DateTime.Parse(now).AddDays(-6); end = DateTime.Parse(now).AddDays(1); //List = tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); } else if (DateType == "month") { for (int i = DateTime.Now.Day - 1; i >= 0; i--) { OperatingCostData Item = new OperatingCostData(); Item.Date = DateTime.Now.Month.ToString().PadLeft(2, '0') + "/" + (DateTime.Now.AddDays(-i).Day).ToString().PadLeft(2, '0'); list.Add(Item); } begin = DateTime.Parse(now).AddDays(-DateTime.Now.Day + 1); end = DateTime.Parse(now).AddDays(1); //List = tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); } else if (DateType == "year") { for (int i = 1; i <= DateTime.Now.Month; i++) { OperatingCostData Item = new OperatingCostData(); Item.Date = DateTime.Now.Year + "/" + i.ToString().PadLeft(2, '0'); list.Add(Item); } begin = DateTime.Parse(DateTime.Now.Year + "/01/01"); end = DateTime.Parse(now).AddDays(1); //List = tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); } else if (DateType == "custom_year") { begin = DateTime.Parse(Year + "/01/01"); for (int i = 1; i <= 12; i++) { OperatingCostData Item = new OperatingCostData(); Item.Date = Year + "/" + i.ToString().PadLeft(2, '0'); list.Add(Item); } end = DateTime.Parse((int.Parse(Year) + 1) + "/01/01"); //List = tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); } else if (DateType == "custom_month") { int days = DateTime.DaysInMonth(int.Parse(Year), int.Parse(Month)); for (int i = days - 1; i >= 0; i--) { OperatingCostData Item = new OperatingCostData(); Item.Date = Month.PadLeft(2, '0') + "/" + (days - i).ToString().PadLeft(2, '0'); list.Add(Item); } begin = DateTime.Parse(Year + "/" + Month + "/01"); if (Month != "12") { end = DateTime.Parse(Year + "/" + (int.Parse(Month) + 1) + "/01"); } else { end = DateTime.Parse((int.Parse(Year) + 1) + "/01/01"); } //List = tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); } tool.GetDayTotal(DateType, PageType, begin, end, list, Format, Year, ProjectId, NickId); return; }