236 lines
8.9 KiB
C#
236 lines
8.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using EAS.Services;
|
|
using SOH.Entities;
|
|
|
|
namespace SOH.BLL
|
|
{
|
|
[ServiceObject("加减项表")]
|
|
[ServiceBind(typeof(It_jjxb))]
|
|
public class t_jjxbBll : It_jjxb
|
|
{
|
|
public String GetjjxByhtbm(int htbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var tmdata = (from jjx in db.t_jjxbs
|
|
join tmm in db.t_ttgzbs
|
|
on jjx.tm equals tmm.tm
|
|
where tmm.htbm == htbm && jjx.jjx == 0 && (tmm.tmztz > 0 || tmm.tmztz == -2)
|
|
select new
|
|
{
|
|
jjx.tm
|
|
}).Distinct();
|
|
var xx = from ttgzb in db.t_ttgzbs
|
|
join tm in tmdata on ttgzb.tm equals tm.tm
|
|
join ht in db.t_htfzbs on ttgzb.htfzbm equals ht.htfzbm
|
|
select new
|
|
{
|
|
htfzmc = ht.htfzmc,
|
|
tm = ttgzb.tm,
|
|
xm = ttgzb.xm,
|
|
xb = ttgzb.xb,
|
|
nl = ttgzb.nl,
|
|
hyzk = ttgzb.hyzk,
|
|
tjrq = ttgzb.tjrq
|
|
};
|
|
if (xx.Any())
|
|
{
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(xx.ToList());
|
|
}
|
|
else return "";
|
|
}
|
|
}
|
|
|
|
public string GetDcjjxmxByhtbm(int htbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var tmdata = (from jjx in db.t_jjxbs
|
|
join tmm in db.t_ttgzbs
|
|
on jjx.tm equals tmm.tm
|
|
where tmm.htbm == htbm && jjx.jjx == 0 && (tmm.tmztz > 0 || tmm.tmztz == -2)
|
|
select new
|
|
{
|
|
jjx.tm
|
|
}).Distinct();
|
|
|
|
var xx = from ttgzb in db.t_ttgzbs
|
|
join tm in tmdata on ttgzb.tm equals tm.tm
|
|
join ht in db.t_htfzbs on ttgzb.htfzbm equals ht.htfzbm
|
|
select new
|
|
{
|
|
htfzmc = ht.htfzmc,
|
|
tm = ttgzb.tm,
|
|
xm = ttgzb.xm,
|
|
xb = ttgzb.xb,
|
|
nl = ttgzb.nl,
|
|
hyzk = ttgzb.hyzk,
|
|
tjrq = ttgzb.tjrq
|
|
};
|
|
|
|
var data = from zhxm in db.t_zhxms
|
|
join jjxb in db.t_jjxbs on zhxm.zhbm equals jjxb.zhbm
|
|
join tt in db.t_ttgzbs on jjxb.tm equals tt.tm
|
|
join ht in db.t_htfzbs on tt.htfzbm equals ht.htfzbm
|
|
join tms in xx on jjxb.tm equals tms.tm
|
|
select new
|
|
{
|
|
htfzmc = ht.htfzmc,
|
|
xm = tt.xm,
|
|
tjrq = tms.tjrq,
|
|
zhmc = zhxm.zhmc,
|
|
jjxlx = (jjxb.jjxlx == 0) ? "减项" : "加项",
|
|
jxgzfbj = (ht.jxgzfbj == 0) ? "公费" : "自费",
|
|
ysfbz = (jjxb.ysfbz == 0) ? "未缴费" : "已缴费",
|
|
jg = jjxb.v_jjxje
|
|
};
|
|
if (data.Any())
|
|
{
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(data.ToList());
|
|
}
|
|
else return "";
|
|
}
|
|
}
|
|
|
|
|
|
public string GetjjxXmBytm(int tm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from zhxm in db.t_zhxms
|
|
join jjxb in db.t_jjxbs on zhxm.zhbm equals jjxb.zhbm
|
|
join tt in db.t_ttgzbs on jjxb.tm equals tt.tm
|
|
join ht in db.t_htfzbs on tt.htfzbm equals ht.htfzbm
|
|
where jjxb.tm == tm
|
|
select new
|
|
{
|
|
zhmc = zhxm.zhmc,
|
|
jjxb.xh,
|
|
jjxb.tm,
|
|
jjxb.zhbm,
|
|
jjxlx = (jjxb.jjxlx == 0) ? "减项" : "加项",
|
|
ysfbz = (jjxb.ysfbz == 0) ? "未缴费" : "已缴费",
|
|
jjxb.zl,
|
|
jjxb.v_jjxje,
|
|
jjxb.czy,
|
|
jjxb.jglx,
|
|
jjxb.jjx,
|
|
jjxb.tjrq,
|
|
jjxb.upflag,
|
|
jxgzfbj = (ht.jxgzfbj == 0) ? "公费" : "自费"
|
|
};
|
|
if (data.Any())
|
|
{
|
|
return Newtonsoft.Json.JsonConvert.SerializeObject(data.ToList());
|
|
}
|
|
else return "";
|
|
}
|
|
}
|
|
|
|
public int GetGfjxhjByHtfzbm(int htfzbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from a in db.t_jjxbs
|
|
join
|
|
b in db.t_ttgzbs
|
|
on a.tm equals b.tm
|
|
where b.htfzbm == htfzbm && a.jjxlx == 0 && a.jjx == 0 && (b.tmztz > 0 || b.tmztz == -2)
|
|
select a.jjxje;
|
|
if (data.Any())
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
int result = data.Sum();
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据合同编码获取有加项的信息
|
|
/// </summary>
|
|
public List<Entities.DTO.dto_jxfz> GetJxxxByHtbm(int htbm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data1 = (from a in db.t_jjxbs
|
|
join b in db.t_ttgzbs
|
|
on a.tm equals b.tm
|
|
where b.htbm == htbm && (b.tmztz > 0 || b.tmztz == -2) && a.jjx == 0 && a.ysfbz == 1
|
|
select new { tm = a.tm }).Distinct();
|
|
if (data1.Any())
|
|
{
|
|
var data2 = from a in data1
|
|
join b in db.t_ttgzbs
|
|
on a.tm equals b.tm
|
|
join c in db.t_htfzbs
|
|
on b.htfzbm equals c.htfzbm
|
|
select new Entities.DTO.dto_jxfz
|
|
{
|
|
htfzmc = c.htfzmc,
|
|
tm = b.tm,
|
|
xm = b.xm,
|
|
xb = b.xb,
|
|
xbmc = b.xb == 0 ? "男" : (b.xb == 1 ? "女" : ""),
|
|
nl = b.nl,
|
|
hyzk = b.hyzk,
|
|
hyzkmc = b.hyzk == 0 ? "未婚" : (b.hyzk == 1 ? "已婚" : "未知"),
|
|
tjrq = b.tjrq
|
|
};
|
|
if (data2.Any())
|
|
{
|
|
return data2.ToList();
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据tm获取加项信息
|
|
/// </summary>
|
|
/// <param name="tm"></param>
|
|
/// <returns></returns>
|
|
public string GetJxByTm(int tm)
|
|
{
|
|
using (DbEntities db = new DbEntities())
|
|
{
|
|
var data = from zhxm in db.t_zhxms
|
|
join jjxb in db.t_jjxbs on zhxm.zhbm equals jjxb.zhbm
|
|
join tt in db.t_ttgzbs on jjxb.tm equals tt.tm
|
|
join ht in db.t_htfzbs on tt.htfzbm equals ht.htfzbm
|
|
where jjxb.tm == tm
|
|
select new
|
|
{
|
|
zhmc = zhxm.zhmc,
|
|
gzfmc = (ht.jxgzfbj == 0) ? "公费" : "自费"
|
|
};
|
|
if (data.Any())
|
|
{
|
|
var data1 = data.ToList();
|
|
string json = Newtonsoft.Json.JsonConvert.SerializeObject(data1);
|
|
return json;
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|