public ActionResult DeleteConfirmed(int id)
        {
            var        companyId = Convert.ToInt32(Session["CompanyID"]);
            acc_ledger vendor    = db.acc_ledger.Where(x => x.Company_Id == companyId && x.id == id).FirstOrDefault();

            db.acc_ledger.Remove(vendor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind(Include = "Id,name,description,group_id")] acc_ledger vendor)
        {
            var companyId = Convert.ToInt32(Session["CompanyID"]);

            if (ModelState.IsValid)
            {
                db.Entry(vendor).State = EntityState.Modified;
                vendor.Company_Id      = companyId;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.group_id = new SelectList(db.acc_group.Where(x => x.is_base_group == true || x.Company_Id == companyId), "id", "name");
            return(View(vendor));
        }
        // GET: accGroup/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var        companyId = Convert.ToInt32(Session["CompanyID"]);
            acc_ledger vendor    = db.acc_ledger.Where(x => x.Company_Id == companyId && x.id == id).FirstOrDefault();

            if (vendor == null)
            {
                return(HttpNotFound());
            }
            return(View(vendor));
        }
        // GET: accGroup/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var        companyId = Convert.ToInt32(Session["CompanyID"]);
            acc_ledger vendor    = db.acc_ledger.Where(x => x.Company_Id == companyId && x.id == id).FirstOrDefault();

            if (vendor == null)
            {
                return(HttpNotFound());
            }
            ViewBag.group_id = new SelectList(db.acc_group.Where(x => x.is_base_group == true || x.Company_Id == companyId), "id", "name", vendor.group_id);
            return(View(vendor));
        }
        // GET: accGroup/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var        companyId = Convert.ToInt32(Session["CompanyID"]);
            acc_ledger vendor    = db.acc_ledger.Where(x => x.Company_Id == companyId && x.id == id).FirstOrDefault();

            if (vendor == null)
            {
                return(HttpNotFound());
            }
            db.acc_ledger.Remove(vendor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }