/// <summary> /// Guarda la información del concepto de cobro. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ImageClickEventArgs"/> instance containing the event data.</param> /// <remarks> /// Autor: Iván José Pimienta Serrano - INTERGRUPO\Ipimienta. /// FechaDeCreacion: 27/12/2013. /// UltimaModificacionPor: (Nombre del Autor de la modificación - Usuario del dominio). /// FechaDeUltimaModificacion: (dd/MM/yyyy). /// EncargadoSoporte: (Nombre del Autor - Usuario del dominio). /// Descripción: Descripción detallada del metodo, procure especificar todo el metodo aqui. /// </remarks> protected void ImgGuardarConcepto_Click(object sender, ImageClickEventArgs e) { ConceptoCobro concepto = new ConceptoCobro() { CodigoEntidad = Settings.Default.General_CodigoEntidad, IdAtencion = string.IsNullOrEmpty(TxtAtencion.Text) ? 0 : Convert.ToInt32(TxtAtencion.Text), IdContrato = EstadoCuentaSeleccionado.IdContrato, IdPlan = EstadoCuentaSeleccionado.IdPlan, FechaConcepto = DateTime.Now, CodigoConcepto = ABONO, ValorConcepto = string.IsNullOrEmpty(TxtValorConcepto.Text) ? 0 : Convert.ToDecimal(TxtValorConcepto.Text), IndHabilitado = 1, ValorContrato = 0, Porcentaje = 0, ValorSaldo = string.IsNullOrEmpty(TxtValorConcepto.Text) ? 0 : Convert.ToDecimal(TxtValorConcepto.Text), ValorMaximo = 0, NumeroFactura = 0 }; if (EstadoCuentaSeleccionado.IdContrato == 473 && EstadoCuentaSeleccionado.IdPlan == 482 && concepto.ValorConcepto > EstadoCuentaGenerado.FirstOrDefault().AtencionActiva.Deposito.TotalDeposito) { RecargarModal(); this.MostrarMensaje(Resources.ControlesUsuario.ConceptoCobro_DepositoMenorParticular, TipoMensaje.Error); } else { Resultado <int> resultado = WebService.Facturacion.GuardarConceptoCobro(concepto); if (resultado.Ejecuto && string.IsNullOrEmpty(resultado.Mensaje)) { this.ResultadoEjecucion(SAHI.Comun.Utilidades.Global.TipoOperacion.CREACION); } else { RecargarModal(); this.MostrarMensaje(resultado.Mensaje, TipoMensaje.Error); } } }
/// <summary> /// Realiza el cruce de un depósito para un particular. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.ImageClickEventArgs"/> instance containing the event data.</param> /// <remarks> /// Autor: Gemay Leandro Ocampo Pino - INTERGRUPO\gocampo. /// FechaDeCreacion: 18/09/2014. /// UltimaModificacionPor: (Nombre del Autor de la modificación - Usuario del dominio). /// FechaDeUltimaModificacion: (dd/MM/yyyy). /// EncargadoSoporte: (Nombre del Autor - Usuario del dominio). /// Descripción: Descripción detallada del metodo, procure especificar todo el metodo aqui. /// </remarks> protected void ImgCruzarDeposito_Click(object sender, System.Web.UI.ImageClickEventArgs e) { if (!string.IsNullOrEmpty(txtDeposito.Text) && !string.IsNullOrEmpty(txtDepositoCruzar.Text)) { var estadoCuenta = EstadoCuentaSeleccionado; if (estadoCuenta != null && estadoCuenta.ValorTotalFacturado > 0) { if (Convert.ToDecimal(txtDepositoCruzar.Text) > Convert.ToDecimal(txtDeposito.Text)) { MostrarMensaje(Resources.GlobalWeb.Cruzar_Depositos_Mensaje, TipoMensaje.Error); txtDepositoCruzar.Text = txtDeposito.Text; } else if (Convert.ToDecimal(txtDepositoCruzar.Text) > estadoCuenta.ValorTotalFacturado) { MostrarMensaje(Resources.GlobalWeb.Cruzar_Depositos_Valor_Mensaje, TipoMensaje.Error); txtDepositoCruzar.Text = Math.Round(estadoCuenta.ValorTotalFacturado, 2).ToString(); } else { decimal sumatoria = 0; if (estadoCuenta.AtencionActiva != null && estadoCuenta.AtencionActiva.Deposito != null && estadoCuenta.AtencionActiva.Deposito.Concepto != null && estadoCuenta.AtencionActiva.Deposito.Concepto.Count > 0) { sumatoria = (from p in estadoCuenta.AtencionActiva.Deposito.Concepto where p.IndHabilitado == 1 && p.DepositoParticular == false select p.ValorConcepto).Sum(); } if (Convert.ToDecimal(txtDeposito.Text) - sumatoria <= 0) { MostrarMensaje(string.Format(Resources.GlobalWeb.Depositos_Cruzar_Total_Mensaje, sumatoria.ToString()), TipoMensaje.Error); txtDepositoCruzar.Text = "0"; } else if (Convert.ToDecimal(txtDepositoCruzar.Text) > (Convert.ToDecimal(txtDeposito.Text) - sumatoria)) { MostrarMensaje(string.Format(Resources.GlobalWeb.Depositos_Cruzar_Parcial_Mensaje, sumatoria, (Convert.ToDecimal(txtDeposito.Text) - sumatoria).ToString()), TipoMensaje.Error); txtDepositoCruzar.Text = (Convert.ToDecimal(txtDeposito.Text) - sumatoria).ToString(); } else { ConceptoCobro depositoParticular = new ConceptoCobro() { Activo = true, IndHabilitado = 1, IdAtencion = estadoCuenta.AtencionActiva.IdAtencion, IdContrato = estadoCuenta.IdContrato, IdPlan = estadoCuenta.IdPlan, NumeroFactura = 0, ValorConcepto = Convert.ToDecimal(txtDepositoCruzar.Text), ValorSaldo = Convert.ToDecimal(txtDepositoCruzar.Text), CodigoConcepto = CONCEPTOABONO, TotalConcepto = Convert.ToDecimal(txtDepositoCruzar.Text), DepositoParticular = true }; GuardarDepositos(new EventoControles <ConceptoCobro>(this, depositoParticular)); } } } } }