示例#1
0
        private void Buscar_ID()
        {
            string maximo = "";

            try
            {
                String  SQL = "SELECT MAX(CODIGO) as CODIGO FROM facturas";
                DataSet ds  = Conexiones.Retorna_Datos(SQL);
                maximo = Convert.ToString(ds.Tables[0].Rows[0]["CODIGO"]);

                if (maximo == "")
                {
                    textBox1.Text = "1";
                }

                if (maximo != "" && ds.Tables[0].Rows.Count > 0)
                {
                    textBox1.Text = (Convert.ToInt32(ds.Tables[0].Rows[0]["CODIGO"]) + 1).ToString();
                }
            }

            catch (Exception ex)
            {
                //MessageBox.Show("Todavía no existían registros.");
            }
        }
示例#2
0
        private void Cargar_Grid_Gastos()
        {
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM gastos ORDER BY COD_GASTOS");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = ds.Tables[0];
        }
示例#3
0
        private void button4_Click(object sender, EventArgs e)
        {
            string ID;
            string ID_obra;
            string Fecha       = "";
            string Tipo        = "";
            string Descripcion = "";

            ID          = textBox1.Text;
            ID_obra     = Convert.ToString(Variables_Globales.id);
            Fecha       = Convert.ToString(dateTimePicker1.Text);
            Tipo        = Convert.ToString(checkedListBox1.Text);
            Descripcion = textBox4.Text;

            if (Fecha != "" && Tipo != "" && Descripcion != "")
            {
                Conexiones.Ejecuta_Consulta("INSERT INTO planificacion (ID, ID_obra, Fecha, Tipo, Descripcion) " +
                                            "VALUES ('" + ID + "', '" + ID_obra + "', '" + Fecha + "', '" + Tipo + "', '" + Descripcion + "')");

                MessageBox.Show("Registro guardado correctamente.");

                this.Close();
            }
            else
            {
                MessageBox.Show("Debes insertar fecha, tipo y/o descripción.");
                return;
            }
        }
示例#4
0
        private void Cargar_Grid_Horas()
        {
            DataSet ds = Conexiones.Retorna_Datos("select * from horas ORDER BY COD_Horas");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = ds.Tables[0];
        }
示例#5
0
        private void dataGridView3_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            try
            {
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    NumFila = e.RowIndex;

                    //dataGridView3.CurrentCell = dataGridView1[0, NumFila];
                    string ID_Eliminar = Convert.ToString(dataGridView3.Rows[NumFila].Cells[4].Value);

                    //Eliminar
                    if (e.ColumnIndex == 5)
                    {
                        DialogResult resp = MessageBox.Show("¿Seguro que deseas eliminar al trabajador de esta obra?", "¡ALERTA!", MessageBoxButtons.YesNo);

                        if (resp == DialogResult.Yes)
                        {
                            string SQL = "UPDATE trabajadores_obra SET Libre = 'SI', Obra_asignada = '00' where CODI = '" + ID_Eliminar + "'";
                            Conexiones.Ejecuta_Consulta("UPDATE trabajadores_obra SET Libre = 'SI', Obra_asignada = '00' where CODI = '" + ID_Eliminar + "'");

                            MessageBox.Show("El trabajador ha quedado LIBRE.");

                            Cargar_Grid_Trabajadores();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error eliminando el registro indicado.");
            }
        }
示例#6
0
        private void Cargar_Obra()
        {
            Variables_Globales.id = textBox15.Text;
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM obras where ID = '" + Variables_Globales.id + "'");

            textBox1.Text        = Convert.ToString(ds.Tables[0].Rows[0]["ID"]);
            textBox2.Text        = Convert.ToString(ds.Tables[0].Rows[0]["Expediente"]);
            textBox3.Text        = Convert.ToString(ds.Tables[0].Rows[0]["Titulo"]);
            textBox4.Text        = Convert.ToString(ds.Tables[0].Rows[0]["Direccion"]);
            textBox5.Text        = Convert.ToString(ds.Tables[0].Rows[0]["Poblacion"]);
            textBox6.Text        = Convert.ToString(ds.Tables[0].Rows[0]["CP"]);
            listBox1.Text        = Convert.ToString(ds.Tables[0].Rows[0]["Estado"]);
            textBox8.Text        = Convert.ToString(ds.Tables[0].Rows[0]["Importe"]);
            listBox2.Text        = Convert.ToString(ds.Tables[0].Rows[0]["IVA"]);
            textBox10.Text       = Convert.ToString(ds.Tables[0].Rows[0]["Total"]);
            textBox11.Text       = Convert.ToString(ds.Tables[0].Rows[0]["Promotor"]);
            dateTimePicker1.Text = Convert.ToString(ds.Tables[0].Rows[0]["Fecha_inicio"]);
            dateTimePicker2.Text = Convert.ToString(ds.Tables[0].Rows[0]["Fecha_fin"]);
            textBox14.Text       = Convert.ToString(ds.Tables[0].Rows[0]["Duracion"]);

            textBox1.Enabled        = false;
            textBox2.Enabled        = false;
            textBox3.Enabled        = false;
            textBox4.Enabled        = false;
            textBox5.Enabled        = false;
            textBox6.Enabled        = false;
            listBox1.Enabled        = true;
            textBox8.Enabled        = true;
            listBox2.Enabled        = true;
            textBox10.Enabled       = true;
            textBox11.Enabled       = false;
            dateTimePicker1.Enabled = true;
            dateTimePicker2.Enabled = true;
            textBox14.Enabled       = true;
        }
示例#7
0
        private void Cargar_Fin()
        {
            Variables_Globales.id = textBox15.Text;
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM doc_fin where ID = '" + Variables_Globales.id + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                string LF   = Convert.ToString(ds.Tables[0].Rows[0]["LF"]);
                string CF   = Convert.ToString(ds.Tables[0].Rows[0]["CF"]);
                string AREC = Convert.ToString(ds.Tables[0].Rows[0]["AREC"]);
                string CEE  = Convert.ToString(ds.Tables[0].Rows[0]["CEE"]);


                if (LF == "True")
                {
                    checkBox26.Checked = true;
                }
                if (CF == "True")
                {
                    checkBox27.Checked = true;
                }
                if (AREC == "True")
                {
                    checkBox28.Checked = true;
                }
                if (CEE == "True")
                {
                    checkBox29.Checked = true;
                }
            }
        }
示例#8
0
        private void Cargar_Grid()
        {
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM obras ORDER BY ID");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = ds.Tables[0];
        }
示例#9
0
        private void Guardar_Final()
        {
            Variables_Globales.id = textBox15.Text;

            String  SQL = "SELECT * from doc_fin where ID = '" + Variables_Globales.id + "' ORDER BY ID ";
            DataSet ds  = Conexiones.Retorna_Datos(SQL);

            string ID   = "";
            string LF   = "";
            string CF   = "";
            string AREC = "";
            string CEE  = "";

            ID   = Convert.ToString(textBox15.Text);
            LF   = checkBox26.Checked.ToString();
            CF   = checkBox27.Checked.ToString();
            AREC = checkBox28.Checked.ToString();
            CEE  = checkBox29.Checked.ToString();

            if (ds.Tables[0].Rows.Count > 0)
            {
                Conexiones.Ejecuta_Consulta("UPDATE doc_fin set LF = '" + LF + "', CF = '" + CF + "', AREC = '" + AREC + "', CEE = '" + CEE + "' where ID = '" + Variables_Globales.id + "'");
            }
            else
            {
                Conexiones.Ejecuta_Consulta("INSERT INTO doc_fin (ID, LF, CF, AREC, CEE) " +
                                            "VALUES ('" + ID + "', '" + LF + "', '" + CF + "', '" + AREC + "','" + CEE + "')");
            }
        }
示例#10
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            try
            {
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    NumFila = e.RowIndex;

                    dataGridView1.CurrentCell = dataGridView1[0, NumFila];
                    string Trabajador = Convert.ToString(dataGridView1.Rows[NumFila].Cells[0].Value);
                    //Seleccionar
                    if (e.ColumnIndex == 3)
                    {
                        DialogResult resp = MessageBox.Show("¿Quieres añadir al trabajador a la obra " + Variables_Globales.id + "?", "¡ALERTA!", MessageBoxButtons.YesNo);

                        if (resp == DialogResult.Yes)
                        {
                            string SQL = "UPDATE trabajadores_obra SET Libre = 'NO', Obra_asignada = '" + Variables_Globales.id + "' WHERE CODI =  '" + Trabajador + "'";
                            Conexiones.Ejecuta_Consulta("UPDATE trabajadores_obra SET Libre = 'NO', Obra_asignada = '" + Variables_Globales.id + "' WHERE CODI =  '" + Trabajador + "'");

                            MessageBox.Show("Añadido correctamente.");
                            this.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error modificando el registro indicado.");
            }
        }
示例#11
0
        private void Cargar_Grid_Trabajadores()
        {
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM trabajadores_obra ORDER BY CODI");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = ds.Tables[0];
        }
示例#12
0
        private void Rellenar_ListBox()
        {
            DataSet ds = Conexiones.Retorna_Datos("Select ID, Expediente, Titulo, Estado from obras where (Estado = 'PUBLICADA' or Estado = 'PRESENTADA' or Estado = 'EN EVALUACIÓN' or Estado = 'ADJUDICADA' or Estado = 'EN EJECUCIÓN' or Estado = 'FINALIZADA' or Estado = 'OTROS')");

            List <string> Lista_ID_obras  = new List <string>();
            List <string> Lista_Exp_obras = new List <string>();
            List <string> Lista_Ti_obras  = new List <string>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string ID  = ds.Tables[0].Rows[i]["ID"].ToString();
                string Exp = ds.Tables[0].Rows[i]["Expediente"].ToString();
                string Ti  = ds.Tables[0].Rows[i]["Titulo"].ToString();
                Lista_ID_obras.Add(ID);
                Lista_Exp_obras.Add(Exp);
                Lista_Ti_obras.Add(Ti);
            }

            List <string> Lista_todo = new List <string>();

            for (int i = 0; i < Lista_ID_obras.Count; i++)
            {
                string concatenar = Lista_ID_obras[i] + ", " + Lista_Exp_obras[i] + ", " + Lista_Ti_obras[i];
                Lista_todo.Add(concatenar);
            }
            listBox1.DataSource = Lista_todo;
        }
