public static Response <int> VerificaNotaCredito(int IdVenta)
 {
     try
     {
         var Response = VentaRepository.VerificaNC(IdVenta);
         var mensaje  = (Convert.ToInt32(Response.id) > 0) ? Message.MsgVerificaNotaCredito + " " + Response.label : string.Empty;
         return(new Response <int>(true, Convert.ToInt32(Response.id), mensaje, true));
     }
     catch (Exception ex)
     {
         Log.Instance(typeof(FechaAbiertaLogic)).Error(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
         return(new Response <int>(false, 0, Message.MsgExcVerificaNotaCredito, false));
     }
 }
Exemplo n.º 2
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));
            }
        }