|
|
@@ -58,10 +58,10 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement |
|
|
|
} |
|
|
|
if (!queryParam["PayFeeStatus"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("PayFeeStatus",queryParam["PayFeeStatus"].ToString(), DbType.String); |
|
|
|
dp.Add("PayFeeStatus", queryParam["PayFeeStatus"].ToString(), DbType.String); |
|
|
|
strSql.Append(" AND t.PayFeeStatus = @PayFeeStatus "); |
|
|
|
} |
|
|
|
return this.BaseRepository("CollegeMIS").FindList<FinaChargeStuYearEntity>(strSql.ToString(),dp, pagination); |
|
|
|
return this.BaseRepository("CollegeMIS").FindList<FinaChargeStuYearEntity>(strSql.ToString(), dp, pagination); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@@ -112,7 +112,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
this.BaseRepository("CollegeMIS").Delete<FinaChargeStuYearEntity>(t=>t.FSYId == keyValue); |
|
|
|
this.BaseRepository("CollegeMIS").Delete<FinaChargeStuYearEntity>(t => t.FSYId == keyValue); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@@ -168,26 +168,79 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement |
|
|
|
try |
|
|
|
{ |
|
|
|
//获取缴费学生 |
|
|
|
var stulist= db.FindList<FinaChargeStudentEntity>(m=>m.F_CheckMark==true); |
|
|
|
var stulist = db.FindList<FinaChargeStudentEntity>(m => m.F_CheckMark == true); |
|
|
|
//获取已有年度学生缴费记录 |
|
|
|
var oldFinaChargeStuYearList = db.FindList<FinaChargeStuYearEntity>(m => m.FSYear == entity.FSYear); |
|
|
|
//获取已有年度学生缴费明细记录 |
|
|
|
var oldFinaChargeStuYearItemList = db.FindList<FinaChargeStuYearItemEntity>(m => m.FSYear == entity.FSYear); |
|
|
|
//获取收费标准 |
|
|
|
var finaChargesStandardList= db.FindList<FinaChargesStandardEntity>("select a.Grade,a.DeptNo,a.MajorNo,a.Standard,a.SYear,b.ChargeItemName,b.ChargeItemCode,b.ChargeItemType from [dbo].[FinaChargesStandard] a left join [dbo].[FinaChargeItem] b on a.ChargeItemID=b.[ChargeItemID]"); |
|
|
|
var finaChargesStandardList = db.FindList<FinaChargesStandardEntity>("select a.Grade,a.DeptNo,a.MajorNo,a.Standard,a.SYear,b.ChargeItemName,b.ChargeItemCode,b.ChargeItemType from [dbo].[FinaChargesStandard] a left join [dbo].[FinaChargeItem] b on a.ChargeItemID=b.[ChargeItemID] where b.ChargeItemType=1"); |
|
|
|
var finaChargesStandardListGroup = db.FindList<FinaChargesStandardEntity>(@"select a.Grade,a.DeptNo,a.MajorNo,sum(isnull(a.Standard,0)) as YJAmount,a.SYear |
|
|
|
from[dbo].[FinaChargesStandard] a left join[dbo].[FinaChargeItem] b on a.ChargeItemID = b.[ChargeItemID] |
|
|
|
from[dbo].[FinaChargesStandard] a left join[dbo].[FinaChargeItem] b on a.ChargeItemID = b.[ChargeItemID] where b.ChargeItemType=1 |
|
|
|
group by a.Grade, a.DeptNo, a.MajorNo, a.SYear"); |
|
|
|
foreach (var stuitem in stulist) |
|
|
|
{ |
|
|
|
//写入学生年度缴费数据 |
|
|
|
var finaChargeStuYear=new FinaChargeStuYearEntity(); |
|
|
|
finaChargeStuYear.Create(); |
|
|
|
finaChargeStuYear.StuNo = stuitem.StuNo; |
|
|
|
finaChargeStuYear.FSYear = entity.FSYear; |
|
|
|
finaChargeStuYear.YJAmount = finaChargesStandardListGroup.FirstOrDefault(m => m.DeptNo == stuitem.DeptNo && m.MajorNo == stuitem.MajorNo && m.Grade==stuitem.Grade)?.YJAmount; |
|
|
|
finaChargeStuYear.SJAmount = 0; |
|
|
|
finaChargeStuYear.FSBlance = 0; |
|
|
|
finaChargeStuYear.PayFeeStatus = 0; |
|
|
|
db.Insert(finaChargeStuYear); |
|
|
|
//写入年度缴费明细数据 |
|
|
|
|
|
|
|
//判断有无年度学生缴费数据 |
|
|
|
if (oldFinaChargeStuYearList.Count(m => m.StuNo == stuitem.StuNo) > 0) |
|
|
|
{ |
|
|
|
var oldFinaChargeStuYearEntity = oldFinaChargeStuYearList.FirstOrDefault(m => m.StuNo == stuitem.StuNo); |
|
|
|
//查询明细并比对 |
|
|
|
var oldFinaChargeStuYearItemListForStu = oldFinaChargeStuYearItemList.Where(m => m.FSYId == oldFinaChargeStuYearEntity.FSYId).Select(m => m.ChargeItemCode); |
|
|
|
string oldcodeitem = string.Join(",", oldFinaChargeStuYearItemListForStu); |
|
|
|
var needinsertchargeitem = finaChargesStandardList.Where(m => m.MajorNo == stuitem.MajorNo && m.SYear == entity.FSYear && m.Grade == stuitem.Grade && !oldcodeitem.Contains(m.ChargeItemCode)); |
|
|
|
foreach (var finaChargesStandardEntity in needinsertchargeitem) |
|
|
|
{ |
|
|
|
var finaChargeStuYearItem = new FinaChargeStuYearItemEntity(); |
|
|
|
finaChargeStuYearItem.Create(); |
|
|
|
finaChargeStuYearItem.FSYId = oldFinaChargeStuYearEntity.FSYId; |
|
|
|
finaChargeStuYearItem.ChargeItemCode = finaChargesStandardEntity.ChargeItemCode; |
|
|
|
finaChargeStuYearItem.ChargeItemName = finaChargesStandardEntity.ChargeItemName; |
|
|
|
finaChargeStuYearItem.ChargeItemType = finaChargesStandardEntity.ChargeItemType; |
|
|
|
finaChargeStuYearItem.Standard = finaChargesStandardEntity.Standard; |
|
|
|
//主表应缴金额更新 |
|
|
|
oldFinaChargeStuYearEntity.YJAmount += finaChargeStuYearItem.Standard; |
|
|
|
//余额扣减 |
|
|
|
oldFinaChargeStuYearEntity.FSBlance -= finaChargeStuYearItem.Standard; |
|
|
|
db.Insert(finaChargeStuYearItem); |
|
|
|
} |
|
|
|
if (oldFinaChargeStuYearItemList.Where(m => m.FSYId == oldFinaChargeStuYearEntity.FSYId).Sum(m => m.SJAmount) > 0) |
|
|
|
oldFinaChargeStuYearEntity.PayFeeStatus = 4; |
|
|
|
else |
|
|
|
{ |
|
|
|
oldFinaChargeStuYearEntity.PayFeeStatus = 0; |
|
|
|
} |
|
|
|
//年度学生缴费数据主表更新 |
|
|
|
db.Update(oldFinaChargeStuYearEntity); |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
//写入学生年度缴费数据 |
|
|
|
var finaChargeStuYear = new FinaChargeStuYearEntity(); |
|
|
|
finaChargeStuYear.Create(); |
|
|
|
finaChargeStuYear.StuNo = stuitem.StuNo; |
|
|
|
finaChargeStuYear.FSYear = entity.FSYear; |
|
|
|
finaChargeStuYear.YJAmount = finaChargesStandardListGroup.FirstOrDefault(m => m.DeptNo == stuitem.DeptNo && m.MajorNo == stuitem.MajorNo && m.Grade == stuitem.Grade)?.YJAmount; |
|
|
|
finaChargeStuYear.SJAmount = 0; |
|
|
|
finaChargeStuYear.FSBlance = -finaChargeStuYear.YJAmount; |
|
|
|
finaChargeStuYear.PayFeeStatus = 0; |
|
|
|
//写入年度缴费明细数据 |
|
|
|
foreach (var finaChargesStandardEntity in finaChargesStandardList) |
|
|
|
{ |
|
|
|
var finaChargeStuYearItem = new FinaChargeStuYearItemEntity(); |
|
|
|
finaChargeStuYearItem.Create(); |
|
|
|
finaChargeStuYearItem.FSYId = finaChargeStuYear.FSYId; |
|
|
|
finaChargeStuYearItem.ChargeItemCode = finaChargesStandardEntity.ChargeItemCode; |
|
|
|
finaChargeStuYearItem.ChargeItemName = finaChargesStandardEntity.ChargeItemName; |
|
|
|
finaChargeStuYearItem.ChargeItemType = finaChargesStandardEntity.ChargeItemType; |
|
|
|
finaChargeStuYearItem.Standard = finaChargesStandardEntity.Standard; |
|
|
|
db.Insert(finaChargeStuYearItem); |
|
|
|
} |
|
|
|
db.Insert(finaChargeStuYear); |
|
|
|
|
|
|
|
} |
|
|
|
//更新学生缴费总表 |
|
|
|
db.ExecuteBySql("update FinaChargeStudent set FSBlance=(select sum(isnull([FSBlance],0)) from [dbo].[FinaChargeStuYear] where StuNo='" + stuitem.StuNo + "')"); |
|
|
|
} |
|
|
|
db.Commit(); |
|
|
|
} |
|
|
|