Browse Source

学生年度缴费明细计算

西昌缴费二期
fzp 1 year ago
parent
commit
302af1e043
1 changed files with 31 additions and 26 deletions
  1. +31
    -26
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYear/FinaChargeStuYearService.cs

+ 31
- 26
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuYear/FinaChargeStuYearService.cs View File

@@ -174,12 +174,12 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
//获取已有年度学生缴费明细记录
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] where b.ChargeItemType=1");
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 and a.SYear='"+entity.FSYear+"'");
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] where b.ChargeItemType=1
group by a.Grade, a.DeptNo, a.MajorNo, a.SYear");
from[dbo].[FinaChargesStandard] a left join[dbo].[FinaChargeItem] b on a.ChargeItemID = b.[ChargeItemID] where b.ChargeItemType=1 and a.SYear='" + entity.FSYear + "' group by a.Grade, a.DeptNo, a.MajorNo, a.SYear");
foreach (var stuitem in stulist)
{
var studentchargestanderdlist = finaChargesStandardList.Where(m =>m.MajorNo == stuitem.MajorNo && m.Grade == stuitem.Grade);
//判断有无年度学生缴费数据
if (oldFinaChargeStuYearList.Count(m => m.StuNo == stuitem.StuNo) > 0)
{
@@ -187,12 +187,13 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
//查询明细并比对
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));
var needinsertchargeitem = studentchargestanderdlist.Where(m =>!oldcodeitem.Contains(m.ChargeItemCode));
foreach (var finaChargesStandardEntity in needinsertchargeitem)
{
var finaChargeStuYearItem = new FinaChargeStuYearItemEntity();
finaChargeStuYearItem.Create();
finaChargeStuYearItem.FSYId = oldFinaChargeStuYearEntity.FSYId;
finaChargeStuYearItem.FSYear = entity.FSYear;
finaChargeStuYearItem.ChargeItemCode = finaChargesStandardEntity.ChargeItemCode;
finaChargeStuYearItem.ChargeItemName = finaChargesStandardEntity.ChargeItemName;
finaChargeStuYearItem.ChargeItemType = finaChargesStandardEntity.ChargeItemType;
@@ -215,32 +216,36 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
}
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)
if (studentchargestanderdlist.Count()>0)
{
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);
//写入学生年度缴费数据
var finaChargeStuYear = new FinaChargeStuYearEntity();
finaChargeStuYear.Create();
finaChargeStuYear.StuNo = stuitem.StuNo;
finaChargeStuYear.FSYear = entity.FSYear;
finaChargeStuYear.SJAmount = 0;
finaChargeStuYear.PayFeeStatus = 0;
//写入年度缴费明细数据
foreach (var finaChargesStandardEntity in studentchargestanderdlist)
{
var finaChargeStuYearItem = new FinaChargeStuYearItemEntity();
finaChargeStuYearItem.Create();
finaChargeStuYearItem.FSYId = finaChargeStuYear.FSYId;
finaChargeStuYearItem.FSYear = entity.FSYear;
finaChargeStuYearItem.ChargeItemCode = finaChargesStandardEntity.ChargeItemCode;
finaChargeStuYearItem.ChargeItemName = finaChargesStandardEntity.ChargeItemName;
finaChargeStuYearItem.ChargeItemType = finaChargesStandardEntity.ChargeItemType;
finaChargeStuYearItem.Standard = finaChargesStandardEntity.Standard;
db.Insert(finaChargeStuYearItem);
}
finaChargeStuYear.YJAmount = finaChargesStandardListGroup.FirstOrDefault(m => m.DeptNo == stuitem.DeptNo && m.MajorNo == stuitem.MajorNo && m.Grade == stuitem.Grade)?.YJAmount;
finaChargeStuYear.FSBlance = -finaChargeStuYear.YJAmount;

db.Insert(finaChargeStuYear);
}
}
//更新学生缴费总表
db.ExecuteBySql("update FinaChargeStudent set FSBlance=(select sum(isnull([FSBlance],0)) from [dbo].[FinaChargeStuYear] where StuNo='" + stuitem.StuNo + "')");
db.ExecuteBySql("update FinaChargeStudent set FSBlance=(select sum(isnull([FSBlance],0)) from [dbo].[FinaChargeStuYear] where StuNo='" + stuitem.StuNo + "') where StuNo='" + stuitem.StuNo + "'");
}
db.Commit();
}


Loading…
Cancel
Save