public ActionResult ListApontamento(string matricula, string filial, string data) { try { if (data != null) { config = new Configuracao(); marcacao = new Marcacao(); var ano = data.Substring(0, 4); var dia = data.Substring(5, 2); var mes = data.Substring(8, 2); data = ano + dia + mes; matricula = User.GetDados("Matricula"); filial = User.GetDados("Filial"); var JornadaDiaria = _jornadaTrbNegocio.ObterListaJornadaPorData(data); } return(Json(_prothuesService.ObterBatidasDePonto(matricula, filial, data))); } catch (Exception e) { return(Json(new { msg = e.Message, erro = true })); } }
public List <Fechamento> ValidacaoFechamento(string id) { List <Fechamento> listFechamento = new List <Fechamento>(); //Mit Validação 8.4.4. //var listD = ValidaSabadoDomingoEFeriado(id); //if (listD.Count > 0) //{ // foreach (Fechamento fechamentolist in listD) // { // listFechamento.Add(fechamentolist); // } //} //Mit Validação 8.4.1 var listLancamento = ValidaDiasComLancameto(id); var listSemLancamento = ValidaDiasSemLancameto(id); foreach (Fechamento fechamentolist in listLancamento.OrderBy(x => x.DataLancamento)) { var listApontamento = _prothuesService.ObterBatidasDePonto(matricula, filial, fechamentolist.DataLancamento.ToDateProtheusConvert()); var fechamentoReturn = _fechamentoNegocio.ValidarApontamentoImpar(fechamentolist, listApontamento); if (fechamentoReturn.Divergencia != null) { Fechamento novoFechamento = new Fechamento(); novoFechamento = fechamentoReturn; listFechamento.Add(novoFechamento); } } //Mit Validação 8.4.1 foreach (Fechamento fechamentolist in listSemLancamento.OrderBy(x => x.DataLancamento)) { var listApontamento = _prothuesService.ObterBatidasDePonto(matricula, filial, fechamentolist.DataLancamento.ToDateProtheusConvert()); var fechamentoReturn = _fechamentoNegocio.ValidarApontamentoImpar(fechamentolist, listApontamento); if (fechamentoReturn.Divergencia != null) { Fechamento novoFechamento = new Fechamento(); novoFechamento = fechamentoReturn; listFechamento.Add(novoFechamento); } } //Mit Validação 8.4.2 var listA = ValidaDiferencaTotalHoraDiaLancamentoMacacao(id); if (listA.Count > 0) { foreach (Fechamento fechamentoResult in listA.ToList()) { listFechamento.Add(fechamentoResult); } } //Mit Validação 8.4.3 var listE = ValidaDiasSemLancameto(id); if (listE.Count > 0) { foreach (Fechamento fechamentoResult in listE.ToList()) { listFechamento.Add(fechamentoResult); } } //Mit Validação 8.4.5 e Validação 8.4.7. var listB = ValidaDiferencaBatida(id); if (listB.Count > 0) { foreach (Fechamento fechamentoResult in listB.ToList()) { listFechamento.Add(fechamentoResult); } } //Mit Validação 8.4.8 a Validação 8.4.10 var listC = ValidaDiferencaTotalHoraLancamentoPorDiaETotalHoraJornadaDiaria(id); if (listC.Count > 0) { foreach (Fechamento fechamentoResult in listC.ToList()) { listFechamento.Add(fechamentoResult); } } //Mit Validação 8.4.8 e 8.4.9 e 8.4.10. var listF = ValidaLancamentoForaDeIntervalo(id); if (listF.Count > 0) { foreach (Fechamento fechamentoResult in listF.ToList()) { listFechamento.Add(fechamentoResult); } } var listG = ValidaLancamentoForaDeIntervaloMinMax(id); if (listG.Count > 0) { foreach (Fechamento fechamentoResult in listG.ToList()) { listFechamento.Add(fechamentoResult); } } var DiasUteisSemLancamento = ValidaDiasSemLancameto(id); var listH = ValidaDiasSemApontamentoRelogio(id, DiasUteisSemLancamento); if (listH.Count > 0) { foreach (Fechamento fechamentoResult in listH.ToList()) { listFechamento.Add(fechamentoResult); } } return(listFechamento); }
private List <Apontamento> ListaApontamentoPorLancamentoEfechamento(List <ViewModelLancamento> listlancamentoViewModel, string codmarcacao) { List <Apontamento> listaApontamento = new List <Apontamento>(); string datalancamento = "0"; // foreach (ViewModelLancamento lancamento in listlancamentoViewModel.OrderBy(x => x.DateLancamento)) { if (datalancamento != lancamento.DateLancamento) { var listApontamento = _protheusService.ObterBatidasDePonto(User.GetDados("Matricula"), User.GetDados("Filial"), lancamento.DateLancamento); datalancamento = lancamento.DateLancamento; if (listApontamento.Count > 0) { foreach (Apontamento apontamentoResult in listApontamento) { Apontamento novo = new Apontamento(); List <Lancamento> listaLancamentoPorApontamento = new List <Lancamento>(); novo.dataApontamento = datalancamento.ToDateProtheusReverseformate(); novo.apontamento = apontamentoResult.apontamento; foreach (ViewModelLancamento listaLacamento in listlancamentoViewModel.OrderBy(x => x.DateLancamento)) { if (novo.dataApontamento == listaLacamento.DateLancamento.ToDateProtheusReverseformate()) { if (!listaLancamentoPorApontamento.Contains(_mapper.Map <Lancamento>(listaLacamento), new ComparerDados())) { listaLancamentoPorApontamento.Add(_mapper.Map <Lancamento>(listaLacamento)); } } } novo.listLancamento = listaLancamentoPorApontamento; listaApontamento.Add(novo); } } else { Apontamento novo = new Apontamento(); List <Lancamento> listaLancamentoPorApontamento = new List <Lancamento>(); novo.dataApontamento = datalancamento.ToDateProtheusReverseformate(); foreach (ViewModelLancamento listaLacamento in listlancamentoViewModel.OrderBy(x => x.DateLancamento)) { if (novo.dataApontamento == listaLacamento.DateLancamento.ToDateProtheusReverseformate()) { if (!listaLancamentoPorApontamento.Contains(_mapper.Map <Lancamento>(listaLacamento), new ComparerDados())) { listaLancamentoPorApontamento.Add(_mapper.Map <Lancamento>(listaLacamento)); } } } novo.listLancamento = listaLancamentoPorApontamento; listaApontamento.Add(novo); } } } var listlancamento = _mapper.Map <List <Lancamento> >(listlancamentoViewModel); var marcacao = _marcacao.ObterMarcacao(codmarcacao); var jornada = _jornadaTrbServiceRepository.ObterJornadaPorCodigo(marcacao.codigojornada); var listDiasSemLancamento = _lancamentoNegocio.ObterDiasSemLancamento(listlancamento.Distinct(new LancamentoComparer()).ToList(), marcacao, User.GetDados("Filial"), jornada); foreach (Fechamento fachamento in listDiasSemLancamento.OrderBy(x => x.DataLancamento)) { var listApontamento = _protheusService.ObterBatidasDePonto(User.GetDados("Matricula"), User.GetDados("Filial"), fachamento.DataLancamento); if (listApontamento.Count > 0) { foreach (Apontamento apontamentoResult in listApontamento) { Apontamento novo = new Apontamento(); List <Lancamento> listaLancamentoPorApontamento = new List <Lancamento>(); novo.dataApontamento = fachamento.DataLancamento.ToDateProtheusReverseformate(); novo.apontamento = apontamentoResult.apontamento; listaApontamento.Add(novo); } } else { Apontamento novo = new Apontamento(); List <Lancamento> listaLancamentoPorApontamento = new List <Lancamento>(); novo.dataApontamento = fachamento.DataLancamento.ToDateProtheusReverseformate(); listaApontamento.Add(novo); } } return(listaApontamento); }