예제 #1
0
        public JsonResult ConsultarTransportadora(int ocorrencia, string tipo)
        {
            var N0203REGBusiness   = new N0203REGBusiness();
            var listaTransportador = N0203REGBusiness.ConsultaTransportadora(ocorrencia, tipo);

            return(this.Json(new { listaTransportador, redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AprovadosEsperandoFaturamento()
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                int quantidadeEmDia               = 0;
                int quantidadeEmAtraso            = 0;
                N0203REGBusiness  N0203REGBusines = new N0203REGBusiness();
                List <Ocorrencia> lista           = new List <Ocorrencia>();
                lista = N0203REGBusines.carregarProtocolosForamAprovadosEsperandoFaturamento("", "", "", "", "", "", "", "4,6,8,9,11", "", Convert.ToInt64(this.CodigoUsuarioLogado));
                DateTime dateForButton = DateTime.Now.AddDays(-30);
                foreach (var item in lista)
                {
                    if (Convert.ToDateTime(item.DataHrGeracao) < dateForButton)
                    {
                        quantidadeEmAtraso++;
                    }
                    else
                    {
                        quantidadeEmDia++;
                    }
                }

                return(this.Json(new { lista, quantidadeEmAtraso, quantidadeEmDia }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult QuantidadeProtocolosPorAreaMeses(int dias, int situacao)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }

            try
            {
                var N9999USUBusiness = new N9999USUBusiness();
                // Busca código do usuário
                var dadosUsuario = N9999USUBusiness.ListaDadosUsuarioPorLogin(this.LoginUsuario);

                List <N0204ORI>  ListaN0204ORI    = new List <N0204ORI>();
                N0203REGBusiness N0203ORIBusiness = new N0203REGBusiness();
                if (dadosUsuario != null)
                {
                    ListaN0204ORI = N0203ORIBusiness.quantidadeProtocolosPorAreaMeses(dias, situacao);
                }
                return(this.Json(new { ListaN0204ORI }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #4
0
        public JsonResult OrigemOcorrencia(int Numreg)
        {
            var N0203REGBusiness      = new N0203REGBusiness();
            var ListaOrigemOcorrencia = N0203REGBusiness.OrigemOcorrencia(Numreg);

            return(this.Json(new { ListaOrigemOcorrencia, redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
 public bool consultarAcesso()
 {
     try
     {
         N0203REGBusiness N0203REG = new N0203REGBusiness();
         return(N0203REG.ConsultarParametroJustificativaColeta(this.LoginUsuario));
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #6
0
        public int listaProtocolosPendentes()
        {
            if (this.ProtocolosPendentes.Count > 0)
            {
                return(1);
            }
            var N0203REGBusiness = new N0203REGBusiness();

            listaAprovacao           = N0203REGBusiness.PesquisaProtocolosPendentesAprovacaoNotificacao(Convert.ToInt64(this.CodigoUsuarioLogado), 0);
            this.ProtocolosPendentes = listaAprovacao;
            return(2);
        }
        public JsonResult consultarPlacaPOC(string NUMREG)
        {
            if (NUMREG == "")
            {
                bool campos = true;
                return(this.Json(new { campos }, JsonRequestBehavior.AllowGet));
            }
            N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
            var resposta = N0203REGBusiness.consultarPlacaPOC(NUMREG);

            return(this.Json(new { resposta }, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        protected void MontarEmailFinanceiroNotasBoleto(string numeroProtocolo, string notas, string cliente, Enums.TipoAtendimento tipoAtendimento)
        {
            string EmailDestino = "*****@*****.**";
            string CopiarEmails = "[email protected]&";
//#if DEBUG
//            EmailDestino = "*****@*****.**";
//            CopiarEmails = string.Empty;
//#endif
            string Assunto = "REGISTRO DE DEVOLUÇÃO - BOLETO";
            string tipoAtd = "Devolução";

            if (tipoAtendimento == Enums.TipoAtendimento.TrocaMercadorias)
            {
                Assunto = "REGISTRO DE TROCA - BOLETO";
                tipoAtd = "Troca";
            }

            string[] formatNotas     = notas.Split('&');
            string   notasFormatadas = string.Empty;

            for (int i = 0; i < formatNotas.Length - 1; i++)
            {
                notasFormatadas = notasFormatadas + formatNotas[i] + ".<br/>";
            }

            N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();

            var obsreg = N0203REGBusiness.PesquisarObservacaoSAC(Convert.ToInt64(numeroProtocolo));

            var emailCabecalho = Attributes.KeyValueAttribute.GetFirst("Descricao", Enums.Email.Cabecalho).GetValue <string>();
            var emailCorpo     = Attributes.KeyValueAttribute.GetFirst("Descricao", Enums.Email.Corpo).GetValue <string>();
            var emailRodape    = Attributes.KeyValueAttribute.GetFirst("Descricao", Enums.Email.Rodape).GetValue <string>();

            StringBuilder Mensagem = new StringBuilder();

            Mensagem.AppendLine(emailCabecalho);
            Mensagem.AppendLine(emailCorpo);
            Mensagem.AppendLine(@"<div class='panel panel-success'>
                                    <div class='panel-heading'>
                                        <h3 class='panel-title'>Registro de " + tipoAtd + @" Nº " + numeroProtocolo + @"</h3>
                                    </div>
                                    <div class='panel-body'>
                                        <strong>Olá,<br/><br/>
                                        O Registro de " + tipoAtd + @" Nº " + numeroProtocolo + @" contém notas fiscais de boleto.<br/><br/>" + cliente + @".<br/><br/>" + notasFormatadas + @" Observações SAC: " + obsreg + "</strong><br/> ");
            Mensagem.AppendLine(emailRodape);

            String destino = EmailDestino + CopiarEmails;

            var Email = new Email();

            Email.EnviarEmail(EmailDestino, CopiarEmails, Assunto, Mensagem.ToString());
        }
        public JsonResult confirmarRecebimento(string NUMREG, string PLACA)
        {
            PLACA = PLACA.Replace("-", "");
            if (NUMREG == "" || PLACA == "")
            {
                bool campos = true;
                return(this.Json(new { campos }, JsonRequestBehavior.AllowGet));
            }
            N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
            var resposta = N0203REGBusiness.confirmarRecebimento(NUMREG, PLACA.ToUpper(), Convert.ToInt64(this.CodigoUsuarioLogado));

            return(this.Json(new { resposta }, JsonRequestBehavior.AllowGet));
        }
예제 #10
0
        public ActionResult Revincular(int numeroRegistro, string codPlaca, string observacao)
        {
            N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
            DateTime         localDate        = DateTime.Now;

            if (!consultarAcesso())
            {
                return(this.Json(new { acesso = false }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                bool retorno = N0203REGBusiness.Revincular(numeroRegistro.ToString(), codPlaca, this.CodigoUsuarioLogado, localDate.ToString(), observacao);
            }

            return(this.Json(new { retorno = true }, JsonRequestBehavior.AllowGet));
        }
 public JsonResult pedidosFaturarIndenizacao()
 {
     if (this.Logado != ((char)Enums.Logado.Sim).ToString())
     {
         return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
     }
     try
     {
         N0203REGBusiness n0203REGBusiness = new N0203REGBusiness();
         var contador = n0203REGBusiness.pedidosFaturarIndenizacao();
         return(this.Json(new { contador, sucesso = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         this.Session["ExceptionErro"] = ex;
         return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
     }
 }
예제 #12
0
 public JsonResult PesquisaProtocolosPendentesAprovacao(long NumReg)
 {
     if (this.Logado != ((char)Enums.Logado.Sim).ToString())
     {
         return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
     }
     try
     {
         N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
         var listaAprovacao = N0203REGBusiness.PesquisaProtocolosPendentesAprovacao(long.Parse(this.CodigoUsuarioLogado), NumReg);
         return(this.Json(new { listaAprovacao }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         this.Session["ExceptionErro"] = ex;
         return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
     }
 }
 public JsonResult PesquisarProtocolosPendentesAprovacaoDashBoard()
 {
     if (this.Logado != ((char)Enums.Logado.Sim).ToString())
     {
         return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
     }
     try
     {
         N0203REGBusiness  N0203REGBusines          = new N0203REGBusiness();
         List <Ocorrencia> ListaProtocolosPendentes = new List <Ocorrencia>();
         ListaProtocolosPendentes = N0203REGBusines.PesquisarProtocolosPendentesAprovacaoDashBoard("", "", "", "", "", "", "", "2", "", Convert.ToInt64(this.CodigoUsuarioLogado));
         return(this.Json(new { ListaProtocolosPendentes, sucesso = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         this.Session["ExceptionErro"] = ex;
         return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
     }
 }
예제 #14
0
        public JsonResult GravarAgrupamento(string ocorrencias, string dataGeracao)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness N0203REGBusines = new N0203REGBusiness();
                var retorno = N0203REGBusines.GravarAgrupamento(ocorrencias, this.CodigoUsuarioLogado);

                return(this.Json(new { retorno, sucesso = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult PesquisaProtocolosAprovadosXPendentesAprovacao()
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness N0203REGBusines = new N0203REGBusiness();
                List <long>      quantidade      = N0203REGBusines.PesquisaProtocolosAprovadosXPendentesAprovacao(Convert.ToInt64(this.CodigoUsuarioLogado));

                return(this.Json(new { quantidade, sucesso = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult carregarAtrasoFaturamento()
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness N0203REGBusines = new N0203REGBusiness();
                ArrayList        quantidade      = N0203REGBusines.carregarAtrasoFaturamento();

                return(this.Json(new { quantidade, sucesso = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
 public JsonResult carregarOcorrenciasFaturamentoEmDia()
 {
     if (this.Logado != ((char)Enums.Logado.Sim).ToString())
     {
         return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
     }
     try
     {
         N0203REGBusiness  N0203REGBusines          = new N0203REGBusiness();
         List <Ocorrencia> ListaProtocolosPendentes = new List <Ocorrencia>();
         ListaProtocolosPendentes = N0203REGBusines.carregarOcorrenciasFaturamentoEmDia();
         return(this.Json(new { ListaProtocolosPendentes, sucesso = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         this.Session["ExceptionErro"] = ex;
         return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
     }
 }
 public JsonResult ocorrenciaDrill(string status, string mes, string filtroAgrup, string indicador, string ano)
 {
     if (this.Logado != ((char)Enums.Logado.Sim).ToString())
     {
         return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
     }
     try
     {
         N0203REGBusiness  N0203REGBusines          = new N0203REGBusiness();
         List <Ocorrencia> ListaProtocolosPendentes = new List <Ocorrencia>();
         ListaProtocolosPendentes = N0203REGBusines.ocorrenciaDrill(status, mes, filtroAgrup, indicador, ano);
         return(this.Json(new { ListaProtocolosPendentes, sucesso = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         this.Session["ExceptionErro"] = ex;
         return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
     }
 }
        public JsonResult mesXOrigem()
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }

            try
            {
                List <MesXOrigem> mesOrigem        = new List <MesXOrigem>();
                N0203REGBusiness  N0203REGBusiness = new N0203REGBusiness();
                mesOrigem = N0203REGBusiness.MesXOrigem();
                return(this.Json(new { mesOrigem }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult carregarObservacoes(string numreg)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness N0203REGBusines   = new N0203REGBusiness();
                List <String>    listarObservacoes = new List <String>();
                listarObservacoes = N0203REGBusines.listarObservacoes(numreg);

                return(this.Json(new { listarObservacoes, sucesso = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult mediaPreAprovado()
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }

            try
            {
                int media;
                N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
                media = N0203REGBusiness.mediaPreAprovado();
                return(this.Json(new { media }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #22
0
        public JsonResult ExcluirAgrupamento(string agrupamento)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness N0203REGBusines = new N0203REGBusiness();

                bool   resposta = N0203REGBusines.ExcluirAgrupamento(agrupamento);
                string dados    = resposta ? "" : "Não é possível excluir agrupamento já integrado!";
                return(this.Json(new { resposta, dados }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #23
0
        public JsonResult PesquisarAgrupamento(long codigoCliente, int filtro)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness   N0203REGBusines = new N0203REGBusiness();
                List <Agrupamento> AGP             = new List <Agrupamento>();
                AGP = N0203REGBusines.PesquisarAgrupamento(codigoCliente, filtro);

                return(this.Json(new { AGP, sucesso = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
        public JsonResult timeLine(string numeroOcorrencia)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                N0203REGBusiness N0203REGBusines = new N0203REGBusiness();
                List <TimeLine>  listaTimeLine   = new List <TimeLine>();
                listaTimeLine = N0203REGBusines.timeLine(Convert.ToInt64(numeroOcorrencia));

                return(this.Json(new { listaTimeLine, sucesso = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #25
0
 public JsonResult ReprovarRegistrosOcorrenciaNivel1(string codigoRegistro, string observacaoReprovacao)
 {
     if (this.Logado != ((char)Enums.Logado.Sim).ToString())
     {
         return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
     }
     try
     {
         N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
         N9999USU         N9999USU         = new N9999USU();
         N9999USUBusiness N9999USUBusiness = new N9999USUBusiness();
         UsuarioADModel   usuarioAD        = new UsuarioADModel();
         var ActiveDirectoryBusiness       = new ActiveDirectoryBusiness();
         var dadosProtocolo = N0203REGBusiness.PesquisaRegistroOcorrencia(long.Parse(codigoRegistro));
         if (dadosProtocolo != null)
         {
             var tipoAtend = Enums.TipoAtendimento.DevolucaoMercadorias;
             if (dadosProtocolo.TIPATE == (int)Enums.TipoAtendimento.TrocaMercadorias)
             {
                 tipoAtend = Enums.TipoAtendimento.TrocaMercadorias;
             }
             N9999USU  = N9999USUBusiness.ListaDadosUsuarioPorCodigo(Convert.ToInt64(dadosProtocolo.USUGER));
             usuarioAD = ActiveDirectoryBusiness.ListaDadosUsuarioAD(N9999USU.LOGIN);
             bool ReprovadoSucesso = N0203REGBusiness.ReprovarRegistrosOcorrenciaNivel1(long.Parse(codigoRegistro), long.Parse(this.CodigoUsuarioLogado), observacaoReprovacao);
             this.MontarEmailProtocoloReprovado(codigoRegistro, observacaoReprovacao, tipoAtend, usuarioAD.Email);
             return(this.Json(new { ReprovadoSucesso }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             var msgRetornoSapiens = string.Empty;
             msgRetornoSapiens = "Registro de devolução Nº " + codigoRegistro + " não encontrado.";
             return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         this.Session["ExceptionErro"] = ex;
         return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
     }
 }
예제 #26
0
        public ActionResult Vincular(int numeroRegistro, string codPlaca, string observacao)
        {
            bool             acesso           = true;
            N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
            DateTime         localDate        = DateTime.Now;

            if (N0203REGBusiness.ValidarPlaca(codPlaca.ToUpper()))
            {
                return(this.Json(new { placa = false }, JsonRequestBehavior.AllowGet));
            }
            else
            {
            }
            if (N0203REGBusiness.ValidarOcorrenciaTransportadora(numeroRegistro.ToString()))
            {
                return(this.Json(new { transportadora = true }, JsonRequestBehavior.AllowGet));
            }

            bool retorno = N0203REGBusiness.Vincular(numeroRegistro.ToString(), codPlaca, this.CodigoUsuarioLogado, localDate.ToString(), observacao);

            return(this.Json(new { retorno, acesso }, JsonRequestBehavior.AllowGet));
        }
예제 #27
0
        public JsonResult EmitirNotaEntradaSapiens(string codigoRegistro, string operacao, string tipoNota)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                var             N0203REGBusiness  = new N0203REGBusiness();
                var             E000NFCBusiness   = new E000NFCBusiness();
                E085CLIBusiness E085CLIBusiness   = new E085CLIBusiness();
                var             aprovadoSucesso   = false;
                var             msgRetornoSapiens = string.Empty;
                var             msgRetornoPedido  = string.Empty;

                // Operação ==> Aprovar e Tipo Nota ==> Nutriplan

                if (int.Parse(operacao) == (int)Enums.OperacaoAprovacaoFaturamento.Aprovar && int.Parse(tipoNota) == (int)Enums.TipoNotaDevolucao.Nutriplan)
                {
                    var dadosProtocolo = N0203REGBusiness.PesquisaRegistroOcorrencia(long.Parse(codigoRegistro));
                    if (dadosProtocolo != null)
                    {
                        var cnpj = E085CLIBusiness.PesquisaClientes(dadosProtocolo.CODCLI).FirstOrDefault().CnpjCpf;
                        // Agrupa notas para validar se há xml de cliente com a mesma nota do protocolo
                        var listNotas = (from a in dadosProtocolo.N0203IPV
                                         group new { a } by new { a.CODEMP, a.CODFIL, a.NUMNFV } into grupo
                                         select new { grupo.Key.CODFIL, grupo.Key.NUMNFV }).ToList();
                        var nota         = listNotas.FirstOrDefault();
                        var validarNotas = E000NFCBusiness.ValidarNotaCliente(nota.NUMNFV.ToString(), nota.CODFIL.ToString(), cnpj);
                        if (validarNotas.Count() == 0)
                        {
                            // Lançar Nota No SISTEMA SAPIENS
                            bool Motivo = N0203REGBusiness.ConsultarOrigem(Convert.ToInt32(codigoRegistro));

                            if (Motivo == true)
                            {
                                N0203REGBusiness.PedidosViaOcorrencia(Convert.ToInt32(codigoRegistro), int.Parse(this.CodigoUsuarioLogado), out msgRetornoPedido);
                            }
                            if (!N0203REGBusiness.EmitirLancamentoNfe(dadosProtocolo, out msgRetornoSapiens))
                            {
                                msgRetornoSapiens = "Registro de devolução Nº " + codigoRegistro + " não aprovado.<br/><br/>Erro de integração com o sistema sapiens.<br/><br/>" + msgRetornoSapiens + " " + msgRetornoPedido;
                                var tipoAtend = Enums.TipoAtendimento.DevolucaoMercadorias;
                                if (dadosProtocolo.TIPATE == (int)Enums.TipoAtendimento.TrocaMercadorias)
                                {
                                    tipoAtend = Enums.TipoAtendimento.TrocaMercadorias;
                                }
                                // Envia Email para TI informando ERRO de integração...
                                this.MontarEmailErroIntegracaoSapiens(codigoRegistro, msgRetornoSapiens, tipoAtend);
                            }
                            else
                            {
                                aprovadoSucesso = true;
                            }
                        }
                        else
                        {
                            N0203REGBusiness.RollbackAprovacao(codigoRegistro);
                            msgRetornoSapiens = "Registro de devolução Nº " + codigoRegistro + " não aprovado.<br/><br/>Verifique as notas " + string.Join(",", validarNotas) + " do cliente.<br/><br/>Selecione o tipo de nota Cliente.";
                        }
                    }
                    else
                    {
                        msgRetornoSapiens = "Registro de devolução Nº " + codigoRegistro + " não encontrado.";
                    }
                }
                if (aprovadoSucesso == false)
                {
                    N0203REGBusiness.RollbackAprovacao(codigoRegistro);
                }
                return(this.Json(new { msgRetornoSapiens, AprovadoSucesso = aprovadoSucesso }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #28
0
        public ActionResult Login(LoginViewModel modelo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    this.InicializaView();

                    modelo.UserName = modelo.UserName.ToLower();
                    if (Membership.ValidateUser(modelo.UserName, modelo.Password))
                    {
                        var N9999USUBusiness = new N9999USUBusiness();
                        // Busca código do usuário

                        dadosUsuario         = N9999USUBusiness.ListaDadosUsuarioPorLogin(modelo.UserName);
                        modelo.versaoSistema = "Produção";

                        if (dadosUsuario != null)
                        {
                            var n9999MENBusiness = new N9999MENBusiness();
                            var n9999SIS         = new N9999SIS();
                            var lista            = n9999MENBusiness.MontarMenu(dadosUsuario.CODUSU, (int)Enums.Sistema.NWORKFLOW);

                            N0203REGBusiness N0203REGBusiness = new N0203REGBusiness();
                            if (lista.Count > 0)
                            {
                                this.Logado              = ((char)Enums.Logado.Sim).ToString();
                                this.PermissoesDeAcesso  = lista;
                                this.TramitesNotificao   = ListaN0203TRAPesquisaa;
                                this.ProtocolosPendentes = listaAprovacao;
                                var ActiveDirectoryBusiness = new ActiveDirectoryBusiness();
                                this.NomeUsuarioLogado   = Abreviar(ActiveDirectoryBusiness.ListaDadosUsuarioAD(modelo.UserName).Nome, true);
                                this.LoginUsuario        = modelo.UserName;
                                this.CodigoUsuarioLogado = dadosUsuario.CODUSU.ToString();
                                this.Empresa             = "NUTRIPLAST INDÚSTRIA E COMÉRCIO LTDA";
                                this.EmpresaFilial       = "CASCAVEL";
                                //this.EmpresaFilialArmazem = "CENTRO DE DISTRIBUIÇÃO";
                                this.NomeAbreviadoEmpresa = "NUTRIPLAN";
                                this.CnpjEmpresa          = "78.575.511/0001-29";
                                this.EnderecoEmpresa      = "Av. Das Agroindústrias, 1829 - Distrito Industrial Domiciano Theobaldo Bresolin";
                                this.CepEmpresa           = "85818-560";

                                return(this.RedirectToAction("InformacoesProtocolo", "InformacoesProtocolo"));
                            }
                            else
                            {
                                ModelState.AddModelError("", "Usuário não possuí acesso ao Sistema de Ocorrência. Favor abrir chamado solicitando acesso.");
                            }
                        }
                        else
                        {
                            ModelState.AddModelError("", "Usuário não possuí acesso ao Sistema de Ocorrência. Favor abrir chamado solicitando acesso.");
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "Usuário ou senha inválida.");
                    }
                }

                return(this.View("Login", this.loginViewModel));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.RedirectToAction("ErroException", "Erro"));
            }
        }
        public JsonResult imprimirRelatorioExcel()
        {
            try
            {
                List <RelatorioGraficoItens> ListaRelatorioItens = new List <RelatorioGraficoItens>();
                N0203REGBusiness             n0203REGBusiness    = new N0203REGBusiness();
                // string msgRetorno = "Nenhum Registro Encontrado.";

                ListaRelatorioItens = n0203REGBusiness.RelatorioGraficoItens("12", "", "myBarChartIndustrial", "2018");

                List <RelatorioGraficoOcorrencia> ListaRelatorioOcorrencia = new List <RelatorioGraficoOcorrencia>();
                //ListaRelatorioOcorrencia = n0203REGBusiness.relatorioGraficoOcorrencias();


                LocalReport report = new LocalReport();
                report.ReportPath = Server.MapPath("~/Reports/RelatorioGrafico.rdlc");
                var reportRelatorio = new ReportDataSource("Itens", ListaRelatorioItens);

                var relatorioGraficoOcorrencia = new ReportDataSource("Ocorrencia", ListaRelatorioOcorrencia);

                // string nomeRelatorio = "Relatorio";

                report.Refresh();
                report.DataSources.Add(reportRelatorio);
                report.DataSources.Add(relatorioGraficoOcorrencia);

                string    reportType = "Excel";
                string    mineType;
                byte[]    reportBytes;
                string    encoding;
                string    fileNameExtension;
                Warning[] warnings;
                string[]  streams;

                string deviceInfo =
                    "<DeviceInfo>" +
                    " <OutputFormat>Excel</OutputFormat>" +
                    " <PageWidth>in</PageWidth>" +
                    " <PageHeight>in</PageHeight>" +
                    " <MarginTop>in</MarginTop>" +
                    " <MarginLeft>in</MarginLeft>" +
                    " <MarginRight>in</MarginRight>" +
                    " <MarginBottom>in</MarginBottom>" +
                    "</DeviceInfo>";

                reportBytes = report.Render(
                    reportType,
                    deviceInfo,
                    out mineType,
                    out encoding,
                    out fileNameExtension,
                    out streams,
                    out warnings);

                var base64EncodedPDF = System.Convert.ToBase64String(reportBytes);
                return(this.Json("data:application/Excel;base64, " + base64EncodedPDF, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #30
0
        public JsonResult AprovarRegistrosOcorrencia(string codigoRegistro, string operacao, string tipoOperacao, string tipoNota, string observacao, string msgRetornoSapiens)
        {
            if (this.Logado != ((char)Enums.Logado.Sim).ToString())
            {
                return(this.Json(new { redirectUrl = Url.Action("Login", "Login"), Logado = true }, JsonRequestBehavior.AllowGet));
            }
            try
            {
                var    N0203REGBusiness = new N0203REGBusiness();
                var    aprovadoSucesso  = true;
                string msgRetorno       = "";
                string msgRetornoPedido = "";

                bool Motivo = N0203REGBusiness.ConsultarOrigem(Convert.ToInt32(codigoRegistro));

                if (Motivo == true && operacao.Contains("1"))
                {
                    N0203REGBusiness.PedidosViaOcorrencia(Convert.ToInt32(codigoRegistro), int.Parse(this.CodigoUsuarioLogado), out msgRetornoPedido);
                }

                if (msgRetornoPedido == "" || msgRetornoPedido == "OK")
                {
                    msgRetorno = N0203REGBusiness.AprovarRegistrosOcorrencia(long.Parse(codigoRegistro), long.Parse(this.CodigoUsuarioLogado), observacao, int.Parse(operacao), tipoOperacao);
                }
                else
                {
                    aprovadoSucesso = false;
                }

                if (msgRetorno.Contains("Operação não permitida, verifique se a ocorrência está com a situação integrado ou faturada.") || msgRetorno.Contains("Operação não permitida, verifique se a ocorrência está com a situação recebida") || msgRetorno.Contains("não está com a situação recebido") || msgRetorno.Contains("Registro de Ocorrência está vinculada a um agrupamento."))
                {
                    aprovadoSucesso = false;
                }
                else if (msgRetorno != "Registros de ocorrências agrupadas foram integradas com sucesso!")
                {
                    if (int.Parse(operacao) == (int)Enums.OperacaoAprovacaoFaturamento.Aprovar && int.Parse(tipoNota) == (int)Enums.TipoNotaDevolucao.Nutriplan)
                    {
                        var descNota = Attributes.KeyValueAttribute.GetFirst("Descricao", Enums.TipoNotaDevolucao.Nutriplan).GetValue <string>();

                        if (msgRetornoPedido != " " && msgRetornoPedido != "")
                        {
                            msgRetorno += "<br></br> Retorno Sapiens: " + msgRetornoSapiens + "<br/>Tipo Nota: " + tipoNota + " - " + descNota + ". Obs Aprovação Faturamento: " + observacao + " <br/>Pedido Indenizado: " + msgRetornoPedido;
                        }
                        else
                        {
                            msgRetorno += "<br></br> Retorno Sapiens: " + msgRetornoSapiens + "<br/>Tipo Nota: " + tipoNota + " - " + descNota + ". Obs Aprovação Faturamento: " + observacao;
                        }
                    }

                    else if (int.Parse(operacao) == (int)Enums.OperacaoAprovacaoFaturamento.Aprovar && int.Parse(tipoNota) == (int)Enums.TipoNotaDevolucao.Cliente)
                    {
                        var descNota = Attributes.KeyValueAttribute.GetFirst("Descricao", Enums.TipoNotaDevolucao.Cliente).GetValue <string>();
                        if (msgRetornoPedido != "")
                        {
                            msgRetorno += "<br></br> Tipo Nota: " + tipoNota + " - " + descNota + ". Obs Aprovação Faturamento: " + observacao + " <br/>Pedido Indenizado: " + msgRetornoPedido;
                        }
                        else
                        {
                            msgRetorno += "<br></br> Tipo Nota: " + tipoNota + " - " + descNota + ". Obs Aprovação Faturamento: " + observacao;
                        }
                    }

                    if (int.Parse(tipoNota) == (int)Enums.TipoNotaDevolucao.Nutriplan)
                    {
                        if (msgRetornoPedido != "")
                        {
                            msgRetorno += msgRetorno + "<br/><br/>Retorno Sapiens: " + msgRetornoSapiens + "<br/> Pedido Indenizado: " + msgRetornoPedido;
                        }
                        else
                        {
                            msgRetorno += msgRetorno + "<br/><br/>Retorno Sapiens: " + msgRetornoSapiens;
                        }
                    }
                }

                return(this.Json(new { msgRetorno, AprovadoSucesso = aprovadoSucesso }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                this.Session["ExceptionErro"] = ex;
                return(this.Json(new { redirectUrl = Url.Action("ErroException", "Erro"), ErroExcecao = true }, JsonRequestBehavior.AllowGet));
            }
        }