tijian_tieying/web/dccdc/Controllers/sq2Controller.cs
2025-02-20 12:14:39 +08:00

6832 lines
284 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using dccdc.Common;
using dccdc.Models;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Web;
using System.Web.Mvc;
using static dccdc.Controllers.DictionariesController;
namespace dccdc.Controllers
{
public class sq2Controller : Controller
{
List<Droplist> fylyD = new List<Droplist>() { new Droplist { Value = "自有资金", Title = "自有资金" }, new Droplist { Value = "项目经费", Title = "项目经费" } };
List<Droplist> ztD = new List<Droplist>() { new Droplist { Value = "1", Title = "等待科室领导审批" }, new Droplist { Value = "2", Title = "等待分管领导审批" }, new Droplist { Value = "3", Title = "等待内审领导审批" }, new Droplist { Value = "4", Title = "等待所有会签审批" }, new Droplist { Value = "5", Title = "等待备案领导审批" }, new Droplist { Value = "6", Title = "等待财务领导审批" }, new Droplist { Value = "7", Title = "等待中心领导审批" }, new Droplist { Value = "8", Title = "审核完成" }, new Droplist { Value = "-1", Title = "科室领导驳回" }, new Droplist { Value = "-2", Title = "分管领导驳回" }, new Droplist { Value = "-3", Title = "内审领导驳回" }, new Droplist { Value = "-4", Title = "会签驳回" }, new Droplist { Value = "-5", Title = "备案领导驳回" }, new Droplist { Value = "-6", Title = "财务领导驳回" }, new Droplist { Value = "-7", Title = "中心领导驳回" } };
List<Droplist> zfD = new List<Droplist>() { new Droplist { Value = "1", Title = "已支付" }, new Droplist { Value = "0", Title = "未支付" } };
List<Droplist> bxD = new List<Droplist>() { new Droplist { Value = "1", Title = "已报销" }, new Droplist { Value = "0", Title = "未报销" } };
List<Droplist> rkD = new List<Droplist>() { new Droplist { Value = "1", Title = "采购中" }, new Droplist { Value = "2", Title = "已入库" } };
List<Droplist> sortD = new List<Droplist>() { new Droplist { Value = "其他采购支出", Title = "其他采购支出" }, new Droplist { Value = "其他报销支出", Title = "其他报销支出" } };
List<Droplist> cclbD = new List<Droplist> { new Droplist { Value = "市内区县", Title = "市内区县" }, new Droplist { Value = "省内", Title = "省内" }, new Droplist { Value = "省外", Title = "省外" } };
List<Droplist> cclxD = new List<Droplist> { new Droplist { Value = "培训学习", Title = "培训学习" }, new Droplist { Value = "其他", Title = "其他" } };
List<Droplist> gwjdbzD = new List<Droplist> { new Droplist { Value = "省级", Title = "省级" }, new Droplist { Value = "市级", Title = "市级" }, new Droplist { Value = "区级", Title = "区级" } };
List<Droplist> wjlxD = new List<Droplist> { new Droplist { Value = "发票", Title = "发票" }, new Droplist { Value = "车票", Title = "车票" }, new Droplist { Value = "文件", Title = "文件" }, new Droplist { Value = "书名", Title = "书名" }, new Droplist { Value = "其他", Title = "其他" }, new Droplist { Value = "明细", Title = "明细" } };
// GET: sq2
public ActionResult Index()
{
dxcs();
return View();
}
public void dxcs()
{
///////////////////////////////////////////////////////////////// 短信验证码
var commonbll = new BLL.Common();
//发送短信
//http://112.35.1.155:1992/sms/norsubmit
string ydhttp = commonbll.getParm_Value("ydhttp", "http://112.35.1.155:1992/sms/tmpsubmit", "移动短信地址");
ydhttp = "http://112.35.1.155:1992/sms/norsubmit";
var req = new Models.duanxin.msend();
req.ecName = commonbll.getParm_Value("yddxqymc", "德州市德城区疾病预防控制中心", "企业名称");
req.apId = commonbll.getParm_Value("yddxapId", "jkoa", "接口账号用户名");
//req.mobiles = commonbll.getParm_Value("zxshdxtz", "18863836559", "疾控中心审核短信通知");
req.mobiles = "18653582965,18863836559,15864190150";
req.sign = commonbll.getParm_Value("yddxsign", "d37CYmrbG", "签名编码");
//req.content = "您报销审核的验证码是:{[yzm:数字+英文符号总长度6]},请小心保管,不要告诉他人。";
req.content = "米";
req.addSerial = " ";
var md5 = System.Security.Cryptography.MD5.Create();
//secretKey
var bs = md5.ComputeHash(Encoding.UTF8.GetBytes(req.ecName + req.apId + commonbll.getParm_Value("yddxsecretKey", "a7551898", "短信接口密码") + req.mobiles + req.content + req.sign + req.addSerial));
var sb = new StringBuilder();
foreach (byte b in bs)
{
sb.Append(b.ToString("x2"));
}
req.mac = sb.ToString().ToLower();
WebClient wc = new WebClient();
byte[] resp = wc.UploadData(ydhttp, System.Text.Encoding.UTF8.GetBytes(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(req)))));
var nres = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.duanxin.nrecive>(System.Text.Encoding.UTF8.GetString(resp));
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(System.Text.Encoding.UTF8.GetString(resp));
}
public ActionResult success()
{
return View();
}
protected JsonResult TimeJsonResult(object data)
{
return new Common.JsonResultDate()
{
Data = data,
ContentEncoding = null,
ContentType = null,
JsonRequestBehavior = JsonRequestBehavior.DenyGet
};
}
#region
public ActionResult sqfyzc()
{
return View();
}
public ActionResult sqfyzcMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.sortD = new SelectList(sortD, "value", "title");
var kemuD = new BLL.kemu2Bll().GetAllList();
ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqfyzcBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqfyzcModel model = new sqfyzcModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.sort = "其他采购支出";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqfyzcMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.sortD = new SelectList(sortD, "value", "title");
var kemuD = new BLL.kemu2Bll().GetAllList();
ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqfyzcBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqfyzcModel model = new sqfyzcModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.sort = "其他采购支出";
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqfyzcPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqfyzcBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqfyzc(string id, string je, string ymcg, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2, string dydh, string dydh2, string dydh3, string dydh4, string bz, string sort, string items)
{
//物资采购附上项目经费
if (!string.IsNullOrEmpty(dydh) && !string.IsNullOrEmpty(fydh))
new BLL.sqwzcgBll().updateXmjf(dydh, fyly, fydh);
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqfyzcBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, ymcg, fyly1, fyly2, fyly, fydh, fydhs, fydh2, dydh, dydh2, dydh3, dydh4, sort, bz, zt);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, ymcg, fyly1, fyly2, fyly, fydh, fydhs, fydh2, dydh, dydh2, dydh3, dydh4, sort, bz, zt);
}
//确认前进行 项目经费与三重一大自审核通知 只通知最新的del=1
dynamic result4 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result4.State == 1)
{
if (!string.IsNullOrEmpty(fydh))
shOneself2(fydh, "项目经费申请");
if (!string.IsNullOrEmpty(fydh2))
shOneself2(fydh2, "三重一大申请");
}
//修改关联项目经费与三重一大 del状态
dynamic result3 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result3.State == 1)
{
string sortid = result3.id;
int del = -1;
string sort1 = "费用支出添加";
if (!string.IsNullOrEmpty(fydh))
new BLL.xmjfsysqBll().opQd(fydh, sort1, sortid, del);
if (!string.IsNullOrEmpty(fydh2))
new BLL.szyd_zjsysqBll().opQd(fydh2, sort1, sortid, del);
}
//自审核
if (result3.State == 1)
{
shOneself(result3.id == null ? id : result3.id.ToString(), "费用支出申请");
}
return Json(result);
}
public JsonResult deletesqfyzc(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqfyzcBll().delete(id));
}
public JsonResult getsqfyzcmx(string key, string key1, string id)
{
var bllmx = new BLL.sqfyzcmxBll();
var modelmx = bllmx.GetListByParent(id);
return Json(new { Rows = modelmx });
}
#endregion
#region
public ActionResult sqfyzcsh()
{
return View();
}
public ActionResult sqfyzcshMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.sortD = new SelectList(sortD, "value", "title");
var bll = new BLL.sqfyzcBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqfyzcshMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.sortD = new SelectList(sortD, "value", "title");
var bll = new BLL.sqfyzcBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public ActionResult sqfyzchqMessage(string id)
{
var bll = new BLL.sqfyzcBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public JsonResult getsqfyzcshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "3": where += " or (zt=3)"; break; //内审 会签 备案 财务 全部科室
case "4": where += " or (zt=4)"; break;
case "5": where += " or (zt=5)"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += " )";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqfyzcBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqfyzcsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqfyzcBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "费用支出申请";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//if (!string.IsNullOrEmpty(model2.fydh))
//{
// model.type = "经费申请";
// model.sqid = Convert.ToInt32(model2.fydh);
// new BLL.sqshBll().Add(model);
//}
//if (!string.IsNullOrEmpty(model2.fydh2))
//{
// model.type = "三重一大申请";
// model.sqid = Convert.ToInt32(model2.fydh2);
// new BLL.sqshBll().Add(model);
//}
//if (!string.IsNullOrEmpty(model2.dydh))
//{
// model.type = "物资采购";
// model.sqid = Convert.ToInt32(model2.dydh);
// new BLL.sqshBll().Add(model);
//}
//if (!string.IsNullOrEmpty(model2.dydh2))
//{
// model.type = "维修";
// model.sqid = Convert.ToInt32(model2.dydh2);
// new BLL.sqshBll().Add(model);
//}
//if (!string.IsNullOrEmpty(model2.dydh3))
//{
// model.type = "加班用餐";
// model.sqid = Convert.ToInt32(model2.dydh3);
// new BLL.sqshBll().Add(model);
//}
//if (!string.IsNullOrEmpty(model2.dydh4))
//{
// model.type = "公务接待";
// model.sqid = Convert.ToInt32(model2.dydh4);
// new BLL.sqshBll().Add(model);
//}
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqfyzccx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.zfD = new SelectList(zfD, "value", "title");
return View();
}
public JsonResult getsqfyzccxPage(int page, int pagesize, string start, string end, string zt, string zf)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(zf))
{
if (zf == "1")
where += " and zfr is not null";
else
where += " and zfr is null";
}
var bll = new BLL.sqfyzcBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqfyzczf(string id)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqfyzcBll();
return Json(bll.opZf(id, user.ID, user.TrueName));
}
#endregion
#region
[AllowAnonymous]
public string sqfyzcdy(string id)
{
var bll = new BLL.sqfyzcBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp01", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Columns.Add("sp5", typeof(byte[]));
dt.Columns.Add("sp6", typeof(byte[]));
dt.Columns.Add("sp7", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp01"] = Common.Global.getqm(results[0].zfrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
dt.Rows[0]["sp5"] = Common.Global.getqm(results[0].sprid5);
dt.Rows[0]["sp6"] = Common.Global.getqm(results[0].sprid6);
dt.Rows[0]["sp7"] = Common.Global.getqm(results[0].sprid7);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqfyzcdymx(string sqdid)
{
var bll = new BLL.sqfyzcmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
#endregion
#region
public ActionResult sqwzcg()
{
return View();
}
public ActionResult sqwzcgMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.wzlbD = new SelectList(new BLL.wzlbBll().GetAllList("", "1"), "id", "lbmc");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwzcgBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgModel model = new sqwzcgModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqwzcgMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.wzlbD = new SelectList(new BLL.wzlbBll().GetAllList("", "1"), "id", "lbmc");
var wzD = new BLL.wzBll().GetListByKey("", "");
ViewBag.wzD = Newtonsoft.Json.JsonConvert.SerializeObject(wzD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwzcgBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgModel model = new sqwzcgModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public string getwz()
{
var wzD = new BLL.wzBll().GetListByKey("", "");
return Newtonsoft.Json.JsonConvert.SerializeObject(wzD);
}
//互拖备份
public ActionResult sqwzcgMessageNew2(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.wzlbD = new SelectList(new BLL.wzlbBll().GetAllList("", "1"), "id", "lbmc");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwzcgBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgModel model = new sqwzcgModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqwzcgPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqwzcgBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwzcg(string id, string je, string bz, string items, string ymcg, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwzcgBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, zt, ymcg, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, zt, ymcg, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
//确认前进行 项目经费与三重一大自审核通知 只通知最新的del=1
dynamic result4 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result4.State == 1)
{
if (!string.IsNullOrEmpty(fydh))
shOneself2(fydh, "项目经费申请");
if (!string.IsNullOrEmpty(fydh2))
shOneself2(fydh2, "三重一大申请");
}
//修改关联项目经费与三重一大 del状态
dynamic result3 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result3.State == 1)
{
string sortid = result3.id;
int del = -2;
string sort1 = "物资采购添加";
if (!string.IsNullOrEmpty(fydh))
new BLL.xmjfsysqBll().opQd(fydh, sort1, sortid, del);
if (!string.IsNullOrEmpty(fydh2))
new BLL.szyd_zjsysqBll().opQd(fydh2, sort1, sortid, del);
}
//自审核
if (result3.State == 1)
{
shOneself(result3.id == null ? id : result3.id.ToString(), "物资采购");
}
return Json(result);
}
public JsonResult deletesqwzcg(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqwzcgBll().delete(id));
}
public JsonResult getWzsqMx(string key, string key1, string id)
{
var bll = new BLL.wzBll();
var models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.sqwzcgmxBll();
var modelmx = bllmx.GetListByParent(id);
wzModel mm;
foreach (sqwzcgmxModel m in modelmx)
{
mm = new wzModel();
mm.id = m.wzid;
mm.mc = m.wzmc;
mm.ggxh = m.wzgg;
mm.jldw = m.wzdw;
mm.dj = m.dj;
mm.sl = m.sl;
models.Add(mm);
}
}
return Json(new { Rows = models });
}
#endregion
#region
public ActionResult sqwzcgsh()
{
return View();
}
public ActionResult sqwzcgshMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqwzcgBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqwzcgshMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqwzcgBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getsqwzcgshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqwzcgBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwzcgsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwzcgBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "物资采购";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
//public ActionResult rkdMessage(string id)
//{
// ViewBag.gysD = new SelectList(new BLL.gyszdBll().GetAllList(""), "id", "mc");
// ViewBag.rkD = new SelectList(rkD, "value", "title");
// ViewBag.wzlbD = new SelectList(new BLL.wzlbBll().GetAllList("", "1"), "id", "lbmc");
// var bll = new BLL.sqwzcgBll();
// var model = bll.GetAllList(id).First();
// return View(model);
//}
//public JsonResult opSaveStore(string id, string gysid, string gys, string cgje, string zt, string items)
//{
// var user = Session["loginUser"] as Models.ERPUser;
// if (string.IsNullOrEmpty(gysid) || string.IsNullOrEmpty(items))
// return Json(new { State = 0, Message = "false" });
// bool resultP = false;
// var result = new BLL.sqwzcgBll().opRk(id, user.ID, user.TrueName, out resultP);
// if (!resultP)
// return Json(result);
// return Json(new BLL.rkdBll().opSave(id, gysid, gys, cgje, zt, items, user.ID, user.TrueName, 1, Convert.ToInt32(id)));
//}
#endregion
#region
public ActionResult sqwzcgcx(string zt)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.rkD = new SelectList(rkD, "value", "title");
ViewBag.zt = zt;
return View();
}
public JsonResult getsqwzcgcxPage(int page, int pagesize, string start, string end, string zt, string rk)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(rk))
{
if (rk == "1")
where += " and cgr is not null and rkr is null";
if (rk == "2")
where += " and rkr is not null";
}
var bll = new BLL.sqwzcgBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
//采购状态
public JsonResult cgwzcg(string id)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwzcgBll();
var model2 = bll.GetAllList(id).First();
//微信消息通知2
wxxx2(model2.id, model2.sqrid, "采购中", user.TrueName);
return Json(bll.opCg(id, user.ID, user.TrueName));
}
#endregion
#region
[AllowAnonymous]
public string sqwzcgdy(string id)
{
var bll = new BLL.sqwzcgBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqwzcgdymx(string sqdid)
{
var bll = new BLL.sqwzcgmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
#endregion
#region
public ActionResult chooswzcgView(string dydh2)
{
ViewBag.dydh2 = dydh2;
return View();
}
public JsonResult getwzcg(int page, int pagesize, string dydh2)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " zt=8 and sqrid=" + user.ID; //状态=8 自己的单子
if (!string.IsNullOrEmpty(dydh2))
where += " and id in (" + dydh2 + ")";
else
{
string dydh2s = new BLL.sqwzcgbxBll().GetHavedydh2s();
if (!string.IsNullOrEmpty(dydh2s))
{
where += " and id not in (" + dydh2s + ")"; //排除之前报销过的
}
}
var bll = new BLL.sqwzcgBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
public ActionResult chooswzrkView(string dydh)
{
ViewBag.dydh = dydh;
return View();
}
public JsonResult getwzrk(int page, int pagesize, string dydh)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " a.zt=1 and a.rklx=1 ";// and rkrid=" + user.ID; //状态=1已入库 入库类型=1申请单入库 自己的单子
if (!string.IsNullOrEmpty(dydh))
where += " and a.id in (" + dydh + ")";
else
{
string dydhs = new BLL.sqwzcgbxBll().GetHavedydhs();
if (!string.IsNullOrEmpty(dydhs))
{
where += " and a.id not in (" + dydhs + ")"; //排除之前报销过的
}
}
var bll = new BLL.rkdBll();
int count = bll.getCountLevelbx(where);
var models = bll.getPageLevelbx(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
//根据入单单明细自动生成报销内容
public JsonResult getrkdmx(string rkdids)
{
var bll = new BLL.rkdBll();
var models = bll.getrkdmx(rkdids);
return Json(new { Rows = models });
}
//根据申请单明细自动生成报销内容
public JsonResult getsqdmx(string sqdids)
{
var bll = new BLL.rkdBll();
var models = bll.getsqdmx(sqdids);
return Json(new { Rows = models });
}
#endregion
#region
//科室领导、分管领导、内审员、所有会签、备案人、财务、中心主任
//string[] zws = new string[] { "科室领导", "分管领导", "内审员", "会签", "备案人", "财务", "中心主任" };
private List<string> getZW()
{
var user = Session["loginUser"] as Models.ERPUser;
string[] zws = user.ZhiWei.Split(',');
//string[] zws = new string[] { "科室领导", "分管领导", "内审员", "会签", "备案人", "财务", "中心主任" };
List<string> zwss = new List<string>();
if (zws.Contains("科室领导"))
zwss.Add("1");
if (zws.Contains("分管领导"))
zwss.Add("2");
if (zws.Contains("内审员"))
zwss.Add("3");
if (zws.Contains("会签"))
zwss.Add("4");
if (zws.Contains("备案人"))
zwss.Add("5");
if (zws.Contains("财务"))
zwss.Add("6");
if (zws.Contains("中心主任"))
zwss.Add("7");
return zwss;
}
private string getZWOne(string current)
{
var user = Session["loginUser"] as Models.ERPUser;
string[] zws = user.ZhiWei.Split(',');
//string[] zws = new string[] { "科室领导", "分管领导", "内审员", "会签", "备案人", "财务", "中心主任" };
List<string> zwss = new List<string>();
if (zws.Contains("科室领导") && current == "1")
return "科室领导";
if (zws.Contains("分管领导") && current == "2")
return "分管领导";
if (zws.Contains("内审员") && current == "3")
return "内审员";
if (zws.Contains("会签") && current == "4")
return "会签";
if (zws.Contains("备案人") && current == "5")
return "备案人";
if (zws.Contains("财务") && current == "6")
return "财务";
if (zws.Contains("中心主任") && current == "7")
return "中心主任";
return "未知";
}
//包含财务时 跳到财务
private int getZWStart(bool havecw)
{
var user = Session["loginUser"] as Models.ERPUser;
string[] zws = user.ZhiWei.Split(',');
//string[] zws = new string[] {"科室领导", "分管领导", "内审员", "会签", "备案人", "财务"};
//中心主任添加 会保存成上一级别的审核状态 分管领导或财务报销或内审员三重一大在dal方法里处理
if (zws.Contains("中心主任"))
{
//return 8;
if (havecw)
return 6;
return 7;
}
if (zws.Contains("分管领导"))
{
if (havecw)
return 6;
return 7;
}
if (zws.Contains("科室领导"))
{
return 2;
}
return 1;
}
//科室领导 分管领导 中心主任本人添加 补充审核内容
//自审核 不需要审核的通知科室领导
private void shOneself(string id, string type)
{
var user = Session["loginUser"] as Models.ERPUser;
string[] zws = user.ZhiWei.Split(',');
//string[] zws = new string[] {"科室领导", "分管领导", "内审员", "会签", "备案人", "财务"};
//中心主任添加 会保存成上一级别的审核状态 分管领导或财务报销或内审员三重一大在dal方法里处理
//自动补充 因为跳到上一级别的审核状态 还需要自己再次审核 因此不需要补充审核内容
//if (zws.Contains("中心主任"))
//{
//}
string zwone = "";
if (zws.Contains("科室领导"))
{
zwone = "科室领导";
}
if (zws.Contains("分管领导"))
{
zwone = "分管领导";
}
//if (zwone == "")
//{
// //没有自审核 说明是科员(需要通知科室领导) 中心(不需要通知科室领导)
// if (!zws.Contains("中心主任"))
// {
// //通知科室领导
// }
// return;
//}
var model = new sqshModel();
model.type = type;
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = "同意";
model.zt = "通过";
model.spzw = zwone;
if (zwone != "") //sqshModel只有科室领导与分管领导添加 其他用于通知科室领导
{
new BLL.sqshBll().Add(model);
}
switch (type)
{
case "费用支出申请":
var bll1 = new BLL.sqfyzcBll();
var model1 = bll1.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model1.id, model1.sqrid, model1.ksmc, model1.sqr, model1.bz, model, user.UserName);
bll1.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model1.id, model1.sqrid, model1.ksmc, model1.sqr, model1.bz, model, user.UserName);
}
break;
case "物资采购":
var bll2 = new BLL.sqwzcgBll();
var model2 = bll2.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
bll2.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
}
break;
case "项目经费申请":
var bll3 = new BLL.xmjfsysqBll();
var model3 = bll3.GetAllList(id).First();
if (zwone != "")
{
if (model3.del != 1) //项目经费与三重一大 关联添加不处理自审核内通知 等关联主项添加确认后再次执行自审核内通知 (延迟通知 确认后单独通知)
{
//微信消息通知
wxxx(model3.id, model3.sqrid, model3.ksmc, model3.sqr, model3.bz, model, user.UserName);
}
bll3.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
if (model3.del != 1) //项目经费与三重一大 关联添加不处理自审核内通知 等关联主项添加确认后再次执行自审核内通知 (延迟通知 确认后单独通知)
{
//微信消息通知
wxxxksld(model3.id, model3.sqrid, model3.ksmc, model3.sqr, model3.bz, model, user.UserName);
}
}
break;
case "三重一大申请":
var bll4 = new BLL.szyd_zjsysqBll();
var model4 = bll4.GetAllList(id).First();
if (zwone != "")
{
if (model4.del != 1) //项目经费与三重一大 关联添加不处理自审核内通知 等关联主项添加确认后再次执行自审核内通知 (延迟通知 确认后单独通知)
{
//微信消息通知
wxxx(model4.id, model4.sqrid, model4.ksmc, model4.sqr, model4.nr, model, user.UserName);
}
bll4.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
if (model4.del != 1) //项目经费与三重一大 关联添加不处理自审核内通知 等关联主项添加确认后再次执行自审核内通知 (延迟通知 确认后单独通知)
{
//微信消息通知
wxxxksld(model4.id, model4.sqrid, model4.ksmc, model4.sqr, model4.nr, model, user.UserName);
}
}
break;
case "预算申请":
var bll5 = new BLL.sqysBll();
var model5 = bll5.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model5.id, model5.sqrid, model5.ksmc, model5.sqr, model5.bz, model, user.UserName);
bll5.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model5.id, model5.sqrid, model5.ksmc, model5.sqr, model5.bz, model, user.UserName);
}
break;
case "出差申请":
var bll6 = new BLL.chuchai_sqBll();
var model6 = bll6.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model6.id, model6.sqrid, model6.ksmc, model6.sqr, model6.sy, model, user.UserName);
bll6.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model6.id, model6.sqrid, model6.ksmc, model6.sqr, model6.sy, model, user.UserName);
}
break;
case "出差报销":
var bll7 = new BLL.sqccbxBll();
var model7 = bll7.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model7.id, model7.sqrid, model7.ksmc, model7.sqr, model7.bz, model, user.UserName);
bll7.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model7.id, model7.sqrid, model7.ksmc, model7.sqr, model7.bz, model, user.UserName);
}
break;
case "借款申请":
var bll8 = new BLL.sqjkBll();
var model8 = bll8.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model8.id, model8.sqrid, model8.ksmc, model8.sqr, model8.bz, model, user.UserName);
bll8.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model8.id, model8.sqrid, model8.ksmc, model8.sqr, model8.bz, model, user.UserName);
}
break;
case "维修":
var bll9 = new BLL.sqwxBll();
var model9 = bll9.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model9.id, model9.sqrid, model9.ksmc, model9.sqr, model9.bz, model, user.UserName);
bll9.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model9.id, model9.sqrid, model9.ksmc, model9.sqr, model9.bz, model, user.UserName);
}
break;
case "加班用餐":
var bll10 = new BLL.sqjbycBll();
var model10 = bll10.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model10.id, model10.sqrid, model10.ksmc, model10.sqr, model10.bz, model, user.UserName);
bll10.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model10.id, model10.sqrid, model10.ksmc, model10.sqr, model10.bz, model, user.UserName);
}
break;
case "公务接待":
var bll11 = new BLL.sqgwjdBll();
var model11 = bll11.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model11.id, model11.sqrid, model11.ksmc, model11.sqr, model11.bz, model, user.UserName);
bll11.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model11.id, model11.sqrid, model11.ksmc, model11.sqr, model11.bz, model, user.UserName);
}
break;
case "其他报销":
var bll12 = new BLL.sqqtbxBll();
var model12 = bll12.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model12.id, model12.sqrid, model12.ksmc, model12.sqr, model12.bz, model, user.UserName);
bll12.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model12.id, model12.sqrid, model12.ksmc, model12.sqr, model12.bz, model, user.UserName);
}
break;
case "物资采购报销":
var bll13 = new BLL.sqwzcgbxBll();
var model13 = bll13.GetAllList(id).First();
//微信消息通知
if (zwone != "")
{
wxxx(model13.id, model13.sqrid, model13.ksmc, model13.sqr, model13.bz, model, user.UserName);
bll13.opSpOneself(id, user.ID, user.TrueName, "同意", true, zwone);
}
else
{
wxxxksld(model13.id, model13.sqrid, model13.ksmc, model13.sqr, model13.bz, model, user.UserName);
}
break;
}
//var bll = new BLL.sqfyzcBll();
//var bll = new BLL.sqwzcgBll();
//var bll = new BLL.xmjfsysqBll();
//var bll = new BLL.szyd_zjsysqBll();
//var bll = new BLL.sqysBll();
//var bll = new BLL.chuchai_sqBll();
//var bll = new BLL.sqccbxBll();
//var bll = new BLL.sqjkBll();
//var bll = new BLL.sqwxBll();
//var bll = new BLL.sqjbycBll();
//var bll = new BLL.sqgwjdBll();
//var bll = new BLL.sqqtbxBll();
//var bll = new BLL.sqwzcgbxBll();
}
//del=1 关联添加的项目经费与三重一大 跳过通知 要主关联业务修改确定状态前吧del=1 (新加的关联) 通知 也避免了多条通知
//项目经费与三重一大 自审核的延迟通知 等待确认后再通知 但是避免修改的重复确认通知 只通知del=1 新加的项目经费与三重一大
private void shOneself2(string id, string type)
{
var user = Session["loginUser"] as Models.ERPUser;
string[] zws = user.ZhiWei.Split(',');
//string[] zws = new string[] {"科室领导", "分管领导", "内审员", "会签", "备案人", "财务"};
//中心主任添加 会保存成上一级别的审核状态 分管领导或财务报销或内审员三重一大在dal方法里处理
//自动补充 因为跳到上一级别的审核状态 还需要自己再次审核 因此不需要补充审核内容
//if (zws.Contains("中心主任"))
//{
//}
string zwone = "";
if (zws.Contains("科室领导"))
{
zwone = "科室领导";
}
if (zws.Contains("分管领导"))
{
zwone = "分管领导";
}
//if (zwone == "")
//{
// //没有自审核 说明是科员(需要通知科室领导) 中心(不需要通知科室领导)
// if (!zws.Contains("中心主任"))
// {
// //通知科室领导
// }
// return;
//}
var model = new sqshModel();
model.type = type;
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = "同意";
model.zt = "通过";
model.spzw = zwone;
switch (type)
{
case "项目经费申请":
var bll3 = new BLL.xmjfsysqBll();
var model3 = bll3.GetAllList(id).First();
if (zwone != "")
{
if (model3.del == 1) //del==1 代表新的
{
//微信消息通知
wxxx(model3.id, model3.sqrid, model3.ksmc, model3.sqr, model3.bz, model, user.UserName);
}
}
else
{
if (model3.del == 1) //del==1 代表新的
{
//微信消息通知
wxxxksld(model3.id, model3.sqrid, model3.ksmc, model3.sqr, model3.bz, model, user.UserName);
}
}
break;
case "三重一大申请":
var bll4 = new BLL.szyd_zjsysqBll();
var model4 = bll4.GetAllList(id).First();
if (zwone != "")
{
if (model4.del == 1) //del==1 代表新的
{
//微信消息通知
wxxx(model4.id, model4.sqrid, model4.ksmc, model4.sqr, model4.nr, model, user.UserName);
}
}
else
{
if (model4.del == 1) //del==1 代表新的
{
//微信消息通知
wxxxksld(model4.id, model4.sqrid, model4.ksmc, model4.sqr, model4.nr, model, user.UserName);
}
}
break;
}
}
//得到所有子科室id
private string getChildrenKsid(int ksid)
{
var bll = new BLL.ERPBuMenBll();
List<string> result = bll.GetAllChildren(ksid.ToString());
string result2 = string.Join(",", result);
return " (" + result2 + ")";
}
//发送微信消息 需要所有关联的openid
//select openid from ERPUser where id = 32
//select openid from ERPUser where zhiwei like '%中心主任%'
//select openid from ERPUser where zhiwei like '%科室领导%' and department = '财务科'
//select openid from ERPUser where zhiwei like '%分管领导%' and department = (select bumenname from erpbumen where id=(select dirid from erpbumen where bumenname='监督一科'))
//select openid from ERPUser where zhiwei like '%内审员%'
//select openid from ERPUser where zhiwei like '%备案人%'
//select openid from ERPUser where zhiwei like '%财务%'
private void wxxx(int id, int sqrid, string sqks, string sqr, string bz, sqshModel model, string sprusername)
{
//"科室领导", "分管领导", "内审员", "会签", "备案人", "财务", "中心主任"
string sql = "";
var bll = new ERPUserBll();
string template_id = "";
string token = "";
//通知前 处理掉自己的提醒 改成已读
new BLL.ERPLanEmailBll().update(model.type + "|" + id.ToString(), sprusername);
//通知审核人 (只通过通知)
if (model.zt == "通过")
{
switch (model.spzw)
{
case "科室领导":
sql = "select * from ERPUser where zhiwei like '%分管领导%' and department = (select bumenname from erpbumen where id = (select dirid from erpbumen where bumenname = '" + sqks + "'))";
break;
case "分管领导":
sql = "select * from ERPUser where zhiwei like '%中心主任%'";
if (model.type == "出差报销" || model.type == "物资采购报销" || model.type == "其他报销")
{
sql = "select * from ERPUser where zhiwei like '%财务%'";
}
else if (model.type == "三重一大申请")
{
sql = "select * from ERPUser where zhiwei like '%内审员%'";
}
break;
case "内审员":
sql = "select * from ERPUser where zhiwei like '%备案人%'";
break;
case "备案人":
sql = "select * from ERPUser where zhiwei like '%中心主任%'";
break;
case "财务":
sql = "select * from ERPUser where zhiwei like '%中心主任%'";
break;
case "中心主任":
if (model.type == "出差报销" || model.type == "物资采购报销" || model.type == "其他报销")
{
sql = "select * from ERPUser where zhiwei like '%出纳员%'";
}
else if (model.type == "物资采购")
{
sql = "select * from ERPUser where zhiwei like '%总务科%'";
}
break;
}
if (!string.IsNullOrEmpty(sql))
{
List<ERPUser> models = bll.getOpenids(sql);
if (models.Count > 0)
{
foreach (ERPUser m in models)
{
//系统消息
ERPLanEmailModel modelxx = new ERPLanEmailModel();
modelxx.EmailTitle = "【" + sqr + "】的" + model.type + "需要你的审核";
modelxx.TimeStr = DateTime.Now;
modelxx.EmailContent = model.sptime.ToString("yyyy-MM-dd HH:mm") + " " + model.spr + " " + model.spzw + "已审核<br/>" + "申请内容:" + bz;
modelxx.FuJian = "";
modelxx.FromUser = "审核消息";
modelxx.ToUser = m.UserName;
modelxx.EmailState = "未读";
modelxx.type = model.type + "|" + id.ToString();
new BLL.ERPLanEmailBll().save(modelxx);
if (!string.IsNullOrEmpty(m.Openid))
{
template_id = "FsZ3HSb-NNxR3Qu13t3pTU-LV5wxeAv9wp6whyjQc28";
token = dccdc.Common.Global.getAccessToken.access_token;
if (m.Openidtype == 1) //疫苗公众号
{
template_id = "Pa3LFO_jV4z4mbFyMtGVbI6warV7CFbCatGtLVgAqDY";
token = dccdc.Common.Global.getAccessTokenYM.access_token;
}
try
{
var data = new
{
touser = m.Openid,
template_id = template_id,
url = "http://dc.51csharp.com/default.aspx?tjlogout=ok&yhid=" + m.ID.ToString(),
miniprogram = new
{
appid = "wx85cc5d2f79a4ba6d",
pagepath = "pages/index/index?hyid=" + m.ID.ToString(),
},
data = new
{
first = new { value = "【" + sqr + "】的" + model.type + "需要你的审核", color = "#173177" },
keyword1 = new { value = model.spr, color = "#173177" },
keyword2 = new { value = model.sptime.ToString("yyyy-MM-dd HH:mm"), color = "#173177" },
keyword3 = new { value = model.spzw + "已审核", color = "#173177" },
remark = new { value = "申请内容:" + bz, color = "#173177" },
}
};
WebClient wc = new WebClient();
byte[] responseBytes = wc.UploadData("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data)));
string responseText = System.Text.Encoding.UTF8.GetString(responseBytes);
}
catch (Exception ex)
{
}
}
}
}
}
}
//通知本人
sql = "select * from ERPUser where id = " + sqrid;
List<ERPUser> models2 = bll.getOpenids(sql);
if (models2.Count > 0)
{
//系统消息
ERPLanEmailModel modelxx = new ERPLanEmailModel();
modelxx.EmailTitle = "你的" + model.type + "申请已被【" + model.spzw + ":" + model.spr + "】" + (model.zt == "通过" ? "审核通过" : "驳回");
modelxx.TimeStr = DateTime.Now;
modelxx.EmailContent = model.sptime.ToString("yyyy-MM-dd HH:mm") + " " + model.spr + " <br/>" + "审批内容:" + model.spnr;
modelxx.FuJian = "";
modelxx.FromUser = "审核消息";
modelxx.ToUser = models2[0].UserName;
modelxx.EmailState = "未读";
modelxx.type = "";
new BLL.ERPLanEmailBll().save(modelxx);
if (!string.IsNullOrEmpty(models2[0].Openid))
{
template_id = "FsZ3HSb-NNxR3Qu13t3pTU-LV5wxeAv9wp6whyjQc28";
token = dccdc.Common.Global.getAccessToken.access_token;
if (models2[0].Openidtype == 1) //疫苗公众号
{
template_id = "Pa3LFO_jV4z4mbFyMtGVbI6warV7CFbCatGtLVgAqDY";
token = dccdc.Common.Global.getAccessTokenYM.access_token;
}
try
{
var data = new
{
touser = models2[0].Openid,
template_id = template_id,
url = "http://dc.51csharp.com/default.aspx?tjlogout=ok&yhid=" + models2[0].ID.ToString(),
miniprogram = new
{
appid = "wx85cc5d2f79a4ba6d",
pagepath = "pages/index/index?hyid=" + models2[0].ID.ToString(),
},
data = new
{
first = new { value = "你的" + model.type + "申请已被【" + model.spzw + ":" + model.spr + "】" + (model.zt == "通过" ? "审核通过" : "驳回"), color = "#173177" },
keyword1 = new { value = model.spr, color = "#173177" },
keyword2 = new { value = model.sptime.ToString("yyyy-MM-dd HH:mm"), color = "#173177" },
keyword3 = new { value = "申请内容:" + bz, color = "#173177" },
remark = new { value = "审批内容:" + model.spnr, color = "#173177" },
}
};
WebClient wc = new WebClient();
byte[] responseBytes = wc.UploadData("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data)));
string responseText = System.Text.Encoding.UTF8.GetString(responseBytes);
}
catch (Exception ex)
{
}
}
}
}
//通知科室领导
private void wxxxksld(int id, int sqrid, string sqks, string sqr, string bz, sqshModel model, string sprusername)
{
string sql = "select * from ERPUser where zhiwei like '%科室领导%' and department = '" + sqks + "'";
var bll = new ERPUserBll();
string template_id = "";
string token = "";
//通知前 处理掉自己的提醒 改成已读
new BLL.ERPLanEmailBll().update(model.type + "|" + id.ToString(), sprusername);
//通知审核人 (只通过通知)
List<ERPUser> models = bll.getOpenids(sql);
if (models.Count > 0)
{
foreach (ERPUser m in models)
{
//系统消息
ERPLanEmailModel modelxx = new ERPLanEmailModel();
modelxx.EmailTitle = "【" + sqr + "】的" + model.type + "需要你的审核";
modelxx.TimeStr = DateTime.Now;
modelxx.EmailContent = model.sptime.ToString("yyyy-MM-dd HH:mm") + " " + model.spr + " " + "等待科室领导审核<br/>" + "申请内容:" + bz;
modelxx.FuJian = "";
modelxx.FromUser = "审核消息";
modelxx.ToUser = m.UserName;
modelxx.EmailState = "未读";
modelxx.type = model.type + "|" + id.ToString();
new BLL.ERPLanEmailBll().save(modelxx);
if (!string.IsNullOrEmpty(m.Openid))
{
template_id = "FsZ3HSb-NNxR3Qu13t3pTU-LV5wxeAv9wp6whyjQc28";
token = dccdc.Common.Global.getAccessToken.access_token;
if (m.Openidtype == 1) //疫苗公众号
{
template_id = "Pa3LFO_jV4z4mbFyMtGVbI6warV7CFbCatGtLVgAqDY";
token = dccdc.Common.Global.getAccessTokenYM.access_token;
}
try
{
var data = new
{
touser = m.Openid,
template_id = template_id,
url = "http://dc.51csharp.com/default.aspx?tjlogout=ok&yhid=" + m.ID.ToString(),
miniprogram = new
{
appid = "wx85cc5d2f79a4ba6d",
pagepath = "pages/index/index?hyid=" + m.ID.ToString(),
},
data = new
{
first = new { value = "【" + sqr + "】的" + model.type + "需要你的审核", color = "#173177" },
keyword1 = new { value = model.spr, color = "#173177" },
keyword2 = new { value = model.sptime.ToString("yyyy-MM-dd HH:mm"), color = "#173177" },
keyword3 = new { value = "等待科室领导审核", color = "#173177" },
remark = new { value = "申请内容:" + bz, color = "#173177" },
}
};
WebClient wc = new WebClient();
byte[] responseBytes = wc.UploadData("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data)));
string responseText = System.Text.Encoding.UTF8.GetString(responseBytes);
}
catch (Exception ex)
{
}
}
}
}
}
//物资采购 采购 入库 通知本人
private void wxxx2(int id, int sqrid, string bz, string czr)
{
string sql = "";
var bll = new ERPUserBll();
string template_id = "";
string token = "";
//通知本人
sql = "select * from ERPUser where id = " + sqrid;
List<ERPUser> models2 = bll.getOpenids(sql);
if (models2.Count > 0)
{
//系统消息
ERPLanEmailModel modelxx = new ERPLanEmailModel();
modelxx.EmailTitle = "你的物资采购申请:" + bz;
modelxx.TimeStr = DateTime.Now;
modelxx.EmailContent = DateTime.Now.ToString("yyyy-MM-dd HH:mm") + " " + czr + " <br/>" + bz;
modelxx.FuJian = "";
modelxx.FromUser = "审核消息";
modelxx.ToUser = models2[0].UserName;
modelxx.EmailState = "未读";
modelxx.type = "";
new BLL.ERPLanEmailBll().save(modelxx);
if (!string.IsNullOrEmpty(models2[0].Openid))
{
template_id = "FsZ3HSb-NNxR3Qu13t3pTU-LV5wxeAv9wp6whyjQc28";
token = dccdc.Common.Global.getAccessToken.access_token;
if (models2[0].Openidtype == 1) //疫苗公众号
{
template_id = "Pa3LFO_jV4z4mbFyMtGVbI6warV7CFbCatGtLVgAqDY";
token = dccdc.Common.Global.getAccessTokenYM.access_token;
}
try
{
var data = new
{
touser = models2[0].Openid,
template_id = template_id,
url = "http://dc.51csharp.com/default.aspx?tjlogout=ok&yhid=" + models2[0].ID.ToString(),
miniprogram = new
{
appid = "wx85cc5d2f79a4ba6d",
pagepath = "pages/index/index?hyid=" + models2[0].ID.ToString(),
},
data = new
{
first = new { value = "你的物资采购申请:" + bz, color = "#173177" },
keyword1 = new { value = czr, color = "#173177" },
keyword2 = new { value = DateTime.Now.ToString("yyyy-MM-dd HH:mm"), color = "#173177" },
remark = new { value = bz, color = "#173177" },
}
};
WebClient wc = new WebClient();
byte[] responseBytes = wc.UploadData("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data)));
string responseText = System.Text.Encoding.UTF8.GetString(responseBytes);
}
catch (Exception ex)
{
}
}
}
}
//上传文件
public JsonResult uploadFile()
{
if (Request.Files.Count > 0)
{
string root = "/uploadFile1";
if (!Directory.Exists(Server.MapPath(root)))
Directory.CreateDirectory(Server.MapPath(root));
HttpPostedFileBase file = Request.Files[0];
if (file.ContentLength > 10240000)
return Json(new { state = false, url = "", msg = "大小超出范围" });
string extension = Path.GetExtension(file.FileName).ToLower();
if (extension != ".jpg" && extension != ".jpeg" && extension != ".png" && extension != ".gif" && extension != ".pdf" && extension != ".doc" && extension != ".docx" && extension != ".xls" && extension != ".xlsx" && extension != ".txt")
return Json(new { state = false, url = "", msg = "不允许的文件格式" });
string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + extension;
string filepath = root + "/" + filename;
try
{
file.SaveAs(Server.MapPath(filepath));
return Json(new { state = true, url = filepath });
}
catch (Exception ex)
{
return Json(new { state = false, url = "", msg = ex.Message });
}
}
else
{
return Json(new { state = false, url = "", msg = "没有文件" });
}
}
//导出
public JsonResult export(string sqdid)
{
try
{
var main = new BLL.sqysBll().GetAllList(sqdid)[0];
var detail = new BLL.sqysBll().getMxBysqdid(sqdid);
//创建Excel文件的对象
NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook();
//添加一个sheet
NPOI.SS.UserModel.ISheet sheet1 = book.CreateSheet("Sheet1");
sheet1.SetColumnWidth(0, 13 * 350);
sheet1.SetColumnWidth(1, 13 * 350);
sheet1.SetColumnWidth(2, 13 * 350);
sheet1.SetColumnWidth(3, 13 * 200);
sheet1.SetColumnWidth(4, 13 * 600);
NPOI.SS.UserModel.IRow row0 = sheet1.CreateRow(0);
row0.CreateCell(0).SetCellValue("单号:" + main.sqdh);
row0.CreateCell(1).SetCellValue(main.ksmc + "-" + main.sqr);
row0.CreateCell(2).SetCellValue("年份:" + main.year);
row0.CreateCell(3).SetCellValue("金额:" + main.je.ToString());
row0.CreateCell(4).SetCellValue("日期:" + main.sqsj.ToString());
//给sheet1添加第一行的头部标题
NPOI.SS.UserModel.IRow row1 = sheet1.CreateRow(2);
row1.CreateCell(0).SetCellValue("经费类别");
row1.CreateCell(1).SetCellValue("经费名称");
row1.CreateCell(2).SetCellValue("科目名称");
row1.CreateCell(3).SetCellValue("申请金额");
row1.CreateCell(4).SetCellValue("测算依据");
//将数据逐步写入sheet1各个行
for (int i = 0; i < detail.Count; i++)
{
NPOI.SS.UserModel.IRow rowtemp = sheet1.CreateRow(i + 3);
rowtemp.CreateCell(0).SetCellValue(detail[i].jflbmc);
rowtemp.CreateCell(1).SetCellValue(detail[i].jfmc);
rowtemp.CreateCell(2).SetCellValue(detail[i].kmmc);
rowtemp.CreateCell(3).SetCellValue(detail[i].dj.ToString());
rowtemp.CreateCell(4).SetCellValue(string.IsNullOrEmpty(detail[i].csyj) ? "" : detail[i].csyj);
}
string fileName = "预算" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
string filePath = "exp/" + fileName;
FileStream fs = new FileStream(Server.MapPath("\\" + filePath), FileMode.Create);
book.Write(fs);
fs.Close();
return Json(new { State = 1, Message = "导出成功", Path = "/" + filePath });
}
catch (Exception ex)
{
return Json(new { State = 0, Message = "导出失败" + ex.Message });
}
}
//金额转大写
public string MoneyToUpper(string strAmount)
{
string functionReturnValue = null;
bool IsNegative = false; // 是否是负数
if (strAmount.Trim().Substring(0, 1) == "-")
{
// 是负数则先转为正数
strAmount = strAmount.Trim().Remove(0, 1);
IsNegative = true;
}
string strLower = null;
string strUpart = null;
string strUpper = null;
int iTemp = 0;
// 保留两位小数 123.489→123.49  123.4→123.4
strAmount = Math.Round(double.Parse(strAmount), 2).ToString();
if (strAmount.IndexOf(".") > 0)
{
if (strAmount.IndexOf(".") == strAmount.Length - 2)
{
strAmount = strAmount + "0";
}
}
else
{
strAmount = strAmount + ".00";
}
strLower = strAmount;
iTemp = 1;
strUpper = "";
while (iTemp <= strLower.Length)
{
switch (strLower.Substring(strLower.Length - iTemp, 1))
{
case ".":
strUpart = "元";
break;
case "0":
strUpart = "零";
break;
case "1":
strUpart = "壹";
break;
case "2":
strUpart = "贰";
break;
case "3":
strUpart = "叁";
break;
case "4":
strUpart = "肆";
break;
case "5":
strUpart = "伍";
break;
case "6":
strUpart = "陆";
break;
case "7":
strUpart = "柒";
break;
case "8":
strUpart = "捌";
break;
case "9":
strUpart = "玖";
break;
}
switch (iTemp)
{
case 1:
strUpart = strUpart + "分";
break;
case 2:
strUpart = strUpart + "角";
break;
case 3:
strUpart = strUpart + "";
break;
case 4:
strUpart = strUpart + "";
break;
case 5:
strUpart = strUpart + "拾";
break;
case 6:
strUpart = strUpart + "佰";
break;
case 7:
strUpart = strUpart + "仟";
break;
case 8:
strUpart = strUpart + "万";
break;
case 9:
strUpart = strUpart + "拾";
break;
case 10:
strUpart = strUpart + "佰";
break;
case 11:
strUpart = strUpart + "仟";
break;
case 12:
strUpart = strUpart + "亿";
break;
case 13:
strUpart = strUpart + "拾";
break;
case 14:
strUpart = strUpart + "佰";
break;
case 15:
strUpart = strUpart + "仟";
break;
case 16:
strUpart = strUpart + "万";
break;
default:
strUpart = strUpart + "";
break;
}
strUpper = strUpart + strUpper;
iTemp = iTemp + 1;
}
strUpper = strUpper.Replace("零拾", "零");
strUpper = strUpper.Replace("零佰", "零");
strUpper = strUpper.Replace("零仟", "零");
strUpper = strUpper.Replace("零零零", "零");
strUpper = strUpper.Replace("零零", "零");
strUpper = strUpper.Replace("零角零分", "整");
strUpper = strUpper.Replace("零分", "整");
strUpper = strUpper.Replace("零角", "零");
strUpper = strUpper.Replace("零亿零万零圆", "亿圆");
strUpper = strUpper.Replace("亿零万零圆", "亿圆");
strUpper = strUpper.Replace("零亿零万", "亿");
strUpper = strUpper.Replace("零万零圆", "万圆");
strUpper = strUpper.Replace("零亿", "亿");
strUpper = strUpper.Replace("零万", "万");
strUpper = strUpper.Replace("零圆", "圆");
strUpper = strUpper.Replace("零零", "零");
// 对壹圆以下的金额的处理
if (strUpper.Substring(0, 1) == "圆")
{
strUpper = strUpper.Substring(1, strUpper.Length - 1);
}
if (strUpper.Substring(0, 1) == "零")
{
strUpper = strUpper.Substring(1, strUpper.Length - 1);
}
if (strUpper.Substring(0, 1) == "角")
{
strUpper = strUpper.Substring(1, strUpper.Length - 1);
}
if (strUpper.Substring(0, 1) == "分")
{
strUpper = strUpper.Substring(1, strUpper.Length - 1);
}
if (strUpper.Substring(0, 1) == "整")
{
strUpper = "零圆整";
}
functionReturnValue = strUpper;
if (IsNegative == true)
{
return "负" + functionReturnValue;
}
else
{
return functionReturnValue;
}
}
//获取验证码
public string getCode()
{
Random rd = new Random();
string yzm = rd.Next(100000, 999999).ToString();
///////////////////////////////////////////////////////////////// 短信验证码
//var commonbll = new BLL.Common();
////发送短信
////http://112.35.1.155:1992/sms/norsubmit
//string ydhttp = commonbll.getParm_Value("ydhttp", "http://112.35.1.155:1992/sms/tmpsubmit", "移动短信地址");
//var req = new Models.duanxin.msend();
//req.ecName = commonbll.getParm_Value("yddxqymc", "德州市德城区疾病预防控制中心", "企业名称");
//req.apId = commonbll.getParm_Value("yddxapId", "jkoa", "接口账号用户名");
//req.mobiles = commonbll.getParm_Value("zxshdxtz", "18863836559", "疾控中心审核短信通知");
//req.sign = commonbll.getParm_Value("yddxsign", "d37CYmrbG", "签名编码");
////req.content = "您报销审核的验证码是:{[yzm:数字+英文符号总长度6]},请小心保管,不要告诉他人。";
//req.templateId = "aded61e87ea940e2a6c0851e1c68bdb4";
//req.addSerial = "";
//string[] parms = new string[1];
//parms[0] = yzm;
//req.parms = Newtonsoft.Json.JsonConvert.SerializeObject(parms);
//var md5 = System.Security.Cryptography.MD5.Create();
////secretKey
//var bs = md5.ComputeHash(Encoding.UTF8.GetBytes(req.ecName + req.apId + commonbll.getParm_Value("yddxsecretKey", "a7551898", "短信接口密码") + req.templateId + req.mobiles + req.parms + req.sign));
//var sb = new StringBuilder();
//foreach (byte b in bs)
//{
// sb.Append(b.ToString("x2"));
//}
//req.mac = sb.ToString().ToLower();
//WebClient wc = new WebClient();
//string upstr = Newtonsoft.Json.JsonConvert.SerializeObject(req);
//upstr = upstr.Replace("parms", "params");
//log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(upstr);
//byte[] resp = wc.UploadData(ydhttp, System.Text.Encoding.UTF8.GetBytes(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(upstr))));
//var nres = Newtonsoft.Json.JsonConvert.DeserializeObject<Models.duanxin.nrecive>(System.Text.Encoding.UTF8.GetString(resp));
//log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType).Info(System.Text.Encoding.UTF8.GetString(resp));
//////////////////////////////////////////////////////////////// 公众号验证码
var user = Session["loginUser"] as Models.ERPUser;
string sql = "select * from ERPUser where id = " + user.ID;
ERPUser model = new ERPUserBll().getOpenids(sql).FirstOrDefault();
if (model != null && !string.IsNullOrEmpty(model.Openid))
{
string template_id = "FsZ3HSb-NNxR3Qu13t3pTU-LV5wxeAv9wp6whyjQc28";
string token = dccdc.Common.Global.getAccessToken.access_token;
if (model.Openidtype == 1) //疫苗公众号
{
template_id = "Fxodt7EjNuGdUAc4X5eqGG2TIL5TlNfq6wrY_eFP0t0";
token = dccdc.Common.Global.getAccessTokenYM.access_token;
}
try
{
var data = new
{
touser = model.Openid,
template_id = template_id,
url = "http://dc.51csharp.com/default.aspx?tjlogout=ok&yhid=" + model.ID.ToString(),
miniprogram = new
{
appid = "wx85cc5d2f79a4ba6d",
pagepath = "pages/index/index?hyid=" + model.ID.ToString(),
},
data = new
{
first = new { value = "疾控审核验证码已生成", color = "#173177" },
keyword1 = new { value = model.TrueName, color = "#173177" },
keyword2 = new { value = yzm, color = "#173177" },
remark = new { value = "", color = "#173177" },
}
};
WebClient wc = new WebClient();
byte[] responseBytes = wc.UploadData("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + token, System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(data)));
string responseText = System.Text.Encoding.UTF8.GetString(responseBytes);
}
catch (Exception ex)
{
}
}
return yzm;
}
#endregion
#region
public JsonResult getsqdy(string type)
{
var bll = new BLL.sqdyBll();
var models = bll.GetListByType(type);
return Json(models);
}
public string savesqdy(string type, string hblx, string hbid)
{
var bll = new BLL.sqdyBll();
var result = bll.Add(new sqdyModel() { type = type, hblx = hblx, hbid = Convert.ToInt32(hbid) });
return result;
}
#endregion
#region
public ActionResult sqView()
{
return View();
}
public ActionResult sqMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.xmjflbD = new SelectList(new BLL.jingfeilbBll().GetAllList("", "1"), "id", "jflbmc");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.xmjfsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
xmjfsysqModel model = new xmjfsysqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.xmjflbD = new SelectList(new BLL.jingfeilbBll().GetAllList("", "1"), "id", "jflbmc");
ViewBag.xmjfD = new SelectList(new BLL.xmjingfeiBll().GetAllList("", "1"), "id", "xmmc");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.xmjfsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
xmjfsysqModel model = new xmjfsysqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.xmjfsysqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesq(string id, string je, string bz, string bz1, string bz2, string bz3, string bz4, string bz5, string bz6, string items, string del, string ksids, string ysid)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.xmjfsysqBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, bz1, bz2, bz3, bz4, bz5, bz6, zt, del, ksids, ysid);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, bz1, bz2, bz3, bz4, bz5, bz6, zt, ksids, ysid);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核
if (result2.State == 1)
{
shOneself(result2.id == null ? id : result2.id.ToString(), "项目经费申请");
}
return Json(result);
}
public JsonResult deleteSqd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.xmjfsysqBll().delete(id));
}
public JsonResult getxmjfbykey(string key, string key1, string id)
{
var bll = new BLL.xmjingfeiBll();
var models = bll.GetListByKey(key, key1);
//修改时 添加已有明细
if (!string.IsNullOrEmpty(id))
{
var bllmx = new BLL.xmjfsysqmxBll();
var modelmx = bllmx.GetListByParent(id);
xmjingfeiModel mm;
foreach (xmjfsysqmxModel m in modelmx)
{
mm = new xmjingfeiModel();
mm.id = m.jfid;
mm.xmmc = m.jfmc;
mm.sqje = m.dj;
models.Add(mm);
}
}
return Json(new { Rows = models });
}
#endregion
#region
public ActionResult sqSp()
{
return View();
}
public ActionResult sqspMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.xmjfsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqspMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.xmjfsysqBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getsqspPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ") and del != 1";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.xmjfsysqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqsp(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.xmjfsysqBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "项目经费申请";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqjfcx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getsqjfcxPage(int page, int pagesize, string start, string end, string zt)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
var bll = new BLL.xmjfsysqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqjfdy(string id)
{
var bll = new BLL.xmjfsysqBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
//经费名称 早期直接关联有 后来关联预算 从预算里面获得
if (string.IsNullOrEmpty(results[0].jfmc))
{
string ysid = results[0].ysid.ToString();
if (!string.IsNullOrEmpty(ysid))
{
var xmjf = new BLL.sqysBll().GetJFMCbyYusuan(ysid);
if (xmjf != null)
{
results[0].jfmc = xmjf.xmmc;
}
}
}
//合并明细项目名称
var mxs = (new BLL.xmjfsysqmxBll()).GetListByParent(id);
List<string> mcs = new List<string>();
foreach (var mx in mxs)
{
mcs.Add(mx.jfmc);
}
results[0].mx = string.Join("|", mcs) + " ";
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqjfdymx(string sqdid)
{
var bll = new BLL.xmjfsysqmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
#endregion
#region
public ActionResult sqjfcx2(string fydhs)
{
ViewBag.fydhs = fydhs;
return View();
}
public JsonResult getsqjfcxPage2(int page, int pagesize, string fydhs)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.xmjfsysqBll();
string haveid = bll.GetHaveid();
if (string.IsNullOrEmpty(haveid))
haveid = "''";
string where = " (del=0 and id not in (" + haveid + ") and ','+ksids+',' like '%," + user.ksid + ",%' )";
if (!string.IsNullOrEmpty(fydhs))
{
where += "or id in (" + fydhs + ")";
}
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region 使
public ActionResult szyd_zjsysqView()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public ActionResult szyd_zjsysqMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cgfsD = new SelectList(new BLL.szyd_cgfsBll().GetAllList(), "cgfs", "cgfs");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.szyd_zjsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
szyd_zjsysqModel model = new szyd_zjsysqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.yjsysj = DateTime.Now;
model.zjxz = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult szyd_zjsysqMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cgfsD = new SelectList(new BLL.szyd_cgfsBll().GetAllList(), "cgfs", "cgfs");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.szyd_zjsysqBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.yjsysj2 = model.yjsysj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
szyd_zjsysqModel model = new szyd_zjsysqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.yjsysj = DateTime.Now;
model.zjxz = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getszyd_sqPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.szyd_zjsysqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult saveszydsq(string id, string je, string nr, string zjxz, string fyly1, string fyly2, string cgfs, string yjsysj, string del)
{
if (string.IsNullOrEmpty(yjsysj))
yjsysj = DateTime.Now.ToString();
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.szyd_zjsysqBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.szyd_sqdSave(id, user.ksid, user.Department, user.ID, user.TrueName, je, nr, zjxz, fyly1, fyly2, cgfs, yjsysj, zt, del);
}
else
{
result = bll.szyd_sqdSave2(id, user.ksid, user.Department, user.ID, user.TrueName, je, nr, zjxz, fyly1, fyly2, cgfs, yjsysj, zt);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核
if (result2.State == 1)
{
shOneself(result2.id == null ? id : result2.id.ToString(), "三重一大申请");
}
return Json(result);
}
public JsonResult deleteSzyd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.szyd_zjsysqBll().delete(id));
}
#endregion
#region
public ActionResult szyd_zjspView()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public ActionResult szyd_zjspMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cgfsD = new SelectList(new BLL.szyd_cgfsBll().GetAllList(), "cgfs", "cgfs");
var bll = new BLL.szyd_zjsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult szyd_zjspMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cgfsD = new SelectList(new BLL.szyd_cgfsBll().GetAllList(), "cgfs", "cgfs");
var bll = new BLL.szyd_zjsysqBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public ActionResult sqszydhqMessage(string id)
{
var bll = new BLL.szyd_zjsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public JsonResult getszydspPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2 ";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "3": where += " or (zt=3)"; break; //内审 会签 备案 全部科室
case "4": where += " or (zt=4)"; break;
case "5": where += " or (zt=5)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ") and del != 1";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.szyd_zjsysqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult saveszydsp(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.szyd_zjsysqBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "三重一大申请"; //添加 查询与添加一致就行
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.nr, model, user.UserName);
return Json(bll.opSzydSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult szyd_zjspSelectView()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getszydspSelectPage(int page, int pagesize, string start, string end, string zt)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
var bll = new BLL.szyd_zjsysqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string szyddy(string id)
{
var bll = new BLL.szyd_zjsysqBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Columns.Add("sp5", typeof(byte[]));
dt.Columns.Add("sp6", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
dt.Rows[0]["sp5"] = Common.Global.getqm(results[0].sprid5);
dt.Rows[0]["sp6"] = Common.Global.getqm(results[0].sprid6);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult sqys()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public ActionResult sqysMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqysBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqysModel model = new sqysModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(true);
model.year = DateTime.Now.Year.ToString();
return View(model);
}
}
public ActionResult sqysMessage2(string items)
{
ViewBag.xmjflbD = new SelectList(new BLL.jingfeilbBll().GetAllList("", "1"), "id", "jflbmc");
ViewBag.xmjfD = Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.xmjingfeiBll().GetAllList("", "1"));
//ViewBag.xmjfD = new SelectList(new BLL.xmjingfeiBll().GetAllList("", "1"), "id", "xmmc");
ViewBag.kemuD = new SelectList(new BLL.kemuBll().GetAllList(), "id", "title");
List<Droplist> slD = new List<Droplist>() { new Droplist { Value = "1", Title = "收入" }, new Droplist { Value = "-1", Title = "支出" } };
ViewBag.slD = new SelectList(slD, "value", "title");
sqysmxModel model = new sqysmxModel();
model.sl = 1; //添加默认支出
model.addorupdate = "add";
if (!string.IsNullOrEmpty(items))
{
string[] items2 = items.Split('|');
//model.jflbid = Convert.ToInt32(items2[0]);
//model.jflbmc = items2[1];
//model.jfid = Convert.ToInt32(items2[2]);
//model.jfmc = items2[3];
//model.kmid = Convert.ToInt32(items2[4]);
//model.kmmc = items2[5];
model.dj = Convert.ToDecimal(items2[0]);
model.sl = Convert.ToDecimal(items2[1]);
model.addorupdate = "update";
model.csyj = items2[2];
model.xmnr = items2[3];
model.xmmb = items2[4];
}
return View(model);
}
public JsonResult getSqysPage(int page, int pagesize, string key, string key2, string year, string zt)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(year))
{
where += " and (year = '" + year + "')";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and (zt = '" + zt + "')";
}
var bll = new BLL.sqysBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult saveSqys(string id, string je, string je2, string je3, string year, string fyly, string bz, string bz2, string xmjfsrid, string xmjfid, string xmjfsrje, string items, string qrsq)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqysBll();
int zt = getZWStart(true);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, je2, je3, year, fyly, bz, bz2, xmjfsrid, xmjfid, xmjfsrje, zt, qrsq);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, je2, je3, year, fyly, bz, bz2, xmjfsrid, xmjfid, xmjfsrje, zt, qrsq);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核 去掉暂存
if (result2.State == 1 && qrsq == "1")
{
shOneself(result2.id == null ? id : result2.id.ToString(), "预算申请");
}
return Json(result);
}
public JsonResult deleteSqys(string id)
{
var bll = new BLL.sqysBll();
return Json(bll.delete(id));
}
public JsonResult getSqysMx(string key, string id)
{
var bllmx = new BLL.sqysmxBll();
var modelmx = bllmx.GetListByParent(id);
return Json(new { Rows = modelmx });
}
#endregion
#region
public ActionResult sqyssp()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public ActionResult sqysspMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
var bll = new BLL.sqysBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getSqysspPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqysBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqyssp(string id, string yj, string ty, string spjea, string spjeb)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqysBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "预算申请"; //添加 查询与添加一致就行
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false, spjea, spjeb));
}
#endregion
#region
public ActionResult sqyscx()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getSqyscxPage(int page, int pagesize, string start, string end, string zt, string key2)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqysBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public ActionResult sqyscx2()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getSqyscxPage2(int page, int pagesize, string start, string end, string zt, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = "1=1 and (sprid1=" + user.ID + " or sprid2=" + user.ID + " or sprid3=" + user.ID + " or sprid4=" + user.ID + ")";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqysBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqysdy(string id)
{
var bll = new BLL.sqysBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqysdymx(string sqdid)
{
var bll = new BLL.sqysmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
#endregion
#region
public ActionResult sqysbx(string all)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//all存在查询所有 没有all查询个人所在部门
ViewBag.disabled = "0";
if (string.IsNullOrEmpty(all))
{
//ViewBag.ksid = (Session["loginUser"] as Models.ERPUser).ksid;
ViewBag.disabled = "1";
}
return View();
}
public ActionResult sqysbx2(string all)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//all存在查询所有 没有all查询个人所在部门
ViewBag.disabled = "0";
if (string.IsNullOrEmpty(all))
{
ViewBag.ksid = (Session["loginUser"] as Models.ERPUser).ksid;
ViewBag.disabled = "1";
}
return View();
}
public string getSqysbxPage(string start, string end, string sqr, string ksid, string year, bool have)
{
//if (string.IsNullOrEmpty(start) && string.IsNullOrEmpty(start))
//{
// return null;
//}
string where = "";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(sqr))
{
where += " and sqr like '%" + sqr + "%'";
}
if (!string.IsNullOrEmpty(ksid))
{
where += " and ksid = '" + ksid + "'";
}
if (!string.IsNullOrEmpty(year))
{
where += " and year = '" + year + "'";
}
if (have)
{
where += " and dj > yyje ";
}
var bll = new BLL.sqysmxBll();
var models = bll.getBXMX(where);
//return Newtonsoft.Json.JsonConvert.SerializeObject(new { data = models );
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = models.Count, Rows = models });
}
#endregion
#region
public ActionResult sqysbxcx(string all)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//all存在查询所有 没有all查询个人所在部门
ViewBag.disabled = "0";
if (string.IsNullOrEmpty(all))
{
ViewBag.ksid = (Session["loginUser"] as Models.ERPUser).ksid;
ViewBag.disabled = "1";
}
return View();
}
//根据bxdid 查询报销明细
public ActionResult sqysbxcxbybxdid(string type, string bxdid)
{
ViewBag.type = type;
ViewBag.bxdid = bxdid;
return View();
}
public string getSqysbxcxPage(string start, string end, string ksid, string type, string bxdid)
{
string where = "";
if (!string.IsNullOrEmpty(start))
{
where += " and aa.czsj >='" + start + "'"; //多表联合 多个czsj
}
if (!string.IsNullOrEmpty(end))
{
where += " and aa.czsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(ksid))
{
where += " and ksid = '" + ksid + "'";
}
if (!string.IsNullOrEmpty(type))
{
where += " and type = '" + type + "'";
}
if (!string.IsNullOrEmpty(bxdid))
{
where += " and bxdid = '" + bxdid + "'";
}
var bll = new BLL.sqysmxBll();
var models = bll.getBXLS(where);
//return Newtonsoft.Json.JsonConvert.SerializeObject(new { data = models );
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = models.Count, Rows = models });
}
#endregion
#region 2
public ActionResult sqysbxcx2(string all)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//all存在查询所有 没有all查询个人所在部门
ViewBag.disabled = "0";
if (string.IsNullOrEmpty(all))
{
ViewBag.ksid = (Session["loginUser"] as Models.ERPUser).ksid;
ViewBag.disabled = "1";
}
return View();
}
//根据bxdid 查询报销明细
public ActionResult sqysbxcxbybxdid2(string type, string bxdid)
{
ViewBag.type = type;
ViewBag.bxdid = bxdid;
return View();
}
public string getSqysbxcxPage2(string start, string end, string ksid, string type, string bxdid)
{
string where = "";
if (!string.IsNullOrEmpty(start))
{
where += " and czsj >='" + start + "'"; //多表联合 多个czsj
}
if (!string.IsNullOrEmpty(end))
{
where += " and czsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(ksid))
{
where += " and ksid = '" + ksid + "'";
}
if (!string.IsNullOrEmpty(type))
{
where += " and type = '" + type + "'";
}
if (!string.IsNullOrEmpty(bxdid))
{
where += " and bxdid = '" + bxdid + "'";
}
var bll = new BLL.sqysBll();
var models = bll.getBXLS(where);
//return Newtonsoft.Json.JsonConvert.SerializeObject(new { data = models );
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = models.Count, Rows = models });
}
#endregion
#region
public ActionResult chuchai_sqView()
{
return View();
}
public JsonResult getchuchai_sqPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.chuchai_sqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public ActionResult chuchai_sqMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cclbD = new SelectList(cclbD, "value", "title");
ViewBag.areaD = new SelectList(new BLL.areaBll().GetChild("0"), "id", "name");
ViewBag.area2D = Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.areaBll().GetAllList());
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.chuchai_sqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
chuchai_sqModel model = new chuchai_sqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.ccsj = DateTime.Now;
model.cclb = "市内区县";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult chuchai_sqMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cclxD = new SelectList(cclxD, "value", "title");
ViewBag.cclbD = new SelectList(cclbD, "value", "title");
ViewBag.areaD = new SelectList(new BLL.areaBll().GetChild("0"), "id", "name");
ViewBag.area2D = Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.areaBll().GetAllList());
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.chuchai_sqBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.ccsj2 = model.ccsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
chuchai_sqModel model = new chuchai_sqModel();
model.sqrid = user.ID; //用于向view传递当前账号id
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.ccsj = DateTime.Now;
model.cclb = "市内区县";
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult savechuchaisq(string id, string je, string cclx, string ccrs, string ccry, string ccryids, string filepath, string sy, string ccsj, string ccts, string ccdd, string cclb, string areaid1, string areaid2, string areaid3, string area, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2)
{
if (string.IsNullOrEmpty(ccsj))
ccsj = DateTime.Now.ToString();
if (string.IsNullOrEmpty(areaid1))
areaid1 = "0";
if (string.IsNullOrEmpty(areaid2))
areaid2 = "0";
if (string.IsNullOrEmpty(areaid3))
areaid3 = "0";
var user = Session["loginUser"] as Models.ERPUser;
//出差人员为空时 赋值当前人员
if (string.IsNullOrEmpty(ccryids))
{
ccryids = user.ID.ToString();
ccry = user.TrueName;
}
var bll = new BLL.chuchai_sqBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.chuchai_sqSave(id, user.ksid, user.Department, user.ID, user.TrueName, je, cclx, ccrs, ccry, ccryids, filepath, sy, ccsj, ccts, ccdd, cclb, areaid1, areaid2, areaid3, area, fyly1, fyly2, fyly, fydh, fydhs, fydh2, zt);
}
else
{
result = bll.CcSave2(id, user.ksid, user.Department, user.ID, user.TrueName, je, cclx, ccrs, ccry, ccryids, filepath, sy, ccsj, ccts, ccdd, cclb, areaid1, areaid2, areaid3, area, fyly1, fyly2, fyly, fydh, fydhs, fydh2, zt);
}
//确认前进行 项目经费与三重一大自审核通知 只通知最新的del=1
dynamic result4 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result4.State == 1)
{
if (!string.IsNullOrEmpty(fydh))
shOneself2(fydh, "项目经费申请");
if (!string.IsNullOrEmpty(fydh2))
shOneself2(fydh2, "三重一大申请");
}
//修改关联项目经费与三重一大 del状态
dynamic result3 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result3.State == 1)
{
string sortid = result3.id;
int del = -3;
string sort1 = "出差添加";
if (!string.IsNullOrEmpty(fydh))
new BLL.xmjfsysqBll().opQd(fydh, sort1, sortid, del);
if (!string.IsNullOrEmpty(fydh2))
new BLL.szyd_zjsysqBll().opQd(fydh2, sort1, sortid, del);
}
//自审核
if (result3.State == 1)
{
shOneself(result3.id == null ? id : result3.id.ToString(), "出差申请");
}
return Json(result);
}
public JsonResult deletechuchai(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.chuchai_sqBll().delete(id));
}
#endregion
#region
public ActionResult chuchai_spView()
{
return View();
}
public ActionResult chuchai_spMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cclbD = new SelectList(cclbD, "value", "title");
var bll = new BLL.chuchai_sqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult chuchai_spMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cclxD = new SelectList(cclxD, "value", "title");
ViewBag.cclbD = new SelectList(cclbD, "value", "title");
var bll = new BLL.chuchai_sqBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getchuchaispPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "3": where += " or (zt=3)"; break; //内审 会签 备案 全部科室
case "4": where += " or (zt=4)"; break;
case "5": where += " or (zt=5)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.chuchai_sqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savechuchaisp(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.chuchai_sqBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "出差申请"; //添加 查询与添加一致就行
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
if (zwone == "中心主任" && ty == "1") //最后一步审核通过 学习心得 同步网站
{
var bll2 = new BLL.sqxxxdBll();
var xxxdlist = bll2.GetAllListbycc(id);
foreach (var xxxd in xxxdlist)
{
bll2.insertXxxsSite(xxxd.bz, xxxd.bz2);
}
}
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.sy, model, user.UserName);
return Json(bll.opCcSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult chuchai_spSelectView()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getchuchaispSelectPage(int page, int pagesize, string start, string end, string zt)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
var bll = new BLL.chuchai_sqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqccdy(string id)
{
var bll = new BLL.chuchai_sqBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult choosccsqView(string type, string dydh)
{
ViewBag.type = type;
ViewBag.dydh = dydh;
return View();
}
//type 学习心得xxxd 出差报销ccbx
public JsonResult getccsq(int page, int pagesize, string type, string dydh)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = "";
if (!string.IsNullOrEmpty(dydh))
where = " id='" + dydh + "'";
else
{
if (type == "ccbx")
{
where = " zt=8 and sqrid=" + user.ID; //状态=8 自己的单子
//排除之前报销过的
string dydhs = new BLL.sqccbxBll().GetHavedydhs();
if (!string.IsNullOrEmpty(dydhs))
{
where += " and id not in (" + dydhs + ")";
}
//包含有过学习心得的
string ccsqds = new BLL.sqxxxdBll().getCcsqds();
if (!string.IsNullOrEmpty(ccsqds))
{
where += " and (cclx!='培训学习' or cclx is null or (cclx='培训学习' and id in (" + ccsqds + ")))";
}
}
else
{
where = " sqrid=" + user.ID + " or ',' + ccryids + ',' like '%," + user.ID + ",%'"; //出差人员包含自己的就行
}
}
var bll = new BLL.chuchai_sqBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
public ActionResult sqxxxd()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public ActionResult sqxxxdMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqxxxdBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.xxsj2 = model.xxsj.ToString("yyyy-MM-dd");
model.ccsj12 = model.ccsj1.ToString("yyyy-MM-dd");
model.ccsj22 = model.ccsj2.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqxxxdModel model = new sqxxxdModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.isdb = true;
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqxxxdPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqxxxdBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
[ValidateInput(false)]
public JsonResult savesqxxxd(string id, string xxsj, string ccsj1, string ccsj2, string xxdd, string cyry, string cyryids, string bz, string bz2, string bz3, string isdb, string ccsqd, string items)
{
if (string.IsNullOrEmpty(xxsj))
xxsj = DateTime.Now.ToString();
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqxxxdBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, xxsj, ccsj1, ccsj2, xxdd, cyry, cyryids, bz, bz2, bz3, isdb, ccsqd, zt);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, xxsj, ccsj1, ccsj2, xxdd, cyry, cyryids, bz, bz2, bz3, isdb, ccsqd, zt);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核
if (result2.State == 1)
{
shOneself(result2.id == null ? id : result2.id.ToString(), "学习心得");
}
return Json(result);
}
public JsonResult deletesqxxxd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqxxxdBll().delete(id));
}
public JsonResult syncSite(string id)
{
var bll2 = new BLL.sqxxxdBll();
var xxxd = bll2.GetAllList(id).FirstOrDefault();
return Json(bll2.insertXxxsSite(xxxd.bz, xxxd.bz2));
}
#endregion
#region
public ActionResult sqxxxdcx()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public JsonResult getsqxxxdcxPage(int page, int pagesize, string start, string end, string key2)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqxxxdBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqxxxddy(string id)
{
var bll = new BLL.sqxxxdBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
//string nohtml = System.Text.RegularExpressions.Regex.Replace(dt.Rows[0]["bz2"].ToString(), "<[^>]+>", "");
//nohtml = System.Text.RegularExpressions.Regex.Replace(nohtml, "&[^;]+;", "");
//dt.Rows[0]["bz2"] = nohtml;
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult sqccbx()
{
return View();
}
public ActionResult sqccbxMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
//var kemuD = new BLL.kemu3Bll().GetAllList();
//ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
var jtgjD = new BLL.kemu4Bll().GetAllList();
ViewBag.jtgjD = Newtonsoft.Json.JsonConvert.SerializeObject(jtgjD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqccbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqccbxModel model = new sqccbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(true);
return View(model);
}
}
public ActionResult sqccbxMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
//var kemuD = new BLL.kemu3Bll().GetAllList();
//ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
var jtgjD = new BLL.kemu4Bll().GetAllList();
ViewBag.jtgjD = Newtonsoft.Json.JsonConvert.SerializeObject(jtgjD);
//附件个数
ViewBag.filecount = "0";
if (!string.IsNullOrEmpty(id))
{
ViewBag.filecount = new BLL.sqfileBll().GetListByKey("出差报销", id, "").Count.ToString();
var bll = new BLL.sqccbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqccbxModel model = new sqccbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(true);
return View(model);
}
}
public ActionResult sqccbxMessage2(string type)
{
var kemuD = new BLL.kemu3Bll().GetAllList();
ViewBag.kemuD = new SelectList(kemuD, "title", "title");
var jtgjD = new BLL.kemu4Bll().GetAllList();
ViewBag.jtgjD = new SelectList(jtgjD, "title", "title");
ViewBag.areaD = new SelectList(new BLL.areaBll().GetChild("0"), "id", "name");
ViewBag.area2D = Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.areaBll().GetAllList());
sqccbxmxModel model = new sqccbxmxModel();
model.begint = DateTime.Now;
model.endt = DateTime.Now;
model.havecb = false;
model.rs = 1;
model.ry = (Session["loginUser"] as Models.ERPUser).TrueName;
return View(model);
}
public ActionResult sqccbxMessage3(string type)
{
ViewBag.areaD = new SelectList(new BLL.areaBll().GetChild("0"), "id", "name");
ViewBag.area2D = Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.areaBll().GetAllList());
return View();
}
public JsonResult getsqccbxPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqccbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqccbx(string id, string je, string fyly, string fydh, string fydhs, string fydh2, string dydh, string bz, string items, string qrsq)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqccbxBll();
int zt = getZWStart(true);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, fyly, fydh, fydhs, fydh2, dydh, bz, zt, qrsq);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, fyly, fydh, fydhs, fydh2, dydh, bz, zt, qrsq);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核 去掉暂存
if (result2.State == 1 && qrsq == "1")
{
shOneself(result2.id == null ? id : result2.id.ToString(), "出差报销");
}
return Json(result);
}
public JsonResult deletesqccbx(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqccbxBll().delete(id));
}
public JsonResult getsqccbxMx(string key, string key1, string id)
{
var bllmx = new BLL.sqccbxmxBll();
var modelmx = bllmx.GetListByParent(id);
var result = TimeJsonResult(new { Rows = modelmx });
return result;
}
#endregion
#region
public ActionResult sqccbxsh()
{
return View();
}
public ActionResult sqccbxshMessage(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqccbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqccbxshMessageNew(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqccbxBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
//是否是出纳
ViewBag.cn = (Session["loginUser"] as Models.ERPUser).ZhiWei.Split(',').Contains("出纳");
return View(model);
}
public JsonResult getsqccbxshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqccbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqccbxsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqccbxBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "出差报销";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqccbxcx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.zfD = new SelectList(zfD, "value", "title");
return View();
}
public JsonResult getsqccbxcxPage(int page, int pagesize, string start, string end, string zt, string zf)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(zf))
{
if (zf == "1")
where += " and zfr is not null";
else
where += " and zfr is null";
}
var bll = new BLL.sqccbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqccbxzf(string id)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqccbxBll();
return Json(bll.opZf(id, user.ID, user.TrueName));
}
#endregion
#region
public ActionResult sqccbxcx2()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.bxD = new SelectList(bxD, "value", "title");
return View();
}
public JsonResult getsqccbxcx2Page(int page, int pagesize, string start, string end, string zt, string bx)
{
string where = "1=1 and fydh != '' and zt>=6"; //必须包含费用单号 并且财务审核后
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(bx))
{
if (bx == "1")
where += " and bxr is not null";
else
where += " and bxr is null";
}
var bll = new BLL.sqccbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqccbxbx(string id, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
//日志
List<sqyssyModel> models = new List<sqyssyModel>();
sqyssyModel m;
foreach (string item in items.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
string[] itemss = item.Split('|');
if (itemss.Length == 2)
{
m = new sqyssyModel();
m.type = "出差报销";
m.ysmxid = Convert.ToInt32(itemss[0]);
m.je = Convert.ToDecimal(itemss[1]);
m.bxdid = Convert.ToInt32(id);
m.czsj = DateTime.Now;
m.czyid = user.ID;
m.czyname = user.TrueName;
models.Add(m);
}
}
new BLL.sqyssyBll().AddList(models);
//预算明细修改已用金额
new BLL.sqysmxBll().updateYyje(items);
var bll = new BLL.sqccbxBll();
return Json(bll.opBx(id, user.ID, user.TrueName));
}
public JsonResult savesqccbxbx2(string id, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
//日志
List<sqbxmx2Model> models = new List<sqbxmx2Model>();
sqbxmx2Model m;
//8 || 4444 | 会议费 | 1,10 || 555 | 维修费 | 99115.7,10 || 777 | 邮电费 | 1,8 || 999 | 邮电费 | 87161
foreach (string item in items.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
string[] itemss = item.Split('|');
if (itemss.Length == 5)
{
m = new sqbxmx2Model();
m.type = "出差报销";
m.bxdid = Convert.ToInt32(id);
m.ysid = Convert.ToInt32(itemss[0]);
m.xmmc = itemss[1];
m.content = itemss[2];
m.kmid = 0;
m.kmmc = itemss[3];
m.je = Convert.ToDecimal(itemss[4]);
m.czsj = DateTime.Now;
m.czyid = user.ID;
m.czyname = user.TrueName;
models.Add(m);
}
}
new BLL.sqbxmx2Bll().AddList(models);
//预算明细修改已用金额
new BLL.sqysBll().updateYyje(items);
var bll = new BLL.sqccbxBll();
return Json(bll.opBx(id, user.ID, user.TrueName));
}
#endregion
#region
[AllowAnonymous]
public string sqccbxdy(string id)
{
var bll = new BLL.sqccbxBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp01", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp01"] = Common.Global.getqm(results[0].zfrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqccbxdymx(string sqdid)
{
var bll = new BLL.sqccbxmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
public string sqccbxdymx2(string sqdid)
{
var bll = new BLL.sqbxmx2Bll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetType("出差报销", sqdid));
}
#endregion
#region
public ActionResult sqjk()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public ActionResult sqjkMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqjkBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqjkModel model = new sqjkModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqjkPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqjkBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqjk(string id, string je, string bz, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqjkBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, zt);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, zt);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核
if (result2.State == 1)
{
shOneself(result2.id == null ? id : result2.id.ToString(), "借款申请");
}
return Json(result);
}
public JsonResult deletesqjk(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqjkBll().delete(id));
}
#endregion
#region
public ActionResult sqjksh()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public ActionResult sqjkshMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqjkBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getsqjkshPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqjkBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqjksh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqjkBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "借款申请";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqjkcx()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.zfD = new SelectList(zfD, "value", "title");
return View();
}
public JsonResult getsqjkcxPage(int page, int pagesize, string start, string end, string zt, string key2, string zf)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(zf))
{
if (zf == "1")
where += " and zfr is not null";
else
where += " and zfr is null";
}
var bll = new BLL.sqjkBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqjkzf(string id)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqjkBll();
return Json(bll.opZf(id, user.ID, user.TrueName));
}
#endregion
#region
[AllowAnonymous]
public string sqjkdy(string id)
{
var bll = new BLL.sqjkBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult sqwx()
{
return View();
}
public ActionResult sqwxMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwxModel model = new sqwxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqwxMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwxModel model = new sqwxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqwxPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqwxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwx(string id, string je, string bz, string bz2, string items, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwxBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, bz2, zt, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, bz2, zt, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
//确认前进行 项目经费与三重一大自审核通知 只通知最新的del=1
dynamic result4 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result4.State == 1)
{
if (!string.IsNullOrEmpty(fydh))
shOneself2(fydh, "项目经费申请");
if (!string.IsNullOrEmpty(fydh2))
shOneself2(fydh2, "三重一大申请");
}
//修改关联项目经费与三重一大 del状态
dynamic result3 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result3.State == 1)
{
string sortid = result3.id;
int del = -4;
string sort1 = "维修添加";
if (!string.IsNullOrEmpty(fydh))
new BLL.xmjfsysqBll().opQd(fydh, sort1, sortid, del);
if (!string.IsNullOrEmpty(fydh2))
new BLL.szyd_zjsysqBll().opQd(fydh2, sort1, sortid, del);
}
//自审核
if (result3.State == 1)
{
shOneself(result3.id == null ? id : result3.id.ToString(), "维修");
}
return Json(result);
}
public JsonResult deletesqwx(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqwxBll().delete(id));
}
#endregion
#region
public ActionResult sqwxsh()
{
return View();
}
public ActionResult sqwxshMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqwxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqwxshMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqwxBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getsqwxshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqwxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwxsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwxBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "维修";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqwxcx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getsqwxcxPage(int page, int pagesize, string start, string end, string zt)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
var bll = new BLL.sqwxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqwxdy(string id)
{
var bll = new BLL.sqwxBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult sqjbyc()
{
return View();
}
public ActionResult sqjbycMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqjbycBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.jbsj2 = model.jbsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqjbycModel model = new sqjbycModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqjbycMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqjbycBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.jbsj2 = model.jbsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqjbycModel model = new sqjbycModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqjbycPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqjbycBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqjbyc(string id, string je, string bz, string jbsj, string jbbz, string jbrs, string jbry, string items, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2)
{
if (string.IsNullOrEmpty(jbsj))
jbsj = DateTime.Now.ToString();
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqjbycBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, jbsj, jbbz, jbrs, jbry, zt, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, jbsj, jbbz, jbrs, jbry, zt, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
//确认前进行 项目经费与三重一大自审核通知 只通知最新的del=1
dynamic result4 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result4.State == 1)
{
if (!string.IsNullOrEmpty(fydh))
shOneself2(fydh, "项目经费申请");
if (!string.IsNullOrEmpty(fydh2))
shOneself2(fydh2, "三重一大申请");
}
//修改关联项目经费与三重一大 del状态
dynamic result3 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result3.State == 1)
{
string sortid = result3.id;
int del = -5;
string sort1 = "加班用餐添加";
if (!string.IsNullOrEmpty(fydh))
new BLL.xmjfsysqBll().opQd(fydh, sort1, sortid, del);
if (!string.IsNullOrEmpty(fydh2))
new BLL.szyd_zjsysqBll().opQd(fydh2, sort1, sortid, del);
}
//自审核
if (result3.State == 1)
{
shOneself(result3.id == null ? id : result3.id.ToString(), "加班用餐");
}
return Json(result);
}
public JsonResult deletesqjbyc(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqjbycBll().delete(id));
}
#endregion
#region
public ActionResult sqjbycsh()
{
return View();
}
public ActionResult sqjbycshMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqjbycBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqjbycshMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqjbycBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getsqjbycshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqjbycBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqjbycsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqjbycBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "加班用餐";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqjbyccx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getsqjbyccxPage(int page, int pagesize, string start, string end, string zt)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
var bll = new BLL.sqjbycBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqjbycdy(string id)
{
var bll = new BLL.sqjbycBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult sqgwjd()
{
return View();
}
public ActionResult sqgwjdMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqgwjdBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqgwjdModel model = new sqgwjdModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqgwjdMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.gwjdbzD = new SelectList(gwjdbzD, "value", "title");
//附件个数
ViewBag.filecount = "0";
if (!string.IsNullOrEmpty(id))
{
ViewBag.filecount = new BLL.sqfileBll().GetListByKey("公务接待", id, "").Count.ToString();
var bll = new BLL.sqgwjdBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.jdsj2 = model.jdsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqgwjdModel model = new sqgwjdModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public JsonResult getsqgwjdPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqgwjdBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqgwjd(string id, string je, string bz, string jdsj, string ddry, string jdld, string sxrs, string pcrs, string lxdh, string zrs, string ycbz, string yjbz, string qtbz, string gzcbz, string gzcrs, string zsbz, string zsrs, string qt, string jdbg, string jcfj, string items, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2)
{
if (string.IsNullOrEmpty(jdsj))
jdsj = DateTime.Now.ToString();
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqgwjdBll();
int zt = getZWStart(false);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, jdsj, ddry, jdld, sxrs, pcrs, lxdh, zrs, ycbz, yjbz, qtbz, gzcbz, gzcrs, zsbz, zsrs, qt, jdbg, jcfj, zt, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, jdsj, ddry, jdld, sxrs, pcrs, lxdh, zrs, ycbz, yjbz, qtbz, gzcbz, gzcrs, zsbz, zsrs, qt, jdbg, jcfj, zt, fyly1, fyly2, fyly, fydh, fydhs, fydh2);
}
//确认前进行 项目经费与三重一大自审核通知 只通知最新的del=1
dynamic result4 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result4.State == 1)
{
if (!string.IsNullOrEmpty(fydh))
shOneself2(fydh, "项目经费申请");
if (!string.IsNullOrEmpty(fydh2))
shOneself2(fydh2, "三重一大申请");
}
//修改关联项目经费与三重一大 del状态
dynamic result3 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
if (result3.State == 1)
{
string sortid = result3.id;
int del = -6;
string sort1 = "公务接待添加";
if (!string.IsNullOrEmpty(fydh))
new BLL.xmjfsysqBll().opQd(fydh, sort1, sortid, del);
if (!string.IsNullOrEmpty(fydh2))
new BLL.szyd_zjsysqBll().opQd(fydh2, sort1, sortid, del);
}
//自审核
if (result3.State == 1)
{
shOneself(result3.id == null ? id : result3.id.ToString(), "公务接待");
}
return Json(result);
}
public JsonResult deletesqgwjd(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqgwjdBll().delete(id));
}
#endregion
#region
public ActionResult sqgwjdsh()
{
return View();
}
public ActionResult sqgwjdshMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqgwjdBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqgwjdshMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqgwjdBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
return View(model);
}
public JsonResult getsqgwjdshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqgwjdBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqgwjdsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqgwjdBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "公务接待";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqgwjdcx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getsqgwjdcxPage(int page, int pagesize, string start, string end, string zt)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
var bll = new BLL.sqgwjdBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
#endregion
#region
[AllowAnonymous]
public string sqgwjddy(string id)
{
var bll = new BLL.sqgwjdBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
#endregion
#region
public ActionResult sqgwjdMessageTx(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqgwjdBll();
var model = bll.GetAllList(id).First();
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.jdsj2 = model.jdsj.ToString("yyyy-MM-dd");
return View(model);
}
public JsonResult savesqgwjdTx(string id, string bz, string bcnr1, string bcnr2, string bcnr3, string bcje)
{
var bll = new BLL.sqgwjdBll();
return Json(bll.bcnr(id, bz, bcnr1, bcnr2, bcnr3, bcje));
}
#endregion
#region
public ActionResult sqqtbx()
{
return View();
}
public ActionResult sqqtbxMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqqtbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqqtbxModel model = new sqqtbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(true);
return View(model);
}
}
public ActionResult sqqtbxMessageNew(string id)
{
var models = new BLL.kemu5Bll().GetListByKey("其他报销费用来源显示部门");
ViewBag.show = false;
if (models.Count > 0)
{
var user = Session["loginUser"] as Models.ERPUser;
//if (models[0].content.Split(',').Contains(user.ksid.ToString()))
//{
// ViewBag.show = true;
//}
if (models[0].content.Split(',').Contains(user.ID.ToString()))
{
ViewBag.show = true;
}
}
ViewBag.ztD = new SelectList(ztD, "value", "title");
//附件个数
ViewBag.filecount = "0";
if (!string.IsNullOrEmpty(id))
{
ViewBag.filecount = new BLL.sqfileBll().GetListByKey("其他报销", id, "").Count.ToString();
var bll = new BLL.sqqtbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqqtbxModel model = new sqqtbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(true);
return View(model);
}
}
public JsonResult getsqqtbxPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqqtbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqqtbx(string id, string je, string bz, string fyly1, string fyly2, string fyly, string fydh, string fydhs, string fydh2, string dydh, string hblx, string sqje, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqqtbxBll();
int zt = getZWStart(true);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, fyly1, fyly2, fyly, fydh, fydhs, fydh2, dydh, hblx, sqje, zt);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, bz, fyly1, fyly2, fyly, fydh, fydhs, fydh2, dydh, hblx, sqje, zt);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核
if (result2.State == 1)
{
shOneself(result2.id == null ? id : result2.id.ToString(), "其他报销");
}
return Json(result);
}
public JsonResult deletesqqtbx(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqqtbxBll().delete(id));
}
public JsonResult getsqqtbxmx(string key, string key1, string id)
{
var bllmx = new BLL.sqqtbxmxBll();
var modelmx = bllmx.GetListByParent(id);
return Json(new { Rows = modelmx });
}
#endregion
#region
public ActionResult sqqtbxsh()
{
return View();
}
public ActionResult sqqtbxshMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqqtbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqqtbxshMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqqtbxBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
//是否是出纳
//ViewBag.cn = true;
ViewBag.cn = (Session["loginUser"] as Models.ERPUser).ZhiWei.Split(',').Contains("出纳");
return View(model);
}
public JsonResult getsqqtbxshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqqtbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqqtbxsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqqtbxBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "其他报销";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqqtbxcx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.zfD = new SelectList(zfD, "value", "title");
return View();
}
public JsonResult getsqqtbxcxPage(int page, int pagesize, string start, string end, string zt, string zf)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(zf))
{
if (zf == "1")
where += " and zfr is not null";
else
where += " and zfr is null";
}
var bll = new BLL.sqqtbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqqtbxzf(string id)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqqtbxBll();
return Json(bll.opZf(id, user.ID, user.TrueName));
}
#endregion
#region
public ActionResult sqqtbxcx2()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.bxD = new SelectList(bxD, "value", "title");
return View();
}
public JsonResult getsqqtbxcx2Page(int page, int pagesize, string start, string end, string zt, string bx)
{
string where = "1=1 and fydh != '' and zt>=6 "; //必须包含费用单号 并且财务审核后
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(bx))
{
if (bx == "1")
where += " and bxr is not null";
else
where += " and bxr is null";
}
var bll = new BLL.sqqtbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqqtbxbx(string id, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
//日志
List<sqyssyModel> models = new List<sqyssyModel>();
sqyssyModel m;
foreach (string item in items.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
string[] itemss = item.Split('|');
if (itemss.Length == 2)
{
m = new sqyssyModel();
m.type = "其他报销";
m.ysmxid = Convert.ToInt32(itemss[0]);
m.je = Convert.ToDecimal(itemss[1]);
m.bxdid = Convert.ToInt32(id);
m.czsj = DateTime.Now;
m.czyid = user.ID;
m.czyname = user.TrueName;
models.Add(m);
}
}
new BLL.sqyssyBll().AddList(models);
//预算明细修改已用金额
new BLL.sqysmxBll().updateYyje(items);
var bll = new BLL.sqqtbxBll();
return Json(bll.opBx(id, user.ID, user.TrueName));
}
public JsonResult savesqqtbxbx2(string id, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
//日志
List<sqbxmx2Model> models = new List<sqbxmx2Model>();
sqbxmx2Model m;
//8 || 4444 | 会议费 | 1,10 || 555 | 维修费 | 99115.7,10 || 777 | 邮电费 | 1,8 || 999 | 邮电费 | 87161
foreach (string item in items.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
string[] itemss = item.Split('|');
if (itemss.Length == 5)
{
m = new sqbxmx2Model();
m.type = "其他报销";
m.bxdid = Convert.ToInt32(id);
m.ysid = Convert.ToInt32(itemss[0]);
m.xmmc = itemss[1];
m.content = itemss[2];
m.kmid = 0;
m.kmmc = itemss[3];
m.je = Convert.ToDecimal(itemss[4]);
m.czsj = DateTime.Now;
m.czyid = user.ID;
m.czyname = user.TrueName;
models.Add(m);
}
}
new BLL.sqbxmx2Bll().AddList(models);
//预算明细修改已用金额
new BLL.sqysBll().updateYyje(items);
var bll = new BLL.sqqtbxBll();
return Json(bll.opBx(id, user.ID, user.TrueName));
}
#endregion
#region
[AllowAnonymous]
public string sqqtbxdy(string id)
{
var bll = new BLL.sqqtbxBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqqtbxdymx(string sqdid)
{
var bll = new BLL.sqqtbxmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
public string sqqtbxdymx2(string sqdid)
{
var bll = new BLL.sqbxmx2Bll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetType("其他报销", sqdid));
}
#endregion
#region
public ActionResult sqwzcgbx()
{
return View();
}
public ActionResult sqwzcgbxMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwzcgbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgbxModel model = new sqwzcgbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(true);
return View(model);
}
}
public ActionResult sqwzcgbxMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
//附件个数
ViewBag.filecount = "0";
if (!string.IsNullOrEmpty(id))
{
ViewBag.filecount = new BLL.sqfileBll().GetListByKey("物资采购报销", id, "").Count.ToString();
var bll = new BLL.sqwzcgbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgbxModel model = new sqwzcgbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(true);
return View(model);
}
}
public JsonResult getsqwzcgbxPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqwzcgbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwzcgbx(string id, string je, string mx, string bz, string fyly, string fydh, string fydhs, string fydh2, string dydh, string dydh2, string sqje, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwzcgbxBll();
int zt = getZWStart(true);
object result;
if (id == "" || id == "0")
{
result = bll.opSave(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, mx, bz, fyly, fydh, fydhs, fydh2, dydh, dydh2, sqje, zt);
}
else
{
result = bll.opSave2(id, user.ksid, user.Department, items, user.ID, user.TrueName, je, mx, bz, fyly, fydh, fydhs, fydh2, dydh, dydh2, sqje, zt);
}
dynamic result2 = Newtonsoft.Json.JsonConvert.DeserializeObject(Newtonsoft.Json.JsonConvert.SerializeObject(result));
//自审核
if (result2.State == 1)
{
shOneself(result2.id == null ? id : result2.id.ToString(), "物资采购报销");
}
return Json(result);
}
public JsonResult deletesqwzcgbx(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqwzcgbxBll().delete(id));
}
public JsonResult getsqwzcgbxmx(string key, string key1, string id)
{
var bllmx = new BLL.sqwzcgbxmxBll();
var modelmx = bllmx.GetListByParent(id);
return Json(new { Rows = modelmx });
}
public JsonResult getsqwzcgByids(string ids)
{
if (string.IsNullOrEmpty(ids))
return null;
var bllmx = new BLL.sqwzcgBll();
string where = "id in (" + ids + ")";
var modelmx = bllmx.getPageLevel(1, 100, where);
return Json(new { Rows = modelmx });
}
public JsonResult getsqwzrkByids(string ids)
{
if (string.IsNullOrEmpty(ids))
return null;
var bllmx = new BLL.rkdBll();
string where = "a.id in (" + ids + ")";
var modelmx = bllmx.getPageLevelbx(1, 100, where);
return Json(new { Rows = modelmx });
}
#endregion
#region
public ActionResult sqwzcgbxsh()
{
return View();
}
public ActionResult sqwzcgbxshMessage(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqwzcgbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
public ActionResult sqwzcgbxshMessageNew(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
var bll = new BLL.sqwzcgbxBll();
var model = bll.GetAllList(id).First();
ViewBag.zw = getZWOne(model.zt.ToString());
//是否是出纳
ViewBag.cn = (Session["loginUser"] as Models.ERPUser).ZhiWei.Split(',').Contains("出纳");
return View(model);
}
public JsonResult getsqwzcgbxshPage(int page, int pagesize, string key)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
var bll = new BLL.sqwzcgbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwzcgbxsh(string id, string yj, string ty)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwzcgbxBll();
var model2 = bll.GetAllList(id).First();
string zwone = getZWOne(model2.zt.ToString());
if (zwone == "未知")
{
return Json(new { State = 0, Message = "未知职务" });
}
var model = new sqshModel();
model.type = "物资采购报销";
model.sqid = Convert.ToInt32(id);
model.spr = user.TrueName;
model.sptime = DateTime.Now;
model.spnr = yj;
model.zt = (ty == "1") ? "通过" : "不通过";
model.spzw = zwone;
new BLL.sqshBll().Add(model);
//微信消息通知
wxxx(model2.id, model2.sqrid, model2.ksmc, model2.sqr, model2.bz, model, user.UserName);
return Json(bll.opSp(id, user.ID, user.TrueName, yj, (ty == "1") ? true : false));
}
#endregion
#region
public ActionResult sqwzcgbxcx()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.zfD = new SelectList(zfD, "value", "title");
return View();
}
public JsonResult getsqwzcgbxcxPage(int page, int pagesize, string start, string end, string zt, string zf)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(zf))
{
if (zf == "1")
where += " and zfr is not null";
else
where += " and zfr is null";
}
var bll = new BLL.sqwzcgbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwzcgbxzf(string id)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqwzcgbxBll();
return Json(bll.opZf(id, user.ID, user.TrueName));
}
#endregion
#region
public ActionResult sqwzcgbxcx2()
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.bxD = new SelectList(bxD, "value", "title");
return View();
}
public JsonResult getsqwzcgbxcx2Page(int page, int pagesize, string start, string end, string zt, string bx)
{
string where = "1=1 and fydh != '' and zt>=6"; //必须包含费用单号 并且财务审核后
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(bx))
{
if (bx == "1")
where += " and bxr is not null";
else
where += " and bxr is null";
}
var bll = new BLL.sqwzcgbxBll();
int count = bll.getCountLevel(where);
var models = bll.getPageLevel(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult savesqwzcgbxbx(string id, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
//日志
List<sqyssyModel> models = new List<sqyssyModel>();
sqyssyModel m;
foreach (string item in items.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
string[] itemss = item.Split('|');
if (itemss.Length == 2)
{
m = new sqyssyModel();
m.type = "物资采购报销";
m.ysmxid = Convert.ToInt32(itemss[0]);
m.je = Convert.ToDecimal(itemss[1]);
m.bxdid = Convert.ToInt32(id);
m.czsj = DateTime.Now;
m.czyid = user.ID;
m.czyname = user.TrueName;
models.Add(m);
}
}
new BLL.sqyssyBll().AddList(models);
//预算明细修改已用金额
new BLL.sqysmxBll().updateYyje(items);
var bll = new BLL.sqwzcgbxBll();
return Json(bll.opBx(id, user.ID, user.TrueName));
}
public JsonResult savesqwzcgbxbx2(string id, string items)
{
var user = Session["loginUser"] as Models.ERPUser;
//日志
List<sqbxmx2Model> models = new List<sqbxmx2Model>();
sqbxmx2Model m;
//8 || 4444 | 会议费 | 1,10 || 555 | 维修费 | 99115.7,10 || 777 | 邮电费 | 1,8 || 999 | 邮电费 | 87161
foreach (string item in items.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
string[] itemss = item.Split('|');
if (itemss.Length == 5)
{
m = new sqbxmx2Model();
m.type = "物资采购报销";
m.bxdid = Convert.ToInt32(id);
m.ysid = Convert.ToInt32(itemss[0]);
m.xmmc = itemss[1];
m.content = itemss[2];
m.kmid = 0;
m.kmmc = itemss[3];
m.je = Convert.ToDecimal(itemss[4]);
m.czsj = DateTime.Now;
m.czyid = user.ID;
m.czyname = user.TrueName;
models.Add(m);
}
}
new BLL.sqbxmx2Bll().AddList(models);
//预算明细修改已用金额
new BLL.sqysBll().updateYyje(items);
var bll = new BLL.sqwzcgbxBll();
return Json(bll.opBx(id, user.ID, user.TrueName));
}
#endregion
#region
[AllowAnonymous]
public string sqwzcgbxdy(string id)
{
var bll = new BLL.sqwzcgbxBll();
if (string.IsNullOrEmpty(id))
return "";
var results = bll.GetAllList(id);
DataTable dt = new DataTable();
if (results.Count > 0)
{
results[0].dxje = MoneyToUpper(results[0].je.ToString());
dt = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(Newtonsoft.Json.JsonConvert.SerializeObject(results));
dt.Columns.Add("sp0", typeof(byte[]));
dt.Columns.Add("sp1", typeof(byte[]));
dt.Columns.Add("sp2", typeof(byte[]));
dt.Columns.Add("sp3", typeof(byte[]));
dt.Columns.Add("sp4", typeof(byte[]));
dt.Rows[0]["sp0"] = Common.Global.getqm(results[0].sqrid);
dt.Rows[0]["sp1"] = Common.Global.getqm(results[0].sprid1);
dt.Rows[0]["sp2"] = Common.Global.getqm(results[0].sprid2);
dt.Rows[0]["sp3"] = Common.Global.getqm(results[0].sprid3);
dt.Rows[0]["sp4"] = Common.Global.getqm(results[0].sprid4);
}
return Newtonsoft.Json.JsonConvert.SerializeObject(dt);
}
[AllowAnonymous]
public string sqwzcgbxdymx(string sqdid)
{
var bll = new BLL.sqwzcgbxmxBll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetListByParent(sqdid));
}
public string sqwzcgbxdymx2(string sqdid)
{
var bll = new BLL.sqbxmx2Bll();
if (string.IsNullOrEmpty(sqdid))
return "";
return Newtonsoft.Json.JsonConvert.SerializeObject(bll.GetType("物资采购报销", sqdid));
}
#endregion
#region
public ActionResult sqhb()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//我的经费申请 我的申请480
//我的三重一大申请 我的申请481
//我的出差申请 我的申请483
//我的维修申请 我的申请485
//我的物资采购申请 我的申请486
//我的接待申请 我的申请487
//我的加班用餐申请 我的申请488
//我的费用支出申请 我的申请534
var user = Session["loginUser"] as Models.ERPUser;
var bll = new dccdc.ERPUserBll();
//List<string> qx = bll.GetQuanxian(user.ID);
List<string> qx = new List<string>();
qx.Add("我的申请480");
qx.Add("我的申请481");
qx.Add("我的申请483");
if (user.Department == "总务科")
qx.Add("我的申请485");
qx.Add("我的申请486");
qx.Add("我的申请487");
qx.Add("我的申请488");
qx.Add("我的申请534");
ViewBag.qxlist = "["
+ (qx.Contains("我的申请483") ? "{ text: '增加出差', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请534") ? ",{ line: true },{ text: '增加费用支出', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请486") ? ",{ line: true },{ text: '增加物资采购', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请485") ? ",{ line: true },{ text: '增加设备维修', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请488") ? ",{ line: true },{ text: '增加加班用餐', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请487") ? ",{ line: true },{ text: '增加公务接待', click: edit, icon: 'add' }" : "")
//+ (qx.Contains("我的申请480") ? ",{ line: true },{ text: '增加项目经费', click: edit, icon: 'add' }" : "")
//+ (qx.Contains("我的申请481") ? ",{ line: true },{ text: '增加三重一大', click: edit, icon: 'add' }" : "")
+ "]";
return View();
}
public JsonResult getsqhbPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqhbBll();
int count = bll.getCountsq(where);
var models = bll.getPagesq(page, pagesize, where);
foreach (var model in models)
{
string groupname = model.hblx + ":" + model.sqdh;
if (string.IsNullOrEmpty(model.groupname))
model.groupname = groupname;
if (!string.IsNullOrEmpty(model.fydh))
{
foreach (var model2 in models)
{
if (model2.hblx == "项目经费" && model2.id == Convert.ToInt32(model.fydh))
{
model2.groupname = groupname;
}
}
}
if (!string.IsNullOrEmpty(model.fydh2))
{
foreach (var model2 in models)
{
if (model2.hblx == "三重一大" && model2.id == Convert.ToInt32(model.fydh2))
{
model2.groupname = groupname;
}
}
}
}
return Json(new { Total = count, Rows = models });
}
public ActionResult sqshhb()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public JsonResult getsqshhbPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "3": where += " or (zt=3)"; break;
case "4": where += " or (zt=4)"; break;
case "5": where += " or (zt=5)"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqhbBll();
int count = bll.getCountsq(where);
var models = bll.getPagesq(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public ActionResult sqhbcx()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
ViewBag.ztD = new SelectList(ztD, "value", "title");
return View();
}
public JsonResult getsqhbcxPage(int page, int pagesize, string start, string end, string zt, string key2, string hblx)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(hblx))
{
where += " and hblx=" + hblx;
}
var bll = new BLL.sqhbBll();
int count = bll.getCountsq(where);
var models = bll.getPagesq(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public ActionResult sqhbcx2(string all, string hblx, string zt)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
hblx = Server.UrlDecode(hblx); //url汉子解码
List<Droplist> hblxD = new List<Droplist>() { new Droplist { Value = "项目经费", Title = "项目经费" }, new Droplist { Value = "三重一大", Title = "三重一大" }, new Droplist { Value = "费用支出", Title = "费用支出" }, new Droplist { Value = "物资采购", Title = "物资采购" }, new Droplist { Value = "设备维修", Title = "设备维修" }, new Droplist { Value = "加班用餐", Title = "加班用餐" }, new Droplist { Value = "公务接待", Title = "公务接待" }, new Droplist { Value = "出差", Title = "出差" } };
ViewBag.hblxD = new SelectList(hblxD, "value", "title", hblx);
ViewBag.ztD = new SelectList(ztD, "value", "title", zt);
ViewBag.all = all;
ViewBag.hblx = hblx;
ViewBag.zt = zt;
return View();
}
public JsonResult getsqhbcxPage2(int page, int pagesize, string start, string end, string zt, string key2, string hblx, string all)
{
string where = "1=1";
if (string.IsNullOrEmpty(all))
{
var user = Session["loginUser"] as Models.ERPUser;
where = "1=1 and (sprid1=" + user.ID + " or sprid2=" + user.ID + " or sprid3=" + user.ID + " or sprid4=" + user.ID + " or sprid5=" + user.ID + " or sprid6=" + user.ID + ")";
}
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(hblx))
{
where += " and hblx='" + hblx + "'";
}
var bll = new BLL.sqhbBll();
int count = bll.getCountsq2(where);
var models = bll.getPagesq2(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public JsonResult getsqhbcxPage2export(string start, string end, string zt, string key2, string hblx, string all)
{
string where = "1=1";
if (string.IsNullOrEmpty(all))
{
var user = Session["loginUser"] as Models.ERPUser;
where = "1=1 and (sprid1=" + user.ID + " or sprid2=" + user.ID + " or sprid3=" + user.ID + " or sprid4=" + user.ID + " or sprid5=" + user.ID + " or sprid6=" + user.ID + ")";
}
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(hblx))
{
where += " and hblx='" + hblx + "'";
}
var bll = new BLL.sqhbBll();
var models = bll.getPagesq2(1, 10000, where);
List<exportModel.sqhbcx2> models2 = new List<exportModel.sqhbcx2>();
foreach (var model in models)
{
models2.Add(new exportModel.sqhbcx2()
{
= model.je,
= model.hblx,
= model.bz,
= model.tjsj,
= model.sqr,
= model.sqdh,
= model.sqsj,
= model.ksmc,
= model.spr1,
= model.sptime1,
= model.spr2,
= model.sptime2,
= model.spr3,
= model.sptime3,
= model.spr4,
= model.sptime4,
= model.spr5,
= model.sptime5
});
}
return Json(Export.ExportExcel(TableListHelper.ToDataTable<exportModel.sqhbcx2>(models2)));
}
public ActionResult bxhb()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//我的出差报销申请 我的申请491
//我的其他报销申请 我的申请541
//我的物资报销申请 我的申请542
var user = Session["loginUser"] as Models.ERPUser;
var bll = new dccdc.ERPUserBll();
List<string> qx = bll.GetQuanxian(user.ID);
qx.Add("我的申请491");
qx.Add("我的申请541");
qx.Add("我的申请542");
ViewBag.qxlist = "["
+ (qx.Contains("我的申请491") ? "{ text: '>出差报销', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请541") ? ",{ line: true },{ text: '>其他报销', click: edit, icon: 'add' }" : "")
+ (qx.Contains("我的申请542") ? ",{ line: true },{ text: '>物资采购报销', click: edit, icon: 'add' }" : "")
+ "]";
return View();
}
public JsonResult getbxhbPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " sqrid=" + user.ID;
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqhbBll();
int count = bll.getCountbx(where);
var models = bll.getPagebx(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public ActionResult bxshhb()
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
return View();
}
public JsonResult getbxshhbPage(int page, int pagesize, string key, string key2)
{
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0)
return Json(null);
string where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "3": where += " or (zt=3)"; break;
case "4": where += " or (zt=4)"; break;
case "5": where += " or (zt=5)"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
var bll = new BLL.sqhbBll();
int count = bll.getCountbx(where);
var models = bll.getPagebx(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
//出纳打印
public ActionResult bxhbcx(string zt)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
ViewBag.ztD = new SelectList(ztD, "value", "title", zt);
ViewBag.zt = zt;
ViewBag.dytype = "bxhbcx";
return View();
}
public JsonResult getbxhbcxPage(int page, int pagesize, string start, string end, string zt, string key2, string hblx)
{
string where = "1=1";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(hblx))
{
where += " and hblx=" + hblx;
}
var bll = new BLL.sqhbBll();
int count = bll.getCountbx(where);
var models = bll.getPagebx(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
public ActionResult bxhbcx2(string all, string hblx, string zt)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
hblx = Server.UrlDecode(hblx); //url汉子解码
List<Droplist> hblxD = new List<Droplist>() { new Droplist { Value = "出差报销", Title = "出差报销" }, new Droplist { Value = "其他报销", Title = "其他报销" }, new Droplist { Value = "物资采购报销", Title = "物资采购报销" } };
ViewBag.hblxD = new SelectList(hblxD, "value", "title", hblx);
ViewBag.ztD = new SelectList(ztD, "value", "title", zt);
ViewBag.all = all;
ViewBag.hblx = hblx;
ViewBag.zt = zt;
return View();
}
public JsonResult getbxhbcxPage2(int page, int pagesize, string start, string end, string zt, string key2, string hblx, string bz, string all)
{
string where = "1=1";
if (string.IsNullOrEmpty(all))
{
var user = Session["loginUser"] as Models.ERPUser;
where = "1=1 and (sprid1=" + user.ID + " or sprid2=" + user.ID + " or sprid3=" + user.ID + " or sprid4=" + user.ID + " or bxrid=" + user.ID + ")";
}
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(zt))
{
where += " and zt=" + zt;
}
if (!string.IsNullOrEmpty(key2))
{
where += " and ksid = " + key2;
}
if (!string.IsNullOrEmpty(hblx))
{
where += " and hblx='" + hblx + "'";
}
if (!string.IsNullOrEmpty(bz))
{
where += " and bz like '%" + bz + "%'";
}
var bll = new BLL.sqhbBll();
int count = bll.getCountbx2(where);
var models = bll.getPagebx2(page, pagesize, where);
return Json(new { Total = count, Rows = models });
}
// 查询交通工具是否包含交通补助
public string bhjtbz(string gj)
{
var bh = new DAL.kemu4Dal().getbhjtbz(gj);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { bhjtbz = bh });
}
#endregion
#region ()
public ActionResult choosqtbxfyzcView(string dydh, string hblx)
{
ViewBag.dydh = dydh;
ViewBag.hblx = Server.UrlEncode(hblx);
return View();
}
//程序过滤不能使用分页
public JsonResult getqtbxfyzc(string dydh, string hblx)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " zt=8 and (hblx ='费用支出' or hblx ='设备维修' or hblx ='加班用餐' or hblx ='公务接待') and sqrid=" + user.ID; //状态=8 自己的单子 除去"物资采购支出"类型的所有
if (!string.IsNullOrEmpty(dydh))
{
if (dydh.Contains(","))
{
string[] dydhs = dydh.Split(',');
string[] hblxs = hblx.Split(',');
where += " and (";
for (var i = 0; i < dydhs.Length; i++)
{
if (i == 0)
where += " (id='" + dydhs[i] + "' and hblx='" + hblxs[i] + "')";
else
where += " or (id='" + dydhs[i] + "' and hblx='" + hblxs[i] + "')";
}
where += " )";
}
else
{
where += " and id='" + dydh + "' and hblx='" + hblx + "' ";
}
var bll = new BLL.sqhbBll();
var models = bll.getPagesq(1, 10000, where);
return Json(new { Total = 0, Rows = models });
}
else
{
var bll = new BLL.sqhbBll();
var models = bll.getPagesq(1, 10000, where);
List<sqhbModel> model2 = new List<sqhbModel>();
var dydhs1 = new BLL.sqqtbxBll().GetHavedydhs();
List<sqqtbxModel> dydhs2 = new List<sqqtbxModel>();
foreach (sqqtbxModel m in dydhs1)
{
if (m.dydh.Contains(","))
{
string[] dydhs = m.dydh.Split(',');
string[] hblxs = m.hblx.Split(',');
for (var i = 0; i < dydhs.Length; i++)
{
dydhs2.Add(new sqqtbxModel() { dydh = dydhs[i], hblx = hblxs[i] });
}
}
else
{
dydhs2.Add(m);
}
}
bool have = false;
foreach (sqhbModel model in models)
{
have = false;
foreach (sqqtbxModel m in dydhs2)
{
if (model.id.ToString() == m.dydh && model.hblx == m.hblx)
{
have = true;
break;
}
}
if (!have)
{
model2.Add(model);
}
}
return Json(new { Total = 0, Rows = model2 });
}
}
#endregion
#region
public ActionResult choosXmjfsrView(string xmjfsrid)
{
ViewBag.xmjfsrid = xmjfsrid;
ViewData["xmjflist"] = new SelectList(new BLL.xmjingfeiBll().GetAllList("", ""), "id", "xmmc");
return View();
}
//程序过滤不能使用分页
public JsonResult getXmjfsr(string xmjfsrid)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " 1=1";
if (!string.IsNullOrEmpty(xmjfsrid))
{
where += " and id='" + xmjfsrid;
var bll = new BLL.xmjfsrBll();
var models = bll.getPage2(1, 1000, where);
return Json(new { Total = 0, Rows = models });
}
else
{
var bll = new BLL.xmjfsrBll();
var models = bll.getPage2(1, 1000, where);
List<xmjfsrModel> model2 = new List<xmjfsrModel>();
var dydhs1 = new BLL.sqysBll().GetAllList("");
List<int> dydhs2 = new List<int>();
foreach (sqysModel m in dydhs1)
{
if (m.xmjfsrid != null)
dydhs2.Add((int)m.xmjfsrid);
}
foreach (xmjfsrModel model in models)
{
if (dydhs2.Contains(model.id))
continue;
model2.Add(model);
}
return Json(new { Total = 0, Rows = model2 });
}
}
#endregion
#region 使
public ActionResult choosYsView(string ysid)
{
ViewBag.ysid = ysid;
return View();
}
//程序过滤不能使用分页
public JsonResult getYs(string ysid)
{
var user = Session["loginUser"] as Models.ERPUser;
string where = " zt=8";
if (!string.IsNullOrEmpty(ysid))
{
where += " and id='" + ysid;
var bll = new BLL.sqysBll();
var models = bll.getPage2(1, 1000, where);
return Json(new { Total = 0, Rows = models });
}
else
{
var bll = new BLL.sqysBll();
var models = bll.getPage2(1, 1000, where);
return Json(new { Total = 0, Rows = models });
}
}
#endregion
#region
public ActionResult sqfyzcMessageNewView(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.sortD = new SelectList(sortD, "value", "title");
var kemuD = new BLL.kemu2Bll().GetAllList();
ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqfyzcBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqfyzcModel model = new sqfyzcModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.sort = "其他采购支出";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqwzcgMessageNewView(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.wzlbD = new SelectList(new BLL.wzlbBll().GetAllList("", "1"), "id", "lbmc");
var wzD = new BLL.wzBll().GetListByKey("", "");
ViewBag.wzD = Newtonsoft.Json.JsonConvert.SerializeObject(wzD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwzcgBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgModel model = new sqwzcgModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.xmjflbD = new SelectList(new BLL.jingfeilbBll().GetAllList("", "1"), "id", "jflbmc");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.xmjfsysqBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
xmjfsysqModel model = new xmjfsysqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult szyd_zjsysqMessageNewView(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cgfsD = new SelectList(new BLL.szyd_cgfsBll().GetAllList(), "cgfs", "cgfs");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.szyd_zjsysqBll();
var model = bll.GetAllList(id).First();
model.yjsysj2 = model.yjsysj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
szyd_zjsysqModel model = new szyd_zjsysqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.yjsysj = DateTime.Now;
model.zjxz = "自有资金";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult chuchai_sqMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
ViewBag.cclbD = new SelectList(cclbD, "value", "title");
ViewBag.areaD = new SelectList(new BLL.areaBll().GetChild("0"), "id", "name");
ViewBag.area2D = Newtonsoft.Json.JsonConvert.SerializeObject(new BLL.areaBll().GetAllList());
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.chuchai_sqBll();
var model = bll.GetAllList(id).First();
model.ccsj2 = model.ccsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
chuchai_sqModel model = new chuchai_sqModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.ccsj = DateTime.Now;
model.cclb = "市内区县";
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqccbxMessageNewView(string id)
{
ViewBag.fylyD = new SelectList(fylyD, "value", "title");
ViewBag.ztD = new SelectList(ztD, "value", "title");
//var kemuD = new BLL.kemu3Bll().GetAllList();
//ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
var jtgjD = new BLL.kemu4Bll().GetAllList();
ViewBag.jtgjD = Newtonsoft.Json.JsonConvert.SerializeObject(jtgjD);
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqccbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqccbxModel model = new sqccbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.fyly = "自有资金";
model.zt = getZWStart(true);
return View(model);
}
}
public ActionResult sqwxMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwxModel model = new sqwxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqjbycMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqjbycBll();
var model = bll.GetAllList(id).First();
model.jbsj2 = model.jbsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqjbycModel model = new sqjbycModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqgwjdMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqgwjdBll();
var model = bll.GetAllList(id).First();
model.jdsj2 = model.jdsj.ToString("yyyy-MM-dd");
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqgwjdModel model = new sqgwjdModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(false);
return View(model);
}
}
public ActionResult sqqtbxMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqqtbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqqtbxModel model = new sqqtbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(true);
return View(model);
}
}
public ActionResult sqwzcgbxMessageNewView(string id)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
if (!string.IsNullOrEmpty(id))
{
var bll = new BLL.sqwzcgbxBll();
var model = bll.GetAllList(id).First();
return View(model);
}
else
{
var user = Session["loginUser"] as Models.ERPUser;
sqwzcgbxModel model = new sqwzcgbxModel();
model.sqr = user.TrueName;
model.ksmc = user.Department;
model.sqdh = "后台生成";
model.sqsj = DateTime.Now;
model.zt = getZWStart(true);
return View(model);
}
}
#endregion
#region oa首页panel
public ActionResult oaIndex(string type)
{
ViewBag.type = type;
ViewBag.title = "待办工作";
if (type == "1")
ViewBag.title = "待办申请工作";
if (type == "2")
ViewBag.title = "待办报销工作";
return View();
}
//待审核的(申请)(申请报销合并)
public string getsqshhb(string type, string key, string id, string username)
{
string where;
if (!string.IsNullOrEmpty(id))
{
where = " id=" + id;
}
else
{
int cc = 0;
var user = Session["loginUser"] as Models.ERPUser;
List<string> zws = getZW();
//非职务人员
if (zws.Count == 0) return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = 0, msg = "success", cc, data = "" }); ;
where = "(1=2";
foreach (string zw in zws)
{
switch (zw)
{
case "1": where += " or (zt=1 and exists (select 1 from oa..erpbumen where id=ksid and chargeMan='" + user.UserName + "'))"; break;
case "2": where += " or (zt=2 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
case "3": where += " or (zt=3)"; break;
case "4": where += " or (zt=4)"; break;
case "5": where += " or (zt=5)"; break;
case "6": where += " or (zt=6)"; break;
case "7": where += " or (zt=7 and ksid in" + getChildrenKsid(user.ksid) + ")"; break;
}
}
where += ")";
if (!string.IsNullOrEmpty(key))
{
where += " and (sqr like '%" + key + "%' or sqdh like '%" + key + "%')";
}
if (!string.IsNullOrEmpty(type))
{
if (type == "1")
where += " and hblx in ('项目经费','三重一大','费用支出','物资采购','设备维修','加班用餐','公务接待','出差','预算','借款')";
if (type == "2")
where += " and hblx in ('出差报销','其他报销','物资采购报销')";
}
}
var bll = new BLL.sqhbBll();
int count = bll.getCounthb(where);
var models = bll.getPagehb(1, 1000, where);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { code = 0, msg = "success", count, data = models });
//return Json(new { Total = count, Rows = models });
}
#endregion
#region
public ActionResult updatedate(string table, string key)
{
ViewBag.ztD = new SelectList(ztD, "value", "title");
List<Droplist> tableD = new List<Droplist>() { new Droplist { Value = "sqfyzc", Title = "费用支出" }, new Droplist { Value = "sqjbyc", Title = "加班用餐" }, new Droplist { Value = "sqgwjd", Title = "公务接待" } };
ViewBag.tableD = new SelectList(tableD, "value", "title");
if (string.IsNullOrEmpty(table) || string.IsNullOrEmpty(key))
{
var model = new sqhb2Model();
return View(model);
}
else
{
var bll = new BLL.sqhbBll();
var model = bll.getdate(table, key);
if (model == null)
return View(new sqhb2Model());
//ligerui时间控件bug 不续与format一致的字符串前台才能显示
model.sqsj2 = model.sqsj == null ? "" : ((DateTime)model.sqsj).ToString("yyyy-MM-dd");
model.tjsj2 = model.tjsj == null ? "" : ((DateTime)model.tjsj).ToString("yyyy-MM-dd");
model.jbsj2 = model.jbsj == null ? "" : ((DateTime)model.jbsj).ToString("yyyy-MM-dd");
model.jdsj2 = model.jdsj == null ? "" : ((DateTime)model.jdsj).ToString("yyyy-MM-dd");
model.sptime12 = model.sptime1 == null ? "" : ((DateTime)model.sptime1).ToString("yyyy-MM-dd");
model.sptime22 = model.sptime2 == null ? "" : ((DateTime)model.sptime2).ToString("yyyy-MM-dd");
model.sptime32 = model.sptime3 == null ? "" : ((DateTime)model.sptime3).ToString("yyyy-MM-dd");
return View(model);
}
}
public JsonResult saveupdatedate(string table, string key, string sqsj, string jbsj, string jdsj, string sptime1, string sptime2, string sptime3)
{
var bll = new BLL.sqhbBll();
var result = bll.savedate(table, key, sqsj, jbsj, jdsj, sptime1, sptime2, sptime3);
return Json(result);
}
#endregion
#region
public ActionResult sqbxmx2(string all, string type, string bxdid)
{
ViewBag.ksD = new SelectList(new BLL.ERPBuMenBll().GetAllList(""), "id", "BuMenName");
//all存在查询所有 没有all查询个人所在部门
ViewBag.disabled = "0";
var kemuD = new BLL.kemu2Bll().GetAllList();
ViewBag.kemuD = Newtonsoft.Json.JsonConvert.SerializeObject(kemuD);
if (string.IsNullOrEmpty(all))
{
//ViewBag.ksid = (Session["loginUser"] as Models.ERPUser).ksid;
ViewBag.disabled = "1";
}
return View();
}
public string getSqysbxPage2(string start, string end, string sqr, string ksid, string year, bool have)
{
string where = "";
if (!string.IsNullOrEmpty(start))
{
where += " and sqsj >='" + start + "'";
}
if (!string.IsNullOrEmpty(end))
{
where += " and sqsj <='" + end + " 23:59:59'";
}
if (!string.IsNullOrEmpty(sqr))
{
where += " and sqr like '%" + sqr + "%'";
}
if (!string.IsNullOrEmpty(ksid))
{
where += " and ksid = '" + ksid + "'";
}
if (!string.IsNullOrEmpty(year))
{
where += " and year = '" + year + "'";
}
if (have)
{
where += " and je > je2 ";
}
var bll = new BLL.sqysBll();
var models = bll.getJFFJ(where);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = models.Count, Rows = models });
}
public string getCwfjBxmx(string type, string id)
{
switch (type)
{
case "ccbx": break;
case "qtbx":
var bll = new BLL.sqqtbxmxBll();
var models = bll.GetListByParent(id);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = models.Count, Rows = models });
case "wzbx":
var bll2 = new BLL.sqwzcgbxmxBll();
var models2 = bll2.GetListByParent(id);
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = models2.Count, Rows = models2 });
}
return Newtonsoft.Json.JsonConvert.SerializeObject(new { Total = 0, Rows = "" });
}
#endregion
#region
public ActionResult sqfile(string type, string sqid)
{
ViewBag.type = type;
ViewBag.sqid = sqid;
ViewBag.wjlxD = new SelectList(wjlxD, "value", "title");
var user = Session["loginUser"] as Models.ERPUser;
ViewBag.truename = user.TrueName;
ViewBag.now = DateTime.Now.ToString("yyyy-MM-dd");
return View();
}
//sqid=0 要加上用户id 存在sqid就不需要用户id
public JsonResult getSqfile(string type, string sqid)
{
var user = Session["loginUser"] as Models.ERPUser;
var bll = new BLL.sqfileBll();
var models = bll.GetListByKey(type, sqid, user.ID.ToString());
return Json(new { Total = 0, Rows = models });
}
public JsonResult saveSqfile(string type, string sqid, string title, string filepath)
{
var user = Session["loginUser"] as Models.ERPUser;
sqfileModel model = new sqfileModel { type = type, sqid = Convert.ToInt32(sqid), sqrid = user.ID, addtime = DateTime.Now, title = title, filepath = filepath, downlog = "" };
var bll = new BLL.sqfileBll();
var result = bll.Add(model);
if (result)
return Json(new { State = 1, Message = "保存成功!" });
else
return Json(new { State = 0, Message = "保存失败!" });
}
public JsonResult deleteSqfile(string id)
{
if (string.IsNullOrEmpty(id))
return Json(null);
return Json(new BLL.sqfileBll().delete(id));
}
public JsonResult savelog(string ids)
{
if (string.IsNullOrEmpty(ids))
return Json(null);
var user = Session["loginUser"] as Models.ERPUser;
return Json(new BLL.sqfileBll().savelog(ids, user.TrueName));
}
public ActionResult viewfile(string paths)
{
return View();
}
#endregion
}
}