public void ValidaCcosto()
 {
     if (txtccosto.Text.Trim().Length == 0)
     {
         txtdcosto.Text = string.Empty;
     }
     else
     {
         txtccosto.Text = VariablesPublicas.PADL(txtccosto.Text.Trim(), txtccosto.MaxLength, "0");
         var BL = new centrocostoBL();
         var BE = new tb_centrocosto();
         BE.cencosid = txtccosto.Text.Trim();
         BE.norden = 1;
         BE.ver_blanco = 0;
         tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
         if (BL.Sql_Error.Length == 0)
         {
             if (tmptabla.Rows.Count > 0)
             {
                 txtccosto.Text = tmptabla.Rows[0]["cencosid"].ToString();
                 txtdcosto.Text = tmptabla.Rows[0]["cencosname"].ToString();
                 txtccargo.Text = string.Empty;
                 txtdcargo.Text = string.Empty;
             }
             else
             {
                 txtccosto.Text = j_ccosto;
             }
         }
         else
         {
             txtccosto.Text = j_ccosto;
         }
     }
 }
        private void Filtrar()
        {
            var sorted = default(SortOrder);
            var xnomcolumna = string.Empty;
            if ((dgProveedor.SortedColumn != null))
            {
                xnomcolumna = dgProveedor.Columns[dgProveedor.SortedColumn.Index].Name;
                sorted = dgProveedor.SortOrder;
            }

            var xpalabra1 = string.Empty;
            var xpalabra2 = string.Empty;
            var xpalabra3 = string.Empty;
            var xpalabra4 = string.Empty;
            if (txtdescripcion.Enabled)
            {
                xpalabra1 = VariablesPublicas.Palabras(txtdescripcion.Text, 1);
                xpalabra2 = VariablesPublicas.Palabras(txtdescripcion.Text, 2);
                xpalabra3 = VariablesPublicas.Palabras(txtdescripcion.Text, 3);
                xpalabra4 = VariablesPublicas.Palabras(txtdescripcion.Text, 4);
            }

            dgProveedor.DataSource = null;
            dgProveedor.AutoGenerateColumns = false;
            var BL = new centrocostoBL();
            var BE = new tb_centrocosto();
            BE.nomlike1 = xpalabra1;
            BE.nomlike2 = xpalabra2;
            BE.nomlike3 = xpalabra3;
            BE.norden = 1;
            BE.ver_blanco = 0;
            dgProveedor.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
            if (xnomcolumna.Trim().Length > 0)
            {
                if (sorted == SortOrder.Ascending)
                {
                    dgProveedor.Sort(dgProveedor.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Ascending);
                }
                else
                {
                    dgProveedor.Sort(dgProveedor.Columns[xnomcolumna], System.ComponentModel.ListSortDirection.Descending);
                }
            }
            else
            {
                dgProveedor.Sort(dgProveedor.Columns["cencosid"], System.ComponentModel.ListSortDirection.Ascending);
            }
            VariablesPublicas.PintaEncabezados(dgProveedor);
        }
        private void Frm_Planilla_Cargos_Activated(object sender, EventArgs e)
        {
            if (Sw_LOad)
            {
                Llenar_Ccosto();
                cmbfiltroccosto.ValueMember = "cencosid";
                cmbfiltroccosto.DisplayMember = "descripcion";
                centrocostoBL BL = new centrocostoBL();
                tb_centrocosto BE = new tb_centrocosto();
                BE.norden = 1;
                BE.ver_blanco = 0;
                tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
                cmbfiltroccosto.SelectedValue = "";

                if (BL.Sql_Error.Length == 0)
                {
                    cmbfiltroccosto.DataSource = tmpcursor;
                    if (tmpcursor.Rows.Count > 0)
                    {
                        cmbfiltroccosto.SelectedValue = tmpcursor.Rows[0]["cencosid"];
                    }
                }
                U_RefrescaControles();
                CargaDatos();
                U_RefrescaControles();
                Sw_LOad = false;
            }
        }
 public void Llenar_Ccosto()
 {
     centrocostoBL BL = new centrocostoBL();
     tb_centrocosto BE = new tb_centrocosto();
     BE.norden = 1;
     BE.ver_blanco = 0;
     cmbccosto.ValueMember = "cencosid";
     cmbccosto.DisplayMember = "descripcion";
     cmbccosto.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
 }
 public void ValidaCcosto()
 {
     if (txtccosto.Text.Trim().Length == 0)
     {
         txtdcosto.Text = "";
     }
     else
     {
         txtccosto.Text = VariablesPublicas.PADL(txtccosto.Text.Trim(), txtccosto.MaxLength, "0");
         centrocostoBL BL = new centrocostoBL();
         tb_centrocosto BE = new tb_centrocosto();
         BE.cencosid = txtccosto.Text.Trim();
         BE.norden = 1;
         BE.ver_blanco = 0;
         tmpTabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
         //tmpTabla = oCapa.CaeSoft_GetAllAyudaCentrodeCosto(GlobalVars.GetInstance.Company, txtccosto.Text, 1, "", "", "", "");
         if (BL.Sql_Error.Length == 0)
         {
             if (tmpTabla.Rows.Count > 0)
             {
                 txtccosto.Text = tmpTabla.Rows[0]["cencosid"].ToString().Trim();
                 txtdcosto.Text = tmpTabla.Rows[0]["cencosname"].ToString().Trim();
             }
             else
             {
                 txtccosto.Text = j_ccosto;
             }
         }
         else
         {
             txtccosto.Text = j_ccosto;
         }
     }
     u_RefrescaControles();
 }