示例#13
0
        private void Cargar_Durante()
        {
            Variables_Globales.id = textBox15.Text;
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM doc_durante where ID = '" + Variables_Globales.id + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                string DC    = Convert.ToString(ds.Tables[0].Rows[0]["DC"]);
                string DE    = Convert.ToString(ds.Tables[0].Rows[0]["DE"]);
                string DF    = Convert.ToString(ds.Tables[0].Rows[0]["DF"]);
                string DP    = Convert.ToString(ds.Tables[0].Rows[0]["DP"]);
                string DCARP = Convert.ToString(ds.Tables[0].Rows[0]["DCARP"]);
                string DA    = Convert.ToString(ds.Tables[0].Rows[0]["DA"]);
                string DI    = Convert.ToString(ds.Tables[0].Rows[0]["DI"]);
                string DINS  = Convert.ToString(ds.Tables[0].Rows[0]["DINS"]);
                string DR    = Convert.ToString(ds.Tables[0].Rows[0]["DR"]);
                string DEQ   = Convert.ToString(ds.Tables[0].Rows[0]["DEQ"]);

                if (DC == "True")
                {
                    checkBox16.Checked = true;
                }
                if (DE == "True")
                {
                    checkBox17.Checked = true;
                }
                if (DF == "True")
                {
                    checkBox18.Checked = true;
                }
                if (DP == "True")
                {
                    checkBox19.Checked = true;
                }
                if (DCARP == "True")
                {
                    checkBox20.Checked = true;
                }
                if (DA == "True")
                {
                    checkBox21.Checked = true;
                }
                if (DI == "True")
                {
                    checkBox22.Checked = true;
                }
                if (DINS == "True")
                {
                    checkBox23.Checked = true;
                }
                if (DR == "True")
                {
                    checkBox24.Checked = true;
                }
                if (DEQ == "True")
                {
                    checkBox25.Checked = true;
                }
            }
        }
示例#14
0
        private void Cargar_Grid_Trabajadores()
        {
            string  SQL = "SELECT * FROM trabajadores_obra where Libre = 'SI'";
            DataSet ds  = Conexiones.Retorna_Datos("SELECT * FROM trabajadores_obra where Libre = 'SI'");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = ds.Tables[0];
        }
示例#15
0
        private void Cargar_Grid_Compras()
        {
            Variables_Globales.id = textBox15.Text;
            DataSet ds = Conexiones.Retorna_Datos("SELECT * FROM facturas where ID_OBRA = '" + Variables_Globales.id + "'");

            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = ds.Tables[0];
        }
示例#16
0
        private void Guardar_Inicio()
        {
            Variables_Globales.id = textBox15.Text;

            String  SQL = "SELECT * from doc_inicio where ID = '" + Variables_Globales.id + "' ORDER BY ID ";
            DataSet ds  = Conexiones.Retorna_Datos(SQL);

            string ID  = "";
            string CF  = "";
            string PC  = "";
            string EG  = "";
            string LO  = "";
            string AP  = "";
            string NP  = "";
            string LD  = "";
            string PSS = "";
            string LC  = "";
            string AC  = "";
            string LI  = "";
            string PGR = "";
            string LS  = "";
            string PG  = "";
            string AR  = "";

            ID  = Convert.ToString(textBox15.Text);
            CF  = checkBox1.Checked.ToString();
            PC  = checkBox2.Checked.ToString();
            EG  = checkBox3.Checked.ToString();
            LO  = checkBox4.Checked.ToString();
            AP  = checkBox5.Checked.ToString();
            NP  = checkBox6.Checked.ToString();
            LD  = checkBox7.Checked.ToString();
            PSS = checkBox8.Checked.ToString();
            LC  = checkBox9.Checked.ToString();
            AC  = checkBox10.Checked.ToString();
            LI  = checkBox11.Checked.ToString();
            PGR = checkBox12.Checked.ToString();
            LS  = checkBox13.Checked.ToString();
            PG  = checkBox14.Checked.ToString();
            AR  = checkBox15.Checked.ToString();

            string SQL2 = "INSERT INTO doc_inicio (ID, CF, PC, EG, LO, AP, NP, LD, PSS, LC, AC, LI, PGR, LS, PG, AR) " +
                          "VALUES ('" + ID + "', '" + CF + "', '" + PC + "', '" + EG + "','" + LO + "', '" + AP + "', '" + NP + "', '" + LD + "', '" + PSS + "', '" + LC + "', '" + AC + "', '" + LI + "','" + PGR + "', '" + LS + "', '" + PG + "', '" + AR + "')";

            if (ds.Tables[0].Rows.Count > 0)
            {
                Conexiones.Ejecuta_Consulta("UPDATE doc_inicio set CF = '" + CF + "', PC = '" + PC + "', EG = '" + EG + "', LO = '" + LO + "'," +
                                            " AP = '" + AP + "', NP = '" + NP + "', LD = '" + LD + "', PSS = '" + PSS + "', LC = '" + LC + "', AC = '" + AC + "', " +
                                            "LI = '" + LI + "', PGR = '" + PGR + "', LS = '" + LS + "', PG = '" + PG + "', AR =  '" + AR + "' where ID = '" + Variables_Globales.id + "'");
            }
            else
            {
                Conexiones.Ejecuta_Consulta("INSERT INTO doc_inicio (ID, CF, PC, EG, LO, AP, NP, LD, PSS, LC, AC, LI, PGR, LS, PG, AR) " +
                                            "VALUES ('" + ID + "', '" + CF + "', '" + PC + "', '" + EG + "','" + LO + "', '" + AP + "', '" + NP + "', '" + LD + "', '" + PSS + "', '" + LC + "', '" + AC + "', '" + LI + "','" + PGR + "', '" + LS + "', '" + PG + "', '" + AR + "')");
            }
            //Conexiones.Ejecuta_Consulta("INSERT INTO doc_inicio (ID, CF, PC, EG, LO, AP, NP, LD, PSS, LC, AC, LI, PGR, LS, PG, AR) " +
            //    "VALUES ('" + ID + "', '" + CF + "', '" + PC + "', '" + EG + "','" + LO + "', '" + AP + "', '" + NP + "', '" + LD + "', '" + PSS + "', '" + LC + "', '" + AC + "', '" + LI + "','" + PGR + "', '" + LS + "', '" + PG + "', '" + AR + "')");
        }
