Ejemplo n.º 1
0
        private void frmclientes_Load(object sender, EventArgs e)
        {
            IntPtr hmenu = GetSystemMenu(this.Handle, 0);
            int    cnt   = GetMenuItemCount(hmenu);

            // remove 'close' action
            RemoveMenu(hmenu, cnt - 1, MF_DISABLED | MF_BYPOSITION);
            // remove extra menu line
            RemoveMenu(hmenu, cnt - 2, MF_DISABLED | MF_BYPOSITION);
            DrawMenuBar(this.Handle);

            conf c = opconf.GellIdConf("clientes");

            if (c != null)
            {
                if (c.cargar == true)
                {
                    status fr = new status();
                    fr.Show("Cargando Datos");
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_clientes.GellAllClientes();
                    this.toolStripStatusLabel1.Text   = dataGridView1.RowCount.ToString();
                }
            }
        }
Ejemplo n.º 2
0
        private void frmdefdist_Load(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Cargando Datos");
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.DataSource          = op_distancias.GellAlldistancias();
        }
Ejemplo n.º 3
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Cargando Datos");
            this.toolStripStatusLabel1.Text   = "Cargando...";
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = op_proveedores.GellAllproveedores();
            this.toolStripStatusLabel1.Text   = dataGridView1.RowCount.ToString();
        }
Ejemplo n.º 4
0
        private void frmmovimientosINT_Load(object sender, EventArgs e)
        {
            splitContainer1.Panel1Collapsed = true;
            splitContainer4.Panel1Collapsed = true;

            IntPtr hmenu = GetSystemMenu(this.Handle, 0);
            int    cnt   = GetMenuItemCount(hmenu);

            // remove 'close' action
            RemoveMenu(hmenu, cnt - 1, MF_DISABLED | MF_BYPOSITION);
            // remove extra menu line
            RemoveMenu(hmenu, cnt - 2, MF_DISABLED | MF_BYPOSITION);
            DrawMenuBar(this.Handle);
            //DateTime a, b;


            status fr = new status();

            fr.Show("Cargando Datos");

            b = Convert.ToDateTime(string.Concat(Convert.ToString(int.Parse(diai) - 1), "/", Convert.ToString(DateTime.Now.Month).PadLeft(2, '0'), "/", DateTime.Now.Year)).AddDays(1);    //resto un día al mes y con esto obtengo el ultimo día

            if (b > DateTime.Now)
            {
                a = Convert.ToDateTime(string.Concat(diai, "/", Convert.ToString(DateTime.Now.Month - 1).PadLeft(2, '0'), "/", DateTime.Now.Year));                              // pongo el 1 porque siempre es el primer día obvio
                b = Convert.ToDateTime(string.Concat(Convert.ToString(int.Parse(diai) - 1), "/", Convert.ToString(DateTime.Now.Month).PadLeft(2, '0'), "/", DateTime.Now.Year)); //resto un día al mes y con esto obtengo el ultimo día
            }
            else
            {
                a = Convert.ToDateTime(string.Concat(diai, "/", Convert.ToString(DateTime.Now.Month).PadLeft(2, '0'), "/", DateTime.Now.Year));                                      // pongo el 1 porque siempre es el primer día obvio
                b = Convert.ToDateTime(string.Concat(Convert.ToString(int.Parse(diai) - 1), "/", Convert.ToString(DateTime.Now.Month + 1).PadLeft(2, '0'), "/", DateTime.Now.Year)); //resto un día al mes y con esto obtengo el ultimo día
            }
            this.Text = "Listado Salidas de Materiales - Cohorte Actual: " + a.ToShortDateString() + " hasta " + b.ToShortDateString();


            using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("select year(fech) as fech  from entradasmat group by year(fech);", conn);


                MySqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows == true)
                {
                    while (reader.Read())
                    {
                        this.comboBox1.Items.Add(Convert.ToString(reader[0]));
                    }
                }
            }
            this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Analizando Datos");


            if (radioButton2.Checked)
            {
                if (!validacion())
                {
                    return;
                }
                if (checkBox2.Checked == false)
                {
                    op_var.a = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 1).PadLeft(2, '0'), "/", comboBox6.Text));             // pongo el 1 porque siempre es el primer día obvio
                    op_var.b = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 2).PadLeft(2, '0'), "/", comboBox6.Text)).AddDays(-1); //resto un día al mes y con esto obtengo el ultimo día
                }
                else
                {
                    string diai = op_sql.parametro1(@"SELECT c.`diainicial` FROM logicop.cohorte_tablas c  where tabla='entrada';");
                    string numd = op_sql.parametro1(@"SELECT c.`diafinal` FROM logicop.cohorte_tablas c where tabla='entrada';");

                    op_var.a = Convert.ToDateTime(string.Concat(diai, "/", Convert.ToString(op_var.mes(comboBox5.SelectedIndex) - 1).PadLeft(2, '0'), "/", comboBox6.Text)); // pongo el 1 porque siempre es el primer día obvio
                    op_var.b = op_var.a.AddDays(int.Parse(numd));                                                                                                            //resto un día al mes y con esto obtengo el ultimo dí
                }
                panel2.Enabled = true;
                panel3.Enabled = false;

                if (comboBox2.Text == "CANTERAS")
                {
                    dataGridView1.AutoGenerateColumns = false;
                    this.dataGridView1.DataSource     = op_entradasmat.GellAllcmat1(op_var.a, op_var.b, comboBox1.SelectedValue.ToString());

                    dataGridView2.AutoGenerateColumns = false;
                    this.dataGridView2.DataSource     = op_salidasmat.GellAllcmat1(op_var.a, op_var.b, comboBox1.SelectedValue.ToString());
                }
                else
                {
                    dataGridView1.AutoGenerateColumns = false;
                    this.dataGridView1.DataSource     = op_entradasmat.GellAllcmat2(op_var.a, op_var.b, comboBox1.SelectedValue.ToString());

                    dataGridView2.AutoGenerateColumns = false;
                    this.dataGridView2.DataSource     = op_salidasmat.GellAllcmat2(op_var.a, op_var.b, comboBox1.SelectedValue.ToString());
                }
            }
        }
