@@ -228,21 +228,31 @@ namespace Learun.Application.Web.Areas.ReceiveSendFeeManagement.Controllers | |||
[AjaxOnly] | |||
public ActionResult DeleteForm(string keyValue) | |||
{ | |||
var entity = finaChargesStandardIBLL.GetFinaChargesStandardEntity(keyValue); | |||
if (entity == null) | |||
{ | |||
return Fail("收费标准不存在!"); | |||
} | |||
//判断某专业收费标准是否已使用 | |||
var isCharge = finaChargesStandardIBLL.IsChargeByMajorNo(entity.DeptNo,entity.MajorNo, entity.SYear.ToString(), entity.Grade); | |||
if (isCharge) | |||
{ | |||
return Fail("该信息正在被系统使用,不能删除!"); | |||
} | |||
//var isCharge = finaChargesStandardIBLL.IsChargeByMajorNo(entity.DeptNo,entity.MajorNo, entity.SYear.ToString(), entity.Grade); | |||
//if (isCharge) | |||
//{ | |||
// return Fail("该信息正在被系统使用,不能删除!"); | |||
//} | |||
finaChargesStandardIBLL.DeleteEntity(keyValue); | |||
return Success("删除成功!"); | |||
} | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult Lock(string deptno, string majorNo, string syear, string grade,string ChargeStandardID) | |||
{ | |||
finaChargesStandardIBLL.Lock(deptno, majorNo, syear, grade, ChargeStandardID); | |||
return Success("审核成功!"); | |||
} | |||
[HttpPost] | |||
[AjaxOnly] | |||
public ActionResult UnLock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID) | |||
{ | |||
finaChargesStandardIBLL.UnLock(deptno, majorNo, syear, grade, ChargeStandardID); | |||
return Success("去审成功!"); | |||
} | |||
/// <summary> | |||
/// 保存实体数据(新增、修改) | |||
/// <param name="keyValue">主键</param> | |||
@@ -34,6 +34,9 @@ | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 设置费用</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a> | |||
<a id="lr_lock" class="btn btn-default"><i class="fa fa-lock"></i> 审核</a> | |||
<a id="lr_unlock" class="btn btn-default"><i class="fa fa-unlock"></i> 去审核</a> | |||
</div> | |||
</div> | |||
</div> | |||
@@ -8,7 +8,7 @@ var refreshGirdData; | |||
var selectedRow; | |||
var bootstrap = function ($, learun) { | |||
"use strict"; | |||
var sYear,grade,deptno,majorno; | |||
var sYear, grade, deptno, majorno; | |||
var page = { | |||
init: function () { | |||
$('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); | |||
@@ -54,7 +54,7 @@ var bootstrap = function ($, learun) { | |||
return; | |||
} | |||
deptno = $('#DeptNo').lrselectGet(); | |||
majorno=$('#MajorNo').lrselectGet(); | |||
majorno = $('#MajorNo').lrselectGet(); | |||
page.search(); | |||
}); | |||
// 新增 | |||
@@ -69,7 +69,7 @@ var bootstrap = function ($, learun) { | |||
learun.layerForm({ | |||
id: 'formFinaChargesStandard', | |||
title: '新增', | |||
url: top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/Form?deptno=' + selectedRow.DeptNo+'&majorno=' + selectedRow.MajorNo + '&syear=' + sYear + '&grade=' + grade + '', | |||
url: top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/Form?deptno=' + selectedRow.DeptNo + '&majorno=' + selectedRow.MajorNo + '&syear=' + sYear + '&grade=' + grade + '', | |||
width: 1000, | |||
height: 600, | |||
callBack: function (id) { | |||
@@ -117,6 +117,54 @@ var bootstrap = function ($, learun) { | |||
}); | |||
} | |||
}); | |||
//审核 | |||
$('#lr_lock').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TempId'); | |||
selectedRow = $('#gridtable').jfGridGet('rowdata'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认审核该项!', function (res) { | |||
if (res) { | |||
if (selectedRow.ChargeStandardID == 0) { | |||
learun.postForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/Lock', | |||
{ deptno: selectedRow.DeptNo, majorno: selectedRow.MajorNo, syear: sYear, grade: grade, ChargeStandardID: '' }, | |||
function () { | |||
refreshGirdData(); | |||
}); | |||
} else { | |||
learun.postForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/Lock', | |||
{ deptno: '', majorno: '', syear: '', grade: '', ChargeStandardID: selectedRow.ChargeStandardID }, | |||
function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
} | |||
}); | |||
} | |||
}); | |||
//去审 | |||
$('#lr_unlock').on('click', function () { | |||
var keyValue = $('#gridtable').jfGridValue('TempId'); | |||
selectedRow = $('#gridtable').jfGridGet('rowdata'); | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认去审该项!', function (res) { | |||
if (res) { | |||
if (selectedRow.ChargeStandardID == 0) { | |||
learun.postForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/UnLock', | |||
{ deptno: selectedRow.DeptNo, majorno: selectedRow.MajorNo, syear: sYear, grade: grade, ChargeStandardID: '' }, | |||
function () { | |||
refreshGirdData(); | |||
}); | |||
} else { | |||
learun.postForm(top.$.rootUrl + '/ReceiveSendFeeManagement/FinaChargesStandard/UnLock', | |||
{ deptno: '', majorno: '', syear: '', grade: '', ChargeStandardID: selectedRow.ChargeStandardID }, | |||
function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
} | |||
}); | |||
} | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
@@ -133,7 +181,8 @@ var bootstrap = function ($, learun) { | |||
callback(_data['deptname']); | |||
} | |||
}); | |||
} }, | |||
} | |||
}, | |||
{ label: "专业编号", name: "MajorNo", width: 100, align: "left" }, | |||
{ label: "专业名称", name: "MajorName", width: 200, align: "left" }, | |||
{ label: "收费项目名称", name: "ChargeItemName", width: 200, align: "left" }, | |||
@@ -148,7 +197,14 @@ var bootstrap = function ($, learun) { | |||
callback(_data.text); | |||
} | |||
}); | |||
} }, | |||
} | |||
}, | |||
{ | |||
label: "是否审核", name: "CheckMark", width: 100, align: "left", | |||
formatter: function (cellvalue, rowObject) { | |||
return cellvalue == "1" ? "<i class=\"fa fa-toggle-on\"></i>" : "<i class=\"fa fa-toggle-off\"></i>"; | |||
} | |||
} | |||
], | |||
isTree: true, | |||
mainId: 'TempId', | |||
@@ -161,7 +217,7 @@ var bootstrap = function ($, learun) { | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
param.SYear =sYear; | |||
param.SYear = sYear; | |||
param.Grade = grade; | |||
param.DeptNo = deptno; | |||
param.MajorNo = majorno; | |||
@@ -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 and a.SYear='"+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 and a.SYear='" + entity.FSYear + "' and a.F_DeleteMark=0 and a.CheckMark=1 and b.CheckMark=1 and b.F_DeleteMark=0"); | |||
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 and a.SYear='" + entity.FSYear + "' 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 + "' and a.F_DeleteMark=0 and a.CheckMark=1 and b.CheckMark=1 and b.F_DeleteMark=0 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); | |||
var studentchargestanderdlist = finaChargesStandardList.Where(m => m.MajorNo == stuitem.MajorNo && m.Grade == stuitem.Grade); | |||
//判断有无年度学生缴费数据 | |||
if (oldFinaChargeStuYearList.Count(m => m.StuNo == stuitem.StuNo) > 0) | |||
{ | |||
@@ -187,7 +187,7 @@ 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 = studentchargestanderdlist.Where(m =>!oldcodeitem.Contains(m.ChargeItemCode)); | |||
var needinsertchargeitem = studentchargestanderdlist.Where(m => !oldcodeitem.Contains(m.ChargeItemCode)); | |||
foreach (var finaChargesStandardEntity in needinsertchargeitem) | |||
{ | |||
var finaChargeStuYearItem = new FinaChargeStuYearItemEntity(); | |||
@@ -216,7 +216,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
} | |||
else | |||
{ | |||
if (studentchargestanderdlist.Count()>0) | |||
if (studentchargestanderdlist.Count() > 0) | |||
{ | |||
//写入学生年度缴费数据 | |||
var finaChargeStuYear = new FinaChargeStuYearEntity(); | |||
@@ -236,6 +236,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
finaChargeStuYearItem.ChargeItemName = finaChargesStandardEntity.ChargeItemName; | |||
finaChargeStuYearItem.ChargeItemType = finaChargesStandardEntity.ChargeItemType; | |||
finaChargeStuYearItem.Standard = finaChargesStandardEntity.Standard; | |||
finaChargeStuYearItem.FSBlance = -finaChargeStuYearItem.Standard; | |||
db.Insert(finaChargeStuYearItem); | |||
} | |||
finaChargeStuYear.YJAmount = finaChargesStandardListGroup.FirstOrDefault(m => m.DeptNo == stuitem.DeptNo && m.MajorNo == stuitem.MajorNo && m.Grade == stuitem.Grade)?.YJAmount; | |||
@@ -244,10 +245,12 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
db.Insert(finaChargeStuYear); | |||
} | |||
} | |||
db.Commit(); | |||
//更新学生缴费总表 | |||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargeStudent set FSBlance=(select sum(isnull([FSBlance],0)) from [dbo].[FinaChargeStuYear] where StuNo='" + stuitem.StuNo + "') where StuNo='" + stuitem.StuNo + "'");} | |||
} | |||
db.Commit(); | |||
//更新学生缴费总表 | |||
BaseRepository("CollegeMIS").ExecuteBySql(@"update FinaChargeStudent set FSBlance=a.[FSBlance] | |||
from (select isnull(sum([FSBlance]),0) as [FSBlance],StuNo from [FinaChargeStuYear] group by StuNo) a left join | |||
FinaChargeStudent b on a.stuno=b.stuno"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -314,6 +314,43 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
} | |||
} | |||
public void Lock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID) | |||
{ | |||
try | |||
{ | |||
finaChargesStandardService.Lock(deptno, majorNo, syear, grade, ChargeStandardID); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
public void UnLock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID) | |||
{ | |||
try | |||
{ | |||
finaChargesStandardService.UnLock(deptno, majorNo, syear, grade, ChargeStandardID); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
} | |||
@@ -100,5 +100,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
#endregion | |||
IEnumerable<FinaChargesStandardEntity> GetFinaChargesStandardListByYongYou(string stuNo, int jiaoFeiYear); | |||
void Lock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID); | |||
void UnLock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID); | |||
} | |||
} |
@@ -77,9 +77,9 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
try | |||
{ | |||
var strSql = new StringBuilder(); | |||
strSql.Append("select CONVERT(varchar,t.ChargeStandardID)+'Temp' as TempId,t.ChargeStandardID,t.ChargeItemID,i.ChargeItemName,i.ChargeItemType,i.ChargeItemCode,t.Standard,'' as MajorNo,'' as MajorName,'' as DeptNo,t.SYear,t.Grade,t.MajorNo as ParentId "); | |||
strSql.Append("select CONVERT(varchar,t.ChargeStandardID)+'Temp' as TempId,t.ChargeStandardID,t.ChargeItemID,i.ChargeItemName,i.ChargeItemType,i.ChargeItemCode,t.Standard,'' as MajorNo,'' as MajorName,'' as DeptNo,t.SYear,t.Grade,t.MajorNo as ParentId,t.CheckMark"); | |||
strSql.Append(" FROM [dbo].[CdMajor] m left join [dbo].[FinaChargesStandard] t on m.MajorNo=t.MajorNo left join [dbo].[FinaChargeItem] i on t.ChargeItemID=i.ChargeItemID "); | |||
strSql.Append(" WHERE 1=1 and i.CheckMark=1 "); | |||
strSql.Append(" WHERE 1=1 and i.CheckMark=1 and i.F_DeleteMark=0 and t.F_DeleteMark=0 "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
@@ -105,7 +105,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
} | |||
strSql.Append(" union "); | |||
strSql.Append(" select m.MajorNo as TempId,'' as ChargeStandardID,0 as ChargeItemID,null as ChargeItemName,null as ChargeItemType, null as ChargeItemCode,"); | |||
strSql.Append(" (select SUM(t.Standard) from [dbo].[FinaChargesStandard] t left join [FinaChargeItem] tt on t.ChargeItemID=tt.ChargeItemID where tt.CheckMark=1 and t.MajorNo=m.MajorNo "); | |||
strSql.Append(" (select SUM(t.Standard) from [dbo].[FinaChargesStandard] t left join [FinaChargeItem] tt on t.ChargeItemID=tt.ChargeItemID where tt.CheckMark=1 and tt.F_DeleteMark=0 and t.MajorNo=m.MajorNo and t.CheckMark=1 and t.F_DeleteMark=0 "); | |||
if (!queryParam["SYear"].IsEmpty()) | |||
{ | |||
strSql.Append(" AND t.SYear = @SYear "); | |||
@@ -114,7 +114,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
{ | |||
strSql.Append(" AND t.Grade = @Grade "); | |||
} | |||
strSql.Append(" ) as Standard,m.MajorNo,m.MajorName,m.DeptNo,null as SYear,null as Grade,'0' as ParentId"); | |||
strSql.Append(" ) as Standard,m.MajorNo,m.MajorName,m.DeptNo,null as SYear,null as Grade,'0' as ParentId, 0 as CheckMark"); | |||
strSql.Append(" from [dbo].[CdMajor] m "); | |||
strSql.Append(" WHERE 1=1 "); | |||
if (!queryParam["DeptNo"].IsEmpty()) | |||
@@ -173,7 +173,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
/// <param name="semester">学期</param> | |||
/// <param name="grade">年级</param> | |||
/// <returns></returns> | |||
public IEnumerable<FinaChargesStandardEntity> GetFinaChargesStandardListByMajorNo(string majorNo, string syear,string grade) | |||
public IEnumerable<FinaChargesStandardEntity> GetFinaChargesStandardListByMajorNo(string majorNo, string syear, string grade) | |||
{ | |||
try | |||
{ | |||
@@ -291,7 +291,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
{ | |||
try | |||
{ | |||
this.BaseRepository("CollegeMIS").Delete<FinaChargesStandardEntity>(t => t.ChargeStandardID == keyValue); | |||
this.BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set F_DeleteMark=1 where ChargeStandardID='" + keyValue + "'"); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -346,7 +346,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
/// <summary> | |||
/// 新增保存 | |||
/// </summary> | |||
public void SaveFinaChargesStandardList(string deptNo,string majorNo, string sYear, string grade, List<FinaChargesStandardEntity> finaChargesStandardList) | |||
public void SaveFinaChargesStandardList(string deptNo, string majorNo, string sYear, string grade, List<FinaChargesStandardEntity> finaChargesStandardList) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS"); | |||
try | |||
@@ -365,7 +365,7 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
DeptNo = deptNo, | |||
MajorNo = majorNo, | |||
Standard = item.Standard, | |||
SYear =Convert.ToInt32(sYear), | |||
SYear = Convert.ToInt32(sYear), | |||
CheckMark = false | |||
}; | |||
entity.Create(); | |||
@@ -454,5 +454,57 @@ namespace Learun.Application.TwoDevelopment.ReceiveSendFeeManagement | |||
} | |||
} | |||
} | |||
public void Lock(string deptno, string majorNo, string syear, string grade,string ChargeStandardID) | |||
{ | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(deptno)) | |||
{ | |||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set CheckMark=1 where Grade='" + grade + "' and DeptNo='" + deptno + "' and MajorNo='" + majorNo + "' and SYear='" + syear + "'"); | |||
} | |||
else | |||
{ | |||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set CheckMark=1 where ChargeStandardID='"+ ChargeStandardID + "'"); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
public void UnLock(string deptno, string majorNo, string syear, string grade, string ChargeStandardID) | |||
{ | |||
try | |||
{ | |||
if (!string.IsNullOrEmpty(deptno)) | |||
{ | |||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set CheckMark=0 where Grade='" + grade + "' and DeptNo='" + deptno + "' and MajorNo='" + majorNo + "' and SYear='" + syear + "'"); | |||
} | |||
else | |||
{ | |||
BaseRepository("CollegeMIS").ExecuteBySql("update FinaChargesStandard set CheckMark=0 where ChargeStandardID='" + ChargeStandardID + "'"); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
} | |||
} |