示例#17
0
        private void Cargar_Grid_Trabajadores()
        {
            Variables_Globales.id = textBox15.Text;
            string  SQL = "SELECT * FROM trabajadores_obra where Obra_asignada = '" + Variables_Globales.id + "'";
            DataSet ds  = Conexiones.Retorna_Datos("SELECT * FROM trabajadores_obra where Obra_asignada = '" + Variables_Globales.id + "' ORDER BY CODI");

            dataGridView3.AutoGenerateColumns = false;
            dataGridView3.DataSource          = ds.Tables[0];
        }
示例#18
0
        private void Cargar_Grid_Planificacion()
        {
            Variables_Globales.id = textBox15.Text;
            string  SQL = "SELECT * FROM planificacion where ID_OBRA = '" + Variables_Globales.id + "'";
            DataSet ds  = Conexiones.Retorna_Datos("SELECT * FROM planificacion where ID_obra = '" + Variables_Globales.id + "' ORDER BY ID");

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = ds.Tables[0];
        }
示例#19
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            try
            {
                if (senderGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                {
                    NumFila = e.RowIndex;

                    dataGridView1.CurrentCell = dataGridView1[0, NumFila];
                    string ID_Eliminar = Convert.ToString(dataGridView1.Rows[NumFila].Cells[0].Value);
                    //Eliminar
                    if (e.ColumnIndex == 18)
                    {
                        DialogResult resp = MessageBox.Show("¿Seguro que deseas eliminar el registro?", "¡ALERTA!", MessageBoxButtons.YesNo);

                        if (resp == DialogResult.Yes)
                        {
                            string SQL = "DELETE FROM trabajadores_obra where CODI = '" + ID_Eliminar + "'";
                            Conexiones.Ejecuta_Consulta("DELETE FROM trabajadores_obra where CODI = '" + ID_Eliminar + "'");

                            MessageBox.Show("Eliminado correctamente.");
                            Cargar_Grid_Trabajadores();
                            //this.Close();
                        }
                    }

                    //Editar
                    if (e.ColumnIndex == 17)
                    {
                        string codigo_empleado = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();

                        Variables_Globales.codigo_empleado = codigo_empleado;
                        Variables_Globales.Form16_Desde    = "FORM10";

                        Form16 frm = new Form16();
                        frm.ShowDialog();
                        Cargar_Grid_Trabajadores();

                        //Variables_Globales.id = "";
                        //Variables_Globales.expediente = "";
                        //Variables_Globales.titulo = "";
                        Variables_Globales.Form16_Desde = "";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error eliminando el registro indicado.");
            }
        }
示例#20
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (Convert.ToString(maskedTextBox1) != "" && Convert.ToString(maskedTextBox2) != "")
            {
                Calcular_Total_Horas();
            }
            else
            {
                MessageBox.Show("Debes insertar la hora de entrada y la de salida.");
            }

            string COD_Horas  = "";
            string Fecha      = "";
            string Obra       = "";
            string H_entrada  = "";
            string H_salida   = "";
            string Total      = "";
            string Expediente = "";
            string Titulo     = "";

            COD_Horas  = textBox1.Text;
            Fecha      = Convert.ToString(dateTimePicker1.Text);
            Obra       = textBox_ID.Text;
            H_entrada  = maskedTextBox1.Text;
            H_salida   = maskedTextBox2.Text;
            Total      = textBox4.Text;
            Expediente = Convert.ToString(textBox_Exp.Text);
            Titulo     = Convert.ToString(textBox_Tit.Text);

            if (Convert.ToString(COD_Horas) != "" && Convert.ToString(Obra) != "" && Convert.ToString(Total) != "")
            {
                string SQL = "INSERT INTO horas (COD_Horas, Fecha, Obra, Expediente, Titulo, H_entrada, H_salida, Total) " +
                             "VALUES ('" + COD_Horas + "', '" + Fecha + "', '" + Obra + "', '" + Expediente + "', '" + Titulo + "', '" + H_entrada + "', '" + H_salida + "', '" + Total + "')";
                Conexiones.Ejecuta_Consulta("INSERT INTO horas (COD_Horas, Fecha, Obra, Expediente, Titulo, H_entrada, H_salida, Total) " +
                                            "VALUES ('" + COD_Horas + "', '" + Fecha + "', '" + Obra + "', '" + Expediente + "', '" + Titulo + "', '" + H_entrada + "', '" + H_salida + "', '" + Total + "')");

                MessageBox.Show("Registro guardado correctamente.");

                this.Close();
            }
            else
            {
                MessageBox.Show("Debes seleccionar la obra e insertar las horas de entrada y salida.");
                return;
            }
        }
示例#21
0
        private void Cargar_Chart()
        {
            //String SQL = "SELECT TITULO, YEAR(Fecha) AS yyyy, MONTHNAME(Fecha) as mm, SUM(Total) AS Su FROM horas " +
            //    "GROUP BY TITULO, YEAR(Fecha), MONTH(Fecha)";
            String  SQL = "SELECT TITULO, SUM(Total) AS Su FROM horas GROUP BY TITULO";
            DataSet ds  = Conexiones.Retorna_Datos(SQL);

            DataTable firstTable = ds.Tables[0];

            chart1.Series.Clear();

            chart1.Titles.Add("HORAS REALIZADAS POR OBRAS");
            foreach (DataRow row in firstTable.Rows)
            {
                Series series = chart1.Series.Add(row["TITULO"].ToString());
                series.Points.Add(Convert.ToDouble(row["Su"].ToString()));
                series.Label = row["Su"].ToString();
            }
        }
示例#22
0
        private void Guardar_Durante()
        {
            Variables_Globales.id = textBox15.Text;

            String  SQL = "SELECT * from doc_durante where ID = '" + Variables_Globales.id + "' ORDER BY ID ";
            DataSet ds  = Conexiones.Retorna_Datos(SQL);

            string ID    = "";
            string DC    = "";
            string DE    = "";
            string DF    = "";
            string DP    = "";
            string DCARP = "";
            string DA    = "";
            string DI    = "";
            string DINS  = "";
            string DR    = "";
            string DEQ   = "";

            ID    = Convert.ToString(textBox15.Text);
            DC    = checkBox16.Checked.ToString();
            DE    = checkBox17.Checked.ToString();
            DF    = checkBox18.Checked.ToString();
            DP    = checkBox19.Checked.ToString();
            DCARP = checkBox20.Checked.ToString();
            DA    = checkBox21.Checked.ToString();
            DI    = checkBox22.Checked.ToString();
            DINS  = checkBox23.Checked.ToString();
            DR    = checkBox24.Checked.ToString();
            DEQ   = checkBox25.Checked.ToString();

            if (ds.Tables[0].Rows.Count > 0)
            {
                Conexiones.Ejecuta_Consulta("UPDATE doc_durante set DC = '" + DC + "', DE = '" + DE + "', DF = '" + DF + "', DP = '" + DP + "'," +
                                            " DCARP = '" + DCARP + "', DA = '" + DA + "', DI = '" + DI + "', DINS = '" + DINS + "', DR = '" + DR + "', DEQ = '" + DEQ + "'" +
                                            " where ID = '" + Variables_Globales.id + "'");
            }
            else
            {
                Conexiones.Ejecuta_Consulta("INSERT INTO doc_durante (ID, DC, DE, DF, DP, DCARP, DA, DI, DINS, DR, DEQ) " +
                                            "VALUES ('" + ID + "', '" + DC + "', '" + DE + "', '" + DF + "','" + DP + "', '" + DCARP + "', '" + DA + "', '" + DI + "', '" + DINS + "', '" + DR + "', '" + DEQ + "')");
            }
        }
示例#23
0
        private void Form16_Load(object sender, EventArgs e)
        {
            if (Variables_Globales.Form16_Desde == "FORM10")
            {
                String SQL = "select trabajadores_obra.Codi, trabajadores_obra.Obra_asignada, obras.ID as ID, obras.Expediente as Expediente," +
                             " obras.Titulo as Titulo from trabajadores_obra inner join obras on trabajadores_obra.Obra_asignada = obras.ID where CODI = '" + Variables_Globales.codigo_empleado + "'";
                DataSet ds = Conexiones.Retorna_Datos(SQL);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    textBox_ID.Text  = Convert.ToString(ds.Tables[0].Rows[0]["ID"]);
                    textBox_Exp.Text = Convert.ToString(ds.Tables[0].Rows[0]["Expediente"]);
                    textBox_Tit.Text = Convert.ToString(ds.Tables[0].Rows[0]["Titulo"]);
                }

                Cargar_Trabajador();
            }
            else
            {
                Buscar_ID();
                Rellenar_ListBox();
            }
        }