Ejemplo n.º 6
0
        private void button4_Click(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Analizando Datos");

            if (radioButton1.Checked)
            {
                ErrorProvider u = new ErrorProvider();
                if (dateTimePicker4.Value > dateTimePicker3.Value)
                {
                    u.SetError(dateTimePicker4, "La fecha debe ser menor a la final");
                    return;
                }
                else if (dateTimePicker3.Value < dateTimePicker4.Value)
                {
                    u.SetError(dateTimePicker3, "La fecha debe ser mayor a la Inicial");
                    return;
                }
                else
                {
                    u.SetError(dateTimePicker3, null);
                    u.SetError(dateTimePicker4, null);
                }



                //op_var.a = dateTimePicker4.Value;
                //op_var.b = dateTimePicker3.Value;
                panel2.Enabled = false;
                if (comboBox2.Text == "CANTERAS")
                {
                    dataGridView1.AutoGenerateColumns = false;
                    this.dataGridView1.DataSource     = op_entradasmat.GellAllcmat1(dateTimePicker4.Value, dateTimePicker3.Value, comboBox1.SelectedValue.ToString());

                    dataGridView2.AutoGenerateColumns = false;
                    this.dataGridView2.DataSource     = op_salidasmat.GellAllcmat1(dateTimePicker4.Value, dateTimePicker3.Value, comboBox1.SelectedValue.ToString());
                }
                else
                {
                    dataGridView1.AutoGenerateColumns = false;
                    this.dataGridView1.DataSource     = op_entradasmat.GellAllcmat2(dateTimePicker4.Value, dateTimePicker3.Value, comboBox1.SelectedValue.ToString());
                }
            }
        }
Ejemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!validacion())
            {
                return;
            }

            status fr = new status();

            fr.Show("Cargando Datos");
            avisar_parametrizada = true;
            if (checkBox2.Checked == false)
            {
                op_var.a = op_var.cohorte(1, comboBox5.SelectedIndex + 1, int.Parse(comboBox6.Text));
                op_var.b = op_var.cohorte(1, comboBox5.SelectedIndex + 2, int.Parse(comboBox6.Text)).AddDays(-1);
            }
            else
            {
                op_var.a = op_var.cohorte(int.Parse(diai), comboBox5.SelectedIndex, int.Parse(comboBox6.Text));
                op_var.b = op_var.a.AddDays(int.Parse(numd));
            }

            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = op_comision.GellAllCargos(op_comision.vista.maestro, op_comision.opciones.parametro_fecha, null);

            this.listBox1.DataSource = null;

            dataGridView3.DataSource        = null;
            this.toolStripStatusLabel2.Text = dataGridView2.RowCount.ToString();
            this.toolStripStatusLabel4.Text = dataGridView3.RowCount.ToString();

            if (dataGridView2.Rows.Count > 0)
            {
                listBox1.DataSource             = op_combos.FillCombo("select codempl as cod, nomempl as nom from empleados");
                listBox1.ValueMember            = "cod";
                listBox1.DisplayMember          = "nom";
                this.toolStripStatusLabel6.Text = this.listBox1.Items.Count.ToString();
                toolStripButton2.Enabled        = false;
                this.button2.Enabled            = true;
            }
            else
            {
                MessageBox.Show("Los parámetros no contienen información", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 8
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Cargando Datos");

            op_var.b = op_var.cohorte(int.Parse(diai) - 1, DateTime.Now.Month, DateTime.Now.Year);
            if (op_var.b > DateTime.Now)
            {
                op_var.a = op_var.cohorte(int.Parse(diai), DateTime.Now.Month - 1, DateTime.Now.Year);
                op_var.b = op_var.cohorte(int.Parse(diai) - 1, DateTime.Now.Month, DateTime.Now.Year);
            }
            else
            {
                op_var.a = op_var.cohorte(int.Parse(diai), DateTime.Now.Month, DateTime.Now.Year);
                op_var.b = op_var.cohorte(int.Parse(diai) - 1, DateTime.Now.Month + 1, DateTime.Now.Year);
            }
            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = op_comision.GellAllCargos(op_comision.vista.maestro, op_comision.opciones.parametro_fecha, null);


            toolStripButton2.Enabled        = true;
            listBox1.DataSource             = op_combos.FillCombo("select codempl as cod, nomempl as nom from empleados");
            listBox1.ValueMember            = "cod";
            listBox1.DisplayMember          = "nom";
            dataGridView3.DataSource        = null;
            this.toolStripStatusLabel2.Text = dataGridView2.RowCount.ToString();
            this.toolStripStatusLabel4.Text = dataGridView3.RowCount.ToString();
            opcion = false;
            avisar_parametrizada = false;
            this.textBox1.Text   = null;
            this.button2.Enabled = false;
            comboBox5.Text       = null;
            comboBox6.Text       = null;
            checkBox2.Checked    = false;
            //dataGridView3.DataSource = op_comision.GellAllCargos(2);
            //SELECT 'SALIDAS' AS ACCESO,ope,  nomempl, count(nrec) as viajes,sum(rkm) as recorrido, sum(tifkm) as rec_km_fle, sum(tifkm*0.07) as comision FROM `logicop`.`salidasmat` join empleados on codempl=ope  group by 1,2
            //union SELECT 'ENTRADAS' AS ACCESO,ope,  nomempl, count(nrec) as viajes,sum(rkm) as recorrido, sum(tifkm) as rec_km_fle, sum(tifkm*0.07) as comision FROM `logicop`.`entradasmat` join empleados on codempl=ope group by 1,2;
        }
Ejemplo n.º 9
0
        private void frmproyectos_Load(object sender, EventArgs e)
        {
            IntPtr hmenu = GetSystemMenu(this.Handle, 0);
            int    cnt   = GetMenuItemCount(hmenu);

            // remove 'close' action
            RemoveMenu(hmenu, cnt - 1, MF_DISABLED | MF_BYPOSITION);
            // remove extra menu line
            RemoveMenu(hmenu, cnt - 2, MF_DISABLED | MF_BYPOSITION);
            DrawMenuBar(this.Handle);

            conf c = opconf.GellIdConf("PROYECTOS");

            if (c != null)
            {
                if (c.cargar == true)
                {
                    status fr = new status();
                    fr.Show("Cargando Datos");
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_proyectos.GellAllproyectos();
                    this.toolStripStatusLabel1.Text   = dataGridView1.RowCount.ToString();
                }
            }

            if (!string.IsNullOrEmpty(_id))
            {
                status fr = new status();
                fr.Show("Cargando Datos");
                this.toolStripButton1.Visible          = false;
                this.toolStripButton3.Visible          = false;
                this.toolStripButton6.Visible          = false;
                this.toolStripTextBox1.Visible         = false;
                this.toolStripSeparator2.Visible       = false;
                this.dataGridView1.AutoGenerateColumns = false;
                this.dataGridView1.DataSource          = op_proyectos.GellAllproyectos2(_id, 3);
                this.toolStripStatusLabel1.Text        = dataGridView1.RowCount.ToString();
            }
        }
Ejemplo n.º 10
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Cargando Datos");

            dataGridView5.AutoGenerateColumns = false;
            dataGridView5.DataSource          = op_entradasmat.GellAllentradasmat();


            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = op_entradasmat.Gellresumen2();

            dataGridView3.AutoGenerateColumns = false;
            dataGridView3.DataSource          = op_entradasmat.Gellresumen1();

            dataGridView4.AutoGenerateColumns = false;
            dataGridView4.DataSource          = op_entradasmat.Gellresumen3();
            toolStripLabel2.Text            = "Vista General";
            this.toolStripStatusLabel1.Text = dataGridView5.RowCount.ToString();

            this.Text = "Listado Entradas de Materiales - Cohorte Actual: " + a.ToShortDateString() + " hasta " + b.ToShortDateString();

            if (this.dataGridView5.RowCount > 0)
            {
                this.toolStripButton2.Enabled = true;
            }

            listBox1.Items.Clear();
            button2.Enabled        = false;
            this.comboBox1.Text    = null;
            this.comboBox2.Text    = null;
            this.checkBox1.Checked = false;
            dinicio = a;
            dfin    = b;
            i       = false;
        }
