lunes, 3 de octubre de 2022

Operaciones sobre tablas

//Agregar un registro
nRenglon = TableCount(TABLE_Detalle)
nRenglon++
TableAdd(TABLE_Detalle)
TABLE_Detalle[nRenglon].COL_IdDB_Articulo = DB_Articulo.IdDB_Articulo
TABLE_Detalle[nRenglon].COL_CodBarras = DB_Articulo.CodigoBarra
TABLE_Detalle[nRenglon].COL_Descripcion = DB_Articulo.Descripcion
TABLE_Detalle[nRenglon].COL_Caducidad = EDT_Caducidad
TABLE_Detalle[nRenglon].COL_Lote = EDT_Lote
TABLE_Detalle[nRenglon].COL_PrecMaxPub = EDT_PrecioMaxPublico
TABLE_Detalle[nRenglon].COL_Cantidad = EDT_Cantidad
TABLE_Detalle[nRenglon].COL_ValorUnitario = EDT_ValorUnitario
TABLE_Detalle[nRenglon].COL_Importe = EDT_Importe
TABLE_Detalle[nRenglon].COL_Descuento = EDT_Descuento
TABLE_Detalle[nRenglon].COL_IVAMonto = EDT_IVA
TABLE_Detalle[nRenglon].COL_IVATasa = EDT_IVATasa
TABLE_Detalle[nRenglon].COL_IEPSMonto = EDT_IEPS
TABLE_Detalle[nRenglon].COL_IEPSTasa = EDT_IEPSTasa
TABLE_Detalle[nRenglon].COL_Total = EDT_Total


//Modificar una cantidad 

IF TableSelect(TABLE_Articulos) = -1 RETURN
nPosicion is int
nTotalRenglones is int
cyCantidad is currency
TableSetFocus(TABLE_Articulos)
// Number of rows found in the "TABLE_Product" control
nTotalRenglones = TableCount(TABLE_Articulos)
// Subscript of selected row in the "TABLE_Product" control
nPosicion     = TableSelect(TABLE_Articulos)
cyCantidad    = Open(WIN_Cantidad)
IF cyCantidad > 0 THEN
    TableSelectPlus(TABLE_Articulos, nPosicion)
    //TableDeleteSelect(TABLE_Articulos)
    TABLE_Articulos.COL_Cantidad = cyCantidad
    TABLE_Articulos.COL_Total = cyCantidad * TABLE_Articulos.COL_PU
    LP_Actualiza()
END

//Borrar

IF TableSelect(TABLE_Articulos) = -1 RETURN
nPosicion is int
nTotalRenglones is int
TableSetFocus(TABLE_Articulos)
// Number of rows found in the "TABLE_Product" control
nTotalRenglones = TableCount(TABLE_Articulos)
// Subscript of selected row in the "TABLE_Product" control
nPosicion = TableSelect(TABLE_Articulos)
TableSelectPlus(TABLE_Articulos, nPosicion)
TableDeleteSelect(TABLE_Articulos)
LP_Actualiza()



////moverse hacia abajo
IF TableSelect(TABLE_Articulos) = -1 RETURN
nPosicion is int
nTotalRenglones is int
TableSetFocus(TABLE_Articulos)
// Number of rows found in the "TABLE_Product" control
nTotalRenglones = TableCount(TABLE_Articulos)
// Subscript of selected row in the "TABLE_Product" control
nPosicion = TableSelect(TABLE_Articulos)
IF nPosicion < nTotalRenglones THEN nPosicion++
TableSelectPlus(TABLE_Articulos, nPosicion)



//Moverse hacia arriba

IF TableSelect(TABLE_Articulos) = -1 RETURN
nPosicion is int
nTotalRenglones is int
TableSetFocus(TABLE_Articulos)
// Number of rows found in the "TABLE_Product" control
nTotalRenglones = TableCount(TABLE_Articulos)
// Subscript of selected row in the "TABLE_Product" control
nPosicion = TableSelect(TABLE_Articulos)
IF nPosicion > 1 THEN nPosicion--
TableSelectPlus(TABLE_Articulos, nPosicion)

No hay comentarios.:

Publicar un comentario

Try catch end

 // -------------------------------------------------- // Procedure principal que executa uma query com tratamento de exceção // -----------...