示例#24
0
        private void button4_Click(object sender, EventArgs e)
        {
            string CODIGO;
            string N_factura;
            string Fecha    = "";
            string Empresa  = "";
            string Producto = "";
            string Importe  = "";
            string ID_Obra  = "";


            CODIGO    = textBox1.Text;
            N_factura = textBox2.Text;
            Fecha     = Convert.ToString(dateTimePicker1.Text);
            Empresa   = textBox3.Text;
            Producto  = textBox4.Text;
            Importe   = textBox6.Text;
            ID_Obra   = Variables_Globales.id;


            if (Convert.ToString(CODIGO) != "" && ID_Obra != "" && Convert.ToString(N_factura) != "" && Importe != "")
            {
                string SQL = "INSERT INTO facturas (CODIGO, ID_Obra, N_factura, Fecha, Empresa, Producto, Importe) " +
                             "VALUES ('" + CODIGO + "', '" + ID_Obra + "', '" + N_factura + "', '" + Fecha + "', '" + Empresa + "', '" + Producto + "', '" + Importe + "')";

                Conexiones.Ejecuta_Consulta("INSERT INTO facturas (CODIGO, ID_Obra, N_factura, Fecha, Empresa, Producto, Importe) " +
                                            "VALUES ('" + CODIGO + "', '" + ID_Obra + "', '" + N_factura + "', '" + Fecha + "', '" + Empresa + "', '" + Producto + "', '" + Importe + "')");

                MessageBox.Show("Registro guardado correctamente.");

                this.Close();
            }
            else
            {
                MessageBox.Show("Debes insertar nº de factura e importe.");
                return;
            }
        }
