public IActionResult AddChartAccount(int id) { GL_CHART_OF_ACCOUNTS model = new GL_CHART_OF_ACCOUNTS(); model.GL_C_ACCOUNT_id = id; return(PartialView("~/Views/ChartOfAccount/_AddChartAccount.cshtml", model)); }
public IActionResult UpdateChartAccount(int id, string desc) { GL_CHART_OF_ACCOUNTS data = _db.GL_CHART_OF_ACCOUNTs.Find(id); if (data != null) { data.DESCRIPTION = desc; _db.Entry(data).State = EntityState.Modified; _db.SaveChanges(); } return(Redirect("/Home/ChartAccountsList")); }
public void AddChartAccount(int Id, string Discription) { var parent = _db.GL_CONTROL_ACCOUNTs.Find(Id); var count = _db.GL_CHART_OF_ACCOUNTs.Where(x => x.GL_C_ACCOUNT_id == Id).Count(); GL_CHART_OF_ACCOUNTS obj = new GL_CHART_OF_ACCOUNTS(); if (count == 0) { obj.CONTROL_ACCOUNT_CODE = parent.CHART_OF_ACCOUNT_CODE + "" + 1.ToString().PadLeft(3, '0'); } else { var GetChild = (from c in _db.GL_CHART_OF_ACCOUNTs.Where(x => x.GL_C_ACCOUNT_id == Id) select c).Max(x => x.CONTROL_ACCOUNT_CODE); obj.CONTROL_ACCOUNT_CODE = (Convert.ToInt32(GetChild) + Convert.ToInt32(1.ToString().PadLeft(3, '0'))).ToString(); } obj.DESCRIPTION = Discription; obj.GL_C_ACCOUNT_id = Id; obj.CREATED_BY = 1; obj.CREATION_DATE = DateTime.Now; _db.GL_CHART_OF_ACCOUNTs.Add(obj); _db.SaveChanges(); }
public IActionResult UpdateChartAccount(int id) { GL_CHART_OF_ACCOUNTS data = _db.GL_CHART_OF_ACCOUNTs.Find(id); return(PartialView("~/Views/ChartOfAccount/_EditChartAccount.cshtml", data)); }