/* Obtiene la informacion general que toda consulta necesita y la carga en common output view pasado * como parametro */ public bool getFillCommonInfo(View self, bool rango_de_fechas, bool fecha_de_jornada, ref string error) { // Campos en la tabla que se van a actualizar TextView textView_reporte = self.FindViewById <TextView>(Resource.Id.textViewNombreDelReporte); TextView textView_user = self.FindViewById <TextView>(Resource.Id.textViewUsuario); TextView textView_office = self.FindViewById <TextView>(Resource.Id.textViewOficina); TextView textView_fecha_hora = self.FindViewById <TextView>(Resource.Id.textViewFechaHora); TextView textView_fecha_rango = self.FindViewById <TextView>(Resource.Id.textViewRangoFechas); TextView textView_fecha_label = self.FindViewById <TextView>(Resource.Id.textViewFechasLabel); textView_reporte.Text = reportName; try { Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos("SELECT CodigoNotificador FROM OficialNotificador", self.Context, ref loggin_usuario); dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos("SELECT DespachoCodigo FROM OficialNotificador", self.Context, ref loggin_officina); string supervisor = ""; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos("SELECT Supervisor FROM OficialNotificador", self.Context, ref supervisor); loggin_supervisor = String.Equals("True", supervisor); } catch (Exception) { error = "No fue posible obtener la información requerida para le reporte (ID)"; return(false); } textView_user.Text = loggin_usuario; textView_office.Text = loggin_officina; textView_fecha_hora.Text = DateTime.Now.ToString("yyyy-MMM-dd hh:mm"); if (fecha_de_jornada) { textView_fecha_label.Text = "Fecha jornada"; textView_fecha_rango.Text = input_fecha_jornada.ToString("yyyy-MMM-dd"); } else if (rango_de_fechas) { textView_fecha_label.Text = "Rango de fechas"; textView_fecha_rango.Text = "De " + input_fecha_inicio.ToString("yyyy-MMM-dd"); textView_fecha_rango.Text += "\na " + input_fecha_fin.ToString("yyyy-MMM-dd"); } else { textView_fecha_label.Text = "Fecha"; textView_fecha_rango.Text = input_fecha_inicio.ToString("yyyy-MMM-dd"); } // FIXME, Se permite generar informe de más de 3 meses para encontrar datos validos facilmente if (!ReportUtils.validarFechas(input_fecha_inicio, input_fecha_fin, false, ref error)) { return(false); } return(true); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your fragment here dbConeccion = new SQLiteConeccion();//Se crea la instancia de la base de datos }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { report.output_error = null; var ignored = base.OnCreateView(inflater, container, savedInstanceState); View self = inflater.Inflate(Resource.Layout.CommonReportOutput, null); if (!report.getFillCommonInfo(self, true, false, ref report.output_error)) { reportErrorGoBack(report.output_error); return(self); } TableLayout table = self.FindViewById <TableLayout>(Resource.Id.tbReporte); // Asegura que ningun parametro este vacío if (String.IsNullOrEmpty(report.input_oficina)) { reportErrorGoBack("El campo de oficina no puede ser vacío"); return(self); } // Consulta // Cambiar las fechas al formato admitido por la BD string fecha_jornada = report.input_fecha_jornada.ToString("yyyyMMdd"); string codigoNotificador = ""; try { Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos( "SELECT CodigoNotificador FROM OficialesNotificadores WHERE NombreCompleto = '" + report.input_notificador + "'", this.Context, ref codigoNotificador); } catch (Exception) { reportErrorGoBack("No fue posible obtener la información requerida para le reporte (ID)"); return(self); } string query = @"https://pjgestionnotificacionmovilservicios.azurewebsites.net/api/Reportes/NotificacionesPendientesJornada" + "?PCodOficina=" + report.input_oficina + "&PCodNotificador=" + codigoNotificador + "&PFechaJornada=" + fecha_jornada; // Verificar si la conección a internet esta disponible if (!coneccionInternet.verificaConeccion(this.Context)) { ReportUtils.alertNoInternetMessage(this.Context); } WebRequest request = HttpWebRequest.Create(query); request.ContentType = "application/json"; request.Method = "GET"; string content = ""; Console.Out.WriteLine("--XDEBUG " + query); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) { Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode); reportErrorGoBack("No fue posible obtener la información requerida para le reporte"); return(self); } using (StreamReader reader = new StreamReader(response.GetResponseStream())) { content = reader.ReadToEnd(); if (string.IsNullOrWhiteSpace(content)) { Console.Out.WriteLine("fzeledon -- Response contained empty body..."); reportErrorGoBack("Los valores de entrada de la consulta no generaron resultado"); return(self); } try { var jsonParsed = JArray.Parse(content); if (jsonParsed.Count <= 0) // Esperamos al menos un resultado { reportErrorGoBack("La información obtenida para le informe no puede ser procesada"); return(self); } // Por cada despacho encontrada ReportUtils.agregarFilaATabla(new string[] { "Notificando", "Expediente", "Fecha de resolución", "Justificación" }, Activity, table); int i = 0; for (i = 0; i < jsonParsed.Count; ++i) { string notificando = jsonParsed[i].Value <string>("Notificando"); string expediente = jsonParsed[i].Value <string>("Expediente"); string resolicion = jsonParsed[i].Value <string>("FechaResolucion"); string justificacion = "No disponible"; // FIXME no existia el campo en la consulta DateTime date_resolucion = DateTime.Parse(resolicion); resolicion = date_resolucion.ToString("dd-MMM-yyyy"); ReportUtils.agregarFilaATabla(new string[] { notificando, expediente, resolicion, justificacion }, Activity, table); // FIXME. Son demasiadas las respuestas, filtrar por pagina o preguntar como proceder if (i > 200) { break; } } ReportUtils.agregarFilaATabla(new string[] { "Total:", i.ToString(), "", "" }, Activity, table); } catch (Exception ex) { Console.WriteLine("Error descargando datos de usuario: " + ex.ToString()); reportErrorGoBack("Error descargando datos de usuario"); return(self); } } } Button btnGen = self.FindViewById <Button>(Resource.Id.btnRegresarNotificacionesEnviadas); btnGen.Click += (sender, e) => { report.output_error = null; Fragment frag = report.getInputReportFragment(); FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).Commit(); }; return(self); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); codigoGen = Arguments.GetInt("someInt"); dbConeccion = new Helpers.SQLiteConeccion(); // Begin building a new dialog. var builder = new AlertDialog.Builder(Activity); //Get the layout inflater var inflater = Activity.LayoutInflater; //Inflate the layout for this dialog var dialogView = inflater.Inflate(Resource.Layout.serviceDialog, null); if (dialogView != null) { //Initialize the properties NameEditText = dialogView.FindViewById <EditText>(Resource.Id.editTextName); //DescriptionEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextDescription); //PriceEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextPrice); //AddCategoryEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextAddCategory); //CategorySpinner = dialogView.FindViewById<Spinner>(Resource.Id.spinnerCategory); CategoryLayout = dialogView.FindViewById <LinearLayout>(Resource.Id.linearLayoutCategorySection); //Container = dialogView.FindViewById<LinearLayout>(Resource.Id.linearLayoutContainer); //Hide this section for now if (codigoGen == 0) { CategoryLayout.Visibility = ViewStates.Invisible; } else { CategoryLayout.Visibility = ViewStates.Visible; } //CategoryButton = dialogView.FindViewById<Button>(Resource.Id.buttonCategory); //cargarComboNotificador(this.Activity,dialogView); //Set on item selected listener for the spinner //CategorySpinner.ItemSelected += spinner_ItemSelected; builder.SetView(dialogView); builder.SetPositiveButton("Aceptar", HandlePositiveButtonClick); builder.SetNegativeButton("Cancelar", HandleNegativeButtonClick); //AddSignaturePad(dialogView); } //Create the builder var dialog = builder.Create(); //Now return the constructed dialog to the calling activity return(dialog); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { report.output_error = null; var ignored = base.OnCreateView(inflater, container, savedInstanceState); View self = inflater.Inflate(Resource.Layout.CommonReportOutput, null); if (!report.getFillCommonInfo(self, true, false, ref report.output_error)) { reportErrorGoBack(report.output_error); return(self); } TableLayout table = self.FindViewById <TableLayout>(Resource.Id.tbReporte); // Asegura que ningun parametro este vacío if (String.IsNullOrEmpty(report.input_oficina)) { reportErrorGoBack("El campo de oficina no puede ser vacío"); return(self); } // Consulta // Cambiar las fechas al formato admitido por la BD string fecha_inicio = report.input_fecha_inicio.ToString("yyyyMMdd"); string fecha_fin = report.input_fecha_fin.ToString("yyyyMMdd"); string codigoNotificador = ""; if (report.loggin_supervisor) { try { Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos( "SELECT CodigoNotificador FROM OficialesNotificadores WHERE NombreCompleto = '" + report.input_notificador + "'", this.Context, ref codigoNotificador); } catch (Exception) { reportErrorGoBack("No fue posible obtener la información requerida para le reporte (ID)"); return(self); } } string query = @"https://pjgestionnotificacionmovilservicios.azurewebsites.net/api/Reportes/NotificacionesCompletadasPorNotificador" + "?PCodOficina=" + report.input_oficina + "&PCodNotificador=" + (report.loggin_supervisor ? codigoNotificador : report.loggin_usuario) + "&PFecha1=" + fecha_inicio + "&PFecha2=" + fecha_fin; // Verificar si la conección a internet esta disponible if (!coneccionInternet.verificaConeccion(this.Context)) { ReportUtils.alertNoInternetMessage(this.Context); } WebRequest request = HttpWebRequest.Create(query); request.ContentType = "application/json"; request.Method = "GET"; string content = ""; Console.Out.WriteLine("--XDEBUG " + query); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) { Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode); reportErrorGoBack("No fue posible obtener la información requerida para le reporte"); return(self); } using (StreamReader reader = new StreamReader(response.GetResponseStream())) { content = reader.ReadToEnd(); if (string.IsNullOrWhiteSpace(content)) { Console.Out.WriteLine("fzeledon -- Response contained empty body..."); reportErrorGoBack("Los valores de entrada de la consulta no generaron resultado"); return(self); } try { var jsonParsed = JArray.Parse(content); if (jsonParsed.Count != 2) // Esperamos 2 resultados unicamente { reportErrorGoBack("La información obtenida para le informe no puede ser procesada"); return(self); } ReportUtils.agregarFilaATabla(new string[] { "Notificador", report.input_notificador, "" }, Activity, table); ReportUtils.agregarFilaATabla(new string[] { "", "Cantidad", "Porcentaje" }, Activity, table); int total_positivas = 0; int total_negativas = 0; int i = 0; for (i = 0; i < jsonParsed.Count; ++i) { int total_diligencias = jsonParsed[i].Value <int>("Total"); bool diligenciada = jsonParsed[i].Value <bool>("Diligenciada"); if (diligenciada) { total_positivas += total_diligencias; } else { total_negativas += total_diligencias; } } int gran_total = total_positivas + total_negativas; ReportUtils.agregarFilaATabla(new string[] { "Positivas:", total_positivas.ToString(), (100.0 * total_positivas / gran_total).ToString("N3") + "%" }, Activity, table); ReportUtils.agregarFilaATabla(new string[] { "Negativas", total_negativas.ToString(), (100.0 * total_negativas / gran_total).ToString("N3") + "%" }, Activity, table); ReportUtils.agregarFilaATabla(new string[] { "Total:", (gran_total).ToString() }, Activity, table); } catch (Exception ex) { Console.WriteLine("Error descargando datos de usuario: " + ex.ToString()); reportErrorGoBack("Error descargando datos de usuario"); return(self); } } } Button btnGen = self.FindViewById <Button>(Resource.Id.btnRegresarNotificacionesEnviadas); btnGen.Click += (sender, e) => { report.output_error = null; Fragment frag = report.getInputReportFragment(); FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).Commit(); }; return(self); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var ignored = base.OnCreateView(inflater, container, savedInstanceState); View self = inflater.Inflate(Resource.Layout.CommonReportInput, null); TextView info = self.FindViewById <TextView>(Resource.Id.textViewReportInputInfo); Spinner spinner_oficina = self.FindViewById <Spinner>(Resource.Id.spinnerInputOficina); Spinner spinner_despacho = self.FindViewById <Spinner>(Resource.Id.spinnerInputDespacho); Spinner spinner_notificador = self.FindViewById <Spinner>(Resource.Id.spinnerInputNotificador); TextView fecha_inicio = self.FindViewById <TextView>(Resource.Id.textViewInputFechaInicio); TextView fecha_fin = self.FindViewById <TextView>(Resource.Id.textViewInputFechaFin); TextView fecha_jornada = self.FindViewById <TextView>(Resource.Id.textViewInputFechaJornada); // Oculta/Muestra los parametros de entrada que no corresponden al // reporte/perfil de usuario bool es_supervisor = false; try { string es_supervisor_str = "False"; Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos("SELECT Supervisor FROM OficialNotificador", this.Activity, ref es_supervisor_str); es_supervisor = (String.Compare("True", es_supervisor_str, true) == 0); } catch (Exception e) { //Se guarda el error en el log de errores Logs.saveLogError("NotificacionesEnviadasADespachoInputReport.OnCreateView " + e.Message + " " + e.StackTrace); //Se muestra un mensaje informando el error Toast.MakeText(this.Context, GetString(Resource.String.MensajeErrorCargaBaseDatos), ToastLength.Long).Show(); } self.FindViewById <LinearLayout>(Resource.Id.linearLayoutInputOficina).Visibility = sel_oficina ? ViewStates.Visible : ViewStates.Gone; self.FindViewById <LinearLayout>(Resource.Id.linearLayoutInputNotificador).Visibility = (sel_notificador && es_supervisor) ? ViewStates.Visible : ViewStates.Gone; self.FindViewById <LinearLayout>(Resource.Id.linearLayoutInputDespacho).Visibility = sel_despacho ? ViewStates.Visible : ViewStates.Gone; self.FindViewById <LinearLayout>(Resource.Id.linearLayoutInputFechaInicio).Visibility = sel_fecha_inicio ? ViewStates.Visible : ViewStates.Gone; self.FindViewById <LinearLayout>(Resource.Id.linearLayoutInputFechaFin).Visibility = sel_fecha_fin ? ViewStates.Visible : ViewStates.Gone; self.FindViewById <LinearLayout>(Resource.Id.linearLayoutInputFechaJornada).Visibility = sel_fecha_jornada ? ViewStates.Visible : ViewStates.Gone; // Cargar los valores que se tengan del ultimo reporte fecha_inicio.Text = report.input_fecha_inicio.ToString("yyyy-MMM-dd"); fecha_fin.Text = report.input_fecha_fin.ToString("yyyy-MMM-dd"); fecha_jornada.Text = report.input_fecha_jornada.ToString("yyyy-MMM-dd"); // FIXME: Poner el mensaje de error en un mejor lugar if (String.IsNullOrEmpty(report.output_error)) { info.Text = "Datos de entrada para Reporte: " + report.ToString(); } else { info.Text = report.output_error; report.output_error = null; } // Accion para el botón de generar reporte Button btnGen = self.FindViewById <Button>(Resource.Id.btnGenerarReporte); btnGen.Click += (sender, e) => { Fragment frag = report.getOutputReportFragment(); // Asigna los parámetros de entrada (las fechas se assignan en OnDateSet) report.input_oficina = "0534"; // FIXME. El valor esta harc report.input_despacho = (string)spinner_despacho.SelectedItem; if (sel_notificador) { if (es_supervisor) { report.input_notificador = (string)spinner_notificador.SelectedItem; } else { try { Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos("SELECT NombreCompleto FROM OficialNotificador", this.Activity, ref report.input_notificador); } catch (Exception ex) { //Se guarda el error en el log de errores Logs.saveLogError("NotificacionesEnviadasADespachoInputReport.OnCreateView " + ex.Message + " " + ex.StackTrace); //Se muestra un mensaje informando el error Toast.MakeText(this.Context, GetString(Resource.String.MensajeErrorCargaBaseDatos), ToastLength.Long).Show(); report.input_notificador = ""; } } } FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).Commit(); }; // Spinner con oficinas if (sel_oficina) { Android.Widget.ArrayAdapter <String> ad; ad = new Android.Widget.ArrayAdapter <String>( this.Context, Android.Resource.Layout.SimpleSpinnerItem, new string[] { Fragments.FragmentLogin.codOficina, "0534" }); // FIXME El valor de la oficina esta hardcoded spinner_oficina.Adapter = ad; } // Spinner con notificadores if (sel_notificador && es_supervisor) { try { Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.setAdaptadorCombo("SELECT NombreCompleto FROM OficialesNotificadores", this.Activity, ref spinner_notificador); } catch (Exception e) { //Se guarda el error en el log de errores Logs.saveLogError("FragmentMap.cargarComboNotificador " + e.Message + " " + e.StackTrace); //Se muestra un mensaje informando el error Toast.MakeText(this.Context, GetString(Resource.String.MensajeErrorCargaBaseDatos), ToastLength.Long).Show(); } } // Spinner con despachos if (sel_despacho) { Android.Widget.ArrayAdapter <String> adapter; adapter = new Android.Widget.ArrayAdapter <String>( this.Context, Android.Resource.Layout.SimpleSpinnerItem, new string[] { Fragments.FragmentLogin.codOficina, "0163" }); // FIXME El valor del despacho esta hardcoded spinner_despacho.Adapter = adapter; } // Fecha inicio if (sel_fecha_inicio) { DatePickerDialogFragment fecha_inicio_picker = new DatePickerDialogFragment(Activity, DateTime.Now, this, "inicio"); fecha_inicio.Click += (sender, args) => { fecha_inicio_picker.Show(FragmentManager, null); }; } // Fecha fin if (sel_fecha_fin) { DatePickerDialogFragment fecha_fin_picker = new DatePickerDialogFragment(Activity, DateTime.Now, this, "fin"); fecha_fin.Click += (sender, args) => { fecha_fin_picker.Show(FragmentManager, null); }; } // Fecha jornada if (sel_fecha_jornada) { DatePickerDialogFragment fecha_jornada_picker = new DatePickerDialogFragment(Activity, DateTime.Now, this, "jornada"); fecha_jornada.Click += (sender, args) => { fecha_jornada_picker.Show(FragmentManager, null); }; } return(self); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { report.output_error = null; var ignored = base.OnCreateView(inflater, container, savedInstanceState); View self = inflater.Inflate(Resource.Layout.CommonReportOutput, null); if (!report.getFillCommonInfo(self, true, false, ref report.output_error)) { reportErrorGoBack(report.output_error); return(self); } TableLayout table = self.FindViewById <TableLayout>(Resource.Id.tbReporte); // Asegura que ningun parametro este vacío if (String.IsNullOrEmpty(report.input_oficina)) { reportErrorGoBack("El campo de oficina no puede ser vacío"); return(self); } // Consulta // Cambiar las fechas al formato admitido por la BD string fecha_inicio = report.input_fecha_inicio.ToString("yyyyMMdd"); string fecha_fin = report.input_fecha_fin.ToString("yyyyMMdd"); string codigoNotificador = ""; if (report.loggin_supervisor) { try { Helpers.SQLiteConeccion dbConeccion; dbConeccion = new Helpers.SQLiteConeccion(); dbConeccion.consultaDatos( "SELECT CodigoNotificador FROM OficialesNotificadores WHERE NombreCompleto = '" + report.input_notificador + "'", this.Context, ref codigoNotificador); } catch (Exception) { reportErrorGoBack("No fue posible obtener la información requerida para le reporte (ID)"); return(self); } } string query = @"https://pjgestionnotificacionmovilservicios.azurewebsites.net/api/Reportes/NotificacionesCompletadasPorNotificador" + "?PCodOficina=" + report.loggin_officina + "&PCodNotificador=" + (report.loggin_supervisor ? codigoNotificador : report.loggin_usuario) + "&PFecha1=" + fecha_inicio + "&PFecha2=" + fecha_fin; // Verificar si la conección a internet esta disponible if (!coneccionInternet.verificaConeccion(this.Context)) { ReportUtils.alertNoInternetMessage(this.Context); } WebRequest request = HttpWebRequest.Create(query); request.ContentType = "application/json"; request.Method = "GET"; string content = ""; Console.Out.WriteLine("--XDEBUG " + query); using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) { Console.Out.WriteLine("Error fetching data. Server returned status code: {0}", response.StatusCode); reportErrorGoBack("No fue posible obtener la información requerida para le reporte"); return(self); } using (StreamReader reader = new StreamReader(response.GetResponseStream())) { content = reader.ReadToEnd(); if (string.IsNullOrWhiteSpace(content)) { Console.Out.WriteLine("fzeledon -- Response contained empty body..."); reportErrorGoBack("Los valores de entrada de la consulta no generaron resultado"); return(self); } try { var jsonParsed = JArray.Parse(content); if (jsonParsed.Count <= 0) // Esperamos al menos un resultado { reportErrorGoBack("La información obtenida para le informe no puede ser procesada"); return(self); } int total_positivas = 0; int total_negativas = 0; // Por cada despacho encontrada TableLayout.LayoutParams layoutParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent); TextView label_descripcion = new TextView(Activity); label_descripcion.Text = "Descripción"; TextView label_total = new TextView(Activity); label_total.Text = "Total"; TextView label_digilenciada = new TextView(Activity); label_digilenciada.Text = "Digilenciada"; // Fila TableRow label_fila = new TableRow(Activity); //Se instancia la nueva fila label_fila.LayoutParameters = layoutParams; //Se agregan los tamaños del layout label_fila.AddView(label_descripcion); label_fila.AddView(label_total); label_fila.AddView(label_digilenciada); label_fila.SetPadding(15, 15, 15, 15); label_fila.SetBackgroundColor(Android.Graphics.Color.Argb(50, 1, 0, 5)); table.AddView(label_fila); for (int i = 0; i < jsonParsed.Count; ++i) { int total_diligencias = jsonParsed[i].Value <int>("Total"); string descripcion = jsonParsed[i].Value <string>("Descripcion"); bool diligenciada = jsonParsed[i].Value <bool>("Diligenciada"); TextView text_descripcion = new TextView(Activity); text_descripcion.Text = descripcion; // FIXME. Buscar una mejor manera de acomodar los nombres largos if (descripcion.Length > 20) { text_descripcion.Text = descripcion.Substring(0, 20); } TextView text_total = new TextView(Activity); text_total.Text = total_diligencias.ToString(); TextView text_digilenciada = new TextView(Activity); text_digilenciada.Text = diligenciada ? "Sí" : "No"; // Fila TableRow fila = new TableRow(Activity); //Se instancia la nueva fila fila.LayoutParameters = layoutParams; //Se agregan los tamaños del layout fila.AddView(text_descripcion); fila.AddView(text_total); fila.AddView(text_digilenciada); fila.SetPadding(15, 15, 15, 15); fila.SetBackgroundColor(Android.Graphics.Color.Argb(20, 1, 0, 5)); table.AddView(fila); if (diligenciada) { total_positivas += total_diligencias; } else { total_negativas += total_diligencias; } } // Cantidad int total_cantidad = total_positivas + total_negativas; // Crea las columnas TextView pad = new TextView(Activity); pad.Text = ""; TextView pad2 = new TextView(Activity); pad.Text = ""; TextView positivas = new TextView(Activity); positivas.Text = "Positivas"; TextView negativas = new TextView(Activity); negativas.Text = "Negativas"; TextView total = new TextView(Activity); total.Text = "Total"; TextView cantidad = new TextView(Activity); cantidad.Text = "Cantidad"; TextView porcentaje = new TextView(Activity); porcentaje.Text = "Porcentaje"; TextView text_positivas_cantidad = new TextView(Activity); text_positivas_cantidad.Text = total_positivas.ToString(); TextView text_negativas_cantidad = new TextView(Activity); text_negativas_cantidad.Text = total_negativas.ToString(); TextView text_positivas_porcentaje = new TextView(Activity); text_positivas_porcentaje.Text = (100.0 * total_positivas / total_cantidad).ToString("N3") + '%'; TextView text_negativas_porcentaje = new TextView(Activity); text_negativas_porcentaje.Text = (100.0 * total_negativas / total_cantidad).ToString("N3") + '%'; TextView text_total_cantidad = new TextView(Activity); text_total_cantidad.Text = total_cantidad.ToString(); // La file de nombre de columnas TableRow filaNombreColumnas = new TableRow(Activity); //Se instancia la nueva fila filaNombreColumnas.LayoutParameters = layoutParams; //Se agregan los tamaños del layout filaNombreColumnas.AddView(pad2); filaNombreColumnas.AddView(cantidad); filaNombreColumnas.AddView(porcentaje); filaNombreColumnas.SetPadding(15, 15, 15, 15); filaNombreColumnas.SetBackgroundColor(Android.Graphics.Color.Argb(30, 1, 0, 5)); // La Fila positivas TableRow filaPositivas = new TableRow(Activity); //Se instancia la nueva fila filaPositivas.LayoutParameters = layoutParams; //Se agregan los tamaños del layout filaPositivas.AddView(positivas); filaPositivas.AddView(text_positivas_cantidad); filaPositivas.AddView(text_positivas_porcentaje); filaPositivas.SetPadding(15, 15, 15, 15); // La Fila negativas TableRow filaNegativa = new TableRow(Activity); //Se instancia la nueva fila filaNegativa.LayoutParameters = layoutParams; //Se agregan los tamaños del layout filaNegativa.AddView(negativas); filaNegativa.AddView(text_negativas_cantidad); filaNegativa.AddView(text_negativas_porcentaje); filaNegativa.SetPadding(15, 15, 15, 15); // La Fila total TableRow filatotal = new TableRow(Activity); //Se instancia la nueva fila filatotal.LayoutParameters = layoutParams; //Se agregan los tamaños del layout filatotal.AddView(total); filatotal.AddView(text_total_cantidad); filatotal.AddView(pad); filatotal.SetPadding(15, 15, 15, 15); // Agregar a la tabla table.AddView(filaNombreColumnas); table.AddView(filaPositivas); table.AddView(filaNegativa); table.AddView(filatotal); } catch (Exception ex) { Console.WriteLine("Error descargando datos de usuario: " + ex.ToString()); reportErrorGoBack("Error descargando datos de usuario"); return(self); } } } Button btnGen = self.FindViewById <Button>(Resource.Id.btnRegresarNotificacionesEnviadas); btnGen.Click += (sender, e) => { report.output_error = null; Fragment frag = report.getInputReportFragment(); FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, frag).Commit(); }; return(self); }