示例#25
0
        private void button4_Click(object sender, EventArgs e)
        {
            string COD_GASTOS = "";
            string N_factura  = "";
            string Fecha      = "";
            string Tipo       = "";
            string Obra       = "";
            string Expediente = "";
            string Titulo     = "";
            string Importe    = "";

            COD_GASTOS = textBox1.Text;
            N_factura  = Convert.ToString(textBox2.Text);
            Fecha      = Convert.ToString(dateTimePicker1.Text);
            Tipo       = Convert.ToString(listBox1.Text);
            Importe    = textBox3.Text;
            Obra       = textBox_ID.Text;
            Expediente = Convert.ToString(textBox_Exp.Text);
            Titulo     = Convert.ToString(textBox_Tit.Text);

            if (Convert.ToString(COD_GASTOS) != "" && Convert.ToString(Obra) != "" && Convert.ToString(N_factura) != "" && Convert.ToString(Fecha) != "" && Convert.ToString(Tipo) != "" && Convert.ToString(Importe) != "")
            {
                string SQL = "INSERT INTO gastos (COD_GASTOS, N_factura, Fecha, Tipo, Obra, Expediente, Titulo, Importe) " +
                             "VALUES ('" + COD_GASTOS + "', '" + N_factura + "', '" + Fecha + "', '" + Tipo + "', '" + Obra + "', '" + Expediente + "', '" + Titulo + "', '" + Importe + "')";
                Conexiones.Ejecuta_Consulta("INSERT INTO gastos (COD_GASTOS, N_factura, Fecha, Tipo, Obra, Expediente, Titulo, Importe) " +
                                            "VALUES ('" + COD_GASTOS + "', '" + N_factura + "', '" + Fecha + "', '" + Tipo + "', '" + Obra + "', '" + Expediente + "', '" + Titulo + "', '" + Importe + "')");

                MessageBox.Show("Registro guardado correctamente.");

                this.Close();
            }
            else
            {
                MessageBox.Show("Debes insertar nº de factura, fecha, tipo de gasto e importe.");
                return;
            }
        }
示例#26
0
 private void textBox14_KeyPress(object sender, KeyPressEventArgs e)
 {
     Conexiones.KeyPress_Entero((TextBox)textBox14, e, false);
 }
示例#27
0
 private void textBox6_KeyPress(object sender, KeyPressEventArgs e)
 {
     Conexiones.KeyPress_Decimal((TextBox)textBox6, e, false);
 }
