Browse Source

【修改】导入线下缴费:自动分配需求修改暂存;

西昌分支
dyy 5 months ago
parent
commit
67a2b33c27
2 changed files with 159 additions and 39 deletions
  1. +7
    -7
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceEntity.cs
  2. +152
    -32
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs

+ 7
- 7
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuBalance/FinaChargeStuBalanceEntity.cs View File

@@ -45,37 +45,37 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
[Column("CHARGEITEMNAME")]
public string ChargeItemName { get; set; }
/// <summary>
/// Standard
/// 收费标准
/// </summary>
[Column("STANDARD")]
public decimal? Standard { get; set; }
/// <summary>
/// 剩余缴费金
/// 本次应缴余
/// </summary>
[Column("DJAMOUNT")]
public decimal? DJAmount { get; set; }
/// <summary>
/// 变动金额
/// 缴费金额
/// </summary>
[Column("PAYMENTAMOUNT")]
public decimal? PaymentAmount { get; set; }
/// <summary>
/// 本次剩余缴费金
/// 剩余应缴余
/// </summary>
[Column("QJAMOUNT")]
public decimal? QJAmount { get; set; }
/// <summary>
/// OldBalance
/// 当前超出应收额
/// </summary>
[Column("OLDBALANCE")]
public decimal? OldBalance { get; set; }
/// <summary>
/// ChangeAmount
/// 本次变动金额
/// </summary>
[Column("CHANGEAMOUNT")]
public decimal? ChangeAmount { get; set; }
/// <summary>
/// NowBalance
/// 超出应收额
/// </summary>
[Column("NOWBALANCE")]
public decimal? NowBalance { get; set; }


+ 152
- 32
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/ReceiveSendFeeManagement/FinaChargeStuOrder/FinaChargeStuOrderService.cs View File

@@ -341,6 +341,129 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
orderEntity.Status = 1;
orderEntity.OrderType = 2;
orderEntity.BankOrder = dr[5].ToString();
orderEntity.YJAmount = finaChargeStuYearEntity.NeedToPay;
orderEntity.SJAmount = dresult;
orderEntity.DJAmount = orderEntity.YJAmount - orderEntity.SJAmount;
if (orderEntity.DJAmount < 0)
{
orderEntity.NowBlance = Math.Abs(orderEntity.DJAmount.Value);
orderEntity.DJAmount = 0;
}
db.Insert(orderEntity);

#region 新的:暂存0
////todo:写入多detail,更新yearitem,写入多balance;
//List<FinaChargeStuOrderDetailEntity> insertFinaChargeStuOrderDetailList = new List<FinaChargeStuOrderDetailEntity>();
//FinaChargeStuYearItemEntity finaChargeStuYearItemEntityHigh = finaChargeStuYearItemList.OrderBy(x => x.priority).FirstOrDefault();
//decimal dresultTemp = dresult;
//foreach (var item in finaChargeStuYearItemList.OrderBy(x => x.priority))
//{
// if (item.NeedToPay > 0 && dresultTemp > 0)
// {
// var insertDetail = new FinaChargeStuOrderDetailEntity()
// {
// FCSOId = orderEntity.Id,
// ChargeItemCode = item.ChargeItemCode,
// ChargeItemName = item.ChargeItemName,
// YJAmount = item.Standard,
// SJAmount = dresultTemp >= item.NeedToPay ? item.NeedToPay : dresultTemp,
// NowBlance = 0
// };
// insertDetail.DJAmount = item.NeedToPay - insertDetail.SJAmount;
// insertDetail.Create();
// insertFinaChargeStuOrderDetailList.Add(insertDetail);
// //balance
// var insertFinaChargeStuBalanceEntity = new FinaChargeStuBalanceEntity()
// {
// StuNo = orderEntity.StuNo,
// FSYear = orderEntity.YearNo,
// FCSOId = orderEntity.Id,
// ChargeItemCode = item.ChargeItemCode,
// ChargeItemName = item.ChargeItemName,
// Standard = item.Standard,
// DJAmount = item.NeedToPay,
// PaymentAmount = insertDetail.SJAmount,
// QJAmount = insertDetail.DJAmount,
// OldBalance = insertDetail.NowBlance,
// ChangeDate = DateTime.Now,
// ChangeType = itemcodeint
// };
// insertFinaChargeStuBalanceEntity.ChangeAmount = insertFinaChargeStuBalanceEntity.OldBalance;
// insertFinaChargeStuBalanceEntity.NowBalance = finaChargeStuYearEntity.FSBlance + insertFinaChargeStuBalanceEntity.ChangeAmount;
// insertFinaChargeStuBalanceEntity.Create();
// db.Insert(insertFinaChargeStuBalanceEntity);
// //yearitem
// item.SJAmount = item.SJAmount + insertDetail.SJAmount;
// item.NeedToPay = item.NeedToPay - insertDetail.SJAmount;
// item.PayFeeStatus = item.NeedToPay > 0 ? 4 : 1;
// db.Update(item);
// //
// dresultTemp -= insertDetail.SJAmount.Value;
// if (dresultTemp <= 0)
// {
// break;
// }
// }
//}
//if (dresultTemp > 0)
//{
// //todo:全分配完,还有剩余,记账到优先级最高的上面;
// //优先级最高的可能在待插入的列表里,也可能不在;
// if (insertFinaChargeStuOrderDetailList.Where(x => x.ChargeItemCode == finaChargeStuYearItemEntityHigh.ChargeItemCode).Any())
// {
// var insertDetailExist = insertFinaChargeStuOrderDetailList.FirstOrDefault(x => x.ChargeItemCode == finaChargeStuYearItemEntityHigh.ChargeItemCode);
// insertDetailExist.SJAmount += dresultTemp;
// insertDetailExist.NowBlance += dresultTemp;
// //yearitem
// finaChargeStuYearItemEntityHigh.SJAmount += insertDetailExist.SJAmount;
// finaChargeStuYearItemEntityHigh.FSBlance += dresultTemp;
// db.Update(finaChargeStuYearItemEntityHigh);
// }
// else
// {
// var insertDetail = new FinaChargeStuOrderDetailEntity()
// {
// FCSOId = orderEntity.Id,
// ChargeItemCode = finaChargeStuYearItemEntityHigh.ChargeItemCode,
// ChargeItemName = finaChargeStuYearItemEntityHigh.ChargeItemName,
// YJAmount = finaChargeStuYearItemEntityHigh.Standard,
// SJAmount = dresultTemp,
// DJAmount = 0,
// NowBlance = dresultTemp
// };
// insertDetail.Create();
// insertFinaChargeStuOrderDetailList.Add(insertDetail);
// //yearitem
// finaChargeStuYearItemEntityHigh.SJAmount += insertDetail.SJAmount;
// finaChargeStuYearItemEntityHigh.FSBlance += insertDetail.SJAmount;
// db.Update(finaChargeStuYearItemEntityHigh);
// }
// //balance
// var insertFinaChargeStuBalanceEntity = new FinaChargeStuBalanceEntity()
// {
// StuNo = orderEntity.StuNo,
// FSYear = orderEntity.YearNo,
// FCSOId = orderEntity.Id,
// ChargeItemCode = finaChargeStuYearItemEntityHigh.ChargeItemCode,
// ChargeItemName = finaChargeStuYearItemEntityHigh.ChargeItemName,
// Standard = finaChargeStuYearItemEntityHigh.Standard,
// DJAmount = 0,
// PaymentAmount = dresultTemp,
// QJAmount = 0,
// OldBalance = dresultTemp,
// ChangeDate = DateTime.Now,
// ChangeType = itemcodeint
// };
// insertFinaChargeStuBalanceEntity.ChangeAmount = insertFinaChargeStuBalanceEntity.OldBalance;
// insertFinaChargeStuBalanceEntity.NowBalance = finaChargeStuYearEntity.FSBlance + insertFinaChargeStuBalanceEntity.ChangeAmount;
// insertFinaChargeStuBalanceEntity.Create();
// db.Insert(insertFinaChargeStuBalanceEntity);
//}
//db.Insert(insertFinaChargeStuOrderDetailList);

