Commit b6f8d5ba authored by liudong1993's avatar liudong1993

1

parent bc2ba96c
...@@ -5147,7 +5147,7 @@ namespace Edu.Module.Course ...@@ -5147,7 +5147,7 @@ namespace Edu.Module.Course
item.TotalClassFee2 = orderModel?.CoursewareFee ?? 0; item.TotalClassFee2 = orderModel?.CoursewareFee ?? 0;
item.TotalSub2 = orderModel?.PreferPrice ?? 0;//总小计 item.TotalSub2 = orderModel?.PreferPrice ?? 0;//总小计
item.TotalCourseFee2 = item.TotalSub2 - item.TotalBookFee2 - item.TotalClassFee2; item.TotalCourseFee2 = item.TotalSub2 - item.TotalBookFee2 - item.TotalClassFee2 - item.TotalDiscountMoney2;
#endregion #endregion
if (item.SourceOrderId > 0) if (item.SourceOrderId > 0)
...@@ -5170,24 +5170,26 @@ namespace Edu.Module.Course ...@@ -5170,24 +5170,26 @@ namespace Edu.Module.Course
item.UseCourseFee = 0; item.UseCourseFee = 0;
if (item.TotalClassHours2 > 0) if (item.TotalClassHours2 > 0)
{ {
if (item.TotalDiscountMoney2 > 0) item.Unit_Price = Math.Round(item.TotalCourseFee2 / item.TotalClassHours2, 6, MidpointRounding.AwayFromZero);//根据合同计算(包含优惠, 需减去课件费等)
{ item.UseCourseFee = Math.Round((Convert.ToDecimal(item.UseClassHours) / item.TotalClassHours2) * item.TotalCourseFee2, 6, MidpointRounding.AwayFromZero);
item.Unit_Price = Math.Round((item.TotalCourseFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalCourseFee2) / item.TotalClassHours2, 6, MidpointRounding.AwayFromZero);//根据合同计算(包含优惠, 需减去课件费等) //if (item.TotalDiscountMoney2 > 0)
item.UseCourseFee = Math.Round((Convert.ToDecimal(item.UseClassHours) / item.TotalClassHours2) * (item.TotalCourseFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalCourseFee2), 6, MidpointRounding.AwayFromZero); //{
} // item.Unit_Price = Math.Round((item.TotalCourseFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalCourseFee2) / item.TotalClassHours2, 6, MidpointRounding.AwayFromZero);//根据合同计算(包含优惠, 需减去课件费等)
else // item.UseCourseFee = Math.Round((Convert.ToDecimal(item.UseClassHours) / item.TotalClassHours2) * (item.TotalCourseFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalCourseFee2), 6, MidpointRounding.AwayFromZero);
{ //}
item.Unit_Price = Math.Round(item.TotalCourseFee2 / item.TotalClassHours2, 6, MidpointRounding.AwayFromZero);//根据合同计算(包含优惠, 需减去课件费等) //else
item.UseCourseFee = Math.Round((Convert.ToDecimal(item.UseClassHours) / item.TotalClassHours2) * item.TotalCourseFee2, 6, MidpointRounding.AwayFromZero); //{
} // item.Unit_Price = Math.Round(item.TotalCourseFee2 / item.TotalClassHours2, 6, MidpointRounding.AwayFromZero);//根据合同计算(包含优惠, 需减去课件费等)
// item.UseCourseFee = Math.Round((Convert.ToDecimal(item.UseClassHours) / item.TotalClassHours2) * item.TotalCourseFee2, 6, MidpointRounding.AwayFromZero);
//}
} }
item.UseBookFee = item.TotalBookFee2; item.UseBookFee = item.TotalBookFee2;
item.UseCoursewareFee = item.TotalClassFee2; item.UseCoursewareFee = item.TotalClassFee2;
if (item.TotalDiscountMoney2 > 0) //if (item.TotalDiscountMoney2 > 0)
{ //{
item.UseBookFee = Math.Round(item.TotalBookFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalBookFee2, 6, MidpointRounding.AwayFromZero);//(优惠比例) // item.UseBookFee = Math.Round(item.TotalBookFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalBookFee2, 6, MidpointRounding.AwayFromZero);//(优惠比例)
item.UseCoursewareFee = Math.Round(item.TotalClassFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalClassFee2, 6, MidpointRounding.AwayFromZero);//(优惠比例) // item.UseCoursewareFee = Math.Round(item.TotalClassFee2 - (item.TotalDiscountMoney2 / item.TotalSub2) * item.TotalClassFee2, 6, MidpointRounding.AwayFromZero);//(优惠比例)
} //}
//用户信息 //用户信息
var amodel = alist.Where(x => x.Id == item.CreateBy).FirstOrDefault(); var amodel = alist.Where(x => x.Id == item.CreateBy).FirstOrDefault();
item.CreateByName = amodel?.AccountName ?? ""; item.CreateByName = amodel?.AccountName ?? "";
......
...@@ -519,7 +519,7 @@ GROUP BY tt.TeacherId,tt.ClassId;"; ...@@ -519,7 +519,7 @@ GROUP BY tt.TeacherId,tt.ClassId;";
{ {
string sql = $@"SELECT q.TeacherId,q.OrderGuestId,q.CurrentDeductionHours, string sql = $@"SELECT q.TeacherId,q.OrderGuestId,q.CurrentDeductionHours,
case when q.ClassHours>0 and q.TotalSub >0 then case when q.ClassHours>0 and q.TotalSub >0 then
(q.CourseFee - q.DiscountMoney / q.TotalSub * q.CourseFee) /q.ClassHours (q.CourseFee - q.DiscountMoney) /q.ClassHours
else 0 END AS UnitPrice else 0 END AS UnitPrice
FROM ( FROM (
SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours SELECT tt.TeacherId,tt.OrderGuestId,tt.CurrentDeductionHours
...@@ -683,7 +683,7 @@ ORDER BY p.ClassDate ASC ...@@ -683,7 +683,7 @@ ORDER BY p.ClassDate ASC
string sql = $@" string sql = $@"
SELECT tt.*, SELECT tt.*,
case when tt.ClassHours>0 and tt.TotalSub >0 then case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney / tt.TotalSub * tt.CourseFee) /tt.ClassHours (tt.CourseFee - tt.DiscountMoney) /tt.ClassHours
else 0 END AS UnitPrice else 0 END AS UnitPrice
FROM ( FROM (
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId
...@@ -762,7 +762,7 @@ ORDER BY tt.ClassDate ASC ...@@ -762,7 +762,7 @@ ORDER BY tt.ClassDate ASC
string sql = $@" string sql = $@"
SELECT tt.*, SELECT tt.*,
case when tt.ClassHours>0 and tt.TotalSub >0 then case when tt.ClassHours>0 and tt.TotalSub >0 then
(tt.CourseFee - tt.DiscountMoney / tt.TotalSub * tt.CourseFee) /tt.ClassHours (tt.CourseFee - tt.DiscountMoney) /tt.ClassHours
else 0 END AS UnitPrice else 0 END AS UnitPrice
FROM ( FROM (
SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId SELECT p.OrderGuestId,p.CurrentDeductionHours,t2.GuestName,p.TeacherId,t3.TeacherName,t2.OrderId,ec.ContractNo,if(cp.PlanType=2,'预约课',c.ClassName) as ClassName,c.ClassNo,if(cp.PlanType=2,co2.CourseName,co.CourseName) as CourseName,p.ClassId,if(cp.PlanType=2,cp.CourseId,c.CouseId) as CouseId
...@@ -822,7 +822,7 @@ WHERE p.`Status` =0 and p.Group_Id ={groupId} and case when cp.PlanType=2 then t ...@@ -822,7 +822,7 @@ WHERE p.`Status` =0 and p.Group_Id ={groupId} and case when cp.PlanType=2 then t
string sql = $@"SELECT hq.ClassId, SUM(hq.CurrentDeductionHours * hq.UnitPrice) AS UnitPrice FROM ( string sql = $@"SELECT hq.ClassId, SUM(hq.CurrentDeductionHours * hq.UnitPrice) AS UnitPrice FROM (
SELECT q.ClassId,q.OrderGuestId,q.CurrentDeductionHours, SELECT q.ClassId,q.OrderGuestId,q.CurrentDeductionHours,
case when q.ClassHours>0 and q.TotalSub >0 then case when q.ClassHours>0 and q.TotalSub >0 then
(q.CourseFee - q.DiscountMoney / q.TotalSub * q.CourseFee) /q.ClassHours (q.CourseFee - q.DiscountMoney) /q.ClassHours
else 0 END AS UnitPrice else 0 END AS UnitPrice
FROM ( FROM (
SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours SELECT tt.ClassId,tt.OrderGuestId,tt.CurrentDeductionHours
......
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