Parcourir la source

【修改】导入线下缴费记录:解除对已缴费学生无法导入的限制;

西昌分支
dyy il y a 7 mois
Parent
révision
d416a7fa34
2 fichiers modifiés avec 33 ajouts et 28 suppressions
  1. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js
  2. +32
    -27
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/ReceiveSendFeeManagement/Views/FinaChargeStuOrder/Index.js Voir le fichier

@@ -79,7 +79,7 @@ var bootstrap = function ($, learun) {
height: 450,
btn: null,
end: function () {
refreshGirdData();
//refreshGirdData();
}
});
}


+ 32
- 27
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs Voir le fichier

@@ -257,7 +257,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
var oldOrderList = BaseRepository("CollegeMIS").FindList<FinaChargeStuOrderEntity>("select * from FinaChargeStuOrder where OrderType='2' ");
//缴费方式字典
var dataitemlist = datarItemService.GetDetailList("PayTypeOffLine");
foreach (DataRow dr in dt.Rows)
{
var db = this.BaseRepository("CollegeMIS").BeginTrans();
@@ -305,10 +305,10 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
else
{
//筛选已缴费的学生
if (finaChargeStuYearEntity.PayFeeStatus == 1)
{
throw new Exception("【年度收费学生】已缴费,请核对!");
}
//if (finaChargeStuYearEntity.PayFeeStatus == 1)
//{
// throw new Exception("【年度收费学生】已缴费,请核对!");
//}
}
//缴费方式判断
var itemcodeentity = dataitemlist.FirstOrDefault(m => m.F_ItemName == dr[4].ToString());
@@ -343,11 +343,16 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
orderEntity.BankOrder = dr[5].ToString();
//历史固定项目未缴费和部分缴费的数据
var oldnotpaylist = finaChargeStuYearItemList.Where(m => m.PayFeeStatus != 1).OrderBy(m => m.priority).ToList();
if (oldnotpaylist.Count==0)
if (oldnotpaylist.Count == 0)
{
//throw new Exception("【固定收费项目】已缴费,请核对!");
//取优先级最高的一条数据
finaChargeStuYearItemEntity = finaChargeStuYearItemList.OrderBy(x => x.priority).FirstOrDefault();
}
else
{
throw new Exception("【固定收费项目】已缴费,请核对!");
finaChargeStuYearItemEntity = oldnotpaylist.FirstOrDefault();
}
finaChargeStuYearItemEntity = oldnotpaylist.FirstOrDefault();
//订单明细 写入优先级最高的一条为暂存位置
FinaChargeStuOrderDetailEntity detail = new FinaChargeStuOrderDetailEntity();
detail.Create();
@@ -355,7 +360,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
detail.ChargeItemCode = finaChargeStuYearItemEntity.ChargeItemCode;
detail.ChargeItemName = finaChargeStuYearItemEntity.ChargeItemName;
detail.YJAmount = finaChargeStuYearItemEntity.Standard;
detail.SJAmount = dresult;
detail.SJAmount = finaChargeStuYearItemEntity.SJAmount + dresult;
detail.DJAmount = detail.YJAmount - detail.SJAmount;
if (detail.DJAmount < 0)//有结余
{
@@ -363,7 +368,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
detail.DJAmount = 0;
}
//主表金额根据子表计算
orderEntity.YJAmount = detail.YJAmount;
orderEntity.YJAmount = finaChargeStuYearEntity.NeedToPay;
orderEntity.SJAmount = dresult;
orderEntity.DJAmount = detail.DJAmount;
orderEntity.NowBlance = detail.NowBlance;
@@ -371,7 +376,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
db.Insert(detail);
//判断实缴金额是否缴清费用
//如果存在未缴费的非固定项目,直接判定部分缴费
var fgdfinaChargeStuYearItem = db.FindList<FinaChargeStuYearItemEntity>("select * from FinaChargeStuYearItem where ChargeItemType=2 and PayFeeStatus<>1 and FSYId='"+ finaChargeStuYearEntity.FSYId+ "'");
var fgdfinaChargeStuYearItem = db.FindList<FinaChargeStuYearItemEntity>("select * from FinaChargeStuYearItem where ChargeItemType=2 and PayFeeStatus<>1 and FSYId='" + finaChargeStuYearEntity.FSYId + "'");
var gdfinaChargeStuYearItem = db.FindList<FinaChargeStuYearItemEntity>("select * from FinaChargeStuYearItem where ChargeItemType=1 and PayFeeStatus<>1 and FSYId='" + finaChargeStuYearEntity.FSYId + "'");
//if (fgdfinaChargeStuYearItem.Count()==0)
//{
@@ -408,10 +413,10 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeStuBalanceEntity.PaymentAmount = dresult;
finaChargeStuBalanceEntity.QJAmount = finaChargeStuYearItemEntity.NeedToPay - dresult > 0 ? finaChargeStuYearItemEntity.NeedToPay - dresult : 0;
finaChargeStuBalanceEntity.OldBalance = finaChargeStuYearItemEntity.FSBlance;
if (finaChargeStuYearItemEntity.NeedToPay-dresult<0)
if (finaChargeStuYearItemEntity.NeedToPay - dresult < 0)
{
finaChargeStuBalanceEntity.ChangeAmount = dresult - finaChargeStuBalanceEntity.DJAmount;
finaChargeStuBalanceEntity.NowBalance = finaChargeStuBalanceEntity.ChangeAmount;
finaChargeStuBalanceEntity.NowBalance = finaChargeStuBalanceEntity.ChangeAmount + finaChargeStuBalanceEntity.OldBalance;
}
else
{
@@ -425,7 +430,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeStuYearItemEntity.SJAmount = finaChargeStuYearItemEntity.SJAmount + dresult;
if (finaChargeStuYearItemEntity.NeedToPay - dresult < 0)
{
finaChargeStuYearItemEntity.FSBlance = Math.Abs(finaChargeStuYearItemEntity.NeedToPay.Value - dresult);
finaChargeStuYearItemEntity.FSBlance = Math.Abs(finaChargeStuYearItemEntity.Standard.Value - finaChargeStuYearItemEntity.SJAmount.Value);
finaChargeStuYearItemEntity.NeedToPay = 0;
}
else
@@ -439,26 +444,26 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
if (fgdfinaChargeStuYearItem.Count() == 0)
{
//FinaChargeStuYear表
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult + ")>=0 then 0 else abs(NeedToPay-" + dresult + ") end),PayFeeStatus=(case when(NeedToPay-" + dresult + ">=0) then 4 else 1 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult + ")>=0 then (0+FSBlance) else (abs(NeedToPay-" + dresult + ")+FSBlance) end),PayFeeStatus=(case when(NeedToPay-" + dresult + ">=0) then 4 else 1 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult + ")>=0 then 0 else abs(NeedToPay-" + dresult + ") end) where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=(case when(NeedToPay-" + dresult + ")>=0 then (0+FSBlance) else (abs(NeedToPay-" + dresult + ")+FSBlance) end) where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
}
else
{
decimal fgdcount = fgdfinaChargeStuYearItem.Sum(m=>m.NeedToPay).Value;
if (gdfinaChargeStuYearItem.Sum(m=>m.NeedToPay).Value- dresult<=0)
decimal fgdcount = fgdfinaChargeStuYearItem.Sum(m => m.NeedToPay).Value;
if (gdfinaChargeStuYearItem.Sum(m => m.NeedToPay).Value - dresult <= 0)
{
//FinaChargeStuYear表
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay="+ fgdcount + ",FSBlance=" + (dresult-gdfinaChargeStuYearItem.Sum(m => m.NeedToPay)) + ",PayFeeStatus=4 where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=" + fgdcount + ",FSBlance=FSBlance+" + (dresult - gdfinaChargeStuYearItem.Sum(m => m.NeedToPay)) + ",PayFeeStatus=4 where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay="+ fgdcount + ",FSBlance=" + (dresult - gdfinaChargeStuYearItem.Sum(m => m.NeedToPay)) + " where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=" + fgdcount + ",FSBlance=FSBlance+" + (dresult - gdfinaChargeStuYearItem.Sum(m => m.NeedToPay)) + " where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
}
else
{
//FinaChargeStuYear表
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=(case when(NeedToPay-" + dresult +")>0 then (NeedToPay-" + dresult +") else 0 end),FSBlance=0,PayFeeStatus=(case when(NeedToPay-" + dresult + "+" + fgdcount + ">=0) then 4 else 1 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
db.ExecuteBySql("update FinaChargeStuYear set SJAmount=SJAmount+" + dresult + ",NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=FSBlance+0,PayFeeStatus=(case when(NeedToPay-" + dresult + "+" + fgdcount + ">=0) then 4 else 1 end) where FSYId='" + finaChargeStuYearItemEntity.FSYId + "'");
//FinaChargeStudent表
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=0 where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
db.ExecuteBySql("update FinaChargeStudent set NeedToPay=(case when(NeedToPay-" + dresult + ")>0 then (NeedToPay-" + dresult + ") else 0 end),FSBlance=FSBlance+0 where StuNo='" + finaChargeStuYearItemEntity.StuNo + "'");
}
}
db.Commit();
@@ -474,7 +479,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
failDt.Rows.Add(dr.ItemArray);
}
}
// 写入缓存如果有未导入的数据
if (failDt.Rows.Count > 0)
{
@@ -507,17 +512,17 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
{
Random ran = new Random();
//获取有缴费余额的固定项目,按照优先级倒排,即优先级低的,先拿出多出余额去分配给高的项目
var FinaChargeStuYearItemHasBalance = BaseRepository("CollegeMIS").FindList<FinaChargeStuYearItemEntity>("select a.*,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId where ChargeItemType=1 and F_DeleteMark=0 and a.FSBlance>0 and b.FSYear='"+YearNo+"' order by priority desc ");
var FinaChargeStuYearItemHasBalance = BaseRepository("CollegeMIS").FindList<FinaChargeStuYearItemEntity>("select a.*,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId where ChargeItemType=1 and F_DeleteMark=0 and a.FSBlance>0 and b.FSYear='" + YearNo + "' order by priority desc ");
//获取欠费的固定项目,按照优先级排序,优先级高的首先会分配到多出的余额
var FinaChargeStuYearItemHasDJ = BaseRepository("CollegeMIS").FindList<FinaChargeStuYearItemEntity>("select a.*,b.StuNo from FinaChargeStuYearItem a left join FinaChargeStuYear b on a.FSYId=b.FSYId where ChargeItemType=1 and F_DeleteMark=0 and a.NeedToPay>0 and b.FSYear='" + YearNo + "' order by priority ");
foreach (var hasBalanceItem in FinaChargeStuYearItemHasBalance)
{
if (hasBalanceItem.FSBlance > 0)
{
foreach (var QJItem in FinaChargeStuYearItemHasDJ.Where(m=>m.StuNo== hasBalanceItem.StuNo))
foreach (var QJItem in FinaChargeStuYearItemHasDJ.Where(m => m.StuNo == hasBalanceItem.StuNo))
{
var db = BaseRepository("CollegeMIS").BeginTrans();
if (QJItem.NeedToPay >0 && hasBalanceItem.FSBlance > 0)
if (QJItem.NeedToPay > 0 && hasBalanceItem.FSBlance > 0)
{
//费用变更表
//超出应收额表余额扣减
@@ -544,7 +549,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeStuBalanceAdd.ChargeItemCode = QJItem.ChargeItemCode;
finaChargeStuBalanceAdd.ChargeItemName = QJItem.ChargeItemName;
finaChargeStuBalanceAdd.Standard = QJItem.Standard;
finaChargeStuBalanceAdd.DJAmount =QJItem.NeedToPay;
finaChargeStuBalanceAdd.DJAmount = QJItem.NeedToPay;
finaChargeStuBalanceAdd.ChangeDate = DateTime.Now;
finaChargeStuBalanceAdd.ChangeType = 6;
//余额分配还有剩余


Chargement…
Annuler
Enregistrer