Beispiel #1
0
 private void btnBusca1_Click(object sender, EventArgs e)
 {
     LObra = ClsTraspaso.BuscaObra(1, 1, this.txtOrigen.Text.Trim());
     this.clsObraBindig.DataSource = LObra;
 }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (_Origen == "O")
            {
                LObra = ClsTraspaso.BuscaObra(1, 1, this.txtDatos.Text.Trim());
                //this.clsObraBindig.DataSource = LObra;
                this.clsbindingBuscar.DataSource = LObra;
                this.ultraGrid1.Rows.ColumnFilters[13].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[14].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[15].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[16].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[0].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[1].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[2].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[3].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[4].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[5].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[6].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[9].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[10].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[11].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[12].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[17].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[18].Column.Hidden = true;



                this.ultraGrid1.Rows.ColumnFilters[7].Column.Header.Caption = "Clave";
                this.ultraGrid1.Rows.ColumnFilters[8].Column.Header.Caption = "Vivienda";

                this.ultraGrid1.Rows.ColumnFilters[7].Column.Width = 55;
                this.ultraGrid1.Rows.ColumnFilters[8].Column.Width = 415;
            }

            if (_Origen == "P")
            {
                LObra = ClsTraspaso.BuscaProveedor(this.txtDatos.Text.Trim());
                this.clsbindingBuscar.DataSource = LObra;

                this.ultraGrid1.Rows.ColumnFilters[15].Column.Width          = 55;
                this.ultraGrid1.Rows.ColumnFilters[16].Column.Width          = 415;
                this.ultraGrid1.Rows.ColumnFilters[15].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
                this.ultraGrid1.Rows.ColumnFilters[16].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
                this.ultraGrid1.Rows.ColumnFilters[15].Column.Header.Caption = "Clave";
                this.ultraGrid1.Rows.ColumnFilters[16].Column.Header.Caption = "Proveedor";

                this.ultraGrid1.Rows.ColumnFilters[0].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[1].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[2].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[3].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[4].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[5].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[6].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[7].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[8].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[9].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[10].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[11].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[12].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[13].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[14].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[17].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[18].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[16].Column.Header.Appearance.TextHAlign = Infragistics.Win.HAlign.Left;
            }
            if (_Origen == "T")
            {
                LObra = ClsTraspaso.BuscaObra(1, 1, this.txtDatos.Text.Trim());
                this.clsbindingBuscar.DataSource = LObra;
                this.ultraGrid1.Rows.ColumnFilters[15].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[16].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[17].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[18].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[0].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[1].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[2].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[3].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[4].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[5].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[6].Column.Hidden  = true;
                this.ultraGrid1.Rows.ColumnFilters[14].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[13].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[12].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[11].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[10].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[9].Column.Hidden  = true;

                this.ultraGrid1.Rows.ColumnFilters[7].Column.Width = 55;
                this.ultraGrid1.Rows.ColumnFilters[8].Column.Width = 415;

                this.ultraGrid1.Rows.ColumnFilters[7].Column.Header.Caption = "Clave";
                this.ultraGrid1.Rows.ColumnFilters[8].Column.Header.Caption = "Vivienda";
            }
            if (_Origen == "A")
            {
                LKit = ClsKit.BuscaKit(3, 0, this.txtDatos.Text.Trim());
                this.clsbindingBuscar.DataSource = LKit;
                this.ultraGrid1.Rows.ColumnFilters[5].Column.Width          = 55;
                this.ultraGrid1.Rows.ColumnFilters[6].Column.Width          = 415;
                this.ultraGrid1.Rows.ColumnFilters[5].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
                this.ultraGrid1.Rows.ColumnFilters[6].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
                this.ultraGrid1.Rows.ColumnFilters[2].Column.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
                this.ultraGrid1.Rows.ColumnFilters[0].Column.Hidden         = true;
                this.ultraGrid1.Rows.ColumnFilters[1].Column.Hidden         = true;
                //this.ultraGrid1.Rows.ColumnFilters[2].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[3].Column.Hidden = true;
                this.ultraGrid1.Rows.ColumnFilters[4].Column.Hidden = true;

                this.ultraGrid1.Rows.ColumnFilters[5].Column.Header.Caption         = "Clave";
                this.ultraGrid1.Rows.ColumnFilters[6].Column.Header.Caption         = "Nombre Kit";
                this.ultraGrid1.Rows.ColumnFilters[2].Column.Header.VisiblePosition = 7;
                this.ultraGrid1.Rows.ColumnFilters[2].Column.Header.Caption         = "Precio U.";
            }
        }
Beispiel #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            if (txtNO.Text.Trim() == "")
            {
                MessageBox.Show("Falta seleccionar Vivienda Origen", "MENSAJE DEL SISTEMA");
                return;
            }

            bool Flag  = true;
            bool Flag2 = true;

            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in gridArtOrigen2.Rows)
            {
                if (Rn.Cells[9].Value.ToString().ToUpper() == "TRUE")
                {
                    Flag = false;
                    if (Rn.Cells[19].Value.ToString() != "" && Rn.Cells[19].Value.ToString() != "0")
                    {
                        Flag2 = false;
                    }
                }
            }

            if (Flag == true)
            {
                MessageBox.Show("Falta seleccionar almenos un articulo a Traspasar", "MENSAJE DEL SISTEMA");
                return;
            }

            if (Flag2 == true)
            {
                MessageBox.Show("Selecciono un artículo a traspasar pero falto capturar la cantidad a traspasar, favor de revisar", "MENSAJE DEL SISTEMA");
                return;
            }

            if (txtIdObraDest.Text.Trim() == "")
            {
                MessageBox.Show("Falta seleccionar Vivienda Destino", "MENSAJE DEL SISTEMA");
                return;
            }

            if (txtNO.Text.Trim() == txtIdObraDest.Text.Trim())
            {
                MessageBox.Show("No esta permitido el Traspaso entre viviendas IGUALES", "MENSAJE DEL SISTEMA");
                return;
            }

            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in this.gridArtOrigen2.Rows)
            {
                if (Rn.Cells[9].Value.ToString().ToUpper() == "TRUE")
                {
                    if (Convert.ToInt32(Rn.Cells[12].Value.ToString()) < Convert.ToInt32(Rn.Cells[19].Value.ToString()))
                    {
                        MessageBox.Show("La Cantidada a traspasar es mayor a la disponible, favor de corregir", "MENSAJE DEL SISTEMA");
                        return;
                    }
                }
            }

            DialogResult Result = MessageBox.Show("¿Seguro que Desea Realizar el Traspaso?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (Result == DialogResult.No)
            {
                return;
            }


            ClsTraspaso Traspasos = new ClsTraspaso();

            //Inserto los Datos a la tabla de Traspasos
            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in this.gridArtOrigen2.Rows)
            {
                if (Rn.Cells[9].Value.ToString().ToUpper() == "TRUE")
                {
                    Traspasos.IdObraOrigen     = Convert.ToInt32(lblIdObraSel.Text.Trim());
                    Traspasos.IdObraDestino    = Convert.ToInt32(txtIdObraDest.Text.Trim());
                    Traspasos.IdArticulo       = Convert.ToInt32(Rn.Cells[10].Value.ToString());
                    Traspasos.CantidadArtTrasp = Convert.ToDouble(Rn.Cells[19].Value.ToString());

                    ClsTraspaso.AddTraspaso(Traspasos, 0);
                }
            }

            //Inserto los Datos de la Obra.
            Traspasos.IdObraDestino = Convert.ToInt32(this.txtIdObraDest.Text.Trim());
            //ClsTraspaso.AddTraspaso(Traspasos, 1);

            int Contador       = 0;
            int IdArticuloObra = 0;
            int Opcion         = 0;

            //Busco la obra
            DataSet Datos = ClsTraspaso.BuscaObra(Convert.ToInt32(txtIdObraDest.Text.Trim()), 1);

            if (Datos.Tables[0].Rows.Count != 0)
            {
                //Permiso = Convert.ToInt16(LoguinUsuario.Tables[0].Rows[i]["TipoUsuario"].ToString());
                foreach (DataRow Rn in Datos.Tables[0].Rows)
                {
                    Contador       = Convert.ToInt32(Rn["Contador"].ToString());
                    IdArticuloObra = Convert.ToInt32(Rn["IdArticuloObra"].ToString());
                }
            }

            if (Contador == 0)
            {
                Opcion = 2;
            }
            else if (Contador >= 0)
            {
                Opcion = 3;
            }

            //Inserto los Articulos de la Obra a Traspasar.
            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in this.gridArtOrigen2.Rows)
            {
                if (Rn.Cells[9].Value.ToString().ToUpper() == "TRUE")
                {
                    Traspasos.IdObraDestino    = Convert.ToInt32(txtIdObraDest.Text.Trim());
                    Traspasos.IdArticulo       = Convert.ToInt32(Rn.Cells[10].Value.ToString());
                    Traspasos.CantidadArtTrasp = Convert.ToDouble(Rn.Cells[19].Value.ToString());
                    Traspasos.IdArtObra        = IdArticuloObra;
                    ClsTraspaso.AddTraspaso(Traspasos, Opcion);
                }
            }



            double CantidadArt = 0;
            double CantidadAct = 0;
            double Total       = 0;
            int    Registro;

            //Actualizo la cantidad de los Articulos.
            foreach (Infragistics.Win.UltraWinGrid.UltraGridRow Rn in this.gridArtOrigen2.Rows)
            {
                if (Rn.Cells[9].Value.ToString().ToUpper() == "TRUE")
                {
                    DataSet Datos2 = ClsTraspaso.BuscaCantidad(Convert.ToInt32(lblIdObraSel.Text.Trim()), Convert.ToInt32(Rn.Cells[10].Value.ToString()), 4);
                    Total = Convert.ToInt32(Rn.Cells[19].Value.ToString());
                    if (Datos2.Tables[0].Rows.Count != 0)
                    {
                        foreach (DataRow Rns in Datos2.Tables[0].Rows)
                        {
                            CantidadArt = Convert.ToDouble(Rns["CantidadArt"].ToString());
                            Registro    = Convert.ToInt32(Rns["IdArtionbraD"].ToString());

                            if (CantidadArt > Total)
                            {
                                CantidadAct = CantidadArt - Total;
                                ClsTraspaso.ActualizoCantidad(Convert.ToInt32(lblIdObraSel.Text.Trim()), Convert.ToInt32(Rn.Cells[10].Value.ToString()), Registro, CantidadAct, 5);
                            }
                            else
                            {
                                ClsTraspaso.ActualizoCantidad(Convert.ToInt32(lblIdObraSel.Text.Trim()), Convert.ToInt32(Rn.Cells[10].Value.ToString()), Registro, 0, 5);
                                Total = Total - CantidadArt;
                            }
                        }
                    }
                }
            }


            txtNO.Text        = "";
            txtNomObra.Text   = "";
            txtOrigen.Text    = "";
            txtArtOrigen.Text = "";
            gridOrigen.DataBind();
            gridArtOrigen2.DataBind();
            txtIdObraDest.Text = "";
            txtObraDest.Text   = "";
            LimpiaGrd();

            MessageBox.Show("Registro agregado Satisfactoriamente...", "I n f o r m a c i ó n", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }