78 lines
2.3 KiB
C#
78 lines
2.3 KiB
C#
using YLErp.Modules.ClientCashModule;
|
|
|
|
namespace YLErp.Web.Controllers
|
|
{
|
|
public class client_cash_otherController : BaseController
|
|
{
|
|
private readonly YLContext db = new YLContext();
|
|
|
|
public static List<SelectListItem> GetCashOtherActions()
|
|
{
|
|
return new List<SelectListItem>()
|
|
{
|
|
new SelectListItem() {
|
|
Text = "支出",
|
|
Value = "支出"
|
|
},
|
|
new SelectListItem() {
|
|
Text = "收入",
|
|
Value = "收入"
|
|
}
|
|
};
|
|
}
|
|
|
|
public ActionResult client_cash_otherList()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public ActionResult client_cash_otherEdit(string enid)
|
|
{
|
|
if (string.IsNullOrEmpty(enid))
|
|
{
|
|
var r = new client_cash_other { HappenDate = DateTime.Now };
|
|
return View(r);
|
|
}
|
|
var intid = DecryptInt(enid);
|
|
var record = db.client_cash_other.Find(intid);
|
|
record.Money = Math.Abs(record.Money ?? 0);
|
|
return View(record);
|
|
}
|
|
|
|
public JsonResult client_cash_otherQuery(ClientCashOtherReq req)
|
|
{
|
|
var sList = new ClientCashOtherService(CurUser).SearchClientCashOtherList(req);
|
|
foreach (var x in sList.rows)
|
|
{
|
|
x.Money = Math.Abs(x.Money ?? 0);
|
|
}
|
|
return Json(sList);
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult client_cash_otherEdit(client_cash_other req)
|
|
{
|
|
var record = new ClientCashOtherService(CurUser).SaveClientCashOther(req);
|
|
if (record == null)
|
|
{
|
|
return JsonError("交易确认规则名称重复,保存失败");
|
|
}
|
|
return Json(record);
|
|
}
|
|
|
|
public JsonResult Deleteclient_cash_other(string enid)
|
|
{
|
|
if (string.IsNullOrEmpty(enid))
|
|
{
|
|
return JsonError("请选择要删除的记录");
|
|
}
|
|
|
|
var intid = DecryptInt(enid);
|
|
var record = db.client_cash_other.Find(intid);
|
|
db.client_cash_other.Remove(record);
|
|
db.SaveChanges();
|
|
|
|
return JsonSuccess("删除成功");
|
|
}
|
|
}
|
|
} |