示例#28
0
        private void button4_Click(object sender, EventArgs e)
        {
            string CODI        = "";
            string Nombre      = "";
            string Apellidos   = "";
            string DNI         = "";
            string Telefono    = "";
            string Nivel       = "";
            string Contrato    = "";
            string EPIs        = "";
            string Maquinaria  = "";
            string Apto        = "";
            string PRL         = "";
            string Albañileria = "";
            string Hormigon    = "";
            string Grua        = "";
            string Plataformas = "";
            string Libre       = "";
            string Obra        = "";

            CODI        = textBox1.Text;
            Nombre      = textBox2.Text;
            Apellidos   = textBox5.Text;
            DNI         = textBox3.Text;
            Telefono    = textBox4.Text;
            Nivel       = listBox1.Text;
            Contrato    = checkBox1.Checked.ToString();
            EPIs        = checkBox2.Checked.ToString();
            Maquinaria  = checkBox3.Checked.ToString();
            Apto        = checkBox9.Checked.ToString();
            PRL         = checkBox4.Checked.ToString();
            Albañileria = checkBox5.Checked.ToString();
            Hormigon    = checkBox6.Checked.ToString();
            Grua        = checkBox7.Checked.ToString();
            Plataformas = checkBox8.Checked.ToString();
            Libre       = listBox2.Text;

            if (listBox2.Text == "SI")
            {
                Obra = "00";
            }
            else if (listBox2.Text == "NO")
            {
                Obra = textBox_ID.Text;
            }

            if (Libre == "NO")
            {
                if (listBox3.SelectedIndex == 0)
                {
                    MessageBox.Show("Si el trabajador NO está libre, debes asignarlo a una obra.");
                }
                else
                {
                    if (Convert.ToString(CODI) != "" && Nombre != "" && DNI != "" && Telefono != "" && Libre != "")
                    {
                        string  SQL = "Select * from trabajadores_obra where CODI = '" + CODI + "'";
                        DataSet ds  = Conexiones.Retorna_Datos(SQL);

                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Conexiones.Ejecuta_Consulta("UPDATE trabajadores_obra set Telefono = '" + Telefono + "', Nivel = '" + Nivel + "', Contrato = '" + Contrato + "', EPIs = '" + EPIs + "' , Maquinaria = '" + Maquinaria + "', Apto = '" + Apto + "'," +
                                                        " PRL = '" + PRL + "', Albañileria = '" + Albañileria + "', Hormigon = '" + Hormigon + "' , Grua = '" + Grua + "' , Plataformas = '" + Plataformas + "' , Libre = '" + Libre + "' , Obra_asignada = '" + Obra + "'" +
                                                        " where CODI = '" + CODI + "'");

                            MessageBox.Show("Registro modificado correctamente.");

                            this.Close();
                        }
                        else
                        {
                            Conexiones.Ejecuta_Consulta("INSERT INTO trabajadores_obra (CODI, Nombre, Apellidos, DNI, Telefono, Nivel, Contrato, EPIs, Maquinaria, Apto, PRL, Albañileria, Hormigon, Grua, Plataformas, Libre, Obra_asignada) " +
                                                        "VALUES ('" + CODI + "', '" + Nombre + "', '" + Apellidos + "', '" + DNI + "','" + Telefono + "', '" + Nivel + "', '" + Contrato + "', '" + EPIs + "', '" + Maquinaria + "', '" + Apto + "', '" + PRL + "', '" + Albañileria + "','" + Hormigon + "', '" + Grua + "', '" + Plataformas + "', '" + Libre + "', '" + Obra + "')");

                            MessageBox.Show("Registro guardado correctamente.");

                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Debes insertar nombre, DNI, teléfono y si el trabajador no está asignado a una obra (Libre).");
                        return;
                    }
                }
            }
            else
            {
                if (Convert.ToString(CODI) != "" && Nombre != "" && DNI != "" && Telefono != "" && Libre != "")
                {
                    Conexiones.Ejecuta_Consulta("INSERT INTO trabajadores_obra (CODI, Nombre, Apellidos, DNI, Telefono, Nivel, Contrato, EPIs, Maquinaria, Apto, PRL, Albañileria, Hormigon, Grua, Plataformas, Libre, Obra_asignada) " +
                                                "VALUES ('" + CODI + "', '" + Nombre + "', '" + Apellidos + "', '" + DNI + "','" + Telefono + "', '" + Nivel + "', '" + Contrato + "', '" + EPIs + "', '" + Maquinaria + "', '" + Apto + "', '" + PRL + "', '" + Albañileria + "','" + Hormigon + "', '" + Grua + "', '" + Plataformas + "', '" + Libre + "', '" + Obra + "')");

                    MessageBox.Show("Registro guardado correctamente.");

                    this.Close();
                }
                else
                {
                    MessageBox.Show("Debes insertar nombre, DNI, teléfono y si el trabajador no está asignado a una obra (Libre).");
                    return;
                }
            }
        }
示例#29
0
        private void button2_Click(object sender, EventArgs e)
        {
            string ID         = "";
            string Expediente = "";
            string Titulo     = "";
            string Direccion  = "";
            string Poblacion  = "";
            string CP;
            string Estado       = "";
            string Importe      = "";
            string IVA          = "";
            string Total        = "";
            string Promotor     = "";
            string Fecha_inicio = "";
            string Fecha_fin    = "";
            string Duracion     = "";

            ID           = textBox1.Text;
            Expediente   = textBox2.Text;
            Titulo       = textBox3.Text;
            Direccion    = textBox4.Text;
            Poblacion    = textBox5.Text;
            CP           = textBox6.Text;
            Estado       = listBox1.Text;
            Importe      = textBox8.Text;
            IVA          = listBox2.Text;
            Total        = textBox10.Text;
            Promotor     = textBox11.Text;
            Fecha_inicio = dateTimePicker1.Text;
            Fecha_fin    = dateTimePicker2.Text;
            Duracion     = textBox14.Text;

            if (textBox2.Text != "" && textBox3.Text != "" && listBox2.Text != "" && listBox1.Text != "")
            {
                string  SQL = "Select * from obras where ID = '" + ID + "'";
                DataSet ds  = Conexiones.Retorna_Datos(SQL);


                if (ds.Tables[0].Rows.Count > 0)
                {
                    string SQL2 = "UPDATE obras  set Estado = '" + Estado + "', Importe = '" + Importe + "', IVA = '" + IVA + "', Total = '" + Total + "' ," +
                                  "Fecha_inicio = '" + Fecha_inicio + "' , Fecha_fin = '" + Fecha_fin + "' , Duracion = '" + Duracion + "' where ID = '" + ID + "'";

                    Conexiones.Ejecuta_Consulta("UPDATE obras set Estado = '" + Estado + "', Importe = '" + Importe + "', IVA = '" + IVA + "', Total = '" + Total + "' ," +
                                                "Fecha_inicio = '" + Fecha_inicio + "' , Fecha_fin = '" + Fecha_fin + "' , Duracion = '" + Duracion + "' where ID = '" + ID + "'");

                    textBox15.Text = ID;
                    textBox16.Text = Expediente;
                    textBox17.Text = Titulo;

                    MessageBox.Show("Registro modificado correctamente.");

                    tabControl1.SelectedIndex = 1;
                }
                else
                {
                    string SQL2 = "INSERT INTO obras (ID, Expediente, Titulo, Direccion, Poblacion, CP, Estado, Importe, IVA, Total, Promotor, Fecha_inicio, Fecha_fin, Duracion) " +
                                  "VALUES ('" + ID + "', '" + Expediente + "', '" + Titulo + "', '" + Direccion + "', '" + Poblacion + "', '" + CP + "', '" + Estado + "', '" + Importe + "', '" + IVA + "', '" + Total + "', '" + Promotor + "', '" + Fecha_inicio + "', '" + Fecha_fin + "', '" + Duracion + "')";

                    Conexiones.Ejecuta_Consulta("INSERT INTO obras (ID, Expediente, Titulo, Direccion, Poblacion, CP, Estado, Importe, IVA, Total, Promotor, Fecha_inicio, Fecha_fin, Duracion) " +
                                                "VALUES ('" + ID + "', '" + Expediente + "', '" + Titulo + "', '" + Direccion + "', '" + Poblacion + "', '" + CP + "', '" + Estado + "', '" + Importe + "', '" + IVA + "', '" + Total + "', '" + Promotor + "', '" + Fecha_inicio + "', '" + Fecha_fin + "', '" + Duracion + "')");

                    textBox15.Text = ID;
                    textBox16.Text = Expediente;
                    textBox17.Text = Titulo;

                    MessageBox.Show("Registro guardado correctamente.");

                    tabControl1.SelectedIndex = 1;
                }
            }
            else
            {
                if (textBox2.Text == "")
                {
                    MessageBox.Show("Es obligatorio completar el EXPEDIENTE.");
                }

                if (textBox3.Text == "")
                {
                    MessageBox.Show("Es obligatorio completar el TÍTULO.");
                }

                if (listBox1.Text == "")
                {
                    MessageBox.Show("Es obligatorio completar el ESTADO.");
                }

                if (listBox2.Text == "")
                {
                    MessageBox.Show("Es obligatorio completar el IVA.");
                }
            }
        }
示例#30
0
        private void Cargar_Trabajador()
        {
            textBox1.Text = Variables_Globales.codigo_empleado;
            String  SQL = "SELECT * FROM trabajadores_obra where CODI = '" + Variables_Globales.codigo_empleado + "'";
            DataSet ds  = Conexiones.Retorna_Datos("SELECT * FROM trabajadores_obra where CODI = '" + Variables_Globales.codigo_empleado + "'");

            textBox2.Text = Convert.ToString(ds.Tables[0].Rows[0]["Nombre"]);
            textBox3.Text = Convert.ToString(ds.Tables[0].Rows[0]["DNI"]);
            textBox4.Text = Convert.ToString(ds.Tables[0].Rows[0]["Telefono"]);
            textBox5.Text = Convert.ToString(ds.Tables[0].Rows[0]["Apellidos"]);
            listBox1.Text = Convert.ToString(ds.Tables[0].Rows[0]["Nivel"]);
            listBox2.Text = Convert.ToString(ds.Tables[0].Rows[0]["Libre"]);
            listBox3.Text = Convert.ToString(ds.Tables[0].Rows[0]["Obra_asignada"]);

            if (textBox_ID.Text != "" && textBox_Exp.Text != "" && textBox_Tit.Text != "")
            {
                string concatenar = textBox_ID.Text + ", " + textBox_Exp.Text + ", " + textBox_Tit.Text;
                listBox3.Text = Convert.ToString(concatenar);
            }

            string Contrato    = Convert.ToString(ds.Tables[0].Rows[0]["Contrato"]);
            string Apto        = Convert.ToString(ds.Tables[0].Rows[0]["Apto"]);
            string EPIs        = Convert.ToString(ds.Tables[0].Rows[0]["EPIs"]);
            string Maquinaria  = Convert.ToString(ds.Tables[0].Rows[0]["Maquinaria"]);
            string PRL         = Convert.ToString(ds.Tables[0].Rows[0]["PRL"]);
            string Albañileria = Convert.ToString(ds.Tables[0].Rows[0]["Albañileria"]);
            string Hormigon    = Convert.ToString(ds.Tables[0].Rows[0]["Hormigon"]);
            string Grua        = Convert.ToString(ds.Tables[0].Rows[0]["Grua"]);
            string Plataformas = Convert.ToString(ds.Tables[0].Rows[0]["Plataformas"]);

            if (Contrato == "True")
            {
                checkBox1.Checked = true;
            }
            if (Apto == "True")
            {
                checkBox2.Checked = true;
            }
            if (EPIs == "True")
            {
                checkBox3.Checked = true;
            }
            if (Maquinaria == "True")
            {
                checkBox4.Checked = true;
            }
            if (PRL == "True")
            {
                checkBox4.Checked = true;
            }
            if (Albañileria == "True")
            {
                checkBox5.Checked = true;
            }
            if (Hormigon == "True")
            {
                checkBox6.Checked = true;
            }
            if (Grua == "True")
            {
                checkBox7.Checked = true;
            }
            if (Plataformas == "True")
            {
                checkBox8.Checked = true;
            }

            textBox1.Enabled = false;
            textBox2.Enabled = false;
            textBox3.Enabled = false;
            textBox4.Enabled = true;
            textBox5.Enabled = false;
            listBox1.Enabled = true;
            listBox2.Enabled = true;
            if (listBox2.Text == "SI")
            {
                listBox3.Enabled = false;
            }
            else if (listBox2.Text == "NO")
            {
                listBox3.Enabled = true;
            }
            checkBox1.Enabled = true;
            checkBox2.Enabled = true;
            checkBox3.Enabled = true;
            checkBox4.Enabled = true;
            checkBox5.Enabled = true;
            checkBox6.Enabled = true;
            checkBox7.Enabled = true;
            checkBox8.Enabled = true;
        }