Ejemplo n.º 1
0
        private void btnGenerarReporte_Click(object sender, EventArgs e)
        {
            if (cmbPeriodo.Text.Equals("") || comboBoxPeriodoFin.Text.Equals(""))
            {
                MessageBox.Show("Error, escoja un periodo de inicio y uno de fin");
            }
            else
            {
                ReportDocument oRep = new ReportDocument();
                Periodo periodoNuevo = new Periodo();
                string nuevoEstado = this.cmbPeriodo.SelectedItem.ToString();
                string[] tokens = nuevoEstado.Split('/');
                string fechaini = tokens[0];

                string nuevoEstadofin = this.comboBoxPeriodoFin.SelectedItem.ToString();
                string[] tokensfin = nuevoEstado.Split('/');
                string fechafin = tokensfin[1];

                if (Reporte.Equals("BalanceComprobacion"))
                {
                    ParameterField PfCompania = new ParameterField();
                    ParameterField PfFechaIni = new ParameterField();
                    ParameterField PfFechaFin = new ParameterField();
                    ParameterFields Pfs = new ParameterFields();
                    ParameterDiscreteValue PvdCompania = new ParameterDiscreteValue();
                    ParameterDiscreteValue PvdFechaIni = new ParameterDiscreteValue();
                    ParameterDiscreteValue PvdFechaFin = new ParameterDiscreteValue();
                    PfCompania.Name = "@Compañia";
                    PfFechaIni.Name = "@FechaInicio";
                    PfFechaFin.Name = "@FechaFinal";
                    PvdCompania.Value = Empresa;
                    DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
                    dtfi.ShortDatePattern = "yyyy-MM-dd";
                    dtfi.DateSeparator = "-";
                    DateTime objDate = Convert.ToDateTime(fechaini, dtfi);
                    DateTimeFormatInfo dtffin = new DateTimeFormatInfo();
                    dtffin.ShortDatePattern = "yyyy-MM-dd";
                    dtffin.DateSeparator = "-";
                    DateTime objDatefin = Convert.ToDateTime(fechafin, dtffin);
                    PfCompania.CurrentValues.Add(PvdCompania);
                    PvdFechaIni.Value = objDate;
                    PfFechaIni.CurrentValues.Add(PvdFechaIni);
                    PvdFechaFin.Value = objDatefin;
                    PfFechaFin.CurrentValues.Add(PvdFechaFin);
                    Pfs.Add(PfFechaIni);
                    Pfs.Add(PfFechaFin);
                    Pfs.Add(PfCompania);
                    crstlRComprobacion.ParameterFieldInfo = Pfs;
                    oRep.Load(@"C:\Users\Hugo\Desktop\Proyecto SIA\SistemaContable\SistemaContable\Reportes\BalanceComprobacion.rpt");//cambiar por su direccion
                    crstlRComprobacion.ReportSource = oRep;
                    //oRepBalanceCom.SetDatabaseLogon("", "", "", "");User, Password, Server, Database(poner para no autentificarse siempre)
                }

            }
        }
Ejemplo n.º 2
0
 public static void introducirTipo(Empresa pempresa, Periodo pperiodo, string ptipo)
 {
     try
     {
         AccesoEmpresas.introducirTipo(new object[] { pempresa, pperiodo, ptipo });
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 3
0
 public static void actualizarPeriodo(Periodo pperiodo)
 {
     try
     {
         AccesoEmpresas.actualizarPeriodo(new object[] { pperiodo.NombreEmpresa, pperiodo.FechaInicio, pperiodo.TipoPeriodo });
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 4
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            if (cmbPeriodo.Text.Equals(""))
            {
                MessageBox.Show("Error, escoja un periodo");
            }
            else
            {
                Periodo periodoNuevo = new Periodo();
                string nuevoEstado = this.cmbPeriodo.SelectedItem.ToString();
                string[] tokens = nuevoEstado.Split('/');
                string fechaini = tokens[0];

                string nuevoEstadofin = this.comboBoxPeriodoFin.SelectedItem.ToString();
                string[] tokensfin = nuevoEstado.Split('/');
                string fechafin = tokensfin[1];

                if (reporte.Equals("EstadoResultados"))
                {
                    dataset = LogicaEstadoResultados.obtenerEstadoResultados(Empresa, fechaini, fechafin);
                    dtgReporte.DataSource = dataset.Tables[0];
                    dtgReporte.Refresh();
                }
                else if (reporte.Equals("BalanceGeneral"))
                {
                    DataSet dataset = LogicaBalance.obtenerBalance(Empresa, fechaini, fechafin);
                    dtgReporte.DataSource = dataset.Tables[0];
                    dtgReporte.Refresh();
                }
            }
        }
Ejemplo n.º 5
0
        public static List<Periodo> obtenerPeriodo(object[] pArgumento)
        {
            List<Periodo> resultado = new List<Periodo>();
            //  List<DateTime> fechas = new List<DateTime>();

            SqlDataReader dataReader = null;
            try
            {
                dataReader = SqlServer.Instance.traerDataReader("cargarPeriodo", pArgumento);
                if (dataReader.HasRows)
                {
                    while (dataReader.Read())
                    {
                        Periodo periodo = new Periodo();
                     //   periodo.FechaInicio = (DateTime)dataReader["FechaInicio"];
                     //   periodo.FechaFin = (DateTime)dataReader["FechaFin"];
                        resultado.Add(periodo);

                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            finally
            {
                SqlServer.Instance.cerrarDataReader(dataReader);
                SqlServer.Instance.CerrarConexion();
            }
            return resultado;
        }
Ejemplo n.º 6
0
        private void buttonGuardarPeriodo_Click(object sender, EventArgs e)
        {
            Periodo periodoNuevo = new Periodo();
            string nuevoEstado = this.comboBoxPeriodoManejoPeriodos.SelectedItem.ToString();
            string[] tokens = nuevoEstado.Split('/');
            periodoNuevo.TipoPeriodo = this.comboBoxEstadoManejoPeriodos.SelectedItem.ToString();
            string fecha = tokens[0];

            DateTimeFormatInfo dtfi = new DateTimeFormatInfo();
            dtfi.ShortDatePattern = "yyyy-MM-dd";
            dtfi.DateSeparator = "-";
            DateTime objDate = Convert.ToDateTime(fecha, dtfi);
            periodoNuevo.FechaInicio = objDate;

            periodoNuevo.NombreEmpresa = this.comboBoxEmpresaManejoPeriodos.SelectedItem.ToString();

            LogicaEmpresas.actualizarPeriodo(periodoNuevo);
            MessageBox.Show("El periodo ha sido actualizado", "Información", MessageBoxButtons.OK);
        }