Пример #1
0
        private async Task CargarRpProyeccion()
        {
            //tarea temporal para mostrar el loading
            //Mostrar();
            //var cargar = new Task(() =>
            //{
            //    actulziarCuotas();
            //});
            //cargar.Start();
            //await cargar;
            //cerrar();

            dataGridView4.DataSource = "";
            if (comboProyecto.Text == "TODOS LOS PROYECTOS")
            {
                if (comboTipo.Text == "TODOS LOS PRODUCTOS")
                {
                    DtProgramado = cuota.reportProyeccion(dateInicio.Text, datefin.Text);
                }
                else
                {
                    DtProgramado = cuota.reportProyeccionTipo(dateInicio.Text, datefin.Text, (comboTipo.SelectedIndex - 1).ToString());
                }
            }
            else
            {
                if (comboTipo.Text == "TODOS LOS PRODUCTOS")
                {
                    DtProgramado = cuota.reportProyeccionProyecto(dateInicio.Text, datefin.Text, comboProyecto.SelectedValue.ToString());
                }
                else
                {
                    DtProgramado = cuota.reportProyeccionProyectoTipo(dateInicio.Text, datefin.Text, comboProyecto.SelectedValue.ToString(), (comboTipo.SelectedIndex - 1).ToString());
                }
            }

            if (DtProgramado.Rows.Count == 0)
            {
                MessageBox.Show("Sin datos para el reporte, seleccione un nuevo atributo o rango de fechas", "No hay resultados", MessageBoxButtons.OK, MessageBoxIcon.Information);
                labelTotal.Text  = "TOTAL INGRESOS: $" + "0";
                labelNumero.Text = "CANTIDAD: " + "0";
            }
            else
            {
                dataGridView4.DataSource       = DtProgramado;
                labelNumero.Text               = "CANTIDAD: " + DtProgramado.Rows.Count;
                dataGridView4.Columns[0].Width = 55;
                dataGridView4.Columns[1].DefaultCellStyle.Format = "n0";
                dataGridView4.Columns[1].Width = 80;
                dataGridView4.Columns[2].Width = 80;
                dataGridView4.Columns[3].Width = 250;
                dataGridView4.Columns[4].Width = 250;
                dataGridView4.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;

                double total = 0;
                foreach (DataRow row in DtProgramado.Rows)
                {
                    //elimino las , amtes de hacer la operacion suma del total
                    total += Convert.ToDouble(row["Valor a Pagar"].ToString().Replace(",", "").Replace(".", ","));
                }
                labelTotal.Text = "TOTAL INGRESOS: $ " + String.Format("{0:N2}", total);
            }
        }