// // GET: /NotaCreditoVenta/Pagar public ActionResult Pagar(long id = 0) { int rol = Convert.ToInt16(Session["Rol_id"]); bool Validacion = SEG.ValidarAcceso(rol, "NotaCreditoVenta", "Pagar"); if (Validacion) { nota_credito_venta NCV = db.nota_credito_venta.Where(p => p.id == id).Select(p => p).Single(); NCV.fecha_pagado = DateTime.Today; facturacion FAC = new facturacion(); FAC.TIPO_FACTURACION_id = 2; FAC.M_VENTA_id = Convert.ToInt16(NCV.id); db.facturacion.Add(FAC); try { db.SaveChanges(); } catch (Exception e) { throw e; } return(RedirectToAction("Index")); } else { return(RedirectToAction("Error")); } }
public ActionResult Create(M_Nota_Credito_Venta MNCV) { //Obteniendo el valor del Master int Maestro = Convert.ToInt16(Session["M_V"]); m_venta MV = db.m_venta.Where(p => p.id == Maestro).Single(); nota_credito_venta NCV = new nota_credito_venta(); NCV.CLIENTE_id = MNCV.cliente; NCV.plazo = Convert.ToDateTime(MNCV.plazo); NCV.fecha_extendido = MV.fecha_venta; NCV.M_VENTA_id = MV.id; NCV.estado = true; db.nota_credito_venta.Add(NCV); db.SaveChanges(); Session["M_V"] = null; return(RedirectToAction("Index")); }