public bool Update(string empresaid, tb_plla_tipoplanilla BE)
 {
     //return tablaDA.Update(empresaid, BE);
     bool zreturn = tablaDA.Update(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return zreturn;
 }
 public bool Delete(string empresaid, tb_plla_tipoplanilla BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaTipoplla_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.Tipoplla;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll_ConsultaTipo(string empresaid, tb_plla_tipoplanilla BE)
 {
     //return tablaDA.GetAll_ConsultaTipo(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAll_ConsultaTipo(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
        public void RequeryTipoPlanilla()
        {
            cmbtipoplanilla.ValueMember = "tipoplla";
            cmbtipoplanilla.DisplayMember = "tipopllaname";
            var BL = new tb_plla_tipoplanillaBL();
            var BE = new tb_plla_tipoplanilla();

            BE.norden = 1;
            BE.ver_blanco = 0;
            cmbtipoplanilla.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
        }
 public DataSet GetAll(string empresaid, tb_plla_tipoplanilla BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaTipoplla_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.Tipoplla;
                 cmd.Parameters.Add("@tipopllaname", SqlDbType.VarChar, 60).Value = BE.Tipopllaname;
                 cmd.Parameters.Add("@modoplla", SqlDbType.Char, 2).Value = BE.Modoplla;
                 cmd.Parameters.Add("@formapago", SqlDbType.Char, 1).Value = BE.Formapago;
                 //cmd.Parameters.Add("@diasplla", SqlDbType.Decimal).Value = BE.Diasplla;
                 cmd.Parameters.Add("@tituloboleta", SqlDbType.VarChar, 60).Value = BE.Tituloboleta;
                 cmd.Parameters.Add("@tipopllaemple", SqlDbType.VarChar, 60).Value = BE.Tipopllaemple;
                 //cmd.Parameters.Add("@gratificacion", SqlDbType.Bit).Value = BE.Gratificacion;
                 //cmd.Parameters.Add("@pdt", SqlDbType.Bit).Value = BE.Pdt;
                 //cmd.Parameters.Add("@cts", SqlDbType.Bit).Value = BE.Cts;
                 cmd.Parameters.Add("@tiptrabid", SqlDbType.Char, 2).Value = BE.Tiptrabid;
                 cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.Status;
                 cmd.Parameters.Add("@nomlike1", SqlDbType.VarChar, 60).Value = BE.nomlike1;
                 cmd.Parameters.Add("@nomlike2", SqlDbType.VarChar, 60).Value = BE.nomlike2;
                 cmd.Parameters.Add("@nomlike3", SqlDbType.VarChar, 60).Value = BE.nomlike3;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        private void Frm_Planilla_RubrosDescuento_Activated(object sender, EventArgs e)
        {
            if (Sw_LOad)
            {
                cmbfiltrotipoplanilla.ValueMember = "tipoplla";
                cmbfiltrotipoplanilla.DisplayMember = "tipopllaname";
                var BL = new tb_plla_tipoplanillaBL();
                var BE = new tb_plla_tipoplanilla();

                BE.norden = 1;
                BE.ver_blanco = 0;
                tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                cmbfiltrotipoplanilla.SelectedValue = string.Empty;

                if (BL.Sql_Error.Length == 0)
                {
                    cmbfiltrotipoplanilla.DataSource = tmpcursor;
                    if (tmpcursor.Rows.Count > 0)
                    {
                        cmbfiltrotipoplanilla.SelectedValue = tmpcursor.Rows[0]["tipoplla"];
                    }
                }

                cmbmodalidad.ValueMember = "cele";
                cmbmodalidad.DisplayMember = "descripcion";
                var BL1 = new tb_plla_tab0100BL();
                var BE1 = new tb_plla_tab0100();
                BE1.ver_blanco = 1;
                cmbmodalidad.DataSource = BL1.gspTbPllaModalidadRubros(VariablesPublicas.EmpresaID.ToString(), BE1).Tables[0];

                cmbtipocalculo.ValueMember = "cele";
                cmbtipocalculo.DisplayMember = "descripcion";
                var BL2 = new tb_plla_tab0100BL();
                var BE2 = new tb_plla_tab0100();
                BE2.ver_blanco = 1;
                cmbtipocalculo.DataSource = BL2.gspTbPllaTipoCalculoRubros(VariablesPublicas.EmpresaID.ToString(), BE2).Tables[0];

                cmbtipo.ValueMember = "cele";
                cmbtipo.DisplayMember = "descripcion";
                var BL3 = new tb_plla_tab0100BL();
                var BE3 = new tb_plla_tab0100();
                BE3.ver_blanco = 1;
                cmbtipo.DataSource = BL3.GetTipoDescuento(VariablesPublicas.EmpresaID.ToString(), BE3).Tables[0];

                RequeryTipoPlanilla();

                cmbrubrorpts.ValueMember = "rubroid";
                cmbrubrorpts.DisplayMember = "descripcion";
                var BL4 = new tb_plla_pdt_tabla22BL();
                var BE4 = new tb_plla_pdt_tabla22();
                BE4.relrubroidtipo = GlobalVars.GetInstance().RubrosDescuentoRPTS;
                BE4.detallado = 1;
                BE4.norden = 1;
                BE4.incluir_blanco = 1;
                cmbrubrorpts.DataSource = BL4.GetAll_Consulta(VariablesPublicas.EmpresaID, BE4).Tables[0];

                U_RefrescaControles();
                CargaDatos();
                U_RefrescaControles();
                Sw_LOad = false;
            }
        }
 public bool Update(string empresaid, tb_plla_tipoplanilla BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaTipoplla_UPDATE", cnx))
         {
             {
                 //cmd.Connection.ConnectionTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.Tipoplla;
                 cmd.Parameters.Add("@tipopllaname", SqlDbType.VarChar, 60).Value = BE.Tipopllaname;
                 cmd.Parameters.Add("@modoplla", SqlDbType.Char, 2).Value = BE.Modoplla;
                 cmd.Parameters.Add("@formapago", SqlDbType.Char, 1).Value = BE.Formapago;
                 cmd.Parameters.Add("@diasplla", SqlDbType.Decimal).Value = BE.Diasplla;
                 cmd.Parameters.Add("@tituloboleta", SqlDbType.VarChar, 60).Value = BE.Tituloboleta;
                 cmd.Parameters.Add("@tipopllaemple", SqlDbType.VarChar, 60).Value = BE.Tipopllaemple;
                 cmd.Parameters.Add("@gratificacion", SqlDbType.Bit).Value = BE.Gratificacion;
                 cmd.Parameters.Add("@pdt", SqlDbType.Bit).Value = BE.Pdt;
                 cmd.Parameters.Add("@cts", SqlDbType.Bit).Value = BE.Cts;
                 cmd.Parameters.Add("@tiptrabid", SqlDbType.Char, 2).Value = BE.Tiptrabid;
                 cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.Status;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 private void Llenar_cboTipoPlanillaFil()
 {
     var BL = new tb_plla_tipoplanillaBL();
     var BE = new tb_plla_tipoplanilla();
     BE.norden = 1;
     BE.ver_blanco = 0;
     cmbfiltrotipoplanilla.ValueMember = "tipoplla";
     cmbfiltrotipoplanilla.DisplayMember = "tipopllaname";
     cmbfiltrotipoplanilla.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (U_Validacion())
            {
                try
                {
                    var BL = new tb_plla_tipoplanillaBL();
                    var BE = new tb_plla_tipoplanilla();

                    BE.Tipoplla = txtCodigo.Text.Trim();
                    BE.Tipopllaname = txtdescripcion.Text.Trim();
                    BE.Diasplla = Convert.ToDecimal(txtdiasplanilla.Text);
                    if (cboFormapago.Text.Length > 0)
                    {
                        BE.Formapago = cboFormapago.SelectedValue.ToString();
                    }
                    else
                    {
                        BE.Formapago = string.Empty;
                    }
                    BE.Tituloboleta = txttituloboleta.Text.Trim();
                    BE.Tipopllaemple = txtdescriptrab.Text.Trim();
                    BE.Gratificacion = chkgratificacion.Checked;
                    BE.Pdt = chkpdt.Checked;
                    BE.Cts = chkcts.Checked;
                    if (cboRubrorpts.Text.Length > 0)
                    {
                        BE.Tiptrabid = cboRubrorpts.SelectedValue.ToString();
                    }
                    else
                    {
                        BE.Tiptrabid = string.Empty;
                    }
                    BE.Modoplla = txtidconta.Text.Trim();
                    if (chkactivo.Checked == true)
                    {
                        BE.Status = "0";
                    }
                    if (chkactivo.Checked == false)
                    {
                        BE.Status = "9";
                    }

                    if (u_n_opsel == 1)
                    {
                        if (BL.Insert(VariablesPublicas.EmpresaID.ToString(), BE))
                        {
                            seguridadlog();
                        }
                        else
                        {
                            Frm_Class.ShowError(BL.Sql_Error, this);
                        }
                    }
                    else
                    {
                        if (BL.Update(VariablesPublicas.EmpresaID.ToString(), BE))
                        {
                            seguridadlog();
                        }
                        else
                        {
                            Frm_Class.ShowError(BL.Sql_Error, this);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                U_CancelarEdicion(0);
            }
        }
        private void cmbtipoplanilla_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (u_n_opsel > 0 & (examinaranexos.CurrentRow != null))
            {
                examinaranexos.Rows[examinaranexos.CurrentRow.Index].Cells["tipoplla"].Value = cboTipoplanilla.SelectedValue;
                examinaranexos.Rows[examinaranexos.CurrentRow.Index].Cells["tipopllaname"].Value = cboTipoplanilla.Text;
                TablaRubrosContrato.AcceptChanges();

                var nfila = 0;
                DataTable tmptabla = null;
                var xformpago = string.Empty;
                var vmnrocontrato = string.Empty;
                if (examinaranexos.CurrentRow != null)
                {
                    if (!object.ReferenceEquals(examinaranexos.Rows[examinaranexos.CurrentRow.Index].Cells["ncontrato"], DBNull.Value))
                    {
                        vmnrocontrato = examinaranexos.Rows[examinaranexos.CurrentRow.Index].Cells["ncontrato"].Value.ToString();
                    }
                }
                var BL = new tb_plla_tipoplanillaBL();
                var BE = new tb_plla_tipoplanilla();
                if (cboTipoplanilla.SelectedValue != null)
                {
                    BE.Tipoplla = cboTipoplanilla.SelectedValue.ToString();
                }
                BE.norden = 1;
                BE.ver_blanco = 0;
                BE.solopdt = 0;
                tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
                if (BL.Sql_Error.Length == 0)
                {
                    if (tmptabla.Rows.Count > 0)
                    {
                        xformpago = tmptabla.Rows[0]["formapago"].ToString();
                    }
                }
                if (xformpago.Trim().Length > 0)
                {
                    for (nfila = 0; nfila <= TablaRubrosContrato.Rows.Count - 1; nfila++)
                    {
                        if (TablaRubrosContrato.Rows[nfila]["ncontrato"].ToString() == vmnrocontrato)
                        {
                            TablaRubrosContrato.Rows[nfila]["formapago"] = xformpago;
                        }
                    }
                }
                TablaRubrosContrato.AcceptChanges();
                VariablesPublicas.SetKey(examinarrubros, "ncontrator", examinaranexos.Rows[examinaranexos.CurrentRow.Index].Cells["ncontrato"].Value, "rubroid");
            }
        }
 private void examinarrubros_CellValueChanged(object sender, DataGridViewCellEventArgs e)
 {
     if (!Sw_LOad)
     {
         if ((examinarrubros.CurrentRow != null))
         {
             sw_novaluechange = true;
             if (examinarrubros.Columns[e.ColumnIndex].Name.ToUpper() == "rubroid".ToUpper())
             {
                 ValidaRubroIngreso();
             }
             if (examinarrubros.Columns[e.ColumnIndex].Name.ToUpper() == "importediario".ToUpper())
             {
                 if (object.ReferenceEquals(examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importediario"].Value, DBNull.Value))
                 {
                     examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importediario"].Value = 0;
                 }
                 var xvmformapago = string.Empty;
                 if ((cboTipoplanilla.SelectedValue != null))
                 {
                     var BL = new tb_plla_tipoplanillaBL();
                     var BE = new tb_plla_tipoplanilla();
                     BE.Tipoplla = cboTipoplanilla.SelectedValue.ToString();
                     BE.norden = 1;
                     BE.ver_blanco = 0;
                     BE.solopdt = 0;
                     tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
                     if (BL.Sql_Error.Length == 0)
                     {
                         if (tmptabla.Rows.Count > 0)
                         {
                             xvmformapago = tmptabla.Rows[0]["formapago"].ToString();
                         }
                     }
                 }
                 examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importediario"].Value = examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importediario"].Value;
                 if (xvmformapago == "3")
                 {
                     examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importemensual"].Value = Math.Round(Convert.ToDecimal(examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importediario"].Value) * 30, 2);
                 }
                 else
                 {
                     examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importemensual"].Value = examinarrubros.Rows[examinarrubros.CurrentRow.Index].Cells["importediario"].Value;
                 }
                 u_SumatoriaImporte();
             }
             if (examinarrubros.Columns[e.ColumnIndex].Name.ToUpper() == "consimporte".ToUpper())
             {
                 if (object.ReferenceEquals(examinarrubros.CurrentCell.Value, DBNull.Value))
                 {
                     examinarrubros.CurrentCell.Value = 0;
                 }
                 u_SumatoriaImporte();
             }
             sw_novaluechange = false;
         }
     }
 }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (Examinar.CurrentRow != null)
            {
                var xnomcampo = string.Empty;
                if (xnomcampo.Length == 0)
                {
                    var BL = new tb_plla_tipoplanillaBL();
                    var BE = new tb_plla_tipoplanilla();

                    BE.Tipoplla = Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipoplla"].Value.ToString();
                    BE.norden = 1;
                    BE.ver_blanco = 0;
                    BE.solopdt = 0;
                    tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                    if (BL.Sql_Error.Length == 0)
                    {
                        var message = "Desea eliminar datos " + tmptabla.Rows[0]["tipoplla"].ToString().Trim() + " - " + tmptabla.Rows[0]["tipopllaname"].ToString().Trim() + " ...?";
                        var caption = "Mensaje del Sistema";
                        var buttons = MessageBoxButtons.YesNo;
                        DialogResult result;
                        result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                        if (result == DialogResult.Yes)
                        {
                            var BL1 = new tb_plla_tipoplanillaBL();
                            var BE1 = new tb_plla_tipoplanilla();

                            BE1.Tipoplla = BE.Tipoplla;
                            if (BL1.Delete(VariablesPublicas.EmpresaID.ToString(), BE1))
                            {
                                if (BL1.Sql_Error.Length == 0)
                                {
                                    var BLS = new tb_co_seguridadlogBL();
                                    var BES = new tb_co_seguridadlog();

                                    BES.moduloid = Name;
                                    BES.clave = VariablesPublicas.EmpresaID + Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipoplla"].Value.ToString();
                                    BES.cuser = VariablesPublicas.Usuar;
                                    BES.fecha = DateTime.Now;
                                    BES.pc = VariablesPublicas.userip;
                                    BES.accion = "B";
                                    BES.detalle = "Descripción:" + txtdescripcion.Text.Trim();

                                    BLS.Insert(VariablesPublicas.EmpresaID.ToString(), BES);
                                    Examinar.Rows.Remove(Examinar.CurrentRow);
                                    Examinar.Refresh();
                                    u_PintaDatos();
                                }
                                else
                                {
                                    Frm_Class.ShowError(BL1.Sql_Error, this);
                                }
                            }
                        }
                    }
                    else
                    {
                        Frm_Class.ShowError(BL.Sql_Error, this);
                    }
                }
                else
                {
                    MessageBox.Show(xnomcampo, "Imposible Eliminar Registro !!!");
                }
            }
            U_RefrescaControles();
        }
 public DataSet GetAll_Consulta(string empresaid, tb_plla_tipoplanilla BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllaTipoplla_CONSULTA", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.Tipoplla;
                 cmd.Parameters.Add("@nomlike1", SqlDbType.VarChar, 50).Value = BE.nomlike1;
                 cmd.Parameters.Add("@nomlike2", SqlDbType.VarChar, 50).Value = BE.nomlike2;
                 cmd.Parameters.Add("@nomlike3", SqlDbType.VarChar, 50).Value = BE.nomlike3;
                 cmd.Parameters.Add("@norden", SqlDbType.Int).Value = BE.norden;
                 cmd.Parameters.Add("@ver_blanco", SqlDbType.Int).Value = BE.ver_blanco;
                 cmd.Parameters.Add("@solopdt", SqlDbType.Int).Value = BE.solopdt;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        private void CargaDatos()
        {
            var nposcolumnasortear = 0;
            var PrvSotOrder = default(SortOrder);
            var zordenado = false;
            var xcodcliente = "..";
            var xpalabra1 = string.Empty;
            var xpalabra2 = string.Empty;
            var xpalabra3 = string.Empty;
            if (txtfiltronombre.Text.Trim().Length > 0)
            {
                xpalabra1 = VariablesPublicas.Palabras(txtfiltronombre.Text, 1);
                xpalabra2 = VariablesPublicas.Palabras(txtfiltronombre.Text, 2);
                xpalabra3 = VariablesPublicas.Palabras(txtfiltronombre.Text, 3);
            }
            if (Examinar.CurrentRow != null)
            {
                xcodcliente = Examinar.Rows[Examinar.CurrentRow.Index].Cells["tipoplla"].Value.ToString();
            }
            if (Examinar.SortedColumn != null)
            {
                nposcolumnasortear = Examinar.SortedColumn.Index;
                PrvSotOrder = Examinar.SortOrder;
                zordenado = true;
            }
            var BL = new tb_plla_tipoplanillaBL();
            var BE = new tb_plla_tipoplanilla();

            if (txtfiltronombre.Text.Trim().Length > 0)
            {
                BE.nomlike1 = xpalabra1;
                BE.nomlike2 = xpalabra2;
                BE.nomlike3 = xpalabra3;
            }
            BE.norden = 1;
            BE.ver_blanco = 0;
            BE.solopdt = 0;
            tablaclientes = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];

            Examinar.AutoGenerateColumns = false;
            Examinar.DataSource = tablaclientes;

            VariablesPublicas.PintaEncabezados(Examinar);

            if (zordenado)
            {
                if (PrvSotOrder == SortOrder.Ascending)
                {
                    Examinar.Sort(Examinar.Columns[nposcolumnasortear], System.ComponentModel.ListSortDirection.Ascending);
                }
                else
                {
                    Examinar.Sort(Examinar.Columns[nposcolumnasortear], System.ComponentModel.ListSortDirection.Descending);
                }
            }
            else
            {
                Examinar.Sort(Examinar.Columns["tipoplla"], System.ComponentModel.ListSortDirection.Ascending);
            }
            if (Examinar.CurrentRow == null)
            {
                if (Examinar.RowCount > 0)
                {
                    Examinar.CurrentCell = Examinar.Rows[0].Cells["tipoplla"];
                }
            }
            for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++)
            {
                if (Examinar.Rows[lc_cont].Cells["tipoplla"].Value.ToString() == xcodcliente)
                {
                    Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["tipoplla"];
                    break;
                }
            }
        }
 private void cmbtipoplanilla_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (u_n_opsel > 0)
     {
         var BL = new tb_plla_tipoplanillaBL();
         var BE = new tb_plla_tipoplanilla();
         BE.Tipoplla = cmbtipoplanilla.SelectedValue.ToString();
         BE.norden = 1;
         BE.ver_blanco = 0;
         BE.solopdt = 0;
         tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
         if (BL.Sql_Error.Length == 0)
         {
             if (tmptabla.Rows.Count > 0)
             {
                 vm_formapago = tmptabla.Rows[0]["formapago"].ToString();
                 if (vm_formapago == "3")
                 {
                     frangotrabini.Checked = false;
                     frangotrabfin.Checked = false;
                 }
                 txtsemana.Text = string.Empty;
                 cmbtipoquincena.SelectedValue = string.Empty;
                 U_RefrescaControles();
             }
         }
     }
 }
        private void Frm_Planilla_RubrosPermanente_Activated(object sender, EventArgs e)
        {
            if (Sw_LOad)
            {
                cmbfiltrotipoplanilla.ValueMember = "tipoplla";
                cmbfiltrotipoplanilla.DisplayMember = "tipopllaname";
                var BL = new tb_plla_tipoplanillaBL();
                var BE = new tb_plla_tipoplanilla();

                BE.norden = 1;
                BE.ver_blanco = 0;
                tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                cmbfiltrotipoplanilla.SelectedValue = string.Empty;

                if (BL.Sql_Error.Length == 0)
                {
                    cmbfiltrotipoplanilla.DataSource = tmpcursor;
                    if (tmpcursor.Rows.Count > 0)
                    {
                        cmbfiltrotipoplanilla.SelectedValue = tmpcursor.Rows[0]["tipoplla"];
                    }
                }

                cmbmodalidad.ValueMember = "cele";
                cmbmodalidad.DisplayMember = "descripcion";
                var BL1 = new tb_plla_tab0100BL();
                var BE1 = new tb_plla_tab0100();
                cmbmodalidad.DataSource = BL1.GetAllModalidadRubroPermanente(VariablesPublicas.EmpresaID.ToString(), BE1).Tables[0];

                cmbtipo.ValueMember = "cele";
                cmbtipo.DisplayMember = "descripcion";
                cmbtipo.DataSource = BL1.GetAllTipoRubroPermanente(VariablesPublicas.EmpresaID.ToString(), BE1).Tables[0];
                RequeryRubroIngresoPlanilla();
                RequeryTipoPlanilla();

                U_RefrescaControles();
                CargaDatos();
                U_RefrescaControles();
                Sw_LOad = false;
            }
        }
        public void RequeryTipoPlanilla()
        {
            var xvmcod = string.Empty;
            if (cmbrubroingreso.SelectedValue != null)
            {
                xvmcod = cmbrubroingreso.SelectedValue.ToString();
            }

            cmbtipoplanilla.ValueMember = "tipoplla";
            cmbtipoplanilla.DisplayMember = "tipopllaname";
            var BL = new tb_plla_tipoplanillaBL();
            var BE = new tb_plla_tipoplanilla();
            BE.norden = 1;
            BE.ver_blanco = 0;
            cmbtipoplanilla.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            cmbrubroingreso.SelectedValue = xvmcod;
        }
 private void Llenar_cboTipoPlanillaFil()
 {
     var BL = new tb_plla_tipoplanillaBL();
     var BE = new tb_plla_tipoplanilla();
     BE.norden = 1;
     BE.ver_blanco = 0;
     cmbfiltrotipoplanilla.ValueMember = "tipoplla";
     cmbfiltrotipoplanilla.DisplayMember = "tipopllaname";
     tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0];
     cmbfiltrotipoplanilla.SelectedValue = string.Empty;
     if (BL.Sql_Error.Length == 0)
     {
         cmbfiltrotipoplanilla.DataSource = tmpcursor;
         if (tmpcursor.Rows.Count > 0)
         {
             cmbfiltrotipoplanilla.SelectedValue = tmpcursor.Rows[0]["tipoplla"];
         }
     }
 }
        private BindingSource NewMethoTP()
        {
            var BL = new tb_plla_tipoplanillaBL();
            var BE = new tb_plla_tipoplanilla();

            BE.norden = 2;
            BE.ver_blanco = 0;
            BE.solopdt = 1;
            var table = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            var rows = table.Rows;

            object[] cell;
            var dic = new Dictionary<string, string>();
            var binding = new BindingSource();

            foreach (DataRow item in rows)
            {
                cell = item.ItemArray;
                dic.Add(cell[0].ToString(), cell[0].ToString() + " - " + cell[1].ToString());
                cell = null;
            }
            binding.DataSource = dic;
            return binding;
        }
        private void Frm_Planilla_RubrosCopiar_Activated(object sender, EventArgs e)
        {
            if (sw_Load)
            {
                cmbtiporubro.ValueMember = "codigo";
                cmbtiporubro.DisplayMember = "descripcion";
                var BLI = new tb_plla_tab0100BL();
                var BEI = new tb_plla_tab0100();

                BEI.norden = 2;
                cmbtiporubro.DataSource = BLI.gspTbPllaTipoRubro(VariablesPublicas.EmpresaID.ToString(), BEI).Tables[0];

                cmbtipoplanillaorigen.ValueMember = "tipoplla";
                cmbtipoplanillaorigen.DisplayMember = "tipopllaname";
                var BL = new tb_plla_tipoplanillaBL();
                var BE = new tb_plla_tipoplanilla();

                BE.norden = 1;
                BE.ver_blanco = 0;
                cmbtipoplanillaorigen.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];

                cmbtipoplanilladestino.ValueMember = "tipoplla";
                cmbtipoplanilladestino.DisplayMember = "tipopllaname";
                cmbtipoplanilladestino.DataSource = BL.GetAll_Consulta(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                if (_LpTipoRubro.Trim().Length > 0)
                {
                    cmbtiporubro.SelectedValue = _LpTipoRubro;
                }
                if (_LpPlanillaOrigen.Trim().Length > 0)
                {
                    cmbtipoplanillaorigen.SelectedValue = _LpTipoRubro;
                }
                if (_LpPlanillaDestino.Trim().Length > 0)
                {
                    cmbtipoplanilladestino.SelectedValue = _LpPlanillaDestino;
                }
                U_RefrescaControles();
                sw_Load = false;
            }
        }