public void ActualizarSaldos(int idCuentaB) { if (idCuentaB != 0) { CuentaBancariaBL oBL = new CuentaBancariaBL(); oBL.updateSaldos(idCuentaB); } }
public ActionResult AddLibro(CuentaBancariaDTO dto) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } if (getCurrentUser().IdRol == 4) { return RedirectToAction("Libros", "Admin"); } try { string sTipoLibro = dto.IdTipoCuenta == 1 ? "Bancarios" : "Administrativos"; int TipoCuenta = 1; //Por defecto tipo de comprobante Ingreso if (dto != null) { TipoCuenta = dto.IdTipoCuenta.GetValueOrDefault(); } CuentaBancariaBL objBL = new CuentaBancariaBL(); if (dto.IdCuentaBancaria == 0) { if (objBL.add(dto)) { createResponseMessage(CONSTANTES.SUCCESS); return RedirectToAction("Libros" + sTipoLibro, "Admin"); } } else if (dto.IdCuentaBancaria != 0) { if (objBL.update(dto)) { createResponseMessage(CONSTANTES.SUCCESS); return RedirectToAction("Libros" + sTipoLibro, "Admin"); } else { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); } } else { createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE); } } catch (Exception e) { if (dto.IdCuentaBancaria != 0) createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_UPDATE_MESSAGE); else createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_INSERT_MESSAGE); } TempData["Libro"] = dto; return RedirectToAction("Libro"); }
public ActionResult Movimiento(int? id = null, int? idLibro = null) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } ViewBag.Title = "Movimiento"; MenuNavBarSelected(1); UsuarioDTO miUsuario = getCurrentUser(); EmpresaBL empBL = new EmpresaBL(); EmpresaDTO empresa = empBL.getEmpresa(miUsuario.IdEmpresa); ViewBag.SimboloMoneda = empresa.SimboloMoneda; MovimientoBL objBL = new MovimientoBL(); ViewBag.IdMovimiento = id; ViewBag.EstadosMovimientos = objBL.getEstadosMovimientos(false); CuentaBancariaBL objCuentaBL = new CuentaBancariaBL(); CuentaBancariaDTO objLibro = objCuentaBL.getCuentaBancariaSoloEnEmpresa(miUsuario.IdEmpresa, idLibro.GetValueOrDefault()); if (objLibro == null) { return RedirectToAction("Index", "Admin"); } ViewBag.IdTipoCuenta = objLibro.IdTipoCuenta; ViewBag.lstTipoMovs = objBL.getTiposMovimientos(); ViewBag.lstFormaMovs = ViewBag.IdTipoCuenta == 1 ? objBL.getListaFormaDeMovimientos() : objBL.getListaFormaDeMovimientosBasic(); EntidadResponsableBL entBL = new EntidadResponsableBL(); ViewBag.TipoEntidades = entBL.getTipoDeEntidades(); ViewBag.EntidadesResponsables = objBL.getEntidadesResponsablesEnEmpresa(miUsuario.IdEmpresa, false); ViewBag.lstTiposDeDocumento = objBL.getListaTiposDeDocumentoVB(true); ViewBag.NombreCategoria = "Sin Categoría"; ViewBag.Categorias = CategoriasBucle(empresa.IdEmpresa, (int)empresa.IdPeriodo, null, null); ViewBag.Comprobantes = objBL.getComprobantesPendientesEnEmpresa(miUsuario.IdEmpresa); var objSent = TempData["Movimiento"]; if (objSent != null) { TempData["Movimiento"] = null; return View(objSent); } if (id == 0 && idLibro != null) { MovimientoDTO nuevo = new MovimientoDTO(); nuevo.IdCuentaBancaria = (int)idLibro; nuevo.Fecha = DateTime.Now; nuevo.TipoCambio = (new EmpresaBL()).getEmpresa(miUsuario.IdEmpresa).TipoCambio; nuevo.NumeroDocumento = null; //nuevo.Comentario = "No existe comentario"; nuevo.Estado = true; nuevo.UsuarioCreacion = miUsuario.IdUsuario; nuevo.FechaCreacion = DateTime.Now; return View(nuevo); } else { if (id != null) { MovimientoDTO obj = objBL.getMovimiento((int)id); if (obj == null) return RedirectToAction("Libro", "Admin", new { id = objLibro.IdCuentaBancaria }); if (obj.IdCuentaBancaria != objLibro.IdCuentaBancaria) return RedirectToAction("Libro", "Admin", new { id = objLibro.IdCuentaBancaria }); CuentaBancariaDTO objLibroMov = objCuentaBL.getCuentaBancariaEnEmpresa(miUsuario.IdEmpresa, obj.IdCuentaBancaria); if (objLibroMov == null) return RedirectToAction("Index", "Admin"); if (objLibroMov.IdEmpresa != miUsuario.IdEmpresa) return RedirectToAction("Index", "Admin"); obj.UsuarioCreacion = miUsuario.IdUsuario; ViewBag.NombreCategoria = objBL.getNombreCategoria(obj.IdCategoria.GetValueOrDefault()); return View(obj); } } return View(); }
//public ActionResult Libro(int? id = null, int? idTipoCuenta = null, string sortOrder = null, string currentFilter = null, string searchString = null, int? page = null) public ActionResult Libro(int? id = null, int? idTipoCuenta = null) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } ViewBag.Title = "Libro"; int tipoCuenta = 2; if (idTipoCuenta != null) { tipoCuenta = idTipoCuenta.GetValueOrDefault(); } MenuNavBarSelected(2, tipoCuenta - 1); UsuarioDTO miUsuario = getCurrentUser(); CuentaBancariaBL objBL = new CuentaBancariaBL(); ViewBag.IdCuentaBancaria = id; ViewBag.Monedas = objBL.getMonedasBag(false); var objSent = TempData["Libro"]; if (objSent != null) { TempData["Libro"] = null; return View(objSent); } CuentaBancariaDTO obj; if (id != null && id != 0) { //Actualizar Saldo Disponible objBL.updateSaldos((int)id); obj = objBL.getCuentaBancariaEnEmpresa(miUsuario.IdEmpresa, (int)id); if (obj == null) return RedirectToAction("Index"); if (obj.IdEmpresa != miUsuario.IdEmpresa) return RedirectToAction("Index"); //obj.listaMovimientoPL = BusquedaYPaginado_Movimiento(obj.listaMovimiento, sortOrder, currentFilter, searchString, page); return View(obj); } obj = new CuentaBancariaDTO(); obj.FechaConciliacion = DateTime.Now; obj.IdEmpresa = miUsuario.IdEmpresa; if (idTipoCuenta != null && idTipoCuenta != 0) obj.IdTipoCuenta = idTipoCuenta.GetValueOrDefault(); return View(obj); }
public ActionResult LibrosAdministrativos(bool inactivos = false) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } ViewBag.Title = "Administrativos"; MenuNavBarSelected(2, 1); UsuarioDTO user = getCurrentUser(); CuentaBancariaBL objBL = new CuentaBancariaBL(); List<CuentaBancariaDTO> lista = new List<CuentaBancariaDTO>(); ViewBag.vbInactivos = inactivos; if (user.IdEmpresa != 0) { if (!inactivos) { lista = objBL.getCuentasBancariasActivasPorTipoEnEmpresa(user.IdEmpresa, 2); } else { lista = objBL.getCuentasBancariasPorTipoEnEmpresa(user.IdEmpresa, 2); } } return View(lista); }
public ActionResult Libros(int? idTipoCuenta = null) { if (!this.currentUser()) { return RedirectToAction("Ingresar"); } ViewBag.Title = "Libros"; MenuNavBarSelected(1); UsuarioDTO miUsuario = getCurrentUser(); CuentaBancariaBL objBL = new CuentaBancariaBL(); ViewBag.lstTipoCuentas = objBL.getTipoDeCuentas(); ViewBag.idTipoCuenta = idTipoCuenta; List<CuentaBancariaDTO> listaLibros = new List<CuentaBancariaDTO>(); if (miUsuario.IdEmpresa != 0) { EmpresaBL empBL = new EmpresaBL(); Decimal miTipoCambio = empBL.getEmpresa((int)miUsuario.IdEmpresa).TipoCambio; listaLibros = objBL.getCuentasBancariasEnEmpresa(miUsuario.IdEmpresa); ViewBag.TotalSoles = DameTotalSoles(listaLibros); ViewBag.TotalDolares = DameTotalDolares(listaLibros); ViewBag.TotalConsolidado = DameTotalConsolidado(listaLibros, miTipoCambio); ViewBag.TipoCambio = miTipoCambio; } else { ViewBag.TotalSoles = 0.0; ViewBag.TotalDolares = 0.0; ViewBag.TotalConsolidado = 0.0; ViewBag.TipoCambio = 1.0; } return View("Libros", listaLibros); }
public ActionResult ReportesPresupuestos(int? message = null) { if(!this.currentUser()) { return RedirectToAction("Ingresar"); } if (getCurrentUser().IdRol == 3) { return RedirectToAction("Ingresar"); } ViewBag.Title = "Reportes de Presupuesto"; MenuNavBarSelected(1, 0); EmpresaDTO empresa = (new EmpresaBL()).getEmpresa(getCurrentUser().IdEmpresa); CuentaBancariaBL objBL = new CuentaBancariaBL(); ViewBag.Categorias = CategoriasBucle(empresa.IdEmpresa, empresa.IdPeriodo.GetValueOrDefault(), null, null); PeriodoBL periodoBL = new PeriodoBL(); ViewBag.Periodos = periodoBL.getPeriodosActivosEnEmpresa(getCurrentUser().IdEmpresa); if (message != null) { switch (message) { case 1: createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_MESSAGE); break; case 2: createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_REPORTE_NO_MOVS); break; } } return View(); }
public ActionResult Proforma(int? id) { if (!this.currentUser()) { return RedirectToAction("Ingresar", "Admin", new { Area = string.Empty }); } ViewBag.Title += "Proforma"; MenuNavBarSelected(12); UsuarioDTO user = getCurrentUser(); EntidadResponsableBL entBL = new EntidadResponsableBL(); ViewBag.lstClientes = entBL.getEntidadesResponsablesActivasPorTipoEnEmpresa(user.IdEmpresa, 1); EmpresaBL empBL = new EmpresaBL(); ViewBag.lstMonedas = empBL.getListaMonedasAll(); MovimientoInvBL movItmBL = new MovimientoInvBL(); ViewBag.lstItems = movItmBL.getItemsEnEmpresa_PorTipoMov(user.IdEmpresa, 1); CuentaBancariaBL cbBL = new CuentaBancariaBL(); ViewBag.lstCuentasBancarias = cbBL.getCuentasBancariasActivasPorTipoEnEmpresa(user.IdEmpresa, 1); ViewBag.lstContactos = new List<ContactoDTO>(); var objSent = TempData["Proforma"]; if (objSent != null) { TempData["Proforma"] = null; return View(objSent); } ProformaDTO obj; if(id != null && id > 0) { obj = new ProformaBL().getProformaId((int)id); return View(obj); } obj = new ProformaDTO(); obj.IdEmpresa = user.IdEmpresa; obj.FechaProforma = DateTime.Now; obj.DetalleProforma = new List<DetalleProformaDTO>(); return View(obj); }