Beispiel #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            // Tomo en la variable desde donde se apretó el botón
            IdArtPosicion = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdArticulo"].Value);
            // Cambio mi estado a alta
            clsGlobales.myEstado = "A";
            // Activo lo botones
            ActivarBotones();
            // Activo los controles
            ActivarControles();
            // Como es una nueva fila, paso los parámetros en blanco
            // Variables para pasar de parámetros
            int      CantidadPedida = 0;
            DateTime FechaPedida    = DateTime.Now;
            int      IdArt          = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdArticulo"].Value);
            int      IdIns          = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdInsumo"].Value);
            int      IdProd         = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdProducto"].Value);
            string   Art            = dgvArt.CurrentRow.Cells["Articulo"].Value.ToString();

            Prama.Formularios.Articulos.frmArticulosPtoPedidoConf myForm = new Prama.Formularios.Articulos.frmArticulosPtoPedidoConf(CantidadPedida, FechaPedida, IdArt, IdIns, IdProd, Art, 0);
            myForm.ShowDialog();

            if (clsGlobales.bBandera)
            {
                // Grabo el registro nuevo en la base
                GrabarNuevoPrograma(clsGlobales.FechaFabricada);
                // Cambio el estado de la bandera
                clsGlobales.bBandera = false;
            }

            // REcargo el formulario
            RecargarFormulario();
        }
Beispiel #2
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            // Tomo en la variable desde donde se apretó el botón
            IdArtPosicion = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdArticulo"].Value);
            // Cambio mi estado a alta
            clsGlobales.myEstado = "M";
            // Activo lo botones
            ActivarBotones();
            // Activo los controles
            ActivarControles();
            // Variables para pasar de parámetros
            int      CantidadPedida = Convert.ToInt32(dgvPrograma.CurrentRow.Cells["Pedido"].Value);
            DateTime FechaPedida    = Convert.ToDateTime(dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value);
            int      IdArt          = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdArticulo"].Value);
            int      IdIns          = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdInsumo"].Value);
            int      IdProd         = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdProducto"].Value);
            string   Art            = dgvArt.CurrentRow.Cells["Articulo"].Value.ToString();


            Prama.Formularios.Articulos.frmArticulosPtoPedidoConf myForm = new Prama.Formularios.Articulos.frmArticulosPtoPedidoConf(CantidadPedida, FechaPedida, IdArt, IdIns, IdProd, Art, 0);
            myForm.ShowDialog();

            // Si fecha no es nulo, lo paso a la clase
            if (!(dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value == null || dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value == ""))
            {
                DateTime dFechaAConvertir = Convert.ToDateTime(dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value);

                myArticulo.Fecha = clsValida.ConvertirFecha(dFechaAConvertir);
            }

            // Si fecha real no es nulo, lo paso a la clase
            if (!(dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value == null || dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value == ""))
            {
                myArticulo.FechaReal = Convert.ToDateTime(dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value);
            }

            if (clsGlobales.bBandera)
            {
                // Armo la cedena SQL
                myCadenaSQL = "delete ArticulosProgramaCompra where IdArticulo = " + myArticulo.IdArticuloFaltante + " and Fecha = '" + myArticulo.FechaReal.ToShortDateString() + "'";
                // Ejecuto la consulta
                clsDataBD.GetSql(myCadenaSQL);

                // Grabo el registro nuevo en la base
                GrabarNuevoPrograma(clsGlobales.FechaFabricada);

                clsGlobales.bBandera = false;
            }

            // REcargo el formulario
            RecargarFormulario();
        }
Beispiel #3
0
        private void brnAceptarFabricado_Click(object sender, EventArgs e)
        {
            // Tomo en la variable desde donde se apretó el botón
            IdArtPosicion = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdArticulo"].Value);

            clsGlobales.myEstado = "F";

            // Variables para pasar de parámetros
            int CantidadPedida = Convert.ToInt32(dgvPrograma.CurrentRow.Cells["Pedido"].Value);

            DateTime FechaPedida = Convert.ToDateTime(dgvPrograma.CurrentRow.Cells["FechaReal_AF"].Value);

            int    IdArt       = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdArticulo"].Value);
            int    IdIns       = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdInsumo"].Value);
            int    IdProd      = Convert.ToInt32(dgvArt.CurrentRow.Cells["IdProducto"].Value);
            string Art         = dgvArt.CurrentRow.Cells["Articulo"].Value.ToString();
            int    iIdEmpleado = Convert.ToInt32(dgvPrograma.CurrentRow.Cells["IdEmpleado"].Value);

            Prama.Formularios.Articulos.frmArticulosPtoPedidoConf myForm = new Prama.Formularios.Articulos.frmArticulosPtoPedidoConf(CantidadPedida, FechaPedida, IdArt, IdIns, IdProd, Art, iIdEmpleado);
            myForm.ShowDialog();

            if (clsGlobales.CantFabricada != 0 && clsGlobales.bBandera != false)
            {
                // cre la cadena SQL
                myCadenaSQL = "update ArticulosProgramaCompra set Cumplido = 1, Fabricado =" + clsGlobales.CantFabricada +
                              ", FechaCumplido = '" + Convert.ToString(clsGlobales.FechaFabricada) +
                              "', Empleado = '" + clsGlobales.EmpleadoFabricado +
                              "', IdEmpleado = " + clsGlobales.IdEmpleadoFabricado +
                              " where IdArticulo = " + IdArt + " and Fecha = '" + FechaPedida + "'";

                // Ejecuto la cadena
                clsDataBD.GetSql(myCadenaSQL);
            }

            RecargarFormulario();
        }