using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Bowin.Common.Data;
using Bowin.Common.Utility;
using Bowin.Web.Controls.Mvc;
using EMIS.CommonLogic.FeeManage;
using EMIS.CommonLogic.Students;
using EMIS.Utility.FormValidate;
using EMIS.ViewModel;
using EMIS.ViewModel.FeeManage;
using EMIS.Web.Controls;
namespace EMIS.Web.Controllers.FeeManage
{
[Authorization]
public class StudentFeeController : Controller
{
public IFeeServices FeeServices { get; set; }
public IExamineApplyServices ExamineApplyService { get; set; }
public ActionResult List()
{
ViewBag.SchoolYearID = BaseExtensions.GetCurrentSchoolYearID();
return View();
}
public ActionResult Print()
{
return View();
}
public ActionResult PrintGDCX()
{
return View();
}
public ActionResult PrintDetail(string examinationRegistConfirmNo)
{
return View();
}
public ActionResult PrintDetailGDCX(string examinationRegistConfirmNo)
{
return View();
}
public ActionResult ReceiptSetting()
{
return View(FeeServices.GetReceiptView());
}
public ActionResult InvalidReceipt()
{
return View();
}
public ActionResult FinanceReport()
{
return View();
}
public ActionResult Refund(Guid examinationRegistrationID)
{
var user = CustomPrincipal.Current;
var refundView = FeeServices.GetRefundView(examinationRegistrationID);
if (!refundView.RefundUserID.HasValue)
{
refundView.RefundUserID = user.UserID;
}
if (refundView.RefundUserName == null)
{
refundView.RefundUserName = user.Name;
}
if (!refundView.RefundTime.HasValue)
{
refundView.RefundTime = DateTime.Today;
}
return View(refundView);
}
public ActionResult RefundConfirm(Guid examinationRegistrationID)
{
var refundView = FeeServices.GetRefundView(examinationRegistrationID);
return View(refundView);
}
public ActionResult ClassStatisticList()
{
return View();
}
public ActionResult ProjectStatisticList()
{
return View();
}
[HttpPost]
public ActionResult List(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
var collegeID = pararms.getExtraGuid("ddlCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var classmajorID = pararms.getExtraGuid("cgbClassmajor");
var recordStatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus");
var isConfirm = pararms.getExtraInt("ddlIsConfirm") == DropdownList.SELECT_ALL ? null : (bool?)(pararms.getExtraInt("ddlIsConfirm") == (int)CF_GeneralPurpose.IsYes);
var payWay = pararms.getExtraInt("ddlPayWay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlPayWay");
var startDate = pararms.getExtraDateTime("StartDate");
var endDate = pararms.getExtraDateTime("EndDate");
var refundStartDate = pararms.getExtraDateTime("RefundStartDate");
var refundEndDate = pararms.getExtraDateTime("RefundEndDate");
return base.Json(FeeServices.GetStudentFeeViewGrid(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, schoolAreaID, collegeID,
yearID, classmajorID, recordStatus, isConfirm, startDate, endDate, payWay, refundStartDate, refundEndDate, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult ListSum(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
var collegeID = pararms.getExtraGuid("ddlCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var classmajorID = pararms.getExtraGuid("cgbClassmajor");
var recordStatus = pararms.getExtraInt("ddlRecordStatus") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlRecordStatus");
var isConfirm = pararms.getExtraInt("ddlIsConfirm") == DropdownList.SELECT_ALL ? null : (bool?)(pararms.getExtraInt("ddlIsConfirm") == (int)CF_GeneralPurpose.IsYes);
var payWay = pararms.getExtraInt("ddlPayWay") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlPayWay");
var startDate = pararms.getExtraDateTime("StartDate");
var endDate = pararms.getExtraDateTime("EndDate");
var refundStartDate = pararms.getExtraDateTime("RefundStartDate");
var refundEndDate = pararms.getExtraDateTime("RefundEndDate");
return base.Json(FeeServices.GetStudentFeeViewListSum(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, schoolAreaID, collegeID,
yearID, classmajorID, recordStatus, isConfirm, startDate, endDate, payWay, refundStartDate, refundEndDate));
}
///
/// Excel导出
///
///
///
[HttpPost]
public ActionResult Excel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var examinationBatchID = Request.Form["cgExaminationBatch"].ParseStrTo();
var examinationTypeID = Request.Form["cgExaminationType"].ParseStrTo();
var examinationProjectID = Request.Form["cgExaminationProject"].ParseStrTo();
var schoolAreaID = Request.Form["ddlSchoolArea"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlSchoolArea"].ParseStrTo();
var collegeID = Request.Form["ddlCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var classmajorID = Request.Form["ddlClassmajor"].ParseStrTo();
var recordStatus = Request.Form["ddlRecordStatus"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlRecordStatus"].ParseStrTo();
var isConfirm = Request.Form["ddlIsConfirm"].ParseStrTo() == DropdownList.SELECT_ALL ? null : (bool?)(Request.Form["ddlIsConfirm"].ParseStrTo() == (int)CF_GeneralPurpose.IsYes);
var payWay = Request.Form["ddlPayWay"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlPayWay"].ParseStrTo();
var startDate = Request.Form["StartDate"].ParseStrTo();
var endDate = Request.Form["EndDate"].ParseStrTo();
var refundStartDate = Request.Form["RefundStartDate"].ParseStrTo();
var refundEndDate = Request.Form["RefundEndDate"].ParseStrTo();
var examinationRegistrationIDList = Request.Form["selectedIDs"].Split(',').Where(x => !string.IsNullOrEmpty(x)).Select(x => new Guid(x)).ToList();
var dt = FeeServices.GetStudentFeeViewList(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID, schoolAreaID, collegeID,
yearID, classmajorID, recordStatus, isConfirm, startDate, endDate, payWay, refundStartDate, refundEndDate, examinationRegistrationIDList).Select(x => new
{
x.SchoolyearCode,
x.ExaminationBatchName,
x.ExaminationProjectName,
x.SchoolAreaName,
x.ClassmajorName,
x.UserName,
x.SexName,
x.CertificatesTypeName,
x.IDNumber,
x.PhoneNumber,
//x.StudentNo,
x.FeeTypeName,
Fee = x.Fee.HasValue ? x.Fee.Value.ToString("#0.00") : null,
x.RecordStatusName,
x.PayWayStr,
PayTime = x.PayTime.HasValue ? x.PayTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
x.BankName,
x.CardNo,
x.RefundUserName,
x.RefundTimeStr,
x.RefundConfirmUserName,
x.RefundConfirmTimeStr,
x.WechatOrderID,
x.RefundOrderID,
x.No,
x.ReceiptNo,
}).ToTable();
string[] liststring = { "学年学期", "考试批次", "项目名称", "校区", "班级", "姓名",
"性别", "证件类型", "证件号码", "联系电话","报名项目", "金额",
"缴费状态", "缴费方式", "缴费时间", "开户行及支行",
"银行卡号","退费经办老师","退费申请时间","退费确认老师","退费确认时间","微信订单号","微信退款单号", "确认单号", "收据号" };
neh.Export(dt, liststring, "学生缴费信息" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
[HttpPost]
public ActionResult ReceiptSetting(ReceiptView receiptView)
{
try
{
FeeServices.SaveReceiptView(receiptView);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult UnloadReceipt()
{
try
{
FeeServices.UnloadReceipt();
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "退出成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "退出失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult InvalidReceipt(string receiptNo)
{
try
{
FeeServices.SaveInvalidReceipt(receiptNo);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "保存成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "保存失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult StudentFeeDetail(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var examinationRegistConfirmNo = pararms.getExtraString("txtConfirmNo");
return base.Json(FeeServices.GetStudentFeeDetailViewGrid(conditionView, examinationRegistConfirmNo, (int)pararms.page, (int)pararms.rows));
}
[HttpPost]
public ActionResult StudentFeeTotal(string examinationRegistConfirmNo)
{
return base.Json(FeeServices.GetStudentFeeDetailTotal(new ConfiguretView(), examinationRegistConfirmNo));
}
[HttpPost]
public ActionResult PrintSaveGDCX(string examinationRegistConfirmNo)
{
try
{
var printView = FeeServices.PrintSaveGDCX(examinationRegistConfirmNo);
if (printView != null)
{
printView.Operator = CustomPrincipal.Current.Name;
return Json(new ReturnMessage()
{
IsSuccess = true,
Data = printView
});
}
else
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "获取打印单号失败:查询更新后打印单信息失败。已消耗一张票据……"
});
}
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "获取打印单号失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult PrintSave(string examinationRegistConfirmNo)
{
try
{
var printView = FeeServices.PrintSave(examinationRegistConfirmNo);
if (printView != null)
{
printView.Operator = CustomPrincipal.Current.Name;
return Json(new ReturnMessage()
{
IsSuccess = true,
Data = printView
});
}
else
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "获取打印单号失败:查询更新后打印单信息失败。已消耗一张票据……"
});
}
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "获取打印单号失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult Refund(RefundView refundView)
{
try
{
FeeServices.RefundOffline(refundView);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "退款申请提交成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "退款申请提交失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult RefundConfirmSave(Guid examinationRegistrationID)
{
try
{
FeeServices.RefundConfirm(examinationRegistrationID);
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "退款确认成功。"
});
}
catch (Exception ex)
{
return Json(new ReturnMessage()
{
IsSuccess = false,
Message = "退款确认失败:" + ex.Message
});
}
}
[HttpPost]
public ActionResult ClassStatisticList(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
var collegeID = pararms.getExtraGuid("ddlCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cgbStandard");
var classmajorID = pararms.getExtraGuid("cgbClassmajor");
return base.Json(FeeServices.GetStudentFeeClassStatisticViewGrid(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
collegeID, yearID, standardID, classmajorID, pararms.page, pararms.rows));
}
[HttpPost]
public ActionResult ClassStatisticTotal(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
var collegeID = pararms.getExtraGuid("ddlCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cgbStandard");
var classmajorID = pararms.getExtraGuid("cgbClassmajor");
return base.Json(FeeServices.GetStudentFeeClassStatisticViewTotal(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
collegeID, yearID, standardID, classmajorID));
}
[HttpPost]
public ActionResult ProjectStatisticList(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
var collegeID = pararms.getExtraGuid("ddlCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cgbStandard");
var classmajorID = pararms.getExtraGuid("cgbClassmajor");
var startDate = pararms.getExtraDateTime("StartDate");
var endDate = pararms.getExtraDateTime("EndDate");
return base.Json(FeeServices.GetStudentFeeProjectStatisticViewGrid(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
schoolAreaID, collegeID, yearID, standardID, classmajorID, startDate, endDate, pararms.page, pararms.rows));
}
[HttpPost]
public ActionResult ProjectStatisticTotal(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var examinationBatchID = pararms.getExtraGuid("cgExaminationBatch");
var examinationTypeID = pararms.getExtraGuid("cgExaminationType");
var examinationProjectID = pararms.getExtraGuid("cgExaminationProject");
var schoolAreaID = pararms.getExtraInt("ddlSchoolArea") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlSchoolArea");
var collegeID = pararms.getExtraGuid("ddlCollege");
var yearID = pararms.getExtraInt("ddlYear") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("ddlYear");
var standardID = pararms.getExtraInt("cgbStandard") == DropdownList.SELECT_ALL ? null : pararms.getExtraInt("cgbStandard");
var classmajorID = pararms.getExtraGuid("cgbClassmajor");
var startDate = pararms.getExtraDateTime("StartDate");
var endDate = pararms.getExtraDateTime("EndDate");
return base.Json(FeeServices.GetStudentFeeProjectStatisticViewTotal(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
schoolAreaID, collegeID, yearID, standardID, classmajorID, startDate, endDate));
}
///
/// Excel导出
///
///
///
[HttpPost]
public ActionResult ClassStatisticExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var examinationBatchID = Request.Form["cgExaminationBatch"].ParseStrTo();
var examinationTypeID = Request.Form["cgExaminationType"].ParseStrTo();
var examinationProjectID = Request.Form["cgExaminationProject"].ParseStrTo();
var collegeID = Request.Form["ddlCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var standardID = Request.Form["cgbStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cgbStandard"].ParseStrTo();
var classmajorID = Request.Form["cgbClassmajor"].ParseStrTo();
var statisticList = FeeServices.GetStudentFeeClassStatisticViewList(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
collegeID, yearID, standardID, classmajorID).Select(x => new
{
x.Year,
x.CollegeName,
x.ClassmajorName,
x.ExaminationTypeName,
x.ExaminationProjectName,
x.FeeTypeName,
x.TotalRegistCount,
TotalRegistAmount = x.TotalRegistAmount.HasValue ? x.TotalRegistAmount.Value.ToString("#0.00") : null,
x.TotalPaidCount,
TotalPaidAmount = x.TotalPaidAmount.HasValue ? x.TotalPaidAmount.Value.ToString("#0.00") : null,
x.TotalRefundCount,
TotalRefundAmount = x.TotalRefundAmount.HasValue ? x.TotalRefundAmount.Value.ToString("#0.00") : null,
x.TotalRefundApplyCount,
TotalRefundApplyAmount = x.TotalRefundApplyAmount.HasValue ? x.TotalRefundApplyAmount.Value.ToString("#0.00") : null,
x.TotalRefundingCount,
TotalRefundingAmount = x.TotalRefundingAmount.HasValue ? x.TotalRefundingAmount.Value.ToString("#0.00") : null
}).ToList();
var statisticTotal = FeeServices.GetStudentFeeClassStatisticViewTotal(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
collegeID, yearID, standardID, classmajorID);
statisticList.Add(new
{
Year = (int?)null,
CollegeName = "",
ClassmajorName = "",
ExaminationTypeName = "",
ExaminationProjectName = "",
FeeTypeName = "",
TotalRegistCount = statisticTotal.TotalRegistCount,
TotalRegistAmount = statisticTotal.TotalRegistAmount.HasValue ? statisticTotal.TotalRegistAmount.Value.ToString("#0.00") : null,
TotalPaidCount = statisticTotal.TotalPaidCount,
TotalPaidAmount = statisticTotal.TotalPaidAmount.HasValue ? statisticTotal.TotalPaidAmount.Value.ToString("#0.00") : null,
TotalRefundCount = statisticTotal.TotalRefundCount,
TotalRefundAmount = statisticTotal.TotalRefundAmount.HasValue ? statisticTotal.TotalRefundAmount.Value.ToString("#0.00") : null,
TotalRefundApplyCount = statisticTotal.TotalRefundApplyCount,
TotalRefundApplyAmount = statisticTotal.TotalRefundApplyAmount.HasValue ? statisticTotal.TotalRefundApplyAmount.Value.ToString("#0.00") : null,
TotalRefundingCount = statisticTotal.TotalRefundingCount,
TotalRefundingAmount = statisticTotal.TotalRefundingAmount.HasValue ? statisticTotal.TotalRefundingAmount.Value.ToString("#0.00") : null,
});
var dt = statisticList.ToTable();
string[] liststring = { "年级", "院/系/部", "班级", "考试类型",
"考试项目", "报名项目(费用)", "报名人数", "总金额", "已交费人数",
"已交费金额", "已退费人数", "已退费金额" };
neh.Export(dt, liststring, "按班级项目等级汇总" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
///
/// Excel导出
///
///
///
[HttpPost]
public ActionResult ProjectStatisticExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var examinationBatchID = Request.Form["cgExaminationBatch"].ParseStrTo();
var examinationTypeID = Request.Form["cgExaminationType"].ParseStrTo();
var examinationProjectID = Request.Form["cgExaminationProject"].ParseStrTo();
var schoolAreaID = Request.Form["ddlSchoolArea"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlSchoolArea"].ParseStrTo();
var collegeID = Request.Form["ddlCollege"].ParseStrTo();
var yearID = Request.Form["ddlYear"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["ddlYear"].ParseStrTo();
var standardID = Request.Form["cgbStandard"].ParseStrTo() == DropdownList.SELECT_ALL ? null : Request.Form["cgbStandard"].ParseStrTo();
var classmajorID = Request.Form["cgbClassmajor"].ParseStrTo();
var startDate = Request.Form["StartDate"].ParseStrTo();
var endDate = Request.Form["EndDate"].ParseStrTo();
var statisticList = FeeServices.GetStudentFeeProjectStatisticViewList(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
schoolAreaID, collegeID, yearID, standardID, classmajorID, startDate, endDate).Select(x => new
{
x.ExaminationBatchName,
x.ExaminationTypeName,
x.ExaminationProjectName,
x.FeeTypeName,
x.TotalRegistCount,
TotalRegistAmount = x.TotalRegistAmount.HasValue ? x.TotalRegistAmount.Value.ToString("#0.00") : null,
x.TotalPaidCount,
TotalPaidAmount = x.TotalPaidAmount.HasValue ? x.TotalPaidAmount.Value.ToString("#0.00") : null,
x.TotalRefundCount,
TotalRefundAmount = x.TotalRefundAmount.HasValue ? x.TotalRefundAmount.Value.ToString("#0.00") : null,
x.TotalRefundApplyCount,
TotalRefundApplyAmount = x.TotalRefundApplyAmount.HasValue ? x.TotalRefundApplyAmount.Value.ToString("#0.00") : null,
x.TotalRefundingCount,
TotalRefundingAmount = x.TotalRefundingAmount.HasValue ? x.TotalRefundingAmount.Value.ToString("#0.00") : null
}).ToList();
var statisticTotal = FeeServices.GetStudentFeeProjectStatisticViewTotal(conditionView, schoolyearID, examinationBatchID, examinationTypeID, examinationProjectID,
schoolAreaID, collegeID, yearID, standardID, classmajorID, startDate, endDate);
statisticList.Add(new
{
ExaminationBatchName = "",
ExaminationTypeName = "",
ExaminationProjectName = "",
FeeTypeName = "",
TotalRegistCount = statisticTotal.TotalRegistCount,
TotalRegistAmount = statisticTotal.TotalRegistAmount.HasValue ? statisticTotal.TotalRegistAmount.Value.ToString("#0.00") : null,
TotalPaidCount = statisticTotal.TotalPaidCount,
TotalPaidAmount = statisticTotal.TotalPaidAmount.HasValue ? statisticTotal.TotalPaidAmount.Value.ToString("#0.00") : null,
TotalRefundCount = statisticTotal.TotalRefundCount,
TotalRefundAmount = statisticTotal.TotalRefundAmount.HasValue ? statisticTotal.TotalRefundAmount.Value.ToString("#0.00") : null,
TotalRefundApplyCount = statisticTotal.TotalRefundApplyCount,
TotalRefundApplyAmount = statisticTotal.TotalRefundApplyAmount.HasValue ? statisticTotal.TotalRefundApplyAmount.Value.ToString("#0.00") : null,
TotalRefundingCount = statisticTotal.TotalRefundingCount,
TotalRefundingAmount = statisticTotal.TotalRefundingAmount.HasValue ? statisticTotal.TotalRefundingAmount.Value.ToString("#0.00") : null,
});
var dt = statisticList.ToTable();
string[] liststring = { "报名批次", "考试类型", "考试项目", "报名费用", "报名人数", "总金额", "已交费人数", "已交费金额", "已退费人数", "已退费金额", "退费申请人数", "退费申请金额", "待退费人数", "待退费金额" };
neh.Export(dt, liststring, "按项目汇总" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
[HttpPost]
public ActionResult FinanceReport(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var payTimeStart = pararms.getExtraDateTime("txtPayTimeStart");
var payTimeEnd = pararms.getExtraDateTime("txtPayTimeEnd");
var examinationProjectID = pararms.getExtraGuid("ddlExaminationProject");
var receiver = pararms.getExtraGuid("cgbReceiver");
return base.Json(FeeServices.GetFinanceReportViewGrid(conditionView, schoolyearID, payTimeStart, payTimeEnd, examinationProjectID, receiver, pararms.page, pararms.rows));
}
[HttpPost]
public ActionResult FinanceReportTotal(QueryParamsModel pararms)
{
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(pararms);
var schoolyearID = pararms.getExtraGuid("ddlSchoolyear");
var payTimeStart = pararms.getExtraDateTime("txtPayTimeStart");
var payTimeEnd = pararms.getExtraDateTime("txtPayTimeEnd");
var examinationProjectID = pararms.getExtraGuid("ddlExaminationProject");
var receiver = pararms.getExtraGuid("cgbReceiver");
return Json(FeeServices.GetFinanceReportViewTotal(conditionView, schoolyearID, payTimeStart, payTimeEnd, examinationProjectID, receiver));
}
///
/// Excel导出
///
///
///
[HttpPost]
public ActionResult FinanceReportExcel()
{
NpoiExcelHelper neh = new NpoiExcelHelper();
ConfiguretView conditionView = ConfiguretExtensions.GetConfiguretermsView(null);
var schoolyearID = Request.Form["ddlSchoolyear"].ParseStrTo();
var payTimeStart = Request.Form["txtPayTimeStart"].ParseStrTo();
var payTimeEnd = Request.Form["txtPayTimeEnd"].ParseStrTo();
var examinationProjectID = Request.Form["ddlExaminationProject"].ParseStrTo();
var receiver = Request.Form["cgbReceiver"].ParseStrTo();
var financeList = FeeServices.GetFinanceReportViewList(conditionView, schoolyearID, payTimeStart, payTimeEnd, examinationProjectID, receiver)
.Select(x => new
{
x.ReceiptNo,
PayTime = x.PayTime.HasValue ? x.PayTime.Value.ToString("yyyy-MM-dd") : "",
x.ClassmajorName,
x.ExaminationRegistrationConfirmNo,
x.ExaminationProjectName,
x.FeeTypeName,
x.StudentCount,
x.AmountString,
x.ReceiverName
}).ToList();
var dt = financeList.ToTable();
string[] liststring = { "收据号", "收费日期", "班级", "确认单号", "项目", "收费标准", "人数", "金额", "开票人" };
neh.Export(dt, liststring, "按项目汇总" + DateTime.Now.ToString("yyyyMMdd"));
return Json(new ReturnMessage()
{
IsSuccess = true,
Message = "导出成功。"
});
}
[HttpGet]
public ActionResult RefundApprove(string examinationRegistrationIDs)
{
//var examinationRegistrationIDList = examinationRegistrationIDs.Split(',').Where(x => x.IndexOf("-") >= 0).Select(x => new Guid(x)).ToList();
//var registrationList = ExamineApplyService.GetExaminationRegistrationPayViewByRegistrationID(examinationRegistrationIDList);
//if (registrationList.Where(x => x.RecordStatus != (int)EX_ExaminationRegistrationStatus.RefundApply).Count() > 0)
//{
// return base.Json("只能对缴费状态是“退费申请”的数据进行审核");
//}
RefundApproveView refundApproveView = new RefundApproveView();
refundApproveView.ExaminationRegistrationIDs = examinationRegistrationIDs;
return View(refundApproveView);
}
public ActionResult RefundApprove(RefundApproveView refundApproveView)
{
try
{
FeeServices.ApproveRefund(refundApproveView);
return RedirectToAction("MsgShow", "Common", new
{
WindowID = Request["WindowID"],
msg = "退费审核成功!",
url = Url.Action("List").AddMenuParameter()
});
}
catch (Exception ex)
{
return RedirectToAction("MsgShow", "Common", new
{
WindowID = Request["WindowID"],
msg = "退费审核失败,原因:" + ex.Message,
url = Url.Action("List").AddMenuParameter()
});
}
}
}
}