public ResumenInformacion4DDTO(ResumenInformacion4D entity) { this.Taxonomia = ReporteUtil.obtenerNombreSimpleTaxonomia(entity.Taxonomia); this.FechaReporte = entity.FechaReporte; this.ClaveCotizacion = entity.ClaveCotizacion; this.NumeroFideicomiso = entity.NumeroFideicomiso; this.Unidad = entity.Unidad; this.TotalActivo = entity.TotalActivo; this.TotalActivoFormateado = "$" + ReporteXBRLUtil.formatoDecimal(entity.TotalActivo, ReporteXBRLUtil.FORMATO_CANTIDADES_MONETARIAS); this.TotalPasivo = entity.TotalPasivo; this.TotalPasivoFormateado = "$" + ReporteXBRLUtil.formatoDecimal(entity.TotalPasivo, ReporteXBRLUtil.FORMATO_CANTIDADES_MONETARIAS); this.TotalCapitalContablePasivo = entity.TotalCapitalContablePasivo; this.TotalCapitalContablePasivoFormateado = "$" + ReporteXBRLUtil.formatoDecimal(entity.TotalCapitalContablePasivo, ReporteXBRLUtil.FORMATO_CANTIDADES_MONETARIAS); this.Ingreso = entity.Ingreso; this.IngresoFormateado = "$" + ReporteXBRLUtil.formatoDecimal(entity.Ingreso, ReporteXBRLUtil.FORMATO_CANTIDADES_MONETARIAS); this.NombreProveedorServiciosAuditoria = entity.NombreProveedorServiciosAuditoria; this.NombreSocioOpinion = entity.NombreSocioOpinion; this.TipoOpinionEstadosFinancieros = entity.TipoOpinionEstadosFinancieros; }
/// <summary> /// Método asíncrono que genera documentos en la collection Resumen4D de envios actuales no procesados. /// </summary> /// <returns></returns> async Task GeneraColeccionResumen4D() { await Task.Run(() => { List <ResumenInformacion4D> listaPersonasResponsables = new List <ResumenInformacion4D>(); var universoTaxonomias = "'http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_ics_entry_point_2014-12-05', 'http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_cp_entry_point_2014-12-05'," + "'http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_fibras_entry_point_2014-12-05', 'http://www.bmv.com.mx/2015-06-30/ccd/full_ifrs_ccd_entry_point_2015-06-30', " + "'http://www.bmv.com.mx/2015-06-30/deuda/full_ifrs_deuda_entry_point_2015-06-30'"; #region Elimina los documentos de envios con el atributo EsVersionActual=false. var parametrosEnvio = " { EsVersionActual: false, 'Parametros.trimestre': '4D', Taxonomia: {$in : [" + universoTaxonomias + "] } }"; var listaIdEnviosAEliminarEnResumen4D = AbaxXBRLCellStoreMongo.ConsultaElementos <Envio>("Envio", parametrosEnvio).ToList(); List <String> listaIdEnviosAEliminarEnResumen4DCadena = new List <string>(); if (listaIdEnviosAEliminarEnResumen4D.Count > 0) { listaIdEnviosAEliminarEnResumen4DCadena = listaIdEnviosAEliminarEnResumen4D.Select(envio => "'" + envio.IdEnvio + "',").ToList(); } var filtros = "{IdEnvio: {$in : [" + String.Join(" ", listaIdEnviosAEliminarEnResumen4DCadena.ToArray()).TrimEnd(',') + "]}}"; AbaxXBRLCellStoreMongo.EliminarAsync("Resumen4D", filtros); #endregion #region Obtiene los envios actuales a procesar, se quitan aquellos que han sido procesados con anterioridad. parametrosEnvio = " { EsVersionActual: true, 'Parametros.trimestre': '4D', Taxonomia: {$in : [" + universoTaxonomias + "] } }"; var listaEnvios = AbaxXBRLCellStoreMongo.ConsultaElementos <Envio>("Envio", parametrosEnvio); List <ResumenInformacion4D> listaResumen4DEnMongo = AbaxXBRLCellStoreMongo.ConsultaElementos <ResumenInformacion4D>("Resumen4D", "{}").ToList(); foreach (var resumen4DAux3 in listaResumen4DEnMongo) { if (listaEnvios.ToList().Find(envio => envio.IdEnvio.Equals(resumen4DAux3.IdEnvio)) != null) { var envio = listaEnvios.ToList().Find(envioAux => envioAux.IdEnvio.Equals(resumen4DAux3.IdEnvio)); listaEnvios.Remove(envio); } } #endregion List <Hecho> listaHechos = new List <Hecho>(); //Se ontienen los hechos que interesan de los envios no procesados. if (listaEnvios.Count > 0) { listaHechos = AbaxXBRLCellStoreMongo.ConsultaElementos <Hecho>("Hecho", ReporteUtil.obtenerFiltrosHechosEnFormatoBSON(listaEnvios, ResumenInformacion4D.universoIdHechos)).ToList(); } List <Dictionary <Envio, IList <Hecho> > > listaHechosPorEnvio = new List <Dictionary <Envio, IList <Hecho> > >(); //Se crea una lista Del envio (Key) y sus hechos (value). if (listaEnvios != null && listaEnvios.Count > 0 && listaHechos != null && listaHechos.Count > 0) { foreach (var envio in listaEnvios) { IList <Hecho> listaHechosPorIdEnvio = listaHechos.ToList().FindAll(hecho => hecho.IdEnvio == envio.IdEnvio); Dictionary <Envio, IList <Hecho> > hechosPorEnvio = new Dictionary <Envio, IList <Hecho> >(); hechosPorEnvio.Add(envio, listaHechosPorIdEnvio); listaHechosPorEnvio.Add(hechosPorEnvio); } } List <ResumenInformacion4D> listaResumenInformacion4D = new List <ResumenInformacion4D>(); #region Se construye la lista del Resumen de Información 4D. foreach (var infoEnvio in listaHechosPorEnvio) { ResumenInformacion4D elemento = new ResumenInformacion4D(); var taxonomia = infoEnvio.ElementAt(0).Key.Taxonomia; elemento.IdEnvio = infoEnvio.ElementAt(0).Key.IdEnvio; elemento.Taxonomia = taxonomia; elemento.FechaReporte = infoEnvio.ElementAt(0).Key.Periodo.Fecha.GetValueOrDefault().ToString("dd/MM/yyyy"); var fechaReporte = infoEnvio.ElementAt(0).Key.Periodo.Fecha; var inicioFechaAcumuladoAnioActual = new DateTime(fechaReporte.GetValueOrDefault().Year, 1, 1); elemento.TotalActivo = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Assets") && hecho.Periodo.FechaInstante.GetValueOrDefault() == fechaReporte.GetValueOrDefault())) != null ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Assets") && hecho.Periodo.FechaInstante.GetValueOrDefault() == fechaReporte.GetValueOrDefault()).Valor) : 0; elemento.TotalPasivo = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Liabilities") && hecho.Periodo.FechaInstante.GetValueOrDefault() == fechaReporte.GetValueOrDefault())) != null ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Liabilities") && hecho.Periodo.FechaInstante.GetValueOrDefault() == fechaReporte.GetValueOrDefault()).Valor) : 0; elemento.TotalCapitalContablePasivo = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_EquityAndLiabilities") && hecho.Periodo.FechaInstante.GetValueOrDefault() == fechaReporte.GetValueOrDefault())) != null ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_EquityAndLiabilities") && hecho.Periodo.FechaInstante.GetValueOrDefault() == fechaReporte.GetValueOrDefault()).Valor) : 0; elemento.Ingreso = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Revenue") && hecho.Periodo.FechaInicio.GetValueOrDefault() == inicioFechaAcumuladoAnioActual && hecho.Periodo.FechaFin.GetValueOrDefault() == fechaReporte.GetValueOrDefault())) != null ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Revenue") && hecho.Periodo.FechaInicio.GetValueOrDefault() == inicioFechaAcumuladoAnioActual && hecho.Periodo.FechaFin.GetValueOrDefault() == fechaReporte.GetValueOrDefault()).Valor) : 0; try { elemento.Unidad = infoEnvio.ElementAt(0).Key.Parametros["moneda"].ToString().Substring(infoEnvio.ElementAt(0).Key.Parametros["moneda"].ToString().LastIndexOf(':') + 1); } catch (KeyNotFoundException) { //LogUtil.Error("LLave no encontrada"); } switch (taxonomia) { case "http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_ics_entry_point_2014-12-05": case "http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_cp_entry_point_2014-12-05": case "http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_fibras_entry_point_2014-12-05": elemento.ClaveCotizacion = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_ClaveDeCotizacionBloqueDeTexto")).Valor; elemento.NumeroFideicomiso = ""; elemento.NombreProveedorServiciosAuditoria = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_NombreDeProveedorDeServiciosDeAuditoriaExternaBloqueDeTexto")).Valor); elemento.NombreSocioOpinion = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_NombreDelSocioQueFirmaLaOpinionBloqueDeTexto")).Valor); elemento.TipoOpinionEstadosFinancieros = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_TipoDeOpinionALosEstadosFinancierosBloqueDeTexto")).Valor); break; case "http://www.bmv.com.mx/2015-06-30/ccd/full_ifrs_ccd_entry_point_2015-06-30": elemento.ClaveCotizacion = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_Ticker")).Valor; elemento.NumeroFideicomiso = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_TrustNumber")).Valor; elemento.NombreProveedorServiciosAuditoria = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_NameServiceProviderExternalAudit")).Valor); elemento.NombreSocioOpinion = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_NameOfTheAsociadoSigningOpinion")).Valor); elemento.TipoOpinionEstadosFinancieros = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_TypeOfOpinionOnTheFinancialStatements")).Valor); break; case "http://www.bmv.com.mx/2015-06-30/deuda/full_ifrs_deuda_entry_point_2015-06-30": elemento.ClaveCotizacion = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_Ticker")).Valor; elemento.NumeroFideicomiso = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_TrustNumber")).Valor;; elemento.NombreProveedorServiciosAuditoria = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_NameServiceProviderExternalAudit")).Valor); elemento.NombreSocioOpinion = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_NameOfTheAsociadoSigningOpinion")).Valor); elemento.TipoOpinionEstadosFinancieros = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_TypeOfOpinionOnTheFinancialStatements")).Valor); break; default: break; } listaResumenInformacion4D.Add(elemento); } #endregion AbaxXBRLCellStoreMongo.UpsertCollectionReportes("Resumen4D", listaResumenInformacion4D); }); }
public static ResumenInformacion4DDTO Resumen4DEntityToResumen4DDTO(ResumenInformacion4D entity) { return(new ResumenInformacion4DDTO(entity)); }
public void GeneraColeccionResumen4D() { var AbaxXBRLCellStoreMongo = new AbaxXBRLCellStoreMongo(); AbaxXBRLCellStoreMongo.ConnectionString = ConectionString; AbaxXBRLCellStoreMongo.DataBaseName = DatabaseName; AbaxXBRLCellStoreMongo.Init(); var universoTaxonomias = "'http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_ics_entry_point_2014-12-05', 'http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_cp_entry_point_2014-12-05'," + "'http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_fibras_entry_point_2014-12-05', 'http://www.bmv.com.mx/2015-06-30/ccd/full_ifrs_ccd_entry_point_2015-06-30', " + "'http://www.bmv.com.mx/2015-06-30/deuda/full_ifrs_deuda_entry_point_2015-06-30'"; var parametrosEnvio = " { 'Parametros.trimestre': '4D', Taxonomia: {$in : [" + universoTaxonomias + "] } }"; var listaEnvios = AbaxXBRLCellStoreMongo.ConsultaElementos <Envio>("Envio", parametrosEnvio); IList <Hecho> listaHechos = new List <Hecho>(); if (listaEnvios.Count > 0) { listaHechos = AbaxXBRLCellStoreMongo.ConsultaElementos <Hecho>("Hecho", ReporteUtil.obtenerFiltrosHechosEnFormatoBSON(listaEnvios, ResumenInformacion4D.universoIdHechos)); } List <Dictionary <Envio, IList <Hecho> > > listaHechosPorEnvio = new List <Dictionary <Envio, IList <Hecho> > >(); if (listaEnvios != null && listaEnvios.Count > 0 && listaHechos != null && listaHechos.Count > 0) { foreach (var envio in listaEnvios) { IList <Hecho> listaHechosPorIdEnvio = listaHechos.ToList().FindAll(hecho => hecho.IdEnvio == envio.IdEnvio); Dictionary <Envio, IList <Hecho> > hechosPorEnvio = new Dictionary <Envio, IList <Hecho> >(); hechosPorEnvio.Add(envio, listaHechosPorIdEnvio); listaHechosPorEnvio.Add(hechosPorEnvio); } } List <ResumenInformacion4D> listaResumenInformacion4D = new List <ResumenInformacion4D>(); #region Se construye la lista del Resumen de Información 4D. foreach (var infoEnvio in listaHechosPorEnvio) { ResumenInformacion4D elemento = new ResumenInformacion4D(); var taxonomia = infoEnvio.ElementAt(0).Key.Taxonomia; elemento.IdEnvio = infoEnvio.ElementAt(0).Key.IdEnvio; elemento.Taxonomia = taxonomia; elemento.FechaReporte = infoEnvio.ElementAt(0).Key.Periodo.Fecha.GetValueOrDefault().ToString("dd/MM/yyyy"); elemento.TotalActivo = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Assets")) != null) ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Assets")).Valor) : 0; elemento.TotalPasivo = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Liabilities")) != null) ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Liabilities")).Valor) : 0; elemento.TotalCapitalContablePasivo = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_EquityAndLiabilities")) != null) ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_EquityAndLiabilities")).Valor) : 0; elemento.Ingreso = (infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Revenue")) != null) ? Decimal.Parse(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs-full_Revenue")).Valor) : 0; try { elemento.Unidad = infoEnvio.ElementAt(0).Key.Parametros["moneda"].ToString().Substring(infoEnvio.ElementAt(0).Key.Parametros["moneda"].ToString().LastIndexOf(':') + 1); } catch (KeyNotFoundException) { //LogUtil.Error("LLave no encontrada"); } switch (taxonomia) { case "http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_ics_entry_point_2014-12-05": case "http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_cp_entry_point_2014-12-05": case "http://www.bmv.com.mx/taxonomy/ifrs_mx/full_ifrs_mc_mx_fibras_entry_point_2014-12-05": elemento.ClaveCotizacion = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_ClaveDeCotizacionBloqueDeTexto")).Valor; elemento.NumeroFideicomiso = ""; elemento.NombreProveedorServiciosAuditoria = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_NombreDeProveedorDeServiciosDeAuditoriaExternaBloqueDeTexto")).Valor); elemento.NombreSocioOpinion = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_NombreDelSocioQueFirmaLaOpinionBloqueDeTexto")).Valor); elemento.TipoOpinionEstadosFinancieros = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("ifrs_mx-cor_20141205_TipoDeOpinionALosEstadosFinancierosBloqueDeTexto")).Valor); break; case "http://www.bmv.com.mx/2015-06-30/ccd/full_ifrs_ccd_entry_point_2015-06-30": elemento.ClaveCotizacion = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_Ticker")).Valor; elemento.NumeroFideicomiso = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_TrustNumber")).Valor; elemento.NombreProveedorServiciosAuditoria = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_NameServiceProviderExternalAudit")).Valor); elemento.NombreSocioOpinion = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_NameOfTheAsociadoSigningOpinion")).Valor); elemento.TipoOpinionEstadosFinancieros = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_ccd_TypeOfOpinionOnTheFinancialStatements")).Valor); break; case "http://www.bmv.com.mx/2015-06-30/deuda/full_ifrs_deuda_entry_point_2015-06-30": elemento.ClaveCotizacion = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_Ticker")).Valor; elemento.NumeroFideicomiso = infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_TrustNumber")).Valor;; elemento.NombreProveedorServiciosAuditoria = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_NameServiceProviderExternalAudit")).Valor); elemento.NombreSocioOpinion = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_NameOfTheAsociadoSigningOpinion")).Valor); elemento.TipoOpinionEstadosFinancieros = ReporteUtil.removeTextHTML(infoEnvio.ElementAt(0).Value.ToList().Find(hecho => hecho.Concepto.IdConcepto.Equals("mx_deuda_TypeOfOpinionOnTheFinancialStatements")).Valor); break; default: break; } listaResumenInformacion4D.Add(elemento); } #endregion AbaxXBRLCellStoreMongo.UpsertCollectionReportes("Resumen4D", listaResumenInformacion4D); }