目录
1、 InsuranceclaimsController
1.1、 单据查询
1.1.1、 //客户编号
1.1.2、 //结算状态名称
1.1.3、 //索赔单号
using QXQPS.Models;
using QXQPS.Vo;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace QXQPS.Areas.MechanicsManagment.Controllers
{
public class InsuranceclaimsController : Controller
{
// GET: MechanicsManagment/Insuranceclaims
Models.QXQPEntities myModels = new Models.QXQPEntities();
public ActionResult SelectInsurance(BsgridPage bsgridPage, string MaintenanceNum, string CarNum, int DocumentStateID, int BalanceStateID, string ToAudit)//单据查询
{
var lingItem = (from tbInsurance in myModels.PW_Insurance
join tbInsuranceDetail in myModels.SYS_InsuranceDetail on tbInsurance.InsuranceDetailID equals tbInsuranceDetail.InsuranceDetailID
join tbReception in myModels.PW_Reception on tbInsuranceDetail.ReceptionID equals tbReception.ReceptionID
join tbInsuranceCom in myModels.SYS_InsuranceCom on tbInsuranceDetail.InsuranceComID equals tbInsuranceCom.InsuranceComID
join tbRepair in myModels.SYS_Repair on tbReception.RepairID equals tbRepair.RepairID
join tbDocumentState in myModels.SYS_DocumentState on tbReception.DocumentStateID equals tbDocumentState.DocumentStateID
join tbBalanceState in myModels.SYS_BalanceState on tbReception.BalanceStateID equals tbBalanceState.BalanceStateID
join tbCustomerSou in myModels.SYS_CustomerSou on tbReception.CustomerSouID equals tbCustomerSou.CustomerSouID
select new ReceptionVo
{
CustomerNum = tbReception.CustomerNum.Trim(),
ReceptionID = tbReception.ReceptionID,//客户接待ID
DocumentStateID = tbDocumentState.DocumentStateID,//单据状态ID
DocumentState = tbDocumentState.DocumentState.Trim(),//单据状态名称
BalanceStateID = tbBalanceState.BalanceStateID,//结算状态ID
BalanceState = tbBalanceState.BalanceState.Trim(),
CarNum = tbReception.CarNum.Trim(),//车牌
VehicleType = tbReception.VehicleType.Trim(),//车型
MaintenanceNum = tbReception.MaintenanceNum.Trim(),//维修单号
Owner = tbReception.Owner.Trim(),//车主
OpenDates = tbInsurance.OpenDate.ToString(),//开单日期
balanceDates = tbInsurance.BalanceDate.ToString(),//结算日期
ToAudit = tbInsurance.ToAudit,//审核否
InsuranceID = tbInsurance.InsuranceID,//索赔ID
InsuranceDetailID = tbInsuranceDetail.InsuranceDetailID,//索赔明细ID
InsuranceComID = tbInsuranceCom.InsuranceComID,//索赔厂家ID
ClaimStaff = tbInsurance.ClaimsStaff.Trim(),//索赔员工
ToTicket = tbInsurance.ToTicket != true ? "false" : "true",//是否开票
InsuranceNum = tbInsurance.InsuranceNum.Trim(),
ReportNum = tbInsuranceDetail.ReportNum,//报案编号
PolicyNum = tbInsuranceDetail.PolicyNum,//保单号
PolicyMoney = (decimal)tbInsuranceDetail.PolicyMoney,//保单金额
Amount = tbInsurance.Amount,//总金额
Describe = tbInsurance.Remark.Trim(),//备注
}).ToList();
#region 拼接条件
if (!string.IsNullOrEmpty(MaintenanceNum))
{
lingItem = lingItem.Where(m => m.MaintenanceNum.Contains(MaintenanceNum)).ToList();
}
if (!string.IsNullOrEmpty(CarNum))
{
lingItem = lingItem.Where(m => m.CarNum == CarNum).ToList();
}
if (!string.IsNullOrEmpty(ToAudit))
{
if (ToAudit == "true")
{
lingItem = lingItem.Where(m => m.ToAudit == true).ToList();
}
else
{
lingItem = lingItem.Where(m => m.ToAudit == false).ToList();
}
}
if (DocumentStateID > 0)
{
lingItem = lingItem.Where(m => m.DocumentStateID == DocumentStateID).ToList();
}
if (BalanceStateID > 0)
{
lingItem = lingItem.Where(m => m.BalanceStateID == BalanceStateID).ToList();
}
#endregion
int count = lingItem.Count();
List<ReceptionVo> listReception = lingItem.OrderBy(m => m.ToAudit).Skip(bsgridPage.GetStartIndex()).Take(bsgridPage.pageSize).ToList();
Bsgrid<ReceptionVo> bsgrid = new Bsgrid<ReceptionVo>()
{
success = true,
totalRows = count,
curPage = bsgridPage.curPage,
data = listReception
};
return Json(bsgrid, JsonRequestBehavior.AllowGet);
}