#endregion
#region 旧的

//历史固定项目未缴费和部分缴费的数据
var oldnotpaylist = finaChargeStuYearItemList.Where(m => m.PayFeeStatus != 1).OrderBy(m => m.priority).ToList();
if (oldnotpaylist.Count == 0)
@@ -367,39 +490,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
detail.NowBlance = Math.Abs(detail.DJAmount.Value);
detail.DJAmount = 0;
}
//主表金额根据子表计算
orderEntity.YJAmount = finaChargeStuYearEntity.NeedToPay;
orderEntity.SJAmount = dresult;
orderEntity.DJAmount = detail.DJAmount;
orderEntity.NowBlance = detail.NowBlance;
db.Insert(orderEntity);
db.Insert(detail);
//判断实缴金额是否缴清费用
//如果存在未缴费的非固定项目,直接判定部分缴费
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)
//{
// decimal sjcount = Convert.ToDecimal(db.FindObject("select isnull(sum(SJAmount),0) from FinaChargeStuOrder where StuNo='" + orderEntity.StuNo + "' and Status=1 and YearNo='" + orderEntity.YearNo + "' "));
// //增加本次缴费金额
// sjcount = sjcount + orderEntity.SJAmount.Value;
// decimal yjcount = finaChargeStuYearEntity.YJAmount.Value;
// if (sjcount >= yjcount)
// {
// //更新缴费状态
// db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='1' where FSYId='" + finaChargeStuYearEntity.FSYId + "'");
// }
// else//更新部分缴费状态
// {
// //更新缴费状态
// db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='4' where FSYId='" + finaChargeStuYearEntity.FSYId + "'");
// }
//}
//else
//{
// //更新缴费状态
// db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='4' where FSYId='" + finaChargeStuYearEntity.FSYId + "'");
//}
//费用变更明细
FinaChargeStuBalanceEntity finaChargeStuBalanceEntity = new FinaChargeStuBalanceEntity();
finaChargeStuBalanceEntity.Create();
@@ -439,6 +530,35 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement
}
finaChargeStuYearItemEntity.PayFeeStatus = finaChargeStuYearItemEntity.NeedToPay > 0 ? 4 : 1;
db.Update(finaChargeStuYearItemEntity);

#endregion
//判断实缴金额是否缴清费用
//如果存在未缴费的非固定项目,直接判定部分缴费
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)
//{
// decimal sjcount = Convert.ToDecimal(db.FindObject("select isnull(sum(SJAmount),0) from FinaChargeStuOrder where StuNo='" + orderEntity.StuNo + "' and Status=1 and YearNo='" + orderEntity.YearNo + "' "));
// //增加本次缴费金额
// sjcount = sjcount + orderEntity.SJAmount.Value;
// decimal yjcount = finaChargeStuYearEntity.YJAmount.Value;
// if (sjcount >= yjcount)
// {
// //更新缴费状态
// db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='1' where FSYId='" + finaChargeStuYearEntity.FSYId + "'");
// }
// else//更新部分缴费状态
// {
// //更新缴费状态
// db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='4' where FSYId='" + finaChargeStuYearEntity.FSYId + "'");
// }
//}
//else
//{
// //更新缴费状态
// db.ExecuteBySql("update FinaChargeStuYear set PayFeeStatus='4' where FSYId='" + finaChargeStuYearEntity.FSYId + "'");
//}

//如果存在未缴费的非固定项目,应缴余额和超出应收应该排除掉
//同时满足固定项目超出的情况
if (fgdfinaChargeStuYearItem.Count() == 0)


Loading…
Cancel
Save