瀏覽代碼

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

西昌分支
dyy 7 月之前
父節點
當前提交
d416a7fa34
共有 2 個檔案被更改,包括 33 行新增28 行删除
  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 查看文件

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


+ 32
- 27
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs 查看文件

@@ -257,7 +257,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
var oldOrderList = BaseRepository("CollegeMIS").FindList<FinaChargeStuOrderEntity>("select * from FinaChargeStuOrder where OrderType='2' "); var oldOrderList = BaseRepository("CollegeMIS").FindList<FinaChargeStuOrderEntity>("select * from FinaChargeStuOrder where OrderType='2' ");
//缴费方式字典 //缴费方式字典
var dataitemlist = datarItemService.GetDetailList("PayTypeOffLine"); var dataitemlist = datarItemService.GetDetailList("PayTypeOffLine");
foreach (DataRow dr in dt.Rows) foreach (DataRow dr in dt.Rows)
{ {
var db = this.BaseRepository("CollegeMIS").BeginTrans(); var db = this.BaseRepository("CollegeMIS").BeginTrans();
@@ -305,10 +305,10 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
else 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()); 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(); orderEntity.BankOrder = dr[5].ToString();
//历史固定项目未缴费和部分缴费的数据 //历史固定项目未缴费和部分缴费的数据
var oldnotpaylist = finaChargeStuYearItemList.Where(m => m.PayFeeStatus != 1).OrderBy(m => m.priority).ToList(); 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(); FinaChargeStuOrderDetailEntity detail = new FinaChargeStuOrderDetailEntity();
detail.Create(); detail.Create();
@@ -355,7 +360,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
detail.ChargeItemCode = finaChargeStuYearItemEntity.ChargeItemCode; detail.ChargeItemCode = finaChargeStuYearItemEntity.ChargeItemCode;
detail.ChargeItemName = finaChargeStuYearItemEntity.ChargeItemName; detail.ChargeItemName = finaChargeStuYearItemEntity.ChargeItemName;
detail.YJAmount = finaChargeStuYearItemEntity.Standard; detail.YJAmount = finaChargeStuYearItemEntity.Standard;
detail.SJAmount = dresult;
detail.SJAmount = finaChargeStuYearItemEntity.SJAmount + dresult;
detail.DJAmount = detail.YJAmount - detail.SJAmount; detail.DJAmount = detail.YJAmount - detail.SJAmount;
if (detail.DJAmount < 0)//有结余 if (detail.DJAmount < 0)//有结余
{ {
@@ -363,7 +368,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
detail.DJAmount = 0; detail.DJAmount = 0;
} }
//主表金额根据子表计算 //主表金额根据子表计算
orderEntity.YJAmount = detail.YJAmount;
orderEntity.YJAmount = finaChargeStuYearEntity.NeedToPay;
orderEntity.SJAmount = dresult; orderEntity.SJAmount = dresult;
orderEntity.DJAmount = detail.DJAmount; orderEntity.DJAmount = detail.DJAmount;
orderEntity.NowBlance = detail.NowBlance; orderEntity.NowBlance = detail.NowBlance;
@@ -371,7 +376,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
db.Insert(detail); 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 + "'"); var gdfinaChargeStuYearItem = db.FindList<FinaChargeStuYearItemEntity>("select * from FinaChargeStuYearItem where ChargeItemType=1 and PayFeeStatus<>1 and FSYId='" + finaChargeStuYearEntity.FSYId + "'");
//if (fgdfinaChargeStuYearItem.Count()==0) //if (fgdfinaChargeStuYearItem.Count()==0)
//{ //{
@@ -408,10 +413,10 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeStuBalanceEntity.PaymentAmount = dresult; finaChargeStuBalanceEntity.PaymentAmount = dresult;
finaChargeStuBalanceEntity.QJAmount = finaChargeStuYearItemEntity.NeedToPay - dresult > 0 ? finaChargeStuYearItemEntity.NeedToPay - dresult : 0; finaChargeStuBalanceEntity.QJAmount = finaChargeStuYearItemEntity.NeedToPay - dresult > 0 ? finaChargeStuYearItemEntity.NeedToPay - dresult : 0;
finaChargeStuBalanceEntity.OldBalance = finaChargeStuYearItemEntity.FSBlance; finaChargeStuBalanceEntity.OldBalance = finaChargeStuYearItemEntity.FSBlance;
if (finaChargeStuYearItemEntity.NeedToPay-dresult<0)
if (finaChargeStuYearItemEntity.NeedToPay - dresult < 0)
{ {
finaChargeStuBalanceEntity.ChangeAmount = dresult - finaChargeStuBalanceEntity.DJAmount; finaChargeStuBalanceEntity.ChangeAmount = dresult - finaChargeStuBalanceEntity.DJAmount;
finaChargeStuBalanceEntity.NowBalance = finaChargeStuBalanceEntity.ChangeAmount;
finaChargeStuBalanceEntity.NowBalance = finaChargeStuBalanceEntity.ChangeAmount + finaChargeStuBalanceEntity.OldBalance;
} }
else else
{ {
@@ -425,7 +430,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
finaChargeStuYearItemEntity.SJAmount = finaChargeStuYearItemEntity.SJAmount + dresult; finaChargeStuYearItemEntity.SJAmount = finaChargeStuYearItemEntity.SJAmount + dresult;
if (finaChargeStuYearItemEntity.NeedToPay - dresult < 0) 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; finaChargeStuYearItemEntity.NeedToPay = 0;
} }
else else
@@ -439,26 +444,26 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
if (fgdfinaChargeStuYearItem.Count() == 0) if (fgdfinaChargeStuYearItem.Count() == 0)
{ {
//FinaChargeStuYear表 //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表 //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 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表 //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表 //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 else
{ {
//FinaChargeStuYear表 //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表 //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(); db.Commit();
@@ -474,7 +479,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
failDt.Rows.Add(dr.ItemArray); failDt.Rows.Add(dr.ItemArray);
} }
} }
// 写入缓存如果有未导入的数据 // 写入缓存如果有未导入的数据
if (failDt.Rows.Count > 0) if (failDt.Rows.Count > 0)
{ {
@@ -507,17 +512,17 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
{ {
Random ran = new Random(); 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 "); 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) foreach (var hasBalanceItem in FinaChargeStuYearItemHasBalance)
{ {
if (hasBalanceItem.FSBlance > 0) 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(); 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.ChargeItemCode = QJItem.ChargeItemCode;
finaChargeStuBalanceAdd.ChargeItemName = QJItem.ChargeItemName; finaChargeStuBalanceAdd.ChargeItemName = QJItem.ChargeItemName;
finaChargeStuBalanceAdd.Standard = QJItem.Standard; finaChargeStuBalanceAdd.Standard = QJItem.Standard;
finaChargeStuBalanceAdd.DJAmount =QJItem.NeedToPay;
finaChargeStuBalanceAdd.DJAmount = QJItem.NeedToPay;
finaChargeStuBalanceAdd.ChangeDate = DateTime.Now; finaChargeStuBalanceAdd.ChangeDate = DateTime.Now;
finaChargeStuBalanceAdd.ChangeType = 6; finaChargeStuBalanceAdd.ChangeType = 6;
//余额分配还有剩余 //余额分配还有剩余


Loading…
取消
儲存