public void RecibetrabajadorIni(string codigo, bool zselect) { if (zselect) { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = codigo; BE.Norden = 2; BE.Estado_trabaj = 0; tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length == 0) { if (tmpcursor.Rows.Count > 0) { Tabla.Rows.Add(VariablesPublicas.INSERTINTOTABLE(Tabla)); Tabla.Rows[Tabla.Rows.Count - 1]["fichaid"] = tmpcursor.Rows[0]["fichaid"]; Tabla.Rows[Tabla.Rows.Count - 1]["nombrelargo"] = tmpcursor.Rows[0]["nombrelargo"].ToString().Trim(); Tabla.AcceptChanges(); U_RefrescaControles(); Examinar.Focus(); for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++) { if (Examinar.Rows[lc_cont].Cells["fichaid"].Value.ToString() == tmpcursor.Rows[0]["fichaid"].ToString()) { Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["nombrelargo"]; Examinar.BeginEdit(true); Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["salxretener"]; break; } } } } } }
public bool DesactivarTrabajadorUpdate(string empresaid, tb_plla_fichatrabajadores BE) { //return tablaDA.DesactivarTrabajadorUpdate(empresaid, BE); bool zreturn = tablaDA.DesactivarTrabajadorUpdate(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public bool Delete(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_DELETE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@fichaid", SqlDbType.Char, 7).Value = BE.Fichaid; } 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 bool CesarTrabajadorUpdate(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_CesarTrabajadorUpdate", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@empresaid", string.IsNullOrEmpty(BE.Empresaid) ? (object)DBNull.Value : BE.Empresaid); cmd.Parameters.AddWithValue("@fichaid", string.IsNullOrEmpty(BE.Fichaid) ? (object)DBNull.Value : BE.Fichaid); cmd.Parameters.AddWithValue("@jefe", string.IsNullOrEmpty(BE.Jefe) ? (object)DBNull.Value : BE.Jefe); cmd.Parameters.Add("@fec_cese", SqlDbType.DateTime).Value = BE.Fechcese; cmd.Parameters.AddWithValue("@motivo", string.IsNullOrEmpty(BE.Motivocese) ? (object)DBNull.Value : BE.Motivocese); cmd.Parameters.Add("@observ", SqlDbType.Text).Value = BE.Observacion; } 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_Consulta(string empresaid, tb_plla_fichatrabajadores BE) { //return tablaDA.GetAll_Consulta(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_Consulta(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
private void btnAccion_Click(object sender, EventArgs e) { string ficha = null; string nombre = null; string empresa = null; if ((dgTrabProceso.CurrentRow != null)) { ficha = dgTrabProceso["ficha", dgTrabProceso.CurrentRow.Index].Value.ToString(); empresa = dgTrabProceso["empresa", dgTrabProceso.CurrentRow.Index].Value.ToString(); nombre = dgTrabProceso["dficha", dgTrabProceso.CurrentRow.Index].Value.ToString().Trim(); if (_varProcesoCesar == 1) { Panel.Visible = true; validacion_panel(false); } if (_varProcesoCesar == 2) { if (MessageBox.Show("Desea Desactivar al trabajador (" + ficha + ") " + nombre, string.Empty, MessageBoxButtons.YesNo) == DialogResult.Yes) { var retorno = false; var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = ficha.Trim(); BE.Empresaid = empresa.Trim(); retorno = BL.DesactivarTrabajadorUpdate(VariablesPublicas.EmpresaID, BE); if (retorno) { MessageBox.Show("Desactivado Correctamente !!", "Mensaje del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); if (swB == 2) { DesEnlazaControles(); } if (swB == 1) { EnlazarControles(); } } else { MessageBox.Show("Hubo problemas al momento de Desactivar, cierra la ventana e intente de nuevo", "Mensaje del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
public DataSet GetAll_GeneraDatosFormatoContrato(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_GeneraDatosFormatoContrato", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@empresaid", string.IsNullOrEmpty(BE.Empresaid) ? (object)DBNull.Value : BE.Empresaid); cmd.Parameters.AddWithValue("@fichaini", string.IsNullOrEmpty(BE.FichaidIni) ? (object)DBNull.Value : BE.FichaidIni); cmd.Parameters.AddWithValue("@fichafin", string.IsNullOrEmpty(BE.FichaidFin) ? (object)DBNull.Value : BE.FichaidFin); cmd.Parameters.AddWithValue("@cencosid", string.IsNullOrEmpty(BE.Cencosid) ? (object)DBNull.Value : BE.Cencosid); cmd.Parameters.AddWithValue("@cargoid", string.IsNullOrEmpty(BE.Cargoid) ? (object)DBNull.Value : BE.Cargoid); cmd.Parameters.AddWithValue("@situtrabid", string.IsNullOrEmpty(BE.Situtrabid) ? (object)DBNull.Value : BE.Situtrabid); cmd.Parameters.AddWithValue("@F_suscripcion", string.IsNullOrEmpty(BE.F_suscripcion) ? (object)DBNull.Value : BE.F_suscripcion); cmd.Parameters.AddWithValue("@xlistacodigos", string.IsNullOrEmpty(BE.Xlistacodigos) ? (object)DBNull.Value : BE.Xlistacodigos); } 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); } } } }
public DataSet GetAll_GeneraDatosFormatoContrato(string empresaid, tb_plla_fichatrabajadores BE) { //return tablaDA.GetAll_GeneraDatosFormatoContrato(empresaid, BE); DataSet xreturn = null; xreturn = tablaDA.GetAll_GeneraDatosFormatoContrato(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return xreturn; }
public bool Insert(string empresaid, tb_plla_fichatrabajadores BE) { //return tablaDA.Insert(empresaid, BE); bool zreturn = tablaDA.Insert(empresaid, BE); Sql_Error = tablaDA.Sql_Error; return zreturn; }
public void SeleccionarDegrilla(int opcion) { var n = 0; var i = 0; var retorno = false; if (chkInactivos.Checked) { i = 1; } else { i = 0; } if (DataGridView1.Rows.Count > 0) { for (n = 0; n <= DataGridView1.Rows.Count - 1; n++) { if (Convert.ToInt32(DataGridView1.Rows[n].Cells[0].Value) == 1) { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = DataGridView1.Rows[n].Cells[1].Value.ToString().Trim(); BE.Ntipo = opcion; retorno = BL.ReactivarTrabajadorUpdate(VariablesPublicas.EmpresaID, BE); } } if (retorno) { MessageBox.Show("Accion realizada con exito !!!"); U_LoadPlanillas(0); } else { MessageBox.Show("Error al Grabar !!!!"); } } }
public void U_CargaDatos(bool nofocusgrid) { lbltotalregistros.Text = string.Empty; var nestado = 0; var xtipoplanilla = string.Empty; if (cmbtipoplanilla.Enabled) { if ((cmbtipoplanilla.SelectedValue != null)) { xtipoplanilla = cmbtipoplanilla.SelectedValue.ToString(); } } if (rbtodos1.Checked) { nestado = 0; } if (rbtodos2.Checked) { nestado = 1; } if (rbtodos3.Checked) { nestado = 2; } var xpalabra1 = string.Empty; var xpalabra2 = string.Empty; var xpalabra3 = string.Empty; if (txtnombre.Enabled) { xpalabra1 = VariablesPublicas.Palabras(txtnombre.Text.Trim(), 1); xpalabra2 = VariablesPublicas.Palabras(txtnombre.Text.Trim(), 2); xpalabra3 = VariablesPublicas.Palabras(txtnombre.Text.Trim(), 3); } var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Norden = 1; BE.Nomlike1 = xpalabra1; BE.Nomlike2 = xpalabra2; BE.Nomlike3 = xpalabra3; BE.Estado_trabaj = nestado; BE.Tipoplla = xtipoplanilla; tabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length > 0) { sw_Load = false; Frm_Class.ShowError(BL.Sql_Error, this); } else { lbltotalregistros.Text = (tabla.Rows.Count).ToString() + " Registro(s)"; var sorted = default(SortOrder); var xnomcolumna = string.Empty; if ((dgProveedor.SortedColumn != null)) { xnomcolumna = dgProveedor.Columns[dgProveedor.SortedColumn.Index].Name; sorted = dgProveedor.SortOrder; } dgProveedor.AutoGenerateColumns = false; dgProveedor.DataSource = tabla; dgProveedor.AllowUserToResizeRows = false; 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["nombrelargo"], System.ComponentModel.ListSortDirection.Ascending); } if (dgProveedor.Rows.Count > 0) { if (nofocusgrid) { } else { dgProveedor.CurrentCell = dgProveedor.Rows[0].Cells["fichaid"]; dgProveedor.Focus(); dgProveedor.BeginEdit(true); } } pintar(); } }
private void btngrabar_Click(object sender, EventArgs e) { if (U_Validacion()) { var tmpcursor = new DataTable(); if (u_n_opsel == 1) { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = txtcodigo.Text.Trim(); BE.Empresaid = cbo_empresaid.SelectedValue.ToString(); BE.Norden = 1; BE.Estado_trabaj = 0; tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (tmpcursor.Rows.Count > 0) { var BLMX = new tb_plla_fichatrabajadoresBL(); var Codigo = cbo_empresaid.SelectedValue.ToString(); txtcodigo.Text = BLMX.GetAll_ConsultaMaxCod(VariablesPublicas.EmpresaID.ToString(), Codigo).Tables[0].Rows[0]["maximo_codigo"].ToString(); } tmpcursor.Rows.Add(VariablesPublicas.InsertIntoTable(tmpcursor)); var BLMX1 = new tb_plla_fichatrabajadoresBL(); var Codigo1 = cbo_empresaid.SelectedValue.ToString(); tmpcursor.Rows[0]["fichaid"] = BLMX1.GetAll_ConsultaMaxCod(VariablesPublicas.EmpresaID.ToString(), Codigo1).Tables[0].Rows[0]["maximo_codigo"].ToString(); tmpcursor.Rows[0]["activo"] = "1"; tmpcursor.Rows[0]["status"] = "0"; tmpcursor.Rows[0]["motivocese"] = string.Empty; tmpcursor.Rows[0]["fechcese"] = DBNull.Value; tmpcursor.Rows[0]["tipsuspenid"] = string.Empty; } else { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = txtcodigo.Text.Trim(); BE.Empresaid = cbo_empresaid.SelectedValue.ToString(); BE.Norden = 1; BE.Estado_trabaj = 0; tmpcursor = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; } tmpcursor.Rows[0]["empresaid"] = cbo_empresaid.SelectedValue; tmpcursor.Rows[0]["fichaid"] = txtcodigo.Text.Trim(); tmpcursor.Rows[0]["apepat"] = txtapepat.Text.Trim(); tmpcursor.Rows[0]["apemat"] = txtapemat.Text.Trim(); tmpcursor.Rows[0]["nombres"] = txtnombres.Text.Trim(); tmpcursor.Rows[0]["nombrelargo"] = txtNombrelargo.Text.Trim(); if ((cboTipdoc.SelectedValue != null)) { tmpcursor.Rows[0]["tipdocid"] = cboTipdoc.SelectedValue; } tmpcursor.Rows[0]["nrodni"] = txtDni.Text.Trim(); tmpcursor.Rows[0]["nmruc"] = txtDni.Text.Trim(); tmpcursor.Rows[0]["ctactename"] = txtNombrelargo.Text.Trim(); tmpcursor.Rows[0]["direcc"] = txtdireccion.Text.Trim(); if ((cboDistr.SelectedValue != null)) { tmpcursor.Rows[0]["ubiged"] = cboDistr.SelectedValue; } if ((cboDistrN.SelectedValue != null)) { tmpcursor.Rows[0]["ubigen"] = cboDistrN.SelectedValue; } if ((cmbestadocivil.SelectedValue != null)) { tmpcursor.Rows[0]["estadocivil"] = cmbestadocivil.SelectedValue; } else { tmpcursor.Rows[0]["estadocivil"] = string.Empty; } if (rbmasculino.Checked) { tmpcursor.Rows[0]["sexo"] = "M"; } else { tmpcursor.Rows[0]["sexo"] = "F"; } tmpcursor.Rows[0]["telef1"] = txttelefono.Text.Trim(); tmpcursor.Rows[0]["telef2"] = txtfax.Text.Trim(); tmpcursor.Rows[0]["carnetsegsoc"] = txtcarnetseguro.Text.Trim(); tmpcursor.Rows[0]["fechnacimiento"] = fnacimiento.Value; if (fIngreso.Checked) { tmpcursor.Rows[0]["fechingreso"] = fIngreso.Value; } else { tmpcursor.Rows[0]["fechingreso"] = DBNull.Value; } if ((cmbestadotrab.SelectedValue != null)) { tmpcursor.Rows[0]["situtrabid"] = cmbestadotrab.SelectedValue; } tmpcursor.Rows[0]["sctr"] = chksctr.Checked; tmpcursor.Rows[0]["remintegral"] = chkremintegral.Checked; tmpcursor.Rows[0]["autocontrol"] = chkautocontrol.Checked; tmpcursor.Rows[0]["chkdephab"] = chkdephaberes.Checked; if ((cmbdephaberes.SelectedValue != null)) { tmpcursor.Rows[0]["bancoidhab"] = cmbdephaberes.SelectedValue; } else { tmpcursor.Rows[0]["bancoidhab"] = string.Empty; } tmpcursor.Rows[0]["ctahaberes"] = txtctahaberes.Text.Trim(); tmpcursor.Rows[0]["chkdepcts"] = chkdepcts.Checked; if ((cmbdepcts.SelectedValue != null)) { tmpcursor.Rows[0]["bancoidcts"] = cmbdepcts.SelectedValue; } else { tmpcursor.Rows[0]["bancoidcts"] = string.Empty; } tmpcursor.Rows[0]["ctacts"] = txtctacts.Text.Trim(); if ((cmbtipo.SelectedValue != null)) { tmpcursor.Rows[0]["tipodeta"] = cmbtipo.SelectedValue; } tmpcursor.Rows[0]["cencosid"] = txtccosto.Text.Trim(); tmpcursor.Rows[0]["cargoid"] = txtccargo.Text.Trim(); tmpcursor.Rows[0]["detallecontable"] = txtdetallecontable.Text.Trim(); if ((cmbafp.SelectedValue != null)) { tmpcursor.Rows[0]["regipenid"] = cmbafp.SelectedValue; } if (Equivalencias.Left(cmbafp.SelectedValue.ToString(), 1) == "2") { tmpcursor.Rows[0]["cuspp"] = txtctaafp.Text.Trim(); if (fafiliacion.Checked) { tmpcursor.Rows[0]["fechafiliacion"] = fafiliacion.Value; } if ((cboTComision.SelectedValue != null)) { tmpcursor.Rows[0]["tipcomisionafp"] = cboTComision.SelectedValue; } } else { tmpcursor.Rows[0]["cuspp"] = string.Empty; tmpcursor.Rows[0]["fechafiliacion"] = DBNull.Value; tmpcursor.Rows[0]["tipcomisionafp"] = string.Empty; } tmpcursor.Rows[0]["essaludvida"] = chkesalud.Checked; tmpcursor.Rows[0]["email"] = txtemail.Text.Trim(); if ((cboNiveleducativo.SelectedValue != null)) { tmpcursor.Rows[0]["niveleduid"] = cboNiveleducativo.SelectedValue; } else { tmpcursor.Rows[0]["niveleduid"] = string.Empty; } if (rbsidiscapacitado.Checked) { tmpcursor.Rows[0]["discapacitado"] = rbsidiscapacitado.Checked; } if (rbnodiscapacitado.Checked) { tmpcursor.Rows[0]["discapacitado"] = false; } tmpcursor.Rows[0]["tipestabid"] = string.Empty; if ((cmbtipolocal.SelectedValue != null)) { tmpcursor.Rows[0]["establec"] = cmbtipolocal.SelectedValue; } if ((cmbcategoria.SelectedValue != null)) { tmpcursor.Rows[0]["cateocupid"] = cmbcategoria.SelectedValue; } else { tmpcursor.Rows[0]["cateocupid"] = string.Empty; } tmpcursor.Rows[0]["fotografia"] = VM_mimagen_3; tmpcursor.Rows[0]["observacion"] = txtobservaciones.Text.Trim(); if (u_n_opsel == 1 | object.ReferenceEquals(tmpcursor.Rows[0]["fechregistro"], DBNull.Value)) { tmpcursor.Rows[0]["fechregistro"] = DateTime.Now; } if ((TablaContratos != null)) { if (TablaContratos.Rows.Count > 0) { if ((!object.ReferenceEquals(TablaContratos.Rows[TablaContratos.Rows.Count - 1]["tipoplla"], DBNull.Value))) { tmpcursor.Rows[0]["tipoplla"] = TablaContratos.Rows[TablaContratos.Rows.Count - 1]["tipoplla"]; } } } if ((cboVia.SelectedValue != null)) { tmpcursor.Rows[0]["viaid"] = cboVia.SelectedValue; } else { tmpcursor.Rows[0]["viaid"] = string.Empty; } if ((cboZona.SelectedValue != null)) { tmpcursor.Rows[0]["zonaid"] = cboZona.SelectedValue; } else { tmpcursor.Rows[0]["zonaid"] = string.Empty; } if ((cboEps.SelectedValue != null)) { tmpcursor.Rows[0]["epsid"] = cboEps.SelectedValue; } else { tmpcursor.Rows[0]["epsid"] = string.Empty; } if ((cboSitutrab.SelectedValue != null)) { tmpcursor.Rows[0]["situtrab"] = cboSitutrab.SelectedValue; } else { tmpcursor.Rows[0]["situtrab"] = string.Empty; } if ((cboTpago.SelectedValue != null)) { tmpcursor.Rows[0]["tippagoid"] = cboTpago.SelectedValue; } else { tmpcursor.Rows[0]["tippagoid"] = string.Empty; } if (rbsiConvenio.Checked) { tmpcursor.Rows[0]["chkconvenio"] = rbsiConvenio.Checked; } if (rbnoConvenio.Checked) { tmpcursor.Rows[0]["chkconvenio"] = false; } if ((cboCtributario.SelectedValue != null)) { tmpcursor.Rows[0]["convendobletribid"] = cboCtributario.SelectedValue; } else { tmpcursor.Rows[0]["convendobletribid"] = string.Empty; } tmpcursor.Rows[0]["paisid"] = txtpaisid.Text.Trim(); tmpcursor.Rows[0]["status"] = (rbactivo.Checked ? "0" : "9"); tmpcursor.Rows[0]["usuar"] = VariablesPublicas.Usuar.Trim(); for (lc_cont = 0; lc_cont <= TablaContratos.Rows.Count - 1; lc_cont++) { TablaContratos.Rows[lc_cont]["fichaid"] = txtcodigo.Text.Trim(); TablaContratos.Rows[lc_cont]["empresaid"] = cbo_empresaid.SelectedValue; } for (lc_cont = 0; lc_cont <= TablaRubrosContrato.Rows.Count - 1; lc_cont++) { TablaRubrosContrato.Rows[lc_cont]["fichaid"] = txtcodigo.Text.Trim(); TablaRubrosContrato.Rows[lc_cont]["empresaid"] = cbo_empresaid.SelectedValue; } var BLIN = new tb_plla_fichatrabajadoresBL(); if (BLIN.Insert_Update(VariablesPublicas.EmpresaID, tmpcursor, TablaContratos, TablaRubrosContrato)) { seguridadlog(); U_CancelarEdicion(0); } else { Frm_Class.ShowError(BLIN.Sql_Error, this); } } }
public DataSet GetAll_TrabajadorRetenciones(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_TrabajadorRetenciones", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@tipoplla", string.IsNullOrEmpty(BE.Tipoplla) ? (object)DBNull.Value : BE.Tipoplla); } 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 Llenar_cboEstadTrabjFil() { cmbfiltroestado.ValueMember = "cele"; cmbfiltroestado.DisplayMember = "descripcion"; var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); cmbfiltroestado.DataSource = BL.GetAll_EstadoTrabj(VariablesPublicas.EmpresaID, BE).Tables[0]; }
private void btncontrato_Click(object sender, EventArgs e) { DataTable tmpdata = null; var xcodestado = string.Empty; var xcodficha = "..."; if ((Examinar.CurrentRow != null)) { xcodficha = Examinar.Rows[Examinar.CurrentRow.Index].Cells["fichaid"].Value.ToString(); } var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Empresaid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["empresaid"].Value.ToString(); ; BE.FichaidIni = xcodficha; BE.FichaidFin = xcodficha; BE.Situtrabid = xcodestado; tmpdata = BL.GetAll_GeneraDatosFormatoContrato(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length > 0) { Frm_Class.ShowError(BL.Sql_Error, this); return; } var BLPC = new tb_plla_plantilla_contratosBL(); var BEPC = new tb_plla_plantilla_contratos(); BEPC.norden = 1; BEPC.ver_blanco = 0; BEPC.vista = 1; tmpcursor = BLPC.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BEPC).Tables[0]; if (BLPC.Sql_Error.Length > 0) { Frm_Class.ShowError(BLPC.Sql_Error, this); return; } if (tmpcursor.Rows.Count == 0) { MessageBox.Show("No hay formatos creados !!!", "Mensaje del Sistema"); return; } if (tmpdata.Rows.Count == 0) { MessageBox.Show("No hay información seleccionada !!!", "Mensaje del Sistema"); return; } var xmsgerror = string.Empty; if (tmpdata.Rows[0]["VM_SUELDOTRABAJADOR"].ToString().Trim().Length == 0) { xmsgerror = xmsgerror + "\r" + "Trabajador no tiene remuneración definida !!!"; } else { if (tmpdata.Rows[0]["msgvalidafecha"].ToString().Trim().Length > 0) { xmsgerror = xmsgerror + "\r" + tmpdata.Rows[0]["msgvalidafecha"]; } else { if (tmpdata.Rows[0]["VM_NROMESESYDIAS"].ToString().Trim().Length == 0) { xmsgerror = xmsgerror + "\r" + "Trabajador no tiene fechas definidas en el contrato !!!"; } else { if (tmpdata.Rows[0]["VM_CENTROCOSTOTRABAJADOR"].ToString().Trim().Length == 0) { xmsgerror = xmsgerror + "\r" + "Trabajador no tiene definido centro de costo !!!"; } else { if (tmpdata.Rows[0]["VM_CARGOTRABAJADOR"].ToString().Trim().Length == 0) { xmsgerror = xmsgerror + "\r" + "Trabajador no tiene definido cargo !!!"; } else { } } } } } if (xmsgerror.Trim().Length == 0) { VariablesPublicas.u_GeneraFormatoContrato(tmpdata, tmpcursor); } else { MessageBox.Show(xmsgerror, "Mensaje del Sistema"); } }
private void EnlazarControles() { swB = 2; var BindingTable = new DataTable(); var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Ntipo = _varProcesoCesar; BindingTable = BL.GetAll_ActivosCesados(VariablesPublicas.EmpresaID, BE).Tables[0]; vistaDatos = new DataView(BindingTable); dgTrabProceso.AutoGenerateColumns = false; dgTrabProceso.DataSource = vistaDatos; Llenar_cboEstadoContrato(); }
private void txtjefe_LostFocus(object sender, System.EventArgs e) { if (txtjefe.Text.Trim().Length > 0) { txtjefe.Text = VariablesPublicas.PADL(txtjefe.Text.Trim(), 7, "0"); } if (!(j_Valor == txtjefe.Text)) { var odata = new DataTable(); var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = txtjefe.Text.Trim(); BE.Norden = 1; odata = BL.GetAll_GETTRABAJADORES(VariablesPublicas.EmpresaID, BE).Tables[0]; if (odata.Rows.Count > 0) { txtDjefe.Text = odata.Rows[0]["nombrelargo"].ToString(); txtjefe.Text = odata.Rows[0]["fichaid"].ToString(); } else { txtDjefe.Text = string.Empty; txtjefe.Text = string.Empty; } } }
public DataSet GetAll_GETTRABAJADORES(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_GETTRABAJADORES", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@fichaid", string.IsNullOrEmpty(BE.Fichaid) ? (object)DBNull.Value : BE.Fichaid); cmd.Parameters.AddWithValue("@nomlike", string.IsNullOrEmpty(BE.Nomlike1) ? (object)DBNull.Value : BE.Nomlike1); cmd.Parameters.Add("@norden", SqlDbType.Int).Value = BE.Norden; } 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); } } } }
public bool Update(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_UPDATE", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@empresaid", SqlDbType.Char, 2).Value = BE.Empresaid; cmd.Parameters.Add("@fichaid", SqlDbType.Char, 7).Value = BE.Fichaid; cmd.Parameters.Add("@apepat", SqlDbType.VarChar, 20).Value = BE.Apepat; cmd.Parameters.Add("@apemat", SqlDbType.VarChar, 20).Value = BE.Apemat; cmd.Parameters.Add("@nombres", SqlDbType.VarChar, 20).Value = BE.Nombres; cmd.Parameters.Add("@nombrelargo", SqlDbType.VarChar, 60).Value = BE.Nombrelargo; cmd.Parameters.Add("@tipdocid", SqlDbType.Char, 2).Value = BE.Tipdocid; cmd.Parameters.Add("@nrodni", SqlDbType.Char, 8).Value = BE.Nrodni; cmd.Parameters.Add("@nmruc", SqlDbType.Char, 11).Value = BE.Nmruc; cmd.Parameters.Add("@ctactename", SqlDbType.VarChar, 60).Value = BE.Ctactename; cmd.Parameters.Add("@direcc", SqlDbType.VarChar, 60).Value = BE.Direcc; cmd.Parameters.Add("@ubiged", SqlDbType.Char, 6).Value = BE.Ubiged; cmd.Parameters.Add("@ubigen", SqlDbType.Char, 6).Value = BE.Ubigen; cmd.Parameters.Add("@estadocivil", SqlDbType.Char, 1).Value = BE.Estadocivil; cmd.Parameters.Add("@sexo", SqlDbType.Char, 1).Value = BE.Sexo; cmd.Parameters.Add("@telef1", SqlDbType.VarChar, 20).Value = BE.Telef1; cmd.Parameters.Add("@telef2", SqlDbType.VarChar, 20).Value = BE.Telef2; cmd.Parameters.Add("@carnetsegsoc", SqlDbType.VarChar, 20).Value = BE.Carnetsegsoc; cmd.Parameters.Add("@fechnacimiento", SqlDbType.DateTime).Value = BE.Fechnacimiento; cmd.Parameters.Add("@fechingreso", SqlDbType.DateTime).Value = BE.Fechingreso; cmd.Parameters.Add("@situtrabid", SqlDbType.Char, 2).Value = BE.Situtrabid; cmd.Parameters.Add("@sctr", SqlDbType.Bit).Value = BE.Sctr; cmd.Parameters.Add("@remintegral", SqlDbType.Bit).Value = BE.Remintegral; cmd.Parameters.Add("@autocontrol", SqlDbType.Bit).Value = BE.Autocontrol; cmd.Parameters.Add("@chkdephab", SqlDbType.Bit).Value = BE.Chkdephab; cmd.Parameters.Add("@bancoidhab", SqlDbType.Char, 2).Value = BE.Bancoidhab; cmd.Parameters.Add("@ctahaberes", SqlDbType.VarChar, 24).Value = BE.Ctahaberes; cmd.Parameters.Add("@chkdepcts", SqlDbType.Bit).Value = BE.Chkdepcts; cmd.Parameters.Add("@bancoidcts", SqlDbType.Char, 2).Value = BE.Bancoidcts; cmd.Parameters.Add("@ctacts", SqlDbType.VarChar, 24).Value = BE.Ctacts; cmd.Parameters.Add("@tipodeta", SqlDbType.Char, 2).Value = BE.Tipodeta; cmd.Parameters.Add("@cencosid", SqlDbType.Char, 5).Value = BE.Cencosid; cmd.Parameters.Add("@cargoid", SqlDbType.Char, 3).Value = BE.Cargoid; cmd.Parameters.Add("@detallecontable", SqlDbType.Char, 11).Value = BE.Detallecontable; cmd.Parameters.Add("@regipenid", SqlDbType.Char, 2).Value = BE.Regipenid; cmd.Parameters.Add("@cuspp", SqlDbType.Char, 15).Value = BE.Cuspp; cmd.Parameters.Add("@fechafiliacion", SqlDbType.DateTime).Value = BE.Fechafiliacion; cmd.Parameters.Add("@tipcomisionafp", SqlDbType.Char, 1).Value = BE.Tipcomisionafp; cmd.Parameters.Add("@essaludvida", SqlDbType.Bit).Value = BE.Essaludvida; cmd.Parameters.Add("@email", SqlDbType.VarChar, 60).Value = BE.Email; cmd.Parameters.Add("@niveleduid", SqlDbType.Char, 2).Value = BE.Niveleduid; cmd.Parameters.Add("@discapacitado", SqlDbType.Bit).Value = BE.Discapacitado; cmd.Parameters.Add("@tipestabid", SqlDbType.Char, 2).Value = BE.Tipestabid; cmd.Parameters.Add("@cateocupid", SqlDbType.Char, 1).Value = BE.Cateocupid; cmd.Parameters.Add("@fotografia", SqlDbType.VarChar, 254).Value = BE.Fotografia; cmd.Parameters.Add("@observacion", SqlDbType.Text).Value = BE.Observacion; cmd.Parameters.Add("@fechregistro", SqlDbType.DateTime).Value = BE.Fechregistro; cmd.Parameters.Add("@activo", SqlDbType.Char, 1).Value = BE.Activo; cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.Status; cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.Usuar; cmd.Parameters.Add("@viaid", SqlDbType.Char, 2).Value = BE.Viaid; cmd.Parameters.Add("@zonaid", SqlDbType.Char, 2).Value = BE.Zonaid; cmd.Parameters.Add("@epsid", SqlDbType.Char, 1).Value = BE.Epsid; cmd.Parameters.Add("@tippagoid", SqlDbType.Char, 1).Value = BE.Tippagoid; cmd.Parameters.Add("@convendobletribid", SqlDbType.Char, 1).Value = BE.Convendobletribid; cmd.Parameters.Add("@tipsuspenid", SqlDbType.Char, 2).Value = BE.Tipsuspenid; } 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 bool ReactivarTrabajadorUpdate(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_ReactivarUpdate", cnx)) { { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@fichaid", string.IsNullOrEmpty(BE.Fichaid) ? (object)DBNull.Value : BE.Fichaid); cmd.Parameters.Add("@ntipo", SqlDbType.Int).Value = BE.Ntipo; } 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_FichaDatos(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_FichaDatos", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@empresaid", string.IsNullOrEmpty(BE.Empresaid) ? (object)DBNull.Value : BE.Empresaid); cmd.Parameters.AddWithValue("@fichaidIni", string.IsNullOrEmpty(BE.FichaidIni) ? (object)DBNull.Value : BE.FichaidIni); cmd.Parameters.AddWithValue("@fichaidFin", string.IsNullOrEmpty(BE.FichaidFin) ? (object)DBNull.Value : BE.FichaidFin); cmd.Parameters.AddWithValue("@cencosid", string.IsNullOrEmpty(BE.Cencosid) ? (object)DBNull.Value : BE.Cencosid); cmd.Parameters.Add("@nOrden", SqlDbType.Int).Value = BE.Norden; cmd.Parameters.AddWithValue("@situtrabid", string.IsNullOrEmpty(BE.Situtrabid) ? (object)DBNull.Value : BE.Situtrabid); cmd.Parameters.AddWithValue("@tipoplla", string.IsNullOrEmpty(BE.Tipoplla) ? (object)DBNull.Value : BE.Tipoplla); } 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); } } } }
public DataSet GetAll_EstadoTrabj(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllatab0100_GetAllEstadoTrabajador", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; } 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 btneliminar_Click(object sender, EventArgs e) { if ((Examinar.CurrentRow != null)) { var xnomcampo = string.Empty; if (xnomcampo.Length == 0) { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["fichaid"].Value.ToString(); BE.Empresaid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["empresaid"].Value.ToString(); BE.Norden = 1; BE.Estado_trabaj = 0; tmptabla = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length == 0) { var message = "Desea eliminar datos de Trabajador " + tmptabla.Rows[0]["fichaid"].ToString().Trim() + " - " + tmptabla.Rows[0]["nombrelargo"].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_fichatrabajadoresBL(); if (BL1.Eliminar(VariablesPublicas.EmpresaID, tmptabla)) { 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["fichaid"].Value.ToString(); BES.cuser = VariablesPublicas.Usuar; BES.fecha = DateTime.Now; BES.pc = VariablesPublicas.userip; BES.accion = "B"; BES.detalle = "Trabajador:" + txtNombrelargo.Text.Trim(); BLS.Insert(VariablesPublicas.EmpresaID.ToString(), BES); Examinar.Rows.Remove(Examinar.CurrentRow); Examinar.Refresh(); } } } else { Frm_Class.ShowError(BL.Sql_Error, this); } } else { MessageBox.Show(xnomcampo, "IMPOSIBLE ELIMINAR REGISTRO"); } } U_RefrescaControles(); }
private void U_LoadPlanillas(Int16 nInit) { DataGridView1.AutoGenerateColumns = false; DataGridView1.Columns[0].DataPropertyName = "nselect"; DataGridView1.Columns[1].DataPropertyName = "ficha"; DataGridView1.Columns[2].DataPropertyName = "dficha"; DataGridView1.Columns[3].DataPropertyName = "f_ingreso"; DataGridView1.Columns[4].DataPropertyName = "f_cese"; DataGridView1.Columns[5].DataPropertyName = "planilla"; DataGridView1.Columns[6].DataPropertyName = "estado"; var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Ver_inactivos = nInit; DataGridView1.DataSource = BL.GetAllTrabajadoresReactivar(VariablesPublicas.EmpresaID, BE).Tables[0]; }
private void CargaDatos() { var xtipoplanilla = string.Empty; var xestadotrab = string.Empty; var xtipolocal = string.Empty; if (cmbfiltroestado.Enabled) { if (cmbfiltroestado.SelectedValue != null) { xestadotrab = cmbfiltroestado.SelectedValue.ToString(); } } if (cmbfiltrotipolocal.Enabled) { if (cmbfiltrotipolocal.SelectedValue != null) { xtipolocal = cmbfiltrotipolocal.SelectedValue.ToString(); } } if (cmbfiltrotipoplanilla.Enabled) { if (cmbfiltrotipoplanilla.SelectedValue != null) { xtipoplanilla = cmbfiltrotipoplanilla.SelectedValue.ToString(); } } var xxxswload = Sw_LOad; Sw_LOad = true; var BLES = new tb_plla_establecimientosBL(); var BEES = new tb_plla_establecimientos(); BEES.empresaid = VariablesPublicas.EmpresaID; BEES.norden = 1; BEES.ver_blanco = 0; cmbfiltrotipolocal.DisplayMember = "estabname"; cmbfiltrotipolocal.ValueMember = "estabid"; cmbfiltrotipolocal.DataSource = BLES.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BEES).Tables[0]; cmbtipolocal.DisplayMember = "estabname"; cmbtipolocal.ValueMember = "estabid"; cmbtipolocal.DataSource = BLES.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BEES).Tables[0]; Sw_LOad = xxxswload; var nposcolumnasortear = 0; var PrvSotOrder = default(SortOrder); var xnumdoclike = txtfiltronumdoc.Text; var xcodlike = txtfiltrocodigo.Text; 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["fichaid"].Value.ToString(); } if (Examinar.SortedColumn != null) { nposcolumnasortear = Examinar.SortedColumn.Index; PrvSotOrder = Examinar.SortOrder; zordenado = true; } var nestadotrab = 1; if (txtfiltronumdoc.Enabled) { xnumdoclike = txtfiltronumdoc.Text; } if (chkvercesados.Checked) { nestadotrab = 0; } if (txtfiltrocodigo.Enabled) { xcodlike = txtfiltrocodigo.Text; } var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = xcodlike; BE.Nrodni = xnumdoclike; BE.Norden = 1; BE.Nomlike1 = xpalabra1; BE.Nomlike2 = xpalabra2; BE.Nomlike3 = xpalabra3; BE.Estado_trabaj = nestadotrab; BE.Tipoplla = xtipoplanilla; BE.Situtrabid = xestadotrab; BE.Establec = xtipolocal; tablaclientes = BL.GetAll_Consulta(VariablesPublicas.EmpresaID, BE).Tables[0]; lbltotaltrab.Text = string.Empty; if (BL.Sql_Error.Length == 0) { lbltotaltrab.Text = "Total Trabajadores " + tablaclientes.Rows.Count.ToString(); } Examinar.AutoGenerateColumns = false; Examinar.DataSource = tablaclientes; VariablesPublicas.PintaEncabezados(Examinar); if (zordenado) { if (PrvSotOrder == SortOrder.Ascending) { Examinar.Sort(Examinar.Columns[nposcolumnasortear], ListSortDirection.Ascending); } else { Examinar.Sort(Examinar.Columns[nposcolumnasortear], ListSortDirection.Descending); } } else { Examinar.Sort(Examinar.Columns["nombrelargo"], ListSortDirection.Ascending); } if (Examinar.CurrentRow == null) { if (Examinar.RowCount > 0) { Examinar.CurrentCell = Examinar.Rows[0].Cells["fichaid"]; } } for (lc_cont = 0; lc_cont <= Examinar.Rows.Count - 1; lc_cont++) { if (Examinar.Rows[lc_cont].Cells["fichaid"].Value.ToString() == xcodcliente) { Examinar.CurrentCell = Examinar.Rows[lc_cont].Cells["fichaid"]; break; } } }
public DataSet GetOne(string empresaid, tb_plla_fichatrabajadores BE) { using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid))) { using (SqlCommand cmd = new SqlCommand("gspTbPllaFichatrabajadores_SELECT", cnx)) { DataSet ds = new DataSet(); { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@fichaid", SqlDbType.Char, 2).Value = BE.Fichaid; } 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); } } } }
public bool U_Validacion() { var xmsg = string.Empty; var objeto = new object(); DataTable tmptabla = null; if (txtnombres.Text.Trim().Length == 0) { xmsg = "Ingrese Apellidos y Nombres del Trabajador"; objeto = txtNombrelargo; } else { if (txtDni.Text.Length > 0) { if (u_n_opsel == 1 | (!(j_Ruc == txtDni.Text))) { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Tipdocid = cboTipdoc.SelectedValue.ToString(); BE.Nrodni = txtDni.Text.Trim(); tmptabla = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; if (tmptabla.Rows.Count > 0) { xmsg = "DNI ya registrado"; objeto = txtDni; } } } if (u_n_opsel == 1) { if (txtcodigo.Text.Trim().Length == 0) { xmsg = "Ingrese Código"; objeto = txtcodigo; } else { var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Fichaid = txtcodigo.Text.Trim(); BE.Empresaid = cbo_empresaid.SelectedValue.ToString(); tmptabla = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; if (tmptabla.Rows.Count > 0) { xmsg = "Código ya registrado"; objeto = txtcodigo; } } } } if (fIngreso.Checked == false) { xmsg = xmsg + "\r" + "Ingrese fecha de ingreso"; objeto = fIngreso; } if (xmsg.Trim().Length == 0) { if (!(VM_AntiguoValorImagen == VM_mimagen_3)) { if (!VariablesPublicas.CopiarArchivo(VM_mimagen_3)) { xmsg = xmsg + "\r" + "Error al Subir Archivo"; } else { VM_mimagen_3 = VariablesPublicas.NombreArchivoSubido; } } } if (u_n_opsel == 1 | !(vm_Nombretrabajador == txtapepat.Text.Trim() + " " + txtapemat.Text.Trim() + " " + txtnombres.Text.Trim())) { string tmpstring = null; tmpstring = txtapepat.Text.Trim() + " " + txtapemat.Text.Trim() + " " + txtnombres.Text.Trim(); var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Nombrelargo = VariablesPublicas.Palabras(tmpstring, 1); BE.Nombrelargo = VariablesPublicas.Palabras(tmpstring, 2); BE.Nombrelargo = VariablesPublicas.Palabras(tmpstring, 3); BE.Nrodni = txtDni.Text.Trim(); tmpcursor = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0]; if (BL.Sql_Error.Length > 0) { Frm_Class.ShowError(BL.Sql_Error + "\r" + "Error al validar duplicidad de nombres", this); return false; } if (tmpcursor.Rows.Count > 0) { if (u_n_opsel == 1) { xmsg = xmsg + "\r" + "Trabajador ya se encuentra registrado con código " + tmpcursor.Rows[0]["fichaid"] + "-" + tmpcursor.Rows[0]["nombrelargo"]; objeto = txtapemat; } else { for (lc_cont = 0; lc_cont <= tmpcursor.Rows.Count - 1; lc_cont++) { if (!(tmpcursor.Rows[lc_cont]["fichaid"].ToString() == txtcodigo.Text)) { xmsg = xmsg + "\r" + "Trabajador ya se encuentra registrado con código " + tmpcursor.Rows[lc_cont]["fichaid"] + "-" + tmpcursor.Rows[lc_cont]["nombrelargo"]; objeto = txtapemat; break; } } } } } if (xmsg.Trim().Length > 0) { MessageBox.Show(xmsg.Trim(), "Error en Ingreso de Datos"); if ((objeto != null)) { objeto = Focus(); } } return xmsg.Trim().Length == 0; }
private void btnAceptar_Click(object sender, EventArgs e) { string ficha = null; string nombre = null; string empresa = null; if ((dgTrabProceso.CurrentRow != null)) { if (string.IsNullOrEmpty(txtjefe.Text.Trim())) { MessageBox.Show("Ingrese a un Jefe para Poder Cesar", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } ficha = dgTrabProceso["ficha", dgTrabProceso.CurrentRow.Index].Value.ToString(); empresa = dgTrabProceso["empresa", dgTrabProceso.CurrentRow.Index].Value.ToString(); nombre = dgTrabProceso["dficha", dgTrabProceso.CurrentRow.Index].Value.ToString().Trim(); if (MessageBox.Show("Desea Cesar al trabajador (" + ficha + ") " + nombre, string.Empty, MessageBoxButtons.YesNo) == DialogResult.Yes) { var retorno = false; var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.Empresaid = empresa.Trim(); BE.Fichaid = ficha.Trim(); BE.Jefe = txtjefe.Text.Trim().ToString(); BE.Fechcese = dtpFechaCese.Value; BE.Motivocese = cbMotivoCese.SelectedValue.ToString(); BE.Observacion = txtObs.Text.Trim(); retorno = BL.CesarTrabajadorUpdate(VariablesPublicas.EmpresaID, BE); if (retorno) { MessageBox.Show("Cesado Correctamente !!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); validacion_panel(true); Panel.Visible = false; if (swB == 2) { DesEnlazaControles(); } if (swB == 1) { EnlazarControles(); } limpiar(); } else { MessageBox.Show("Hubo problemas al momento de Cesar, cierra la ventana e intente de nuevo", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void btnficha_Click(object sender, EventArgs e) { if (u_n_opsel == 0 & (Examinar.CurrentRow != null)) { var xficha = Examinar.Rows[Examinar.CurrentRow.Index].Cells["fichaid"].Value.ToString(); var xempresa = Examinar.Rows[Examinar.CurrentRow.Index].Cells["empresaid"].Value.ToString(); var xfichero = string.Empty; DataTable dt = null; var ncont = 0; var zprocesafoto = false; var BL = new tb_plla_fichatrabajadoresBL(); var BE = new tb_plla_fichatrabajadores(); BE.FichaidIni = xficha; BE.FichaidFin = xficha; BE.Empresaid = xempresa; BE.Norden = 2; dt = BL.GetAll_FichaDatos(VariablesPublicas.EmpresaID, BE).Tables[0]; VariablesPublicas.CrearXml(dt, "fichadatos"); if (BL.Sql_Error.Trim().Length == 0) { if (dt.Rows.Count > 0) { for (ncont = 0; ncont <= dt.Rows.Count - 1; ncont++) { xfichero = string.Empty; zprocesafoto = false; if (dt.Rows[ncont]["fotografia"].ToString().Trim().Length > 0) { xfichero = GlobalVars.GetInstance().RutaFotoPersonal + dt.Rows[ncont]["fotografia"].ToString().Trim(); if (System.IO.File.Exists(xfichero)) { try { dt.Rows[ncont]["gfoto"] = VariablesPublicas.ImageToByte(System.Drawing.Image.FromFile(GlobalVars.GetInstance().RutaFotoPersonal + dt.Rows[ncont]["fotografia"].ToString().Trim()), true); zprocesafoto = true; } catch (Exception ex) { dt.Rows[ncont]["fotografia"] = string.Empty; } } } else { zprocesafoto = true; } if (!zprocesafoto) { dt.Rows[ncont]["gfoto"] = VariablesPublicas.ImageToByte(BapFormulariosNet.Properties.Resources.error, false); dt.Rows[ncont]["fotografia"] = "ERROR"; } } var frmreporte = new Frm_Reportes(); frmreporte.Table = dt; frmreporte.Reporte = new Crpt_FichaTrabajador(); frmreporte.Show(); } else { MessageBox.Show("No existe Información a Procesar", "Mensaje del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }
private void Frm_PllaAyudaRta5ta_Load(object sender, EventArgs e) { MaximizeBox = false; MinimizeBox = false; tb_plla_fichatrabajadoresBL BL = new tb_plla_fichatrabajadoresBL(); tb_plla_fichatrabajadores BE = new tb_plla_fichatrabajadores(); BE.Tipoplla = TipoPlanilla; dw = new DataView(BL.GetAll_TrabajadorRetenciones(VariablesPublicas.EmpresaID, BE).Tables[0]); dgAyuda.AutoGenerateColumns = false; dgAyuda.DataSource = dw; dgAyuda.Columns[0].DataPropertyName = "fichaid"; dgAyuda.Columns[1].DataPropertyName = "nombrelargo"; dgAyuda.Columns[2].DataPropertyName = "nrodni"; dgAyuda.Columns[3].DataPropertyName = "estado"; checks(); }