public Clases._VENOBSDOC BuscarAnterior(Clases._VENOBSDOC VOD) { dbSQLConn.ConecDb_Abrir(); Clases._VENOBSDOC usr = new Clases._VENOBSDOC(); NpgsqlDataReader Dr = null; string Sql = "SELECT " + Elementos1 + " FROM ventobsdoc WHERE codmov < @codmov ORDER BY codmov DESC LIMIT 1"; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); cmd.Parameters.AddWithValue("@codmov", VOD.codmov); Dr = cmd.ExecuteReader(); if (Dr.HasRows) { Dr.Read(); usr = LLenar1(Dr); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } else { Dr.Close(); dbSQLConn.ConecDb_Close(); return(BuscarPrimero()); } }
public Clases._VENOBSDOC BuscarPrimero() { dbSQLConn.ConecDb_Abrir(); Clases._VENOBSDOC usr = new Clases._VENOBSDOC(); NpgsqlDataReader Dr = null; string Sql = "SELECT " + Elementos1 + " FROM ventobsdoc ORDER BY codmov ASC LIMIT 1 "; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); Dr = cmd.ExecuteReader(); if (Dr.HasRows) { Dr.Read(); usr = LLenar1(Dr); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } else { Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } }
public Clases._VENOBSDOC Search_UltimoEntregaVac_OBS(int vcedper) { dbSQLConn.ConecDb_Abrir(); Clases._VENOBSDOC usr = new Clases._VENOBSDOC(); NpgsqlDataReader Dr = null; string Sql = "SELECT VEO.codmov, VEO.cedper, VEO.fecdoc, VEO.netdoc, VEO.brudoc, VEO.mtidoc, VEO.codrec, VEO.tiptid, VEO.cxcdoc, VEO.estdoc, VEO.condoc, VEO.stadoc, VEO.comdoc " + "FROM ventobsdoc AS VEO INNER JOIN movinv AS MOV ON VEO.codmov = MOV.codmov " + "WHERE VEO.tiptid = 'OBS' AND MOV.tiptra = 'S007' AND VEO.cedper = @cedper AND stadoc = 1 " + "ORDER BY VEO.codmov DESC"; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); cmd.Parameters.AddWithValue("@cedper", vcedper); Dr = cmd.ExecuteReader(); if (Dr.HasRows) { Dr.Read(); usr = LLenar1(Dr); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } else { MessageBox.Show("Al trabajado no se le ha entregado el beneficio de Vacaciones.", "AtenciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } }
public Clases._VENOBSDOC Search_UltimoEntrega_OBS(int vcedper) { dbSQLConn.ConecDb_Abrir(); Clases._VENOBSDOC usr = new Clases._VENOBSDOC(); NpgsqlDataReader Dr = null; string Sql = "SELECT " + Elementos1 + " FROM ventobsdoc WHERE cedper = @cedper AND tiptid = 'OBS' ORDER BY codmov DESC LIMIT 1"; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); cmd.Parameters.AddWithValue("@cedper", vcedper); Dr = cmd.ExecuteReader(); if (Dr.HasRows) { Dr.Read(); usr = LLenar1(Dr); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } else { MessageBox.Show("Al trabajado no se ultimas entrega.", "AtenciĆ³n", MessageBoxButtons.OK, MessageBoxIcon.Information); Dr.Close(); dbSQLConn.ConecDb_Close(); return(usr); } }
public Boolean AnularENC_OBS(Clases._VENOBSDOC clas) { if (ExisteOBS(clas.codmov, clas.cedper, clas.codrec, clas.tiptid)) { dbSQLConn.ConecDb_Abrir(); string Sql = "UPDATE ventobsdoc SET codmov = @codmov, stadoc = @stadoc WHERE codmov = @codmov "; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); cmd.Parameters.AddWithValue("@codmov", clas.codmov); cmd.Parameters.AddWithValue("@stadoc", clas.stadoc); int retVal = cmd.ExecuteNonQuery(); dbSQLConn.ConecDb_Close(); if (retVal == 1) { return(true); } else { return(false); } } else { return(false); } }
public Boolean NuevoOBS(Clases._VENOBSDOC clas) { if (!ExisteOBS(clas.codmov, clas.cedper, clas.codrec, clas.tiptid)) { dbSQLConn.ConecDb_Abrir(); string Sql = "INSERT INTO ventobsdoc (codmov, cedper, fecdoc, netdoc, brudoc, mtidoc, codrec, tiptid, cxcdoc, estdoc, condoc, stadoc, comdoc) " + "VALUES (@codmov, @cedper, @fecdoc, @netdoc, @brudoc, @mtidoc, @codrec, @tiptid, @cxcdoc, @estdoc, @condoc, @stadoc, @comdoc)"; NpgsqlCommand cmd = new NpgsqlCommand(Sql, dbSQLConn.Cnn); cmd.Parameters.AddWithValue("@codmov", clas.codmov); cmd.Parameters.AddWithValue("@cedper", clas.cedper); cmd.Parameters.AddWithValue("@fecdoc", clas.fecdoc); cmd.Parameters.AddWithValue("@netdoc", clas.netdoc); cmd.Parameters.AddWithValue("@brudoc", clas.brudoc); cmd.Parameters.AddWithValue("@mtidoc", clas.mtidoc); cmd.Parameters.AddWithValue("@codrec", clas.codrec); cmd.Parameters.AddWithValue("@tiptid", clas.tiptid); cmd.Parameters.AddWithValue("@cxcdoc", clas.cxcdoc); cmd.Parameters.AddWithValue("@estdoc", clas.estdoc); cmd.Parameters.AddWithValue("@condoc", clas.condoc); cmd.Parameters.AddWithValue("@stadoc", clas.stadoc); cmd.Parameters.AddWithValue("@comdoc", clas.comdoc); cmd.ExecuteNonQuery(); dbSQLConn.ConecDb_Close(); return(true); } else { return(false); } }