-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CRUD BALANZA INSUMOS RECETAS DTRECETAS
- Loading branch information
1 parent
0627db8
commit d4b9bc5
Showing
27 changed files
with
3,322 additions
and
2,172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
procedure pPostBalanza(entidad : TypMantGenerico); | ||
sql : string; | ||
conexion : integer; | ||
sResultado : SysCode; | ||
id : integer; | ||
l_Nombretabla:string:="Balanza"; | ||
begin | ||
id := fGetNextId(l_Nombretabla,CONST_MAX_DB_BALANZA); | ||
sql := "Insert into Balanza (Id, Numero, Nombre) values ("; | ||
sql := sql + IntegerToString(id, 0) + ","; | ||
sql := sql + "'"+ entidad.Codigo + "', "; | ||
sql := sql + "'" +entidad.Nombre + "')"; | ||
|
||
sResultado := DbExec(sql, conexion); | ||
if (sResultado <> SysOk) then | ||
pLoggerDB("pPostBalanza",DBErrMsg); | ||
return; | ||
end if; | ||
--pMostrarYLimpiar("Se agrego correctamente"); | ||
end; | ||
|
||
procedure pPutBalanza(entidad : TypMantGenerico); | ||
sql : string; | ||
conexion : integer; | ||
sResultado : SysCode; | ||
|
||
begin | ||
sql:="Update Balanza set "; | ||
sql:=sql + "Numero='" + entidad.Codigo+ "',"; | ||
sql:=sql + "nombre='" + entidad.Nombre + "' "; | ||
sql:=sql + "where id="+IntegerToString(g_IdItemActual,0); | ||
|
||
sResultado := DbExec(sql, conexion); | ||
if (sResultado <> SysOk) then | ||
pLoggerDB("pPutBalanza",DBErrMsg); | ||
return; | ||
end if; | ||
|
||
pMostrarYLimpiar("Se actualizo con Éxito"); | ||
end; | ||
|
||
function fGetBalanza(Id : integer) : TypBalanza; | ||
sql : string; | ||
conexion : integer; | ||
sResultado : SysCode; | ||
Balanza : TypBalanza; | ||
begin | ||
sql:="select * from Balanza where id = "; | ||
sql:=sql + IntegerToString(Id, 0); | ||
|
||
sResultado := DbExec(sql, conexion); | ||
--Primero verificamos que la consulta sea diferente de OK. Esto es error | ||
if(sResultado<>SysOk) then | ||
pLoggerDB("fGetBalanza",DBErrMsg); | ||
return Balanza; | ||
end if; | ||
|
||
-- Luego verificamos que la conexión sea = 0. Eso quiere decir que no hay datos para recuperar | ||
if (conexion=0) then | ||
return Balanza; | ||
end if; | ||
|
||
-- Caso contrario, tomamos los datos y los leemos. | ||
DbColumnInt(conexion, 1, Balanza.Id); | ||
DbColumnString(conexion, 2, Balanza.Numero); | ||
DbColumnString(conexion, 3, Balanza.Nombre); | ||
sResultado := DbNext(conexion); | ||
DbFinalize(conexion); | ||
pMostrarYLimpiar("Se obtuvo correctamente"); | ||
return Balanza; | ||
end; | ||
|
||
|
||
|
||
function fListaBalanza : TypArrayBalanza; | ||
sql : string; | ||
conexion : integer; | ||
sResultado : SysCode; | ||
listado : TypArrayBalanza; | ||
indice : integer; | ||
begin | ||
sql := "select * from Balanza order by Id asc limit "+IntegerToString(g_ItemsPorPagina,0); | ||
sql :=sql + " Offset "+IntegerToString(g_PaginaActual - 1, 0); | ||
|
||
sResultado := DbExec(sql, conexion); | ||
--Primero verificamos que la consulta sea diferente de OK. Esto es error | ||
if(sResultado<>SysOk) then | ||
pLoggerDB("fListaBalanza",DBErrMsg); | ||
return listado; | ||
end if; | ||
|
||
-- Luego verificamos que la conexión sea = 0. Eso quiere decir que no hay datos para recuperar | ||
if (conexion=0) then | ||
return listado; | ||
end if; | ||
|
||
-- Caso contrario, tomamos los datos y los leemos. | ||
|
||
indice := 0; | ||
while sResultado = SysOk | ||
loop | ||
indice := indice +1; | ||
DbColumnInt(conexion, 1, listado[indice].Id); | ||
DbColumnString(conexion, 2, listado[indice].Numero); | ||
DbColumnString(conexion, 3, listado[indice].Nombre); | ||
sResultado := DbNext(conexion); | ||
end loop; | ||
|
||
DbFinalize(conexion); | ||
--pMostrarYLimpiar("Se listo correctamente"); | ||
|
||
return listado; | ||
end; | ||
|
||
function fExisteCodigoBalanza (Numero:string) : BooleanType; | ||
sql : string; | ||
conexion : integer; | ||
sResultado : SysCode; | ||
cantidad :integer; | ||
begin | ||
sql:="select count(1) from Balanza where Numero='"+Numero+"' "; | ||
sResultado := DbExec(sql, conexion); | ||
if (sResultado <> SysOk or conexion = 0) then | ||
pLoggerDB("fExisteCodigoBalanza",DBErrMsg); | ||
return BoolTrue; | ||
|
||
end if; | ||
|
||
DbColumnInt(conexion,1,cantidad); | ||
DbFinalize(conexion); | ||
if (cantidad=0) then | ||
return BoolFalse; | ||
else | ||
return BoolTrue; | ||
end if; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,42 @@ | ||
Procedure pMuestraPromptEliminar; | ||
begin | ||
if (g_TipoMant = tipoMantEliminar) then | ||
if g_NombreMenuMantto = CONST_INSUMO_LABEL then | ||
PromptUser("¿Desea Desctivar el Insumo? "); | ||
else | ||
PromptUser("¿Desea eliminar el registro?"); | ||
end if; | ||
end if; | ||
end; | ||
|
||
Procedure pMuestraPromptEliminarItemReceta; | ||
begin | ||
if (g_TipoMant = tipoMantEliminarItemReceta) then | ||
PromptUser("¿Desea eliminar el Item de la Receta?"); | ||
end if; | ||
end; | ||
|
||
|
||
|
||
procedure pEliminarRegistroDB(id:integer); | ||
begin | ||
if (g_TipoMant = tipoMantEliminar) then | ||
PromptUser("¿Esta seguro de eliminar el registro?"); | ||
if EventKey = EnterKey then | ||
if (g_NombreMenuMantto = CONST_RECETA_LABEL) then | ||
if (g_NombreMenuMantto = CONST_RECETA_LABEL) then | ||
if fCantidadItemsEnDtReceta(Id)=0 then | ||
pDeleteItemTabla("Receta",id); | ||
pMuestraReceta; | ||
elsif (g_NombreMenuMantto = CONST_INSUMO_LABEL) then | ||
pDeleteItemTabla("Insumo",id); | ||
pMuestraInsumo; | ||
else | ||
pMostrarYLimpiar("Debe eliminar los Items Primero"); | ||
end if; | ||
--pDeleteItemTabla("Receta",id); | ||
--pMuestraReceta; | ||
elsif (g_NombreMenuMantto = CONST_INSUMO_LABEL) then | ||
pDesactivarItemInsumo(id); | ||
pMuestraInsumo; | ||
elsif (g_NombreMenuMantto = CONST_BALANZA_LABEL) then | ||
pDeleteItemTabla("Balanza",id); | ||
pMuestraBalanza; | ||
end if; | ||
end if; | ||
end; | ||
|
||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.