Ejemplo n.º 11
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Analizando Datos");
            op_sql.parametro1("DELETE from tmp_liq_eq");


            if (radioButton1.Checked)
            {
                if (!validacion())
                {
                    return;
                }
                if (checkBox2.Checked == false)
                {
                    op_var.a = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 1).PadLeft(2, '0'), "/", comboBox6.Text));             // pongo el 1 porque siempre es el primer día obvio
                    op_var.b = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 2).PadLeft(2, '0'), "/", comboBox6.Text)).AddDays(-1); //resto un día al mes y con esto obtengo el ultimo día
                }
                else
                {
                    string diai = op_sql.parametro1(@"SELECT c.`diainicial` FROM logicop.cohorte_tablas c  where tabla='entrada';");
                    string numd = op_sql.parametro1(@"SELECT c.`diafinal` FROM logicop.cohorte_tablas c where tabla='entrada';");

                    op_var.a = Convert.ToDateTime(string.Concat(diai, "/", Convert.ToString(op_var.mes(comboBox5.SelectedIndex) - 1).PadLeft(2, '0'), "/", comboBox6.Text)); // pongo el 1 porque siempre es el primer día obvio
                    op_var.b = op_var.a.AddDays(int.Parse(numd));                                                                                                            //resto un día al mes y con esto obtengo el ultimo dí
                }
                panel2.Enabled = true;
                panel3.Enabled = false;
            }
            else
            {
                if (dateTimePicker1.Value >= dateTimePicker2.Value)
                {
                    this.errorProvider1.SetError(dateTimePicker1, "La fecha dede ser menor a la final");
                    return;
                }
                if (dateTimePicker2.Value <= dateTimePicker1.Value)
                {
                    this.errorProvider1.SetError(dateTimePicker2, "La fecha dede ser mayor a la Inicial");
                    return;
                }

                op_var.a       = dateTimePicker1.Value;
                op_var.b       = dateTimePicker2.Value;
                panel2.Enabled = false;
                panel3.Enabled = true;
            }

            try
            {
                using (MySqlConnection con = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
                {
                    con.Open();
                    if (comboBox4.Text == "INTERNOS")
                    {
                        this.Cursor = Cursors.WaitCursor;
                        MySqlCommand command = new MySqlCommand("SP_liq_eq", con);
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("inicio", op_var.a);
                        command.Parameters.AddWithValue("fin", op_var.b);
                        command.ExecuteNonQuery();
                        status fr1 = new status();
                        fr1.Show("Cargando Datos");
                        dataGridView3.AutoGenerateColumns = false;
                        dataGridView3.DataSource          = op_salidasmat.Gellresumenall(op_salidasmat.ac.interno);
                        this.toolStripStatusLabel4.Text   = this.dataGridView3.RowCount.ToString();
                        this.Cursor = Cursors.Default;
                    }
                    else
                    {
                        this.Cursor = Cursors.WaitCursor;
                        MySqlCommand command = new MySqlCommand("SP_liq_eq_ext", con);
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.AddWithValue("inicio", op_var.a);
                        command.Parameters.AddWithValue("fin", op_var.b);
                        command.ExecuteNonQuery();
                        status fr1 = new status();
                        fr1.Show("Cargando Datos");
                        dataGridView3.AutoGenerateColumns = false;
                        dataGridView3.DataSource          = op_salidasmat.Gellresumenall(op_salidasmat.ac.externo);
                        this.toolStripStatusLabel4.Text   = this.dataGridView3.RowCount.ToString();
                        this.Cursor = Cursors.Default;
                    }
                }
                if (dataGridView3.Rows.Count > 0)
                {
                    this.errorProvider1.SetError(dateTimePicker2, null);
                    this.errorProvider1.SetError(dateTimePicker1, null);
                }
            }
            catch (MySqlException ex)
            {
                MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex1)
            {
                MessageBox.Show("Error: " + ex1.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 12
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            try
            {
                status fr = new status();
                fr.Show("Cargando Datos");

                if (this.radioButton1.Checked)
                {
                    if (!validacion())
                    {
                        return;
                    }
                    if (checkBox2.Checked == false)
                    {
                        op_var.a = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 1).PadLeft(2, '0'), "/", comboBox6.Text));             // pongo el 1 porque siempre es el primer día obvio
                        op_var.b = Convert.ToDateTime(string.Concat("01", "/", Convert.ToString(comboBox5.SelectedIndex + 2).PadLeft(2, '0'), "/", comboBox6.Text)).AddDays(-1); //resto un día al mes y con esto obtengo el ultimo día
                    }
                    else
                    {
                        string diai = op_sql.parametro1(@"SELECT c.`diainicial` FROM logicop.cohorte_tablas c  where tabla='entrada';");
                        string numd = op_sql.parametro1(@"SELECT c.`diafinal` FROM logicop.cohorte_tablas c where tabla='entrada';");

                        op_var.a = Convert.ToDateTime(string.Concat(diai, "/", Convert.ToString(op_var.mes(comboBox5.SelectedIndex) - 1).PadLeft(2, '0'), "/", comboBox6.Text)); // pongo el 1 porque siempre es el primer día obvio
                        op_var.b = op_var.a.AddDays(int.Parse(numd));                                                                                                            //resto un día al mes y con esto obtengo el ultimo dí
                    }

                    this.errorProvider1.SetError(dateTimePicker1, null);
                    this.errorProvider1.SetError(dateTimePicker2, null);
                    this.errorProvider1.SetError(comboBox5, null);
                    this.errorProvider1.SetError(comboBox6, null);
                    panel2.Enabled = true;
                    panel3.Enabled = false;
                }
                else
                {
                    if (string.IsNullOrEmpty(this.textBox2.Text))
                    {
                        errorProvider1.SetError(textBox2, "La Código es Obligatorio");
                        return;
                    }

                    if (string.IsNullOrEmpty(comboBox4.Text))
                    {
                        errorProvider1.SetError(comboBox4, "El Objecto contractual es Obligatorio");
                        return;
                    }


                    if (dateTimePicker1.Value >= dateTimePicker2.Value)
                    {
                        this.errorProvider1.SetError(dateTimePicker1, "La fecha dede ser menor a la final");
                        return;
                    }
                    if (dateTimePicker2.Value <= dateTimePicker1.Value)
                    {
                        this.errorProvider1.SetError(dateTimePicker2, "La fecha dede ser mayor a la Inicial");
                        return;
                    }

                    this.errorProvider1.SetError(dateTimePicker1, null);
                    this.errorProvider1.SetError(dateTimePicker2, null);
                    this.errorProvider1.SetError(comboBox5, null);
                    this.errorProvider1.SetError(comboBox6, null);

                    op_var.a       = dateTimePicker1.Value;
                    op_var.b       = dateTimePicker2.Value;
                    panel2.Enabled = false;
                    panel3.Enabled = true;
                }


                if (this.comboBox4.Text == "CANTERA ENTRADAS")
                {
                    dataGridView5.AutoGenerateColumns = false;
                    dataGridView5.DataSource          = op_entradasmat.GellAllentradasmat4(op_var.a, op_var.b, textBox1.Text, 1);
                    dataGridView5.BringToFront();
                    try
                    {
                        using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
                        {
                            conn.Open();
                            MySqlCommand cmd = new MySqlCommand(@"SELECT
                                                                    SUM(entradasmat.matfle) AS TOTAL,
                                                                    AVG(entradasmat.matfle) AS prom
                                                                    FROM
                                                                    entradasmat
                                                                    WHERE
                                                                    entradasmat.prov=@a and fech BETWEEN @b and @c", conn);
                            cmd.Parameters.AddWithValue("@a", this.textBox2.Text);
                            cmd.Parameters.AddWithValue("@b", op_var.a);
                            cmd.Parameters.AddWithValue("@c", op_var.b);
                            MySqlDataReader reader = cmd.ExecuteReader();
                            if (reader.HasRows == true)
                            {
                                while (reader.Read())
                                {
                                    label6.Text = "TOTAL: " + string.Format("{0:C}", reader[0]);
                                    label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", reader[1]);
                                }
                            }
                            else
                            {
                                label6.Text = "TOTAL: " + string.Format("{0:C}", 0);
                                label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", 0);
                            }
                        }
                    }
                    catch (MySqlException ex)
                    {
                        MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    this.toolStripButton2.Enabled = true;

                    if (dataGridView5.RowCount <= 0)
                    {
                        this.toolStripButton2.Enabled = false;
                    }
                    else
                    {
                        toolStripButton4.Visible = true;
                    }

                    this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();


                    dataGridView1.DataSource = null;
                }
                else if (this.comboBox4.Text == "CENTRO DE COSTOS")
                {
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_salidasmat.GellAllsalidasmat4(op_var.a, op_var.b, textBox1.Text, 1);
                    try
                    {
                        using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
                        {
                            conn.Open();
                            MySqlCommand cmd = new MySqlCommand(@"SELECT
                                                                    SUM(salidasmat.matflet) AS TOTAL,
                                                                    AVG(salidasmat.matflet) AS prom
                                                                    FROM
                                                                    salidasmat
                                                                    WHERE
                                                                    salidasmat.ccos=@a and fech BETWEEN @b and @c", conn);
                            cmd.Parameters.AddWithValue("@a", this.textBox2.Text);
                            cmd.Parameters.AddWithValue("@b", op_var.a);
                            cmd.Parameters.AddWithValue("@c", op_var.b);
                            MySqlDataReader reader = cmd.ExecuteReader();
                            if (reader.HasRows == true)
                            {
                                while (reader.Read())
                                {
                                    label6.Text = "TOTAL: " + string.Format("{0:C}", reader[0]);
                                    label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", reader[1]);
                                }
                            }
                            else
                            {
                                label6.Text = "TOTAL: " + string.Format("{0:C}", 0);
                                label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", 0);
                            }
                        }
                    }


                    catch (MySqlException ex)
                    {
                        MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    this.toolStripButton2.Enabled = true;
                    if (dataGridView1.RowCount <= 0)
                    {
                        this.toolStripButton2.Enabled = false;
                    }
                    else
                    {
                        toolStripButton4.Visible = true;
                    }

                    this.toolStripStatusLabel4.Text = dataGridView1.RowCount.ToString();
                    dataGridView5.DataSource        = null;
                }
                else if (this.comboBox4.Text == "CANTERA SALIDAS")
                {
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_salidasmat.GellAllsalidasmat4(op_var.a, op_var.b, textBox1.Text, 3);
                    try
                    {
                        using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
                        {
                            conn.Open();
                            MySqlCommand cmd = new MySqlCommand(@"SELECT
                                                                    SUM(salidasmat.matflet) AS TOTAL,
                                                                    AVG(salidasmat.matflet) AS prom
                                                                    FROM
                                                                    salidasmat
                                                                    WHERE
                                                                    salidasmat.prov=@a and fech BETWEEN @b and @c", conn);
                            cmd.Parameters.AddWithValue("@a", this.textBox2.Text);
                            cmd.Parameters.AddWithValue("@b", op_var.a);
                            cmd.Parameters.AddWithValue("@c", op_var.b);
                            MySqlDataReader reader = cmd.ExecuteReader();
                            if (reader.HasRows == true)
                            {
                                while (reader.Read())
                                {
                                    label6.Text = "TOTAL: " + string.Format("{0:C}", reader[0]);
                                    label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", reader[1]);
                                }
                            }
                            else
                            {
                                label6.Text = "TOTAL: " + string.Format("{0:C}", 0);
                                label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", 0);
                            }
                        }
                    }


                    catch (MySqlException ex)
                    {
                        MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    this.toolStripButton2.Enabled = true;
                    if (dataGridView1.RowCount <= 0)
                    {
                        this.toolStripButton2.Enabled = false;
                    }
                    else
                    {
                        toolStripButton4.Visible = true;
                    }
                    dataGridView1.BringToFront();
                    this.toolStripStatusLabel4.Text = dataGridView1.RowCount.ToString();
                    dataGridView5.DataSource        = null;
                }
                else
                {
                    dataGridView1.AutoGenerateColumns = false;
                    dataGridView1.DataSource          = op_salidasmat.GellAllsalidasmat4(op_var.a, op_var.b, textBox1.Text, 2);
                    dataGridView1.BringToFront();
                    try
                    {
                        using (MySqlConnection conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString()))
                        {
                            conn.Open();
                            MySqlCommand cmd = new MySqlCommand(@"SELECT
                                                                    SUM(salidasmat.matflet) AS TOTAL,
                                                                    AVG(salidasmat.matflet) AS prom
                                                                    FROM
                                                                    salidasmat
                                                                    WHERE
                                                                    salidasmat.cont=@a and fech BETWEEN @b and @c", conn);
                            cmd.Parameters.AddWithValue("@a", this.textBox2.Text);
                            cmd.Parameters.AddWithValue("@b", op_var.a);
                            cmd.Parameters.AddWithValue("@c", op_var.b);
                            MySqlDataReader reader = cmd.ExecuteReader();
                            if (reader.HasRows == true)
                            {
                                while (reader.Read())
                                {
                                    label6.Text = "TOTAL: " + string.Format("{0:C}", reader[0]);
                                    label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", reader[1]);
                                }
                            }
                            else
                            {
                                label6.Text = "TOTAL: " + string.Format("{0:C}", 0);
                                label7.Text = "PROMEDIO DIARIO: " + string.Format("{0:C}", 0);
                            }
                        }
                    }
                    catch (MySqlException ex)
                    {
                        MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    this.toolStripButton2.Enabled = true;
                    if (dataGridView1.RowCount <= 0)
                    {
                        this.toolStripButton2.Enabled = false;
                    }
                    else
                    {
                        toolStripButton4.Visible = true;
                    }

                    this.toolStripStatusLabel4.Text = dataGridView1.RowCount.ToString();
                    dataGridView5.DataSource        = null;
                }
            }

            catch (MySqlException ex)
            {
                MessageBox.Show("Error de acceso a datos: " + ex.Message.ToString(), Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }



            if (string.IsNullOrEmpty(comboBox4.Text) || string.IsNullOrEmpty(this.textBox2.Text) || string.IsNullOrEmpty(comboBox6.Text) || string.IsNullOrEmpty(comboBox5.Text))
            {
            }
            else
            {
            }
        }
Ejemplo n.º 13
0
        private void frmverificacion_Load(object sender, EventArgs e)
        {
            status fr = new status();

            fr.Show("Cargando Datos");

            if (_o == 1)
            {
                this.Text = "Verificación del Equipo " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.BringToFront();
                dataGridView5.AutoGenerateColumns = false;
                Column2.Visible                 = false;
                dataGridView5.DataSource        = op_salidasmat.GellAllsalidasmatver(_a, _b, _s, _c, 1);
                this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
            }
            if (_o == 2)
            {
                this.Text = "Verificación del Equipo " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.SendToBack();
                dataGridView2.AutoGenerateColumns = false;
                dataGridViewButtonColumn1.Visible = false;
                dataGridView2.DataSource          = op_entradasmat.GellAllentradasmatver(_a, _b, _s, _c, 1);
                this.toolStripStatusLabel4.Text   = dataGridView2.RowCount.ToString();
            }
            if (_o == 3)
            {
                this.Text = "Verificación del Centro de Costo " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.BringToFront();
                dataGridView5.AutoGenerateColumns = false;
                Column2.Visible                 = false;
                dataGridView5.DataSource        = op_salidasmat.GellAllsalidasmatver(_a, _b, _s, _c, 2);
                this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
            }
            if (_o == 4)
            {
                this.Text = "Verificación del Centro de Costo " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.BringToFront();
                dataGridView5.AutoGenerateColumns = false;
                Column2.Visible                 = false;
                dataGridView5.DataSource        = op_salidasmat.GellAllsalidasmatver(_a, _b, _s, _c, 3);
                this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
            }

            if (_o == 5)
            {
                this.Text = "Listado de Recibos de Salidas Anulados en Facturación";
                dataGridView5.BringToFront();
                dataGridView5.AutoGenerateColumns = false;
                Column2.Visible                 = true;
                dataGridView5.DataSource        = op_salidasmat.GellAllsalidasmatver(_a, _b, null, _c, 4);
                this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
            }
            if (_o == 6)
            {
                this.Text = "Listado de Recibos de Entradas Anulados en Facturación";
                dataGridView5.SendToBack();
                dataGridView2.AutoGenerateColumns = false;
                dataGridViewButtonColumn1.Visible = true;
                dataGridView2.DataSource          = op_entradasmat.GellAllentradasmatver(_a, _b, null, _c, 4);
                this.toolStripStatusLabel4.Text   = dataGridView2.RowCount.ToString();
            }
            if (_o == 7)
            {
                this.Text = "Verificación de Cantera " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.SendToBack();
                dataGridView2.AutoGenerateColumns = false;
                dataGridViewButtonColumn1.Visible = false;
                dataGridView2.DataSource          = op_entradasmat.GellAllentradasmatver(_a, _b, _s, _c, 5);
                this.toolStripStatusLabel4.Text   = dataGridView2.RowCount.ToString();
            }
            if (_o == 8)
            {
                this.Text = "Verificación del Centro de Costo " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.BringToFront();
                dataGridView5.AutoGenerateColumns = false;
                Column2.Visible                 = false;
                dataGridView5.DataSource        = op_salidasmat.GellAllsalidasmatver(_a, _b, _s, _c, 5);
                this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
            }
            if (_o == 9)
            {
                this.Text = "Verificación del Centro de Costo " + _s + " con Facturación desde " + _a.ToShortDateString() + " hasta " + _b.ToShortDateString();
                dataGridView5.BringToFront();
                dataGridView5.AutoGenerateColumns = false;
                Column2.Visible                 = false;
                dataGridView5.DataSource        = op_salidasmat.GellAllsalidasmatver(_a, _b, _s, _c, 6);
                this.toolStripStatusLabel4.Text = dataGridView5.RowCount.ToString();
            }
        }
Ejemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool recibe1, recibe2 = false;

            if (!validacion())
            {
                return;
            }
            op_distancias.distancias a = new op_distancias.distancias();
            a.lug1 = this.comboBox2.Text;
            a.lug2 = this.comboBox3.Text;
            a.tip1 = this.comboBox1.Text;
            a.tip2 = this.comboBox4.Text;
            a.cant = int.Parse(this.textBox1.Text);

            if (a.lug1 == a.lug2)
            {
                MessageBox.Show("El lugar debe ser diferente", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            recibe1 = op_sql.comprobar("SELECT * FROM distancias WHERE `tip1` = '" + a.tip1 + "' and`lug1` = '" + a.lug1 + "' and`tip2` = '" + a.tip2 + "' and `lug2` = '" + a.lug2 + "'");
            if (recibe1)
            {
                MessageBox.Show(mensajes.MsjProc4, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            recibe2 = op_sql.comprobar("SELECT * FROM distancias WHERE `tip1` = '" + a.tip2 + "' and`lug1` = '" + a.lug2 + "' and`tip2` = '" + a.tip1 + "' and `lug2` = '" + a.lug1 + "'");
            if (recibe2)
            {
                MessageBox.Show("El origen y el destino se aplica de forma viceversa", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }


            int c = op_distancias.accion(a, 1);

            if (c > 0)
            {
                if (c == 1)
                {
                    MessageBox.Show(mensajes.MsjProc1, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    borrar();
                }
                if (c == 2)
                {
                    MessageBox.Show(mensajes.MsjProc2, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    borrar();
                }
                if (c == 3)
                {
                    MessageBox.Show(mensajes.MsjProc3, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    borrar();
                }
                if (c == 4)
                {
                    //if (MessageBox.Show(mensajes.MsjProc4 + " " + mensajes.MsjProc5, Application.ProductName.ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    //{
                    //    rowsAffected = op_equipos.accion(a, 2);
                    //}
                    MessageBox.Show(mensajes.MsjProc4 + " " + mensajes.MsjProc5, Application.ProductName.ToString(), MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show(mensajes.MsjProc0, Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            status fr = new status();

            fr.Show("Cargando Datos");
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.DataSource          = op_distancias.GellAlldistancias();
        }