public async Task <IActionResult> AddPago(PagoViewModel model, ContabilidadViewModel model1) { if (ModelState.IsValid) { var pago = await _converterHelper.ToPagoAsync(model, true); var ingreso = await _converterHelper.ToIngresosAsync(model1, true); //var anio_nuevo = pago.Anio.Id; //var anio = _context.Pagostbls.Find(model.AnioId); //var mes_nuevo = pago.Mes.Id; //var mes = _context.Pagostbls.Find(model.MesId); //var anio_nuevo2 = anio_nuevo.ToString(); //var mes_nuevo2 = mes_nuevo.ToString(); //guardamos el pago _context.Pagostbls.Add(pago); _context.Contabilidadtbls.Add(ingreso); await _context.SaveChangesAsync(); //var IdDelRegistroInsertadoEnPagos = pago.Id; //var IdDelRegistroInsertadoEnIngresos = ingreso.Id; //var PagoInsertadoObj = _context.Contabilidadtbls.First(x => x.Id == IdDelRegistroInsertadoEnIngresos); //PagoInsertadoObj.Con_IngId = IdDelRegistroInsertadoEnPagos; //await _context.SaveChangesAsync(); return(RedirectToAction($"Details/{model.PropietarioId}")); } model.Anios1 = _combosHelper.GetComboAnios(); model.Meses1 = _combosHelper.GetComboMeses(); model.Valores = _combosHelper.GetComboValores(); model.TiposPago = _combosHelper.GetComboValoresDescripcion(); model.Puntos = _combosHelper.GetComboPuntos(); return(View(model)); }
public PartialViewResult IngresarAprobacion(ContabilidadViewModel model) { var idContable = _presupuestoSvc.guardarContabilidadInfo(new ContabilidadDto { Cotizacion = model.Cotizacion, Direccion = model.Direccion, PersonaAprobacion = model.PersonaAprobacion, TelefonoContacto = model.TelefonoContacto, Vendedor = model.Vendedor }); Session["NuevaContabilidad"] = idContable; var infoCoti = _presupuestoSvc.obtenerPresupuestos(model.Cotizacion); ContabilidadViewModel contabilidad = new ContabilidadViewModel() { Activado = "none", Obra = infoCoti.Obra, Direccion = model.Direccion, Supervisor = model.Supervisor, Ascensor = infoCoti.Ascensor, PresupuestoNumero = infoCoti.PresupuestoNumero, TecEmisor = infoCoti.TecEmisor }; return(PartialView("ContabilidadAprobacion", contabilidad)); }
public PartialViewResult Aprobacion(int id) { ContabilidadViewModel contabilidad = new ContabilidadViewModel(); var infoCoti = _presupuestoSvc.obtenerPresupuestos(id); var aprobacion = _presupuestoSvc.obtenerContabilidadInfo(id); contabilidad.Activado = "visible"; contabilidad.Cotizacion = id; contabilidad.DetalleDescrip = infoCoti.DetalleDescrip; contabilidad.Obra = infoCoti.Obra; contabilidad.Ascensor = infoCoti.Ascensor; contabilidad.PresupuestoNumero = infoCoti.PresupuestoNumero; contabilidad.TecEmisor = infoCoti.TecEmisor; if (aprobacion.Direccion != null) { contabilidad.Direccion = aprobacion.Direccion; contabilidad.PersonaAprobacion = aprobacion.PersonaAprobacion; contabilidad.TelefonoContacto = aprobacion.TelefonoContacto; contabilidad.Vendedor = aprobacion.Vendedor; contabilidad.Activado = "none"; } return(PartialView("ContabilidadAprobacion", contabilidad)); }
public async Task <Contabilidadtbl> ToContabilidadAsync(ContabilidadViewModel model1, bool isNew) { var entrada = new Contabilidadtbl { Tip = await _dataContext1.TiposPagotbls.FindAsync(model1.TipoPagoId), }; return(entrada); }
public async Task <Contabilidadtbl> ToIngresosAsync(ContabilidadViewModel model1, bool isNew) { var ingresos = new Contabilidadtbl { Id = isNew ? 0 : model1.Id, Tip = await _dataContext1.TiposPagotbls.FindAsync(model1.TipoPagoId), Valo = await _dataContext1.Valorestbls.FindAsync(model1.ValorId), Anio = await _dataContext1.Aniostbls.FindAsync(model1.AnioId), Punt = await _dataContext1.PuntosPagotbls.FindAsync(model1.PuntoPagoId), Mess = await _dataContext1.Mesestbls.FindAsync(model1.MesId) }; return(ingresos); }
public async Task <IActionResult> EditPago(PagoViewModel model, ContabilidadViewModel model1) { if (ModelState.IsValid) { var pago = await _converterHelper.ToPagoAsync(model, false); var ingreso = await _converterHelper.ToIngresosAsync(model1, false); _context.Pagostbls.Update(pago); _context.Contabilidadtbls.Update(ingreso); await _context.SaveChangesAsync(); var IdTipoDelRegistroActualizadoEnPagos = pago.Tipos.Id; return(RedirectToAction($"Details/{model.PropietarioId}")); } model.Anios1 = _combosHelper.GetComboAnios(); model.Meses1 = _combosHelper.GetComboMeses(); model.Valores = _combosHelper.GetComboValores(); model.TiposPago = _combosHelper.GetComboValoresDescripcion(); model.Puntos = _combosHelper.GetComboPuntos(); return(View(model)); }