示例#1
0
        public static ReintegroEntity VentaConsultaF12(ReintegroRequest filtro)
        {
            var objeto = new ReintegroEntity();

            using (IDatabase db = DatabaseHelper.GetDatabase())
            {
                db.ProcedureName = "scwsp_VentaConsultaF12Elect";
                db.AddParameter("@serie", DbType.Int32, ParameterDirection.Input, filtro.Serie);
                db.AddParameter("@numero", DbType.Int32, ParameterDirection.Input, filtro.Numero);
                db.AddParameter("@Empresa", DbType.Int32, ParameterDirection.Input, filtro.CodiEmpresa);
                db.AddParameter("@Tipo", DbType.String, ParameterDirection.Input, filtro.Tipo);
                using (IDataReader drlector = db.GetDataReader())
                {
                    while (drlector.Read())
                    {
                        objeto = new ReintegroEntity
                        {
                            SerieBoleto        = Reader.GetSmallIntValue(drlector, "SERIE_BOLETO"),
                            NumeBoleto         = Reader.GetIntValue(drlector, "NUME_BOLETO"),
                            CodiEmpresa        = Reader.GetByteValue(drlector, "CODI_EMPRESA"),
                            TipoDocumento      = Reader.GetStringValue(drlector, "TIPO_DOC"),
                            CodiEsca           = Reader.GetStringValue(drlector, "CODI_ESCA"),
                            FlagVenta          = Reader.GetStringValue(drlector, "FLAG_VENTA"),
                            IndiAnulado        = Reader.GetStringValue(drlector, "INDI_ANULADO"),
                            IdVenta            = Reader.GetIntValue(drlector, "id_venta"),
                            Dni                = Reader.GetStringValue(drlector, "DNI"),
                            Nombre             = Reader.GetStringValue(drlector, "NOMBRE"),
                            RucCliente         = Reader.GetStringValue(drlector, "NIT_CLIENTE"),
                            NumeAsiento        = Reader.GetByteValue(drlector, "NUME_ASIENTO"),
                            PrecioVenta        = Reader.GetDecimalValue(drlector, "PREC_VENTA"),
                            CodiDestino        = Reader.GetSmallIntValue(drlector, "CODI_SUBRUTA"),
                            FechaViaje         = Reader.GetDateStringValue(drlector, "Fecha_Viaje"),
                            HoraViaje          = Reader.GetStringValue(drlector, "Hora_Viaje"),
                            CodiProgramacion   = Reader.GetIntValue(drlector, "CODI_PROGRAMACION"),
                            CodiOrigen         = Reader.GetSmallIntValue(drlector, "COD_ORIGEN"),
                            CodiEmbarque       = Reader.GetSmallIntValue(drlector, "sube_en"),
                            CodiArribo         = Reader.GetSmallIntValue(drlector, "baja_en"),
                            Edad               = Reader.GetByteValue(drlector, "EDAD"),
                            Telefono           = Reader.GetStringValue(drlector, "TELEFONO"),
                            Nacionalidad       = Reader.GetStringValue(drlector, "nacionalidad"),
                            Tipo               = Reader.GetStringValue(drlector, "TIPO"),
                            CodiPuntoVenta     = Reader.GetIntValue(drlector, "Punto_Venta"),
                            CodiServicio       = Reader.GetByteValue(drlector, "Servicio"),
                            FechaVenta         = Reader.GetDateStringValue(drlector, "FECH_VENTA"),
                            TipoPago           = Reader.GetStringValue(drlector, "tipo_pago"),
                            CodiTarjetaCredito = Reader.GetStringValue(drlector, "Codi_Tarjeta"),
                            NumeTarjetaCredito = Reader.GetStringValue(drlector, "Nume_tarjeta")
                        };
                    }
                }
            }

            return(objeto);
        }
示例#2
0
 public static Response <ReintegroEntity> ValidaReintegroParaAnualar(ReintegroRequest request)
 {
     try
     {
         var res = ReintegroRepository.ValidaReintegroParaAnualar(request);
         if (res != null && res.IdVenta != 0)
         {
             return(new Response <ReintegroEntity>(true, res, string.Empty, true));
         }
         else
         {
             return(new Response <ReintegroEntity>(false, res, Message.MsgNoConsultaReintegroParaAnular, true));
         }
     }
     catch (Exception ex)
     {
         Log.Instance(typeof(BaseLogic)).Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
         return(new Response <ReintegroEntity>(false, null, Message.MsgExcConsultaReintegroParaAnular, false));
     }
 }
示例#3
0
        public static ReintegroEntity ValidaReintegroParaAnualar(ReintegroRequest request)
        {
            var objeto = new ReintegroEntity();

            using (IDatabase db = DatabaseHelper.GetDatabase())
            {
                db.ProcedureName = "scwsp_VentaReintegroConsultaAnulEle";
                db.AddParameter("@ser", DbType.String, ParameterDirection.Input, request.Serie);
                db.AddParameter("@bol", DbType.String, ParameterDirection.Input, request.Numero);
                db.AddParameter("@emp", DbType.String, ParameterDirection.Input, request.CodiEmpresa);
                db.AddParameter("@tipo", DbType.String, ParameterDirection.Input, request.Tipo);
                using (IDataReader drlector = db.GetDataReader())
                {
                    while (drlector.Read())
                    {
                        objeto = new ReintegroEntity
                        {
                            IdVenta     = Reader.GetIntValue(drlector, "id_venta"),
                            CodiEsca    = Reader.GetStringValue(drlector, "codi_esca"),
                            Sucursal    = Reader.GetIntValue(drlector, "Codi_Sucursal"),
                            PrecioVenta = Reader.GetDecimalValue(drlector, "PREC_VENTA"),
                            TipoPago    = Reader.GetStringValue(drlector, "tipo_pago"),
                            ClavUsuario = Reader.GetStringValue(drlector, "clav_usuario"),
                            Tipo        = Reader.GetStringValue(drlector, "tipo"),
                            RucCliente  = Reader.GetStringValue(drlector, "NIT_CLIENTE"),
                            CodiDestino = Reader.GetSmallIntValue(drlector, "CODI_SUBRUTA"),
                            SerieBoleto = Reader.GetSmallIntValue(drlector, "SERIE_BOLETO"),
                            NumeBoleto  = Reader.GetIntValue(drlector, "NUME_BOLETO"),
                            CodiEmpresa = Reader.GetByteValue(drlector, "CODI_EMPRESA"),
                            FechaVenta  = Reader.GetDateStringValue(drlector, "FECH_VENTA")
                        };
                    }
                }
            }

            return(objeto);
        }
示例#4
0
        public static Response <ReintegroEntity> VentaConsultaF12(ReintegroRequest request)
        {
            try
            {
                var valor = ReintegroRepository.VentaConsultaF12(request);
                //Datos adicionales: 'FechaNacimiento'
                var clientePasaje = ClientePasajeRepository.BuscaPasajero(VentaLogic.TipoDocumentoHomologado(valor.TipoDocumento).ToString(), valor.Dni);
                valor.FechaNac = clientePasaje.FechaNacimiento;

                if (valor.IdVenta == 0)
                {
                    return(new Response <ReintegroEntity>(false, valor, Message.MsgExcF12NoExiste, true));
                }
                //Setea Razón Social y Dirección con el RUC
                if (!string.IsNullOrEmpty(valor.RucCliente))
                {
                    var buscarEmpresa = ClientePasajeRepository.BuscarEmpresa(valor.RucCliente);
                    valor.RazonSocial = buscarEmpresa.RazonSocial;
                    valor.Direccion   = buscarEmpresa.Direccion;
                }
                else
                {
                    valor.RazonSocial = string.Empty;
                    valor.Direccion   = string.Empty;
                }

                // Busca 'AgenciaEmpresa' (E -> GenerarAdicionales, M -> También se va a necesitar.)
                var buscarAgenciaEmpresa = new AgenciaEntity();
                buscarAgenciaEmpresa = VentaRepository.BuscarAgenciaEmpresa(valor.CodiEmpresa, valor.CodiPuntoVenta);
                valor.DirEmbarque    = buscarAgenciaEmpresa.Direccion;

                //Verifica si el boleto está en Fecha Abierta
                if (valor.CodiProgramacion != 0)
                {
                    var programacion = ReintegroRepository.DatosProgramacion(valor.CodiProgramacion);
                    //Verifica si no tiene Programación, caso contrario setea Ruta y Servicio
                    if (programacion.CodiRuta != 0 && programacion.CodiServicio != 00)
                    {
                        valor.CodiRuta     = programacion.CodiRuta;
                        valor.CodiServicio = programacion.CodiServicio;
                        valor.CodiBus      = programacion.CodiBus;
                    }
                    else
                    {
                        valor.CodiError = 2;
                        return(new Response <ReintegroEntity>(false, valor, Message.MsgExcF12SinProgramacion, true));
                    }
                    //Verfica si tiene Nota de Crédito
                    var notaCredito = VentaRepository.VerificaNC(valor.IdVenta);
                    if (Convert.ToInt32(notaCredito.id) > 0)
                    {
                        valor.CodiError = 3;
                        return(new Response <ReintegroEntity>(false, valor, Message.MsgExcF12NotaCredito + " " + notaCredito.label, true));
                    }
                    //Verfica si esta como Reintegro
                    if (valor.FlagVenta == "O")
                    {
                        valor.CodiError = 4;
                        return(new Response <ReintegroEntity>(false, valor, Message.MsgExcF12EsReintegro, true));
                    }
                    //Verfica si ya tiene adjunto un Reintegro
                    if (valor.CodiEsca != "")
                    {
                        valor.CodiError = 5;
                        return(new Response <ReintegroEntity>(false, valor, Message.MsgExcF12TieneReintegro, true));
                    }
                }
                else
                {
                    valor.CodiError = 1;
                    return(new Response <ReintegroEntity>(false, valor, Message.MsgExcF12EsFechaAbierta, true));
                }
                return(new Response <ReintegroEntity>(true, valor, Message.MsgCorrectoVentaConsultaF12, true));
            }
            catch (Exception ex)
            {
                Log.Instance(typeof(FechaAbiertaLogic)).Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                return(new Response <ReintegroEntity>(false, null, Message.MsgExcVentaConsultaF12, false));
            }
        }