public Frm_PesajesMineraPlanta(string login)
        {
            InitializeComponent();
            //Pruebas Llamadoss
            this.Login        = login;
            this.label11.Text = DateTime.Now.ToString("dd/MM/yyyy");
            #region Configuracion inicial carga
            List <Ent_Localizacion> Reader = new List <Ent_Localizacion>();
            Reader = ConsultaEntidades.ObtenerLocalizacion("SpConsulta_Tablas", "recuLocalizacion", "", 0, "0");
            cboLocalizacion.DataSource    = Reader;
            cboLocalizacion.ValueMember   = "Identificacacion";
            cboLocalizacion.DisplayMember = "Nombre";
            cboLocalizacion.SelectedIndex = -1;

            this.tolSripValorSalida.Image = null;
            txtConcecutivo.Text           = 0.ToString();
            txtConcecutivo.BackColor      = Color.FromArgb(217, 213, 213);
            txtConcecutivo.Focus();


            TxtPlaca.Enabled               = true;
            TxbConductor.Enabled           = true;
            txtProyectoInfProyecto.Enabled = true;
            txtPlaza.Enabled               = true;
            #endregion
        }
        private void btnNew_Click(object sender, EventArgs e)
        {
            foreach (Control control in this.Controls)
            {
                if (control is System.Windows.Forms.GroupBox)
                {
                    foreach (Control item in control.Controls)
                    {
                        if (item is System.Windows.Forms.TextBox)
                        {
                            item.Text = string.Empty;
                        }

                        if (item is System.Windows.Forms.MaskedTextBox)
                        {
                            item.Text = string.Empty;
                        }
                    }
                }
            }
            dtpDate.Value                  = DateTime.Now;
            tolstripPeso.Text              = string.Empty;
            tolstripDefaul.Text            = string.Empty;
            tolSripValorSalida.Text        = string.Empty;
            tolSripValorSalida.ToolTipText = string.Empty;
            cboLocalizacion.SelectedIndex  = -1;
            cboLocalizacion.Enabled        = true;
            cboLocalizacion.Enabled        = true;
            btnplaca.Enabled               = true;
            btnProyecto.Enabled            = true;
            btnPlaza.Enabled               = true;
            btnCatidadPlaca.Visible        = false;


            btnConduc.Enabled              = true;
            TxtPlaca.Enabled               = true;
            TxbConductor.Enabled           = true;
            txtProyectoInfProyecto.Enabled = true;
            txtPlaza.Enabled               = true;
            txtConcecutivo.Enabled         = true;
            txtConcecutivo.Text            = 0.ToString();
            dtpDate.Enabled   = true;
            consecutiveReturn = string.Empty;

            this.txtConcecutivo.Focus();
            this.toolTip1.SetToolTip(toolStrip1, "");


            List <Ent_Localizacion> Reader = new List <Ent_Localizacion>();

            Reader = ConsultaEntidades.ObtenerLocalizacion("SpConsulta_Tablas", "recuLocalizacion", "", 0, "0");
            cboLocalizacion.DataSource    = Reader;
            cboLocalizacion.ValueMember   = "Identificacacion";
            cboLocalizacion.DisplayMember = "Nombre";
            cboLocalizacion.SelectedIndex = -1;
        }
 private void TxbIdentificacion_Leave(object sender, EventArgs e)
 {
     try
     {
         Ent_Localizacion Reader = ConsultaEntidades.ObtenerLocalizacion("ObeterLocalizacion", TxbIdentificacion.Text.Trim(), 0, 0.00).FirstOrDefault();
         if (Reader != null)
         {
             TxbNombre.Text    = Reader.nombre.Trim();
             txtDetail.Text    = Reader.Detalle;
             ChbEstado.Checked = Reader.estado;
         }
     }
     catch (Exception Ex1)
     {
         MessageBox.Show(Ex1.Message);;
     }
 }
        private void txtConcecutivo_Leave(object sender, EventArgs e)
        {
            List <Ent_PesajeMineral> Reader = new List <Ent_PesajeMineral>();

            txtConcecutivo.BackColor = Color.White;

            if (!String.IsNullOrEmpty(this.txtConcecutivo.Text))
            {
                Reader = ConsultaEntidades.ObtenerPesoMinas("SpConsulta_Tablas", "ConsePlanta", "", Convert.ToInt64(this.txtConcecutivo.Text), "0");

                if (Reader != null && Reader.Count() > 0)
                {
                    Ent_PesajeMineral value = Reader[0];
                    dtpDate.Value               = value.Fecha;
                    Placa                       = TxtPlaca.Text = value.PlacaVehiculo;
                    txtDescripciomPlaca.Text    = value.DescripcionVehiculo;
                    TxbConductor.Text           = value.CodigoConductor.ToString();
                    txtDescripcionCond.Text     = value.NombreConductor;
                    txtProyectoInfProyecto.Text = value.CodigoProyecto;
                    txtDescripcionProyecto.Text = value.NombreProyecto;
                    txtPlaza.Text               = value.CodigoPlaza;
                    txtDescipcionPlaza.Text     = value.NombrePlaza;
                    txtSello1.Text              = value.Sello1;
                    txtSello2.Text              = value.Sello2;
                    txtSello3.Text              = value.Sello3;
                    txtSello4.Text              = value.Sello4;
                    txtSello5.Text              = value.Sello5;
                    txtSello6.Text              = value.Sello6;
                    txtPesoEnt.Text             = value.PesoEstado1.ToString("N0", CultureInfo.InvariantCulture);
                    txtPesoSalida.Text          = value.PesoEstado0.ToString("N0", CultureInfo.InvariantCulture);
                    txtTotalCargue.Text         = (value.PesoEstado1 - value.PesoEstado0).ToString("N0", CultureInfo.InvariantCulture);
                    tolstripPeso.Text           = value.PesoVehiculo.ToString("N0", CultureInfo.InvariantCulture);
                    tolstripDefaul.Text         = value.CodigoPlazaDefault;
                    ptbFotoVehiculo.Image       = DBMETAL_SHARP.Common.Common.ImageConvert.byteToImage(value.Foto);

                    cboLocalizacion.Enabled        = false;
                    btnplaca.Enabled               = false;
                    btnProyecto.Enabled            = false;
                    btnPlaza.Enabled               = false;
                    btnConduc.Enabled              = false;
                    TxtPlaca.Enabled               = false;
                    TxbConductor.Enabled           = false;
                    txtProyectoInfProyecto.Enabled = false;
                    txtPlaza.Enabled               = false;
                    txtConcecutivo.Enabled         = false;
                    dtpDate.Enabled = false;
                    List <Ent_Localizacion> cbo = new List <Ent_Localizacion>();

                    cbo = ConsultaEntidades.ObtenerLocalizacion("SpConsulta_Tablas", "recuLocalizacionParam", "PARAMETRO GUARDADO COMO LOCALIZACION", 0, "0");

                    cboLocalizacion.DataSource    = cbo;
                    cboLocalizacion.ValueMember   = "Identificacacion";
                    cboLocalizacion.DisplayMember = "Nombre";
                    cboLocalizacion.SelectedIndex = -1;

                    if (value.PesoVehiculo > 0)
                    {
                        decimal dif  = Convert.ToInt32(value.PesoVehiculo) - Convert.ToInt32(value.PesoEstado0);
                        decimal calc = (dif * -100) / Convert.ToInt32(value.PesoVehiculo);

                        if (calc >= -5 && calc <= 5)
                        {
                            tolSripValorSalida.Text = dif.ToString("N0");
                            this.toolTip1.SetToolTip(toolStrip1, " Diferencia de peso entre -5% y 5%");

                            this.tolSripValorSalida.Image     = DBMETAL_SHARP.Properties.Resources.green;
                            this.tolSripValorSalida.Font      = new System.Drawing.Font("Consolas", 8F);
                            this.tolSripValorSalida.ForeColor = System.Drawing.Color.Navy;
                        }
                        else
                        if (calc > 5)
                        {
                            tolSripValorSalida.Text = dif.ToString("N0");
                            this.toolTip1.SetToolTip(toolStrip1, " Diferencia de peso mayor a 5%");
                            this.tolSripValorSalida.Image     = DBMETAL_SHARP.Properties.Resources.blue;
                            this.tolSripValorSalida.Font      = new System.Drawing.Font("Consolas", 8F);
                            this.tolSripValorSalida.ForeColor = System.Drawing.Color.Navy;
                        }
                        else
                        {
                            tolSripValorSalida.Text = dif.ToString("N0");
                            this.toolTip1.SetToolTip(toolStrip1, " Diferencia de peso menor a 5%");
                            this.tolSripValorSalida.Image     = DBMETAL_SHARP.Properties.Resources.red;
                            this.tolSripValorSalida.Font      = new System.Drawing.Font("Consolas", 8F);
                            this.tolSripValorSalida.ForeColor = System.Drawing.Color.Navy;
                        }
                    }
                }
            }
        }