Commit aa9de9a8 authored by 吴春's avatar 吴春

提交代码

parent 0328682d
......@@ -153,7 +153,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
item.NoPaid = item.ALLCommission;
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.PaidCostMoney + item.RemitFXCommission ;
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.GrossProfit = (item.AllPrice + item.RealMoney) - item.CouponMoney - item.RefundActual - item.ALLCommission - item.PayMoney;
item.GrossProfitRate = (item.AllPrice + item.RealMoney - item.RefundActual) == 0 ? 0 : Math.Round((item.GrossProfit / ((item.AllPrice + item.RealMoney - item.RefundActual) == 0 ? 1 : (item.AllPrice + item.RealMoney - item.RefundActual))), 2, MidpointRounding.AwayFromZero);
// item.GrossProfitRate = (item.AllPrice + item.RealMoney - item.RefundActual) == 0 ? 0 : Math.Round((item.GrossProfit / (item.AllPrice + item.RealMoney - item.RefundActual)), 2, MidpointRounding.AwayFromZero);
......@@ -433,6 +433,49 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: item.GrossProfitRate.ToString("#0.00")) { });
slist.Add(datarow);
}
if (list!=null&&list.Any())
{
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value:""){ },
}
};
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.Unit_Price).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.Number).ToString()) { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.Final_Price).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (list.Sum(x => !string.IsNullOrWhiteSpace(x.FreightMoney) ? Convert.ToDecimal(x.FreightMoney) : 0)).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: "0") { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.AllPrice).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CostMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.PackingMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.GoodsFreight).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.PaidCostMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CostFreight).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.FXCommission).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.RemitFXCommission).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });//返佣信息
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.OtherPrice).ToString("#0.00")) { });
// datarow.ExcelRows.Add(new ExcelColumn(value: item.ALLCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.Paid).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.NoPaid).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.CouponMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.RefundActual).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.YSMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.RealMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.YFMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.PayMoney).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: list.Sum(x => x.GrossProfit).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
//datarow.ExcelRows.Add(new ExcelColumn(value: Math.Round((item.GrossProfit * (item.CompanyProfitRate / 100)), 2, MidpointRounding.AwayFromZero).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (Math.Round(list.Sum(x => x.GrossProfitRate) / (list.Count() == 0 ? 1 : list.Count()), 2, MidpointRounding.AwayFromZero)).ToString("#0.00")) { });
slist.Add(datarow);
}
#endregion
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
......@@ -485,6 +528,80 @@ namespace Mall.WebApi.Controllers.AppletWeChat
}
/// <summary>
/// 获取分销商
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetTotalOrderProfitLoss_V2(object requestMsg)
{
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
OrderStatistics_Query demodel = JsonConvert.DeserializeObject<OrderStatistics_Query>(requestParm.msg.ToString());
demodel.TenantId = requestParm.TenantId;
demodel.MallBaseId = requestParm.MallBaseId;
List<OrderStatistics_Query> list = new List<OrderStatistics_Query>();
if (demodel.IsFxCommission == 1)
{
list = statisticsModule.GetFXAllOrderProfitLossList(demodel);
}
else if (demodel.IsFxCommission == 0)
{
demodel.IsSelectOrderCommission = 1;
list = statisticsModule.GetAllOrderProfitLossList(demodel);
}
foreach (var item in list)
{
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.OtherPrice;
item.NoPaid = item.ALLCommission;
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.GrossProfit = (item.AllPrice + item.RealMoney) - item.CouponMoney - item.RefundActual - item.ALLCommission - item.PayMoney;
item.GrossProfitRate = (item.AllPrice + item.RealMoney) == 0 ? 0 : Math.Round((item.GrossProfit / ((item.AllPrice + item.RealMoney - item.RefundActual) == 0 ? 1 : (item.AllPrice + item.RealMoney - item.RefundActual))), 2, MidpointRounding.AwayFromZero);
}
var retult = new
{
OrderNo = "",
GoodsName = "",
Unit_Price = list.Sum(x => x.Unit_Price),//单价
Number = list.Sum(x => x.Number),//数量
SupplierName = "",
Final_Price = list.Sum(x => x.Final_Price),//数量
FreightMoney = list.Sum(x => !string.IsNullOrWhiteSpace(x.FreightMoney) ? Convert.ToDecimal(x.FreightMoney) : 0),
AllPrice = list.Sum(x => x.AllPrice),
CostMoney = list.Sum(x => x.CostMoney),
PackingMoney = list.Sum(x => x.PackingMoney),
GoodsFreight = list.Sum(x => x.GoodsFreight),
PaidCostMoney = list.Sum(x => x.PaidCostMoney),
CostFreight = list.Sum(x => x.CostFreight),
FXCommission = list.Sum(x => x.FXCommission),
RemitFXCommission = list.Sum(x => x.RemitFXCommission),
ALLCommission = list.Sum(x => x.ALLCommission),
OtherPrice = list.Sum(x => x.OtherPrice),
Paid = list.Sum(x => x.Paid),
NoPaid = list.Sum(x => x.NoPaid),
CouponMoney = list.Sum(x => x.CouponMoney),
RefundActual = list.Sum(x => x.RefundActual),
YSMoney = list.Sum(x => x.YSMoney),
RealMoney = list.Sum(x => x.RealMoney),
YFMoney = list.Sum(x => x.YFMoney),
PayMoney = list.Sum(x => x.PayMoney),
GrossProfit = list.Sum(x => x.GrossProfit),
CompanyName = "",
GrossProfitRate = Math.Round(list.Sum(x => x.GrossProfitRate) / (list.Count() == 0 ? 1 : list.Count()), 2, MidpointRounding.AwayFromZero),//毛利率的平均值
};
return ApiResult.Success("", retult);
}
/// <summary>
/// 获取分销商
/// </summary>
......@@ -515,7 +632,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.GrossProfit = (item.AllPrice + item.RealMoney) - item.CouponMoney - item.RefundActual - item.ALLCommission - item.PayMoney;
item.GrossProfitRate = (item.AllPrice + item.RealMoney) == 0 ? 0 : Math.Round((item.GrossProfit / ((item.AllPrice + item.RealMoney - item.RefundActual)==0?1: (item.AllPrice + item.RealMoney - item.RefundActual))), 2, MidpointRounding.AwayFromZero);
item.GrossProfitRate = (item.AllPrice + item.RealMoney) == 0 ? 0 : Math.Round((item.GrossProfit / ((item.AllPrice + item.RealMoney - item.RefundActual) == 0 ? 1 : (item.AllPrice + item.RealMoney - item.RefundActual))), 2, MidpointRounding.AwayFromZero);
//item.GrossProfit = item.AllPrice - item.ALLCommission;
//item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment