Exemplo n.º 1
0
        /// <summary>
        /// Inserta la transacción de la hoja de liquidacion en la tabla de aportaciones como entrada (ahorro).
        /// </summary>
        /// <param name="HojaDeLiquidacion"></param>
        /// <param name="db"></param>
        public void InsertarTransaccionAportacionesDeSocio(liquidacion HojaDeLiquidacion, colinasEntities db)
        {
            try
            {
                reporte_total_aportaciones_por_socio asocInventory = this.GetAportacionesXSocio(HojaDeLiquidacion.SOCIOS_ID);

                decimal saldo_aportaciones_ordinaria                = asocInventory == null ? 0 : asocInventory.APORTACIONES_ORDINARIA_SALDO;
                decimal saldo_aportaciones_extraordinaria           = asocInventory == null ? 0 : asocInventory.APORTACIONES_EXTRAORDINARIA_SALDO;
                decimal saldo_aportaciones_capitalizacion_retencion = asocInventory == null ? 0 : asocInventory.APORTACIONES_CAPITALIZACION_RETENCION_SALDO;
                decimal saldo_aportaciones_intereses_aportaciones   = asocInventory == null ? 0 : asocInventory.APORTACIONES_INTERESES_S_APORTACION_SALDO;
                decimal saldo_aportaciones_excedente_periodo        = asocInventory == null ? 0 : asocInventory.APORTACIONES_EXCEDENTE_PERIODO_SALDO;

                decimal saldo_aportaciones_total = asocInventory == null ? 0 : asocInventory.APORTACIONES_SALDO_TOTAL;

                decimal liquidacion_aportacion_extraordinaria = (HojaDeLiquidacion.LIQUIDACIONES_D_APORTACION_EXTRAORD_COOP == true ? HojaDeLiquidacion.LIQUIDACIONES_D_APORTACION_EXTRAORDINARIA : 0);

                aportacion_socio aportacionDeSocio = new aportacion_socio();

                aportacionDeSocio.SOCIOS_ID      = HojaDeLiquidacion.SOCIOS_ID;
                aportacionDeSocio.DOCUMENTO_ID   = HojaDeLiquidacion.LIQUIDACIONES_ID;
                aportacionDeSocio.DOCUMENTO_TIPO = "ENTRADA";//Las hojas de liquidaciones son tomadas como entradas para las aportaciones

                aportacionDeSocio.APORTACIONES_ORDINARIA_SALDO                = saldo_aportaciones_ordinaria + HojaDeLiquidacion.LIQUIDACIONES_D_APORTACION_ORDINARIO;
                aportacionDeSocio.APORTACIONES_EXTRAORDINARIA_SALDO           = saldo_aportaciones_extraordinaria + liquidacion_aportacion_extraordinaria;
                aportacionDeSocio.APORTACIONES_CAPITALIZACION_RETENCION_SALDO = saldo_aportaciones_capitalizacion_retencion + HojaDeLiquidacion.LIQUIDACIONES_D_CAPITALIZACION_RETENCION_CANTIDAD;
                aportacionDeSocio.APORTACIONES_INTERESES_S_APORTACION_SALDO   = saldo_aportaciones_intereses_aportaciones + HojaDeLiquidacion.LIQUIDACIONES_D_INTERESES_S_APORTACIONES;
                aportacionDeSocio.APORTACIONES_EXCEDENTE_PERIODO_SALDO        = saldo_aportaciones_excedente_periodo + HojaDeLiquidacion.LIQUIDACIONES_D_EXCEDENTE_PERIODO;

                aportacionDeSocio.APORTACIONES_CANTIDAD = Convert.ToDecimal
                                                              (HojaDeLiquidacion.LIQUIDACIONES_D_APORTACION_ORDINARIO +
                                                              liquidacion_aportacion_extraordinaria +
                                                              HojaDeLiquidacion.LIQUIDACIONES_D_CAPITALIZACION_RETENCION_CANTIDAD +
                                                              HojaDeLiquidacion.LIQUIDACIONES_D_INTERESES_S_APORTACIONES +
                                                              HojaDeLiquidacion.LIQUIDACIONES_D_EXCEDENTE_PERIODO);

                aportacionDeSocio.APORTACIONES_SALDO_TOTAL = saldo_aportaciones_total + aportacionDeSocio.APORTACIONES_CANTIDAD;

                aportacionDeSocio.CREADO_POR     = HojaDeLiquidacion.CREADO_POR;
                aportacionDeSocio.FECHA_CREACION = HojaDeLiquidacion.FECHA_CREACION;

                db.aportaciones_socio.AddObject(aportacionDeSocio);

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al insertar transaccion de aportaciones de socio. Liquidacion.", ex);
                throw;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Inserta la transacción del retiro aportación en la tabla de aportaciones como salida (retiro).
        /// </summary>
        /// <param name="RetiroDeAportaciones"></param>
        /// <param name="db"></param>
        public void InsertarTransaccionAportacionesDeSocio(retiro_aportaciones RetiroDeAportaciones, colinasEntities db)
        {
            try
            {
                reporte_total_aportaciones_por_socio asocInventory = this.GetAportacionesXSocio(RetiroDeAportaciones.SOCIOS_ID);

                decimal saldo_aportaciones_ordinaria                = asocInventory == null ? 0 : asocInventory.APORTACIONES_ORDINARIA_SALDO;
                decimal saldo_aportaciones_extraordinaria           = asocInventory == null ? 0 : asocInventory.APORTACIONES_EXTRAORDINARIA_SALDO;
                decimal saldo_aportaciones_capitalizacion_retencion = asocInventory == null ? 0 : asocInventory.APORTACIONES_CAPITALIZACION_RETENCION_SALDO;
                decimal saldo_aportaciones_intereses_aportaciones   = asocInventory == null ? 0 : asocInventory.APORTACIONES_INTERESES_S_APORTACION_SALDO;
                decimal saldo_aportaciones_excedente_periodo        = asocInventory == null ? 0 : asocInventory.APORTACIONES_EXCEDENTE_PERIODO_SALDO;

                decimal saldo_aportaciones_total = asocInventory == null ? 0 : asocInventory.APORTACIONES_SALDO_TOTAL;

                decimal liquidacion_aportacion_extraordinaria = RetiroDeAportaciones.RETIROS_AP_EXTRAORDINARIA;

                aportacion_socio aportacionDeSocio = new aportacion_socio();

                aportacionDeSocio.SOCIOS_ID      = RetiroDeAportaciones.SOCIOS_ID;
                aportacionDeSocio.DOCUMENTO_ID   = RetiroDeAportaciones.RETIROS_AP_ID;
                aportacionDeSocio.DOCUMENTO_TIPO = "SALIDA";//Los retiros de aportaciones son tomadas como salidas para las aportaciones

                aportacionDeSocio.APORTACIONES_ORDINARIA_SALDO                = saldo_aportaciones_ordinaria - RetiroDeAportaciones.RETIROS_AP_ORDINARIA;
                aportacionDeSocio.APORTACIONES_EXTRAORDINARIA_SALDO           = saldo_aportaciones_extraordinaria - liquidacion_aportacion_extraordinaria;
                aportacionDeSocio.APORTACIONES_CAPITALIZACION_RETENCION_SALDO = saldo_aportaciones_capitalizacion_retencion - RetiroDeAportaciones.RETIROS_AP_CAPITALIZACION_RETENCION;
                aportacionDeSocio.APORTACIONES_INTERESES_S_APORTACION_SALDO   = saldo_aportaciones_intereses_aportaciones + RetiroDeAportaciones.RETIROS_AP_INTERESES_S_APORTACION;
                aportacionDeSocio.APORTACIONES_EXCEDENTE_PERIODO_SALDO        = saldo_aportaciones_excedente_periodo + RetiroDeAportaciones.RETIROS_AP_EXCEDENTE_PERIODO;

                aportacionDeSocio.APORTACIONES_CANTIDAD    = -RetiroDeAportaciones.RETIROS_AP_TOTAL_RETIRADO;
                aportacionDeSocio.APORTACIONES_SALDO_TOTAL = saldo_aportaciones_total + aportacionDeSocio.APORTACIONES_CANTIDAD;

                aportacionDeSocio.CREADO_POR     = RetiroDeAportaciones.CREADO_POR;
                aportacionDeSocio.FECHA_CREACION = RetiroDeAportaciones.FECHA_CREACION;

                db.aportaciones_socio.AddObject(aportacionDeSocio);

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al insertar transaccion de aportaciones de socio. Retiro de Aportaciones.", ex);
                throw;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Obtiene el saldo total de aportaciones para un socio específico.
        /// </summary>
        /// <param name="SOCIOS_ID"></param>
        /// <returns>El saldo total de aportaciones para el socio especificado.</returns>
        public decimal GetSaldoTotalAportacionesXSocio(string SOCIOS_ID)
        {
            try
            {
                using (var db = new colinasEntities())
                {
                    var query = from ap in db.reporte_total_aportaciones_por_socio
                                where ap.SOCIOS_ID == SOCIOS_ID
                                select ap;

                    reporte_total_aportaciones_por_socio totalAportaciones = query.FirstOrDefault <reporte_total_aportaciones_por_socio>();

                    return(totalAportaciones == null ? 0 : totalAportaciones.APORTACIONES_SALDO_TOTAL);
                }
            }
            catch (Exception ex)
            {
                log.Fatal("Error fatal al obtener el reporte total de aportaciones de socio.", ex);
                throw;
            }
        }