public viewEstadoResultados()
        {
            InitializeComponent();

            bgDatos = new ESTADO_RESULTADOSTableAdapter();
            EstadosContables ecDS = new EstadosContables();
            DateTime t = DateTime.Today;
            FechaInicio = new DateTime(t.Year, t.Month, 1);
            FechaFin = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(-1);
            DataTable Datos = new DataTable("ESTADO_RESULTADOS");
            DataTableReader origen = ecDS.ESTADO_RESULTADOS.CreateDataReader();

            Double Saldo = 0.0;

            bgDatos.Fill(ecDS.ESTADO_RESULTADOS, FechaInicio, FechaFin);
            Datos.Columns.Add("CODIGO");
            Datos.Columns.Add("NOMBRE");
            Datos.Columns.Add("DEBE", typeof(Double));
            Datos.Columns.Add("HABER", typeof(Double));
            Datos.Columns.Add("TIPO");

            while (origen.Read())
            {
                DataRow row = Datos.NewRow();

                row["CODIGO"] = origen["CODIGO"];
                row["NOMBRE"] = origen["NOMBRE"];

                Double s = Double.Parse(origen["DEBE"].ToString()) - Double.Parse(origen["HABER"].ToString());

                if (validateBLX.Validar.IsPositivo((int)s))
                {
                    row["TIPO"] = "Gastos";
                    row["DEBE"] = s;
                    Saldo += s;
                    row["HABER"] = 0.0;
                }
                else
                {
                    row["TIPO"] = "Ingresos";
                    row["HABER"] = -s;
                    Saldo += s;
                    row["DEBE"] = 0.0;
                }
                Datos.Rows.Add(row);
            }

            bg.SetDataSource(Datos.DefaultView);
            bg.SetParameterValue("EmpresaNombre", Kaikei.Properties.Settings.Default.EmpresaNombre);
            bg.SetParameterValue("txtRealizo", Kaikei.Properties.Settings.Default.EmpresaContador);
            bg.SetParameterValue("txtAutorizo", Kaikei.Properties.Settings.Default.EmpresaAdministrador);
            bg.SetParameterValue("FechaReporte", String.Format("DEL {0} AL {1} DE {2} De {3}", FechaInicio.Day,
                FechaFin.Day, FechaInicio.ToString("MMMM").ToUpper(), FechaInicio.Year));
            bg.SetParameterValue("txtSALDO", Saldo);

            this.crvEstadoResultados.ReportSource = bg;
        }
        //DataTable Datos;
        public viewBalanceGeneral()
        {
            InitializeComponent();
            bgDatos =new BALANCE_GENERALTableAdapter();
            EstadosContables ec =new EstadosContables();
            DateTime hoy = DateTime.Today;
            bg.SetDataSource((DataTable)bgDatos.GetData(hoy));
            bg.SetParameterValue("EmpresaNombre", Kaikei.Properties.Settings.Default.EmpresaNombre);
            bg.SetParameterValue("txtRealizo", Kaikei.Properties.Settings.Default.EmpresaContador);
            bg.SetParameterValue("txtAutorizo", Kaikei.Properties.Settings.Default.EmpresaAdministrador);
            bg.SetParameterValue("FechaReporte",String.Format("AL {0} de {1} de {2}",hoy.Day,
                hoy.ToString("MMMM").ToUpper(),hoy.Year));

            this.crvBalanceGeneral.ReportSource = bg;
        }
        public viewEstadoCapital()
        {
            InitializeComponent();

            bgDatos = new ESTADO_CAPITALTableAdapter();
            EstadosContables ecDS = new EstadosContables();
            DateTime hoy = DateTime.Now;
            FechaInicio = new DateTime(hoy.Year, hoy.Month, 1);
            FechaFin = new DateTime(hoy.Year, hoy.Month, DateTime.DaysInMonth(hoy.Year, hoy.Month),23,59,59);
            if (hoy.Day < FechaFin.Day)
            {
                FechaFin = hoy;
            }
            DataTable Datos = new DataTable("ESTADO_CAPITAL");
            DataTableReader origen = ecDS.ESTADO_CAPITAL.CreateDataReader();

            Double Saldo = 0.0;

            bgDatos.Fill(ecDS.ESTADO_CAPITAL, FechaInicio, FechaFin);
            Datos.Columns.Add("CODIGO");
            Datos.Columns.Add("NOMBRE");
            Datos.Columns.Add("DEBE",typeof(Double));
            Datos.Columns.Add("HABER", typeof(Double));
            Datos.Columns.Add("SALDO");
            Datos.Columns.Add("TIPO");

            while (origen.Read())
            {
                DataRow row = Datos.NewRow();

                row["CODIGO"] = origen["CODIGO"];
                row["NOMBRE"] = origen["NOMBRE"];
                row["SALDO"] = "";

                if (validateBLX.Validar.IsPositivo((int)Double.Parse(origen["SALDO"].ToString())))
                {
                    row["TIPO"] = "Desinversion";
                    row["DEBE"] = 0.0;
                    Saldo += Double.Parse(origen["SALDO"].ToString());
                    row["HABER"] = Double.Parse(origen["SALDO"].ToString()); ;
                }
                else
                {
                    row["TIPO"] = "Inversion";
                    row["HABER"] = 0.0;
                    Saldo += Double.Parse(origen["SALDO"].ToString());
                    row["DEBE"] = -Double.Parse(origen["SALDO"].ToString());
                }
                Datos.Rows.Add(row);
            }

            bg.SetDataSource(Datos.DefaultView);
            bg.SetParameterValue("EmpresaNombre", Kaikei.Properties.Settings.Default.EmpresaNombre);
            bg.SetParameterValue("txtRealizo", Kaikei.Properties.Settings.Default.EmpresaContador);
            bg.SetParameterValue("txtAutorizo", Kaikei.Properties.Settings.Default.EmpresaAdministrador);
            bg.SetParameterValue("FechaReporte", String.Format("DEL {0} AL {1} DE {2} De {3}", FechaInicio.Day,
                FechaFin.Day, FechaInicio.ToString("MMMM").ToUpper(), FechaInicio.Year));
            bg.SetParameterValue("txtSALDO", Saldo);

            this.crvEstadoCapital.ReportSource = bg;
        }