public void GetB2BC(int departmentType, List <int?> NickIdList, string year, string month, string ProjectId) { CWProfitModel monthData = GetB2BCMonthData(departmentType, NickIdList, year, month); MonthData = tool.AccumulationValue(MonthData, monthData); DateTime end = new DateTime(); if (month == "12") { end = DateTime.Parse((int.Parse(year) + 1) + "/" + month.ToString() + "/01"); } else { end = DateTime.Parse(year + "/" + (int.Parse(month) + 1).ToString() + "/01"); } for (int i = 1; i <= 12; i++) { DateTime begin = DateTime.Parse(year + "/" + i + "/01"); if (begin < end) { monthData = GetB2BCMonthData(departmentType, NickIdList, year, i.ToString()); MonthList.AddRange(GetMonthListDataList(monthData, year, i.ToString(), ProjectId, NickIdList, null, departmentType)); YearData = tool.AccumulationValue(YearData, monthData); } else { break; } } }
public List <CWStaffSpendingMapping> GetMonthListDataList(CWProfitModel monthData, string year, string month, string ProjectId, List <int?> NickIdList, List <int> nickIdList, int DepartmentType) { List <CWStaffSpendingMapping> list = new List <CWStaffSpendingMapping>(); list.Add(GetMonthListData(monthData, year, month, ProjectId, NickIdList, nickIdList, 64, DepartmentType)); list.Add(GetMonthListData(monthData, year, month, ProjectId, NickIdList, nickIdList, 66, DepartmentType)); list.Add(GetMonthListData(monthData, year, month, ProjectId, NickIdList, nickIdList, 68, DepartmentType)); list.Add(GetMonthListData(monthData, year, month, ProjectId, NickIdList, nickIdList, 73, DepartmentType)); return(list); }
public CWProfitModel GetB2BCMonthData(int departmentType, List <int?> NickIdList, string year, string month) { CWProfitModel monthData = new CWProfitModel(); List <CWStaffSpending> CWStaffSpendingList = tool.GetAllResult(FinancialFieldList, year, month, -1, departmentType, -1); foreach (int ID in son) { monthData = tool.B2BOrB2C(monthData, ID, NickIdList, year, month, -1, departmentType, CWStaffSpendingList); } foreach (int ID in parent) { monthData = tool.B2BOrB2C(monthData, ID, NickIdList, year, month, -1, departmentType, CWStaffSpendingList); } return(monthData); }
public CWProfitModel AccumulationValue(CWProfitModel a, CWProfitModel b) { a.CountMoneySum1 += b.CountMoneySum1; a.CountMoneySum2 += b.CountMoneySum2; a.CountMoneySum3 += b.CountMoneySum3; a.CountMoneySum4 += b.CountMoneySum4; a.CountMoneySum5 += b.CountMoneySum5; a.CountMoneySum6 += b.CountMoneySum6; a.CountMoneySum7 += b.CountMoneySum7; a.CountMoneySum8 += b.CountMoneySum8; a.CountMoneySum9 += b.CountMoneySum9; a.CountMoneySum10 += b.CountMoneySum10; a.OperatingPerformance += b.OperatingPerformance; a.BusinessIncome += b.BusinessIncome; a.ReturnMoney += b.ReturnMoney; a.PurchaseCost += b.PurchaseCost; a.ReturnCost += b.ReturnCost; a.PremiumsCost += b.PremiumsCost; a.TakeBrush += b.TakeBrush; a.Cashback += b.Cashback; a.AdvertisementFEE += b.AdvertisementFEE; a.PlatformFee += b.PlatformFee; a.Freight += b.Freight; a.ZZSMoney += b.ZZSMoney; a.YYCBMoney += b.YYCBMoney; a.MLMoney += b.MLMoney; a.ZJRGMoney += b.ZJRGMoney; a.YYFYMoney += b.YYFYMoney; a.YYSJMoney += b.YYSJMoney; a.SQLRMoney += b.SQLRMoney; a.Wages += b.Wages; a.SocialSecurity += b.SocialSecurity; a.Bonus += b.Bonus; a.Subsidy += b.Subsidy; a.SalesIncentive += b.SalesIncentive; a.WelfareFunds += b.WelfareFunds; a.MarketFees += b.MarketFees; a.ServerRentalFee += b.ServerRentalFee; a.IncomeTax += b.IncomeTax; a.DirectSellingNetProfit += b.DirectSellingNetProfit; a.ServiceIncome += b.ServiceIncome; return(a); }
public CWProfitModel GetProjectMonthData(int ProjectId, List <int> nickIdList, string year, string month) { CWProfitModel MonthCacheData = new CWProfitModel(); List <CWStaffSpending> NickSettingDataList = tool.GetAllResult(NickSetting.ToList(), year, month, ProjectId, -1, -1); MonthCacheData = GetAuxiliaryParameters(MonthCacheData, ProjectId, year, month); foreach (int ID in NickSetting) { MonthCacheData = GetValue(MonthCacheData, year, month, ID, ProjectId, -1, NickSettingDataList, "-1"); } List <CWStaffSpending> ProjectSettingDataList = tool.GetAllResult(ProjectSetting.ToList(), year, month, ProjectId, -1, -1); MonthCacheData = tool.AddOfflineData(MonthCacheData, nickIdList, year, month); foreach (int ID in ProjectSetting) { MonthCacheData = GetValue(MonthCacheData, year, month, ID, ProjectId, -1, ProjectSettingDataList, "-1"); } foreach (int ID in parent) { MonthCacheData = GetValue(MonthCacheData, year, month, ID, ProjectId, -1, null, ""); } return(MonthCacheData); }
public CWProfitModel AddOfflineData(CWProfitModel MonthData, List <int> nickIdList, string Year, string Month) { DateTime begin = DateTime.Parse(Year + "/" + Month + "/01"); DateTime end = begin.AddMonths(1).AddSeconds(-1); decimal BusinessIncome = 0; decimal PurchaseCost = 0; List <JDSelfModel> List = new List <JDSelfModel>(); List <XMJDSaleRejectedProductDetail> RejectedList = new List <XMJDSaleRejectedProductDetail>(); List <XMSaleReturnProductDetails> ReturnList = new List <XMSaleReturnProductDetails>(); var wareHousesList = IoC.Resolve <IXMWareHousesService>().GetXMWarehouseListByNickIds(nickIdList); 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 (nickIdList.Contains(29)) { RejectedList = IoC.Resolve <IXMJDSaleRejectedProductDetailService>().GetXMJDSaleRejectedProductDetailListJDSelf(begin, end);//京东自营退货 } if ((nickIdList.Contains(29) && nickIdList.Count > 1) || !nickIdList.Contains(29)) { ReturnList = IoC.Resolve <IXMSaleReturnProductDetailsService>().GetXMSaleReturnProductDetailsListByDate(begin, end, WarehousesList); } var InventoryList = IoC.Resolve <IXMInventoryInfoService>().GetXMInventoryInfoListByWfIds(WareHousesList);//京东自营库存 GetJDProductsPriceList(ref List, SaleList, RejectedList, ReturnList, InventoryList, WareHousesList); if (SaleList.Count > 0) { foreach (XMSaleDeliveryProductDetails sale in SaleList) { BusinessIncome += (decimal)(sale.ProductMoney == null ? 0 : sale.ProductMoney); decimal cost = GetCost(List, sale.XM_SaleDelivery.WareHouseId, sale.PlatformMerchantCode); PurchaseCost += cost * decimal.Parse(sale.SaleCount.ToString()); } } if (RejectedList.Count > 0) { foreach (XMJDSaleRejectedProductDetail rejected in RejectedList) { BusinessIncome -= (decimal)(rejected.RejectionMoney == null ? 0 : rejected.RejectionMoney); decimal cost = GetCost(List, -1, rejected.PlatformMerchantCode); PurchaseCost -= cost * decimal.Parse(rejected.RejectionCount.ToString()); } } if (ReturnList.Count > 0) { foreach (XMSaleReturnProductDetails rejected in ReturnList) { BusinessIncome -= (decimal)(rejected.RejectionsaleMoney == null ? 0 : rejected.RejectionsaleMoney); string PlatformMerchantCode = ""; if (rejected.DeliveryProductsDetailID != null) { var ProductDetail = IoC.Resolve <IXMSaleDeliveryProductDetailsService>().GetXMSaleDeliveryProductDetailsById(rejected.DeliveryProductsDetailID.Value); if (ProductDetail != null) { PlatformMerchantCode = ProductDetail.PlatformMerchantCode; } } decimal cost = GetCost(List, (int)rejected.XM_SaleReturn.WarehouseId, PlatformMerchantCode); PurchaseCost -= cost * decimal.Parse(rejected.RejectionProdcutsCount.ToString()); } } MonthData.BusinessIncome += BusinessIncome; MonthData.PurchaseCost += PurchaseCost; return(MonthData); }
public CWProfitModel B2BOrB2C(CWProfitModel model, int FinancialFieldID, List <int?> NickIdList, string year, string month, int ProjectId, int DepartmentType, List <CWStaffSpending> CWStaffSpendingList) { decimal value = 0; var a = CWStaffSpendingList.Where(x => x.FinancialFieldId == FinancialFieldID); if (a.Count() > 0) { value = (decimal)(a.ToList())[0].CountMoney; } //营业业绩额 if (FinancialFieldID == 63) { model.OperatingPerformance = value; if (value != 0) { return(model); } if (DepartmentType == 6) { model.OperatingPerformance = GetProfitValue(FinancialFieldID, -1, -1, year, month, DepartmentType); } else { model.OperatingPerformance = model.ServiceIncome; } value = model.OperatingPerformance; } //营业成本 if (FinancialFieldID == 66) { model.YYCBMoney = value; if (value != 0) { return(model); } model.YYCBMoney = GetProfitValue(FinancialFieldID, -1, -1, year, month, DepartmentType); value = model.YYCBMoney; } //增值税 if (FinancialFieldID == 67) { model.ZZSMoney = value; if (value != 0) { return(model); } model.ZZSMoney = Math.Round((model.OperatingPerformance / (decimal)1.06) * (decimal)0.06, 2); value = model.ZZSMoney; } //毛利 if (FinancialFieldID == 68) { model.MLMoney = value; if (value != 0) { return(model); } model.MLMoney = Math.Round((model.OperatingPerformance - model.YYCBMoney - model.ZZSMoney), 2); value = model.MLMoney; } //营业税金及附加 if (FinancialFieldID == 72) { model.YYSJMoney = value; if (value != 0) { return(model); } model.YYSJMoney = Math.Round(model.ZZSMoney * (decimal)0.12 + model.OperatingPerformance / (decimal)1.06 * (decimal)0.001, 2); value = model.YYSJMoney; } //税前利润=毛利-营业费用-营业税金及附加 if (FinancialFieldID == 73) { model.SQLRMoney = value; if (value != 0) { return(model); } model.SQLRMoney += Math.Round((model.MLMoney - model.YYSJMoney - model.YYFYMoney), 2); value = model.SQLRMoney; model.IncomeTax = Math.Round(model.SQLRMoney / 4, 2); } //营业费用=工资+社保+奖金+补贴+销售激励+福利费+市场费+服务器租赁费+办公费用+其他费用+差旅费 if (FinancialFieldID == 70) { model.YYFYMoney = value; if (value != 0) { return(model); } else { model.YYFYMoney = Math.Round(model.Wages + model.SocialSecurity + model.Bonus + model.Subsidy + model.SalesIncentive + model.WelfareFunds + model.MarketFees + model.ServerRentalFee + model.CountMoneySum6 + model.CountMoneySum7 + model.CountMoneySum5, 2); value = model.YYFYMoney; return(model); } } //直销净利润 if (FinancialFieldID == 74) { model.DirectSellingNetProfit = value; if (value != 0) { return(model); } else { model.DirectSellingNetProfit = Math.Round(model.SQLRMoney - model.IncomeTax, 2); value = model.DirectSellingNetProfit; return(model); } } //工资 if (FinancialFieldID == 93) { model.Wages = value; if (value != 0) { return(model); } } //社保 if (FinancialFieldID == 94) { model.SocialSecurity = value; if (value != 0) { return(model); } } //奖金 if (FinancialFieldID == 95) { model.Bonus = value; if (value != 0) { return(model); } } //补贴 if (FinancialFieldID == 96) { model.Subsidy = value; if (value != 0) { return(model); } } //销售激励 if (FinancialFieldID == 97) { model.SalesIncentive = value; if (value != 0) { return(model); } } //福利费 if (FinancialFieldID == 99) { model.WelfareFunds = value; if (value != 0) { return(model); } } //市场费 if (FinancialFieldID == 103) { model.MarketFees = value; if (value != 0) { return(model); } } //服务器租赁费 if (FinancialFieldID == 105) { model.ServerRentalFee = value; if (value != 0) { return(model); } } //办公费用 if (FinancialFieldID == 101) { model.CountMoneySum6 = value; if (value != 0) { return(model); } } //其他费用 if (FinancialFieldID == 100) { model.CountMoneySum7 = value; if (value != 0) { return(model); } } //服务收入 if (FinancialFieldID == 75) { model.ServiceIncome = value; if (DepartmentType == 197) { if (value != 0) { return(model); } model.ServiceIncome = GetProfitValue(FinancialFieldID, -1, -1, year, month, DepartmentType); value = model.ServiceIncome; } } //差旅费 if (FinancialFieldID == 98) { model.CountMoneySum5 = value; if (value != 0) { return(model); } } return(model); }
public List <CWStaffSpendingMapping> GetCompleteData(List <CWStaffSpendingMapping> list, CWProfitModel MonthData, CWProfitModel YearData) { foreach (CWStaffSpendingMapping info in list) { if (info.FinancialFieldId == 63) { info.MonthTotal = MonthData.OperatingPerformance; info.YearTotal = YearData.OperatingPerformance; } if (info.FinancialFieldId == 64) { info.MonthTotal = MonthData.BusinessIncome; info.YearTotal = YearData.BusinessIncome; } if (info.FinancialFieldId == 78) { info.MonthTotal = MonthData.PurchaseCost; info.YearTotal = YearData.PurchaseCost; } if (info.FinancialFieldId == 79) { info.MonthTotal = MonthData.PremiumsCost; info.YearTotal = YearData.PremiumsCost; } if (info.FinancialFieldId == 109) { info.MonthTotal = MonthData.TakeBrush; info.YearTotal = YearData.TakeBrush; } if (info.FinancialFieldId == 110) { info.MonthTotal = MonthData.Cashback; info.YearTotal = YearData.Cashback; } if (info.FinancialFieldId == 86) { info.MonthTotal = MonthData.AdvertisementFEE; info.YearTotal = YearData.AdvertisementFEE; } if (info.FinancialFieldId == 107) { info.MonthTotal = MonthData.PlatformFee; info.YearTotal = YearData.PlatformFee; } if (info.FinancialFieldId == 108) { info.MonthTotal = MonthData.Freight; info.YearTotal = YearData.Freight; } if (info.FinancialFieldId == 67) { info.MonthTotal = MonthData.ZZSMoney; info.YearTotal = YearData.ZZSMoney; } if (info.FinancialFieldId == 66) { info.MonthTotal = MonthData.YYCBMoney; info.YearTotal = YearData.YYCBMoney; } if (info.FinancialFieldId == 68) { info.MonthTotal = MonthData.MLMoney; info.YearTotal = YearData.MLMoney; } if (info.FinancialFieldId == 89) { info.MonthTotal = MonthData.CountMoneySum1; info.YearTotal = YearData.CountMoneySum1; } if (info.FinancialFieldId == 90) { info.MonthTotal = MonthData.CountMoneySum2; info.YearTotal = YearData.CountMoneySum2; } if (info.FinancialFieldId == 91) { info.MonthTotal = MonthData.CountMoneySum3; info.YearTotal = YearData.CountMoneySum3; } if (info.FinancialFieldId == 111) { info.MonthTotal = MonthData.CountMoneySum4; info.YearTotal = YearData.CountMoneySum4; } if (info.FinancialFieldId == 98) { info.MonthTotal = MonthData.CountMoneySum5; info.YearTotal = YearData.CountMoneySum5; } if (info.FinancialFieldId == 101) { info.MonthTotal = MonthData.CountMoneySum6; info.YearTotal = YearData.CountMoneySum6; } if (info.FinancialFieldId == 100) { info.MonthTotal = MonthData.CountMoneySum7; info.YearTotal = YearData.CountMoneySum7; } if (info.FinancialFieldId == 112) { info.MonthTotal = MonthData.CountMoneySum8; info.YearTotal = YearData.CountMoneySum8; } if (info.FinancialFieldId == 113) { info.MonthTotal = MonthData.CountMoneySum9; info.YearTotal = YearData.CountMoneySum9; } if (info.FinancialFieldId == 71) { info.MonthTotal = MonthData.CountMoneySum10; info.YearTotal = YearData.CountMoneySum10; } if (info.FinancialFieldId == 69) { info.MonthTotal = MonthData.ZJRGMoney; info.YearTotal = YearData.ZJRGMoney; } if (info.FinancialFieldId == 70) { info.MonthTotal = MonthData.YYFYMoney; info.YearTotal = YearData.YYFYMoney; } if (info.FinancialFieldId == 72) { info.MonthTotal = MonthData.YYSJMoney; info.YearTotal = YearData.YYSJMoney; } if (info.FinancialFieldId == 73) { info.MonthTotal = MonthData.SQLRMoney; info.YearTotal = YearData.SQLRMoney; } if (info.FinancialFieldId == 93) { info.MonthTotal = MonthData.Wages; info.YearTotal = YearData.Wages; } if (info.FinancialFieldId == 94) { info.MonthTotal = MonthData.SocialSecurity; info.YearTotal = YearData.SocialSecurity; } if (info.FinancialFieldId == 95) { info.MonthTotal = MonthData.Bonus; info.YearTotal = YearData.Bonus; } if (info.FinancialFieldId == 96) { info.MonthTotal = MonthData.Subsidy; info.YearTotal = YearData.Subsidy; } if (info.FinancialFieldId == 97) { info.MonthTotal = MonthData.SalesIncentive; info.YearTotal = YearData.SalesIncentive; } if (info.FinancialFieldId == 99) { info.MonthTotal = MonthData.WelfareFunds; info.YearTotal = YearData.WelfareFunds; } if (info.FinancialFieldId == 103) { info.MonthTotal = MonthData.MarketFees; info.YearTotal = YearData.MarketFees; } if (info.FinancialFieldId == 105) { info.MonthTotal = MonthData.ServerRentalFee; info.YearTotal = YearData.ServerRentalFee; } if (info.FinancialFieldId == 106) { info.MonthTotal = MonthData.IncomeTax; info.YearTotal = YearData.IncomeTax; } if (info.FinancialFieldId == 74) { info.MonthTotal = MonthData.DirectSellingNetProfit; info.YearTotal = YearData.DirectSellingNetProfit; } if (info.FinancialFieldId == 75) { info.MonthTotal = MonthData.ServiceIncome; info.YearTotal = YearData.ServiceIncome; } } return(list); }
public CWProfitModel GetValue(CWProfitModel model, string year, string month, int FinancialFieldID, int ProjectId, int NickId, List <CWStaffSpending> CWStaffSpendingList, string cbNickId, string cbProjectTypeId) { decimal value = 0; if (CWStaffSpendingList != null) { var a = CWStaffSpendingList.Where(x => x.FinancialFieldId == FinancialFieldID); if (a.Count() > 0) { value = (decimal)(a.ToList())[0].CountMoney; } } //营业收入 if (FinancialFieldID == 64) { model.BusinessIncome = value; if (value != 0) { return(model); } model.BusinessIncome = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.BusinessIncome; } //进货成本 if (FinancialFieldID == 78) { model.PurchaseCost = value; if (value != 0) { return(model); } model.PurchaseCost = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.PurchaseCost; } //赠品成本 if (FinancialFieldID == 79) { model.PremiumsCost = value; if (value != 0) { return(model); } model.PremiumsCost = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.PremiumsCost; } //广告费用 if (FinancialFieldID == 148)//86 { model.AdvertisementFEE = value; if (value != 0) { return(model); } model.AdvertisementFEE = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.AdvertisementFEE; } //平台费用 if (FinancialFieldID == 107) { model.PlatformFee = value; if (value != 0) { return(model); } model.PlatformFee = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.PlatformFee; } //刷拍成本 if (FinancialFieldID == 109) { model.TakeBrush = value; if (value != 0) { return(model); } model.TakeBrush = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.TakeBrush; } //返现成本 if (FinancialFieldID == 110) { model.Cashback = value; if (value != 0) { return(model); } model.Cashback = GetProfitValue(FinancialFieldID, ProjectId, NickId, year, month, -1); value = model.Cashback; } //运费 if (FinancialFieldID == 108) { if (ProjectId == -1) { model.Freight = 0; } else { List <int> IDs = new List <int>(); IDs.Add(108); decimal Freight = (decimal)GetAllResult(IDs, year, month, ProjectId, -1, -1).Sum(x => x.CountMoney); if (Freight == 0) { //根据店铺项目 查询运费比例 var xmproject = IoC.Resolve <IXMProjectService>().GetXMProjectById(ProjectId); if (xmproject != null) { if (xmproject.ShipmentProportion != null) { decimal ShipmentProportion = xmproject.ShipmentProportion.Value / 100; model.Freight = Math.Round((model.BusinessIncome - model.ReturnMoney) * ShipmentProportion, 2); } } } else if (cbNickId != "-1") { IDs.Clear(); IDs.Add(64);//收入 List <int> nickIdList = new List <int>(); #region 获取店铺 List <int> nicklist = new List <int>(); var nickList = IoC.Resolve <IXMNickService>().GetXMNickListByProjectId(ProjectId, Convert.ToInt32(cbProjectTypeId)); if (nickList.Count > 0) { nicklist = nickList.Select(p => p.nick_id).ToList(); nickIdList = nicklist; } #endregion decimal BusinessIncomeTotal = 0; foreach (int id in nickIdList) { decimal BusinessIncome = (decimal)GetAllResult(IDs, year, month, ProjectId, -1, id).Sum(x => x.CountMoney); if (BusinessIncome == 0) { BusinessIncome = GetProfitValue(64, ProjectId, id, year, month, -1); } BusinessIncomeTotal += BusinessIncome; } if (BusinessIncomeTotal != 0) { model.Freight = Math.Round(Freight * model.BusinessIncome / BusinessIncomeTotal, 2); } else { model.Freight = 0; } } else { model.Freight = Freight; } } } //运营部门人员工资 if (FinancialFieldID == 89) { model.CountMoneySum1 = value; if (value != 0) { return(model); } } //运营部门人员社保 if (FinancialFieldID == 90) { model.CountMoneySum2 = value; if (value != 0) { return(model); } } //运营部门人员奖金 if (FinancialFieldID == 91) { model.CountMoneySum3 = value; if (value != 0) { return(model); } } //运营部门销售奖金 if (FinancialFieldID == 111) { model.CountMoneySum4 = value; if (value != 0) { return(model); } } //差旅费 if (FinancialFieldID == 98) { model.CountMoneySum5 = value; if (value != 0) { return(model); } } //办公费用 if (FinancialFieldID == 101) { model.CountMoneySum6 = value; if (value != 0) { return(model); } } //其他费用 if (FinancialFieldID == 100) { model.CountMoneySum7 = value; if (value != 0) { return(model); } } //固定资产折旧 if (FinancialFieldID == 112) { model.CountMoneySum8 = value; if (value != 0) { return(model); } } //摊销费用 if (FinancialFieldID == 113) { model.CountMoneySum9 = value; if (value != 0) { return(model); } } //广告费补贴 if (FinancialFieldID == 71) { model.CountMoneySum10 = value; if (value != 0) { return(model); } } //增值税 if (FinancialFieldID == 67) { model.ZZSMoney = value; if (value != 0) { return(model); } else { model.ZZSMoney = Math.Round((model.BusinessIncome - model.ReturnMoney - (model.PurchaseCost - model.ReturnCost)) / (decimal)1.17 * (decimal)0.17 - model.Freight / (decimal)1.06 * (decimal)0.06, 2); value = model.ZZSMoney; return(model); } } //营业成本=进货成本+赠品成本+平台成本费用+运费+刷拍成本+返现成本+广告费 if (FinancialFieldID == 66) { model.YYCBMoney = value; if (value != 0) { return(model); } else { model.YYCBMoney = Convert.ToDecimal(model.PurchaseCost - model.ReturnCost) + Convert.ToDecimal(model.PremiumsCost) + model.PlatformFee + model.Freight + Convert.ToDecimal(model.TakeBrush) + Convert.ToDecimal(model.Cashback) + Convert.ToDecimal(model.AdvertisementFEE); value = model.YYCBMoney; return(model); } } //毛利=营业收入-增值税-营业成本 if (FinancialFieldID == 68) { model.MLMoney = value; if (value != 0) { return(model); } else { model.MLMoney = Math.Round(model.BusinessIncome - model.ReturnMoney - Convert.ToDecimal(model.ZZSMoney) - Convert.ToDecimal(model.YYCBMoney)); value = model.MLMoney; return(model); } } //直接人工=运营部门人员工资+运营部门人员社保+运营部门人员奖金 if (FinancialFieldID == 69) { model.ZJRGMoney = value; if (value != 0) { return(model); } else { model.ZJRGMoney = Math.Round(model.CountMoneySum1 + model.CountMoneySum2 + model.CountMoneySum3, 2); value = model.ZJRGMoney; return(model); } } //营业费用=运营部门销售奖金+差旅费+办公费用+其他费用+固定资产折旧+摊销费用 if (FinancialFieldID == 70) { model.YYFYMoney = value; if (value != 0) { return(model); } else { model.YYFYMoney = Math.Round(model.CountMoneySum4 + model.CountMoneySum5 + model.CountMoneySum6 + model.CountMoneySum7 + model.CountMoneySum8 + model.CountMoneySum9, 2); value = model.YYFYMoney; return(model); } } //营业税金及附加=增值税*0.12+营业收入/1.17*0.001 if (FinancialFieldID == 72) { model.YYSJMoney = value; if (value != 0) { return(model); } else { model.YYSJMoney = Math.Round(Convert.ToDecimal(model.ZZSMoney) * (decimal)0.12 + model.BusinessIncome / (decimal)1.17 * (decimal)0.001, 2); value = model.YYSJMoney; return(model); } } //税前利润=毛利-直接人工-营业费用-营业税金及附加-广告费补贴-平台其他费用 if (FinancialFieldID == 73) { model.SQLRMoney = value; if (value == 0) { model.SQLRMoney = Math.Round(Convert.ToDecimal(model.MLMoney) - Convert.ToDecimal(model.ZJRGMoney) - Convert.ToDecimal(model.YYFYMoney) - Convert.ToDecimal(model.YYSJMoney) - Convert.ToDecimal(model.CountMoneySum10), 2); value = model.SQLRMoney; } model.IncomeTax = Math.Round(model.SQLRMoney / 4, 2); } return(model); }
public CWProfitModel GetAuxiliaryParameters(CWProfitModel model, int ProjectId, int NickId, string year, string month) { model.ReturnMoney = GetProfitValue(114, ProjectId, NickId, year, month, -1); model.ReturnCost = GetProfitValue(115, ProjectId, NickId, year, month, -1); return(model); }
public CWProfitModel GetValue(CWProfitModel model, string year, string month, int FinancialFieldID, int ProjectId, int NickId, List <CWStaffSpending> CWStaffSpendingList, string cbNickId) { decimal value = 0; if (CWStaffSpendingList != null) { var a = CWStaffSpendingList.Where(x => x.FinancialFieldId == FinancialFieldID); if (a.Count() > 0) { value = (decimal)(a.ToList())[0].CountMoney; } } //营业收入 if (FinancialFieldID == 64) { model.BusinessIncome = value; if (value != 0) { return(model); } model.BusinessIncome = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.BusinessIncome; } //进货成本 if (FinancialFieldID == 78) { model.PurchaseCost = value; if (value != 0) { return(model); } model.PurchaseCost = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.PurchaseCost; } //赠品成本 if (FinancialFieldID == 79) { model.PremiumsCost = value; if (value != 0) { return(model); } model.PremiumsCost = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.PremiumsCost; } //广告费用 if (FinancialFieldID == 86) { model.AdvertisementFEE = value; if (value != 0) { return(model); } model.AdvertisementFEE = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.AdvertisementFEE; } //平台费用 if (FinancialFieldID == 107) { model.PlatformFee = value; if (value != 0) { return(model); } model.PlatformFee = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.PlatformFee; } //刷拍成本 if (FinancialFieldID == 109) { model.TakeBrush = value; if (value != 0) { return(model); } model.TakeBrush = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.TakeBrush; } //返现成本 if (FinancialFieldID == 110) { model.Cashback = value; if (value != 0) { return(model); } model.Cashback = GetProfitValue(FinancialFieldID, ProjectId, year, month); value = model.Cashback; } //运费 if (FinancialFieldID == 108) { model.Freight = value; if (value != 0) { return(model); } //根据项目 查询运费比例 var xmproject = base.XMProjectService.GetXMProjectById(ProjectId); if (xmproject != null) { if (xmproject.ShipmentProportion != null) { decimal ShipmentProportion = xmproject.ShipmentProportion.Value / 100; model.Freight = Math.Round((model.BusinessIncome - model.ReturnMoney) * ShipmentProportion, 2); } } value = model.Freight; } //运营部门人员工资 if (FinancialFieldID == 89) { model.CountMoneySum1 = value; if (value != 0) { return(model); } } //运营部门人员社保 if (FinancialFieldID == 90) { model.CountMoneySum2 = value; if (value != 0) { return(model); } } //运营部门人员奖金 if (FinancialFieldID == 91) { model.CountMoneySum3 = value; if (value != 0) { return(model); } } //运营部门销售奖金 if (FinancialFieldID == 111) { model.CountMoneySum4 = value; if (value != 0) { return(model); } } //差旅费 if (FinancialFieldID == 98) { model.CountMoneySum5 = value; if (value != 0) { return(model); } } //办公费用 if (FinancialFieldID == 101) { model.CountMoneySum6 = value; if (value != 0) { return(model); } } //其他费用 if (FinancialFieldID == 100) { model.CountMoneySum7 = value; if (value != 0) { return(model); } } //固定资产折旧 if (FinancialFieldID == 112) { model.CountMoneySum8 = value; if (value != 0) { return(model); } } //摊销费用 if (FinancialFieldID == 113) { model.CountMoneySum9 = value; if (value != 0) { return(model); } } //广告费补贴 if (FinancialFieldID == 71) { model.CountMoneySum10 = value; if (value != 0) { return(model); } } //增值税 if (FinancialFieldID == 67) { model.ZZSMoney = value; if (value != 0) { return(model); } else { model.ZZSMoney = Math.Round((model.BusinessIncome - model.ReturnMoney - (model.PurchaseCost - model.ReturnCost)) / (decimal)1.17 * (decimal)0.17 - model.Freight / (decimal)1.06 * (decimal)0.06, 2); value = model.ZZSMoney; return(model); } } //营业成本=进货成本+赠品成本+平台成本费用+运费+刷拍成本+返现成本+广告费 if (FinancialFieldID == 66) { model.YYCBMoney = value; if (value != 0) { return(model); } else { model.YYCBMoney = Convert.ToDecimal(model.PurchaseCost - model.ReturnCost) + Convert.ToDecimal(model.PremiumsCost) + model.PlatformFee + model.Freight + Convert.ToDecimal(model.TakeBrush) + Convert.ToDecimal(model.Cashback) + Convert.ToDecimal(model.AdvertisementFEE); value = model.YYCBMoney; return(model); } } //毛利=营业收入-增值税-营业成本 if (FinancialFieldID == 68) { model.MLMoney = value; if (value != 0) { return(model); } else { model.MLMoney = Math.Round(model.BusinessIncome - model.ReturnMoney - Convert.ToDecimal(model.ZZSMoney) - Convert.ToDecimal(model.YYCBMoney)); value = model.MLMoney; return(model); } } //直接人工=运营部门人员工资+运营部门人员社保+运营部门人员奖金 if (FinancialFieldID == 69) { model.ZJRGMoney = value; if (value != 0) { return(model); } else { model.ZJRGMoney = Math.Round(model.CountMoneySum1 + model.CountMoneySum2 + model.CountMoneySum3, 2); value = model.ZJRGMoney; return(model); } } //营业费用=运营部门销售奖金+差旅费+办公费用+其他费用+固定资产折旧+摊销费用 if (FinancialFieldID == 70) { model.YYFYMoney = value; if (value != 0) { return(model); } else { model.YYFYMoney = Math.Round(model.CountMoneySum4 + model.CountMoneySum5 + model.CountMoneySum6 + model.CountMoneySum7 + model.CountMoneySum8 + model.CountMoneySum9, 2); value = model.YYFYMoney; return(model); } } //营业税金及附加=增值税*0.12+营业收入/1.17*0.001 if (FinancialFieldID == 72) { model.YYSJMoney = value; if (value != 0) { return(model); } else { model.YYSJMoney = Math.Round(Convert.ToDecimal(model.ZZSMoney) * (decimal)0.12 + model.BusinessIncome / (decimal)1.17 * (decimal)0.001, 2); value = model.YYSJMoney; return(model); } } //税前利润=毛利-直接人工-营业费用-营业税金及附加-广告费补贴-平台其他费用 if (FinancialFieldID == 73) { model.SQLRMoney = value; if (value != 0) { return(model); } else { model.SQLRMoney = Math.Round(Convert.ToDecimal(model.MLMoney) - Convert.ToDecimal(model.ZJRGMoney) - Convert.ToDecimal(model.YYFYMoney) - Convert.ToDecimal(model.YYSJMoney) - Convert.ToDecimal(model.CountMoneySum10), 2); value = model.SQLRMoney; return(model); } } return(model); }
public List <CWStaffSpendingMapping> GetDataByDateTime(string DepartmentType, string cbXMProject, List <int> nickIdList, string year, string month) { MonthData = new CWProfitModel(); YearData = new CWProfitModel(); int ProjectId = 0; List <int?> NickIdList = new List <int?>(); CWProfitModel monthData = new CWProfitModel(); List <CWStaffSpendingMapping> data = new List <CWStaffSpendingMapping>(); foreach (int nick in nickIdList) { NickIdList.Add(nick); } if (DepartmentType == "197") { GetB2BC(197, NickIdList, year, month, cbXMProject); } else if (DepartmentType == "6") { GetB2BC(6, NickIdList, year, month, cbXMProject); } if (DepartmentType == "505") { ProjectId = int.Parse(cbXMProject); MonthData = GetProjectMonthData(ProjectId, nickIdList, year, month); DateTime end = new DateTime(); if (month == "12") { end = DateTime.Parse((int.Parse(year) + 1) + "/" + month.ToString() + "/01"); } else { end = DateTime.Parse(year + "/" + (int.Parse(month) + 1).ToString() + "/01"); } for (int i = 1; i <= 12; i++) { DateTime begin = DateTime.Parse(year + "/" + i + "/01"); if (begin < end) { CWProfitModel MonthCacheData = GetProjectMonthData(ProjectId, nickIdList, year, i.ToString()); MonthList.AddRange(GetMonthListDataList(MonthCacheData, year, i.ToString(), cbXMProject, NickIdList, nickIdList, int.Parse(DepartmentType))); YearData = tool.AccumulationValue(YearData, MonthCacheData); } else { break; } } } if (DepartmentType != "507") { foreach (int ID in son) { data.Add(GetData(ID, year, month, int.Parse(cbXMProject), int.Parse(DepartmentType))); } foreach (int ID in parent) { data.Add(GetData(ID, year, month, int.Parse(cbXMProject), int.Parse(DepartmentType))); } data = tool.GetCompleteData(data, MonthData, YearData); } else { //综管的数据 List <CWStaffSpendingMapping> FinanceFeeList = new List <CWStaffSpendingMapping>(); if (IntegratedManagementIDList.Count() > 0) { for (int i = 0; i < DateTime.Now.Month; i++) { CWStaffSpendingMapping Item = GetIntegratedManagementData(int.Parse(year), i + 1); Item.FinancialFieldId = 73;//利润 MonthList.Add(Item); if (int.Parse(month) == (i + 1)) { Item.YearTotal = MonthList.Sum(x => x.MonthTotal); Item.LastYearTotal = MonthList.Sum(x => x.LastMonthTotal); if (Item.LastYearTotal != 0) { Item.MonthGrowthRate = (decimal)(Item.YearTotal - Item.LastYearTotal) / Item.LastYearTotal; } else { Item.MonthGrowthRate = 0; } data.Add(Item); } } } } List <CWStaffSpendingMapping> Data = GetBindTableData(data, DepartmentType); return(Data); }
public CWStaffSpendingMapping GetMonthListData(CWProfitModel monthData, string year, string month, string ProjectId, List <int?> NickIdList, List <int> nickIdList, int FinancialFieldId, int DepartmentType) { int projectId = int.Parse(ProjectId); CWStaffSpendingMapping data = new CWStaffSpendingMapping(); CWStaffSpendingMapping LastData = new CWStaffSpendingMapping(); CWProfitModel LastMonthData = new CWProfitModel(); if (DepartmentType != 505) { LastMonthData = GetB2BCMonthData(DepartmentType, NickIdList, (int.Parse(year) - 1).ToString(), month); } else { LastMonthData = GetProjectMonthData(projectId, nickIdList, (int.Parse(year) - 1).ToString(), month); } if (FinancialFieldId == 64) { if (DepartmentType != 505) { data = GetData(63, year, month, projectId, DepartmentType); data.MonthTotal = monthData.OperatingPerformance; data.LastMonthTotal = LastMonthData.OperatingPerformance; } else { data = GetData(64, year, month, projectId, DepartmentType); data.MonthTotal = monthData.BusinessIncome; data.LastMonthTotal = LastMonthData.BusinessIncome; } } else if (FinancialFieldId == 66) { data = GetData(66, year, month, projectId, DepartmentType); data.MonthTotal = monthData.YYCBMoney; data.LastMonthTotal = LastMonthData.YYCBMoney; } else if (FinancialFieldId == 68) { data = GetData(68, year, month, projectId, DepartmentType); data.MonthTotal = monthData.MLMoney; data.LastMonthTotal = LastMonthData.MLMoney; } else if (FinancialFieldId == 73) { data = GetData(73, year, month, projectId, DepartmentType); data.MonthTotal = monthData.SQLRMoney; data.LastMonthTotal = LastMonthData.SQLRMoney; } data.MonthStr = month; data.YearStr = year; data.FinancialFieldId = FinancialFieldId; if (data.MonthTarget != 0)//统计图表中的增长率,达成率的值 { data.MonthReachRate = Math.Round((decimal)data.MonthTotal / data.MonthTarget, 4); } if (data.LastMonthTotal != 0) { data.MonthGrowthRate = Math.Round(((decimal)data.MonthTotal - data.LastMonthTotal) / data.LastMonthTotal, 4); } return(data); }