/// <summary> /// Genera un diccionaro con la información de las personas responsables. /// </summary> /// <param name="estructuraReporte">Estructura del reporte.</param> /// <returns>Diccionario con la información de las personas responsables.</returns> private IDictionary <String, IList <PersonaResponsable431000DTO> > GeneraDiccionarioPersonasResponsables(ReporteXBRLDTO estructuraReporte) { var documentoInstancia = estructuraReporte.Instancia; var consultaUtil = new ConsultaDocumentoInstanciaUtil(documentoInstancia, estructuraReporte.Plantilla); var diccionario = new Dictionary <String, IList <PersonaResponsable431000DTO> >(); var filtroHechos = new FiltroHechosDto() { IdConcepto = new List <String>() { "ar_pros_ResponsiblePersonName", "ar_pros_ResponsiblePersonPosition", "ar_pros_ResponsiblePersonInstitution", "ar_pros_ResponsiblePersonLegend", "ar_pros_SignIssuanceUnderArt13OfTheCUE", "ar_pros_ResponsiblePersonInstitutionExternalAuditor", "ar_pros_OtherInstitutionExternalAuditor", "ar_pros_ResponsiblePersonInstitutionBacherlorOfLaws", "ar_pros_OtherInstitutionBacherlorOfLaws", } }; var diccionarioPersonasResponsables = new Dictionary <String, IList <PersonaResponsable431000DTO> >(); var idsHechosConceptos = consultaUtil.BuscaHechosPorFiltro(filtroHechos); var idsContextos = consultaUtil.ObtenIdsContextosHechos(idsHechosConceptos); var contextosPorFiguraResponsable = consultaUtil.AgrupaContextosPorMiembro("http://www.cnbv.gob.mx/2016-08-22/ar_prospectus:TypeOfResponsibleFigureAxis", idsContextos); foreach (var idItemMiembroFiguraResponsable in contextosPorFiguraResponsable.Keys) { var listaContextosPorFiguraResponsable = contextosPorFiguraResponsable[idItemMiembroFiguraResponsable]; var contextosPorEntidad = consultaUtil.AgrupaContextosPorMiembro("http://www.cnbv.gob.mx/2016-08-22/ar_prospectus:ResponsiblePersonsInstitutionSequenceTypedAxis", listaContextosPorFiguraResponsable); IList <PersonaResponsable431000DTO> listaPersonasResponsablesMiembro; if (!diccionario.TryGetValue(idItemMiembroFiguraResponsable, out listaPersonasResponsablesMiembro)) { listaPersonasResponsablesMiembro = new List <PersonaResponsable431000DTO>(); diccionario.Add(idItemMiembroFiguraResponsable, listaPersonasResponsablesMiembro); } foreach (var miembroTipificadoInstitucion in contextosPorEntidad.Keys) { var personaResponsableDto = new PersonaResponsable431000DTO() { Miembros = new List <PersonaResponsableMiembro431000DTO>() }; listaPersonasResponsablesMiembro.Add(personaResponsableDto); var listaContextosPorInstitucion = contextosPorEntidad[miembroTipificadoInstitucion]; var listaIdsHechosInstitucion = consultaUtil.BuscaHechosPorFiltro(new FiltroHechosDto() { IdConcepto = new List <String>() { "ar_pros_ResponsiblePersonInstitution", "ar_pros_ResponsiblePersonLegend", "ar_pros_ResponsiblePersonInstitutionExternalAuditor", "ar_pros_OtherInstitutionExternalAuditor", "ar_pros_ResponsiblePersonInstitutionBacherlorOfLaws", "ar_pros_OtherInstitutionBacherlorOfLaws" }, IdContexto = listaContextosPorInstitucion }); String otraInstitucion = String.Empty; foreach (var idHechoInstitucion in listaIdsHechosInstitucion) { HechoDto hechoInsititucionLeyenda; if (documentoInstancia.HechosPorId.TryGetValue(idHechoInstitucion, out hechoInsititucionLeyenda)) { if (hechoInsititucionLeyenda.IdConcepto.Equals("ar_pros_ResponsiblePersonInstitution")) { personaResponsableDto.Institucion = hechoInsititucionLeyenda.Valor; } if (hechoInsititucionLeyenda.IdConcepto.Equals("ar_pros_ResponsiblePersonInstitutionExternalAuditor") || hechoInsititucionLeyenda.IdConcepto.Equals("ar_pros_ResponsiblePersonInstitutionBacherlorOfLaws")) { personaResponsableDto.Institucion = hechoInsititucionLeyenda.Valor; } if (hechoInsititucionLeyenda.IdConcepto.Equals("ar_pros_OtherInstitutionExternalAuditor") || hechoInsititucionLeyenda.IdConcepto.Equals("ar_pros_OtherInstitutionBacherlorOfLaws")) { otraInstitucion = hechoInsititucionLeyenda.Valor; } if (hechoInsititucionLeyenda.IdConcepto.Equals("ar_pros_ResponsiblePersonLegend")) { personaResponsableDto.Leyenda = hechoInsititucionLeyenda.Valor; } } } if (!String.IsNullOrEmpty(otraInstitucion) && personaResponsableDto.Institucion.Equals("Otro")) { personaResponsableDto.Institucion = otraInstitucion; } var diccionarioMiembrosPersonasResponsables = consultaUtil.AgrupaContextosPorMiembro("http://www.cnbv.gob.mx/2016-08-22/ar_prospectus:ResponsiblePersonsSequenceTypedAxis", listaContextosPorInstitucion); foreach (var idMiembroResponsable in diccionarioMiembrosPersonasResponsables.Keys) { var listaContextosPersonaResponsable = diccionarioMiembrosPersonasResponsables[idMiembroResponsable]; var idPrimerContexto = listaContextosPersonaResponsable.First(); IList <String> listaIdsHechosPersonaResponsable; if (documentoInstancia.HechosPorIdContexto.TryGetValue(idPrimerContexto, out listaIdsHechosPersonaResponsable)) { var miembroPresonaResponsable = new PersonaResponsableMiembro431000DTO(); for (var indexHechoPresona = 0; indexHechoPresona < listaIdsHechosPersonaResponsable.Count; indexHechoPresona++) { var idHechoPersona = listaIdsHechosPersonaResponsable[indexHechoPresona]; HechoDto hechoPersonaResponsable; if (documentoInstancia.HechosPorId.TryGetValue(idHechoPersona, out hechoPersonaResponsable)) { if (hechoPersonaResponsable.IdConcepto.Equals("ar_pros_ResponsiblePersonName")) { miembroPresonaResponsable.Nombre = hechoPersonaResponsable.Valor; } if (hechoPersonaResponsable.IdConcepto.Equals("ar_pros_ResponsiblePersonPosition")) { miembroPresonaResponsable.Cargo = hechoPersonaResponsable.Valor; } if (hechoPersonaResponsable.IdConcepto.Equals("ar_pros_SignIssuanceUnderArt13OfTheCUE")) { miembroPresonaResponsable.FirmaArticulo13 = hechoPersonaResponsable.Valor.Equals("SI"); if (miembroPresonaResponsable.FirmaArticulo13) { personaResponsableDto.ContieneFirmasLeyendaArt13 = true; } } } } if (!String.IsNullOrEmpty(miembroPresonaResponsable.Nombre)) { personaResponsableDto.Miembros.Add(miembroPresonaResponsable); } } } } } return(diccionario); }
/// <summary> /// Exporta todos los hechos asociados al miembro de la figura enviada como parámetro /// </summary> /// <returns></returns> private int ExportarFigura(int numRow, string idMiembroFiguraActual, ISheet hojaAExportar, DocumentoInstanciaXbrlDto instancia, IDefinicionPlantillaXbrl plantillaDocumento, ConsultaDocumentoInstanciaUtil consultaUtil) { var idsHechosConceptosInstitucion = consultaUtil.BuscaHechosPorFiltro(new Dto.Hipercubos.FiltroHechosDto() { IdConcepto = ID_CONCEPTO_INSTITUCION, }); if (hojaAExportar.SheetName == "431000-Auditor") { ID_CONCEPTO_INSTITUCION[0] = "ar_pros_ResponsiblePersonInstitutionExternalAuditor"; } else if (hojaAExportar.SheetName == "431000-Derecho") { ID_CONCEPTO_INSTITUCION[0] = "ar_pros_ResponsiblePersonInstitutionBacherlorOfLaws"; } var idsContextosInstitucion = consultaUtil.ObtenIdsContextosHechos(idsHechosConceptosInstitucion); var contextosPorInstitucion = consultaUtil.AgrupaContextosPorMiembro("http://www.cnbv.gob.mx/2016-08-22/ar_prospectus:TypeOfResponsibleFigureAxis", idsContextosInstitucion); if (contextosPorInstitucion.ContainsKey(idMiembroFiguraActual)) { var contextosFiguraActual = contextosPorInstitucion[idMiembroFiguraActual]; foreach (var idContextoFigActual in contextosFiguraActual) { var ctxFigActual = instancia.ContextosPorId[idContextoFigActual]; var dimTypedInst = ctxFigActual.ValoresDimension.FirstOrDefault(x => x.IdDimension == ID_DIMENSION_TYPED_INSTITUCION); var idsHechosConceptosPersonas = consultaUtil.BuscaHechosPorFiltro(new Dto.Hipercubos.FiltroHechosDto() { IdConcepto = ID_CONCEPTO_PERSONAS, ConjuntosParcialesDimensiones = new List <IList <DimensionInfoDto> >() { ctxFigActual.ValoresDimension } }); var idsContextosPersonas = consultaUtil.ObtenIdsContextosHechos(idsHechosConceptosPersonas); var contextosPorPersona = consultaUtil.AgrupaContextosPorMiembro("http://www.cnbv.gob.mx/2016-08-22/ar_prospectus:ResponsiblePersonsSequenceTypedAxis", idsContextosPersonas); foreach (var seqPersona in contextosPorPersona.Keys) { foreach (var idCtxPersona in contextosPorPersona[seqPersona]) { numRow++; hojaAExportar.ShiftRows(numRow, hojaAExportar.LastRowNum, 1); var renglon = hojaAExportar.CreateRow(numRow); var ctxPersona = instancia.ContextosPorId[idCtxPersona]; var hecho = consultaUtil.ObtenerHechoPorIdConcepto(instancia.HechosPorIdContexto[idCtxPersona], ID_CONCEPTO_PERSONAS[0]); var celda = renglon.GetCell(COL_CONCEPTO_NOMBRE, MissingCellPolicy.CREATE_NULL_AS_BLANK); celda.SetCellValue(hecho.Valor); hecho = consultaUtil.ObtenerHechoPorIdConcepto(instancia.HechosPorIdContexto[idCtxPersona], ID_CONCEPTO_PERSONAS[1]); celda = renglon.GetCell(COL_CONCEPTO_CARGO, MissingCellPolicy.CREATE_NULL_AS_BLANK); celda.SetCellValue(hecho.Valor); hecho = consultaUtil.ObtenerHechoPorIdConcepto(instancia.HechosPorIdContexto[idContextoFigActual], ID_CONCEPTO_INSTITUCION[0]); celda = renglon.GetCell(COL_CONCEPTO_INSTITUCION, MissingCellPolicy.CREATE_NULL_AS_BLANK); celda.SetCellValue(hecho.Valor); hecho = consultaUtil.ObtenerHechoPorIdConcepto(instancia.HechosPorIdContexto[idContextoFigActual], ID_CONCEPTO_INSTITUCION[1]); celda = renglon.GetCell(COL_CONCEPTO_LEYENDA, MissingCellPolicy.CREATE_NULL_AS_BLANK); celda.SetCellValue(hecho.Valor); } } } } return(numRow); }