Página 1 de 1

Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 11 Nov 2017 17:11
por dripro
HIDE: ON
Hidebb Message Hidden Description

Imagen

script
foundDBF = Folder.DoesExist(_SourceFolder .."\\DataBase");
if not foundDBF then
Folder.Create(_SourceFolder .."\\DataBase");
end

-------------------------------------------------------------------------------------------------------->> OPEN SQLite3
sDatabase = _SourceFolder.."\\DataBase\\db.db"
tInfo_Selected = nil;
db = SQLite3.Open(sDatabase);
nLastError = Application.GetLastError();
if nLastError ~= SQLite3.OK then
Dialog.Message("Error de Apertura de Base de Datos", SQLite3.GetLastErrorString());
end



function Convertdate(strdate)
if strdate then
if (tonumber(strdate)< 10) and (String.Length(strdate)<2) then
newDate = "0"..strdate
else
newDate =strdate
end
end
return newDate
end

-------------------------------------------------------------------------------------------------------->> CRIAR TABELA
SQLite3.Query(db,"CREATE TABLE Ussers (RecordID INTEGER  PRIMARY KEY,"
.."\r\DATA            TEXT,"
.."\r\TIPO            TEXT,"
.."\r\DESCRISAO       TEXT,"
.."\r\ENTRADA_1       TEXT,"
.."\r\ENTRADA_2       TEXT,"
.."\r\SAIDA_1         TEXT,"
.."\r\SAIDA_2         TEXT,"
.."\r\SALDO           TEXT)")
SQLite3.Query(db, "CREATE TABLE Backup (RecordID INTEGER  PRIMARY KEY,Date TEXT, Path TEXT)");
Backup = false;

-----------------------------------------------------------------------------------------------------------------------------------------------------------==
function InputSoloNumeros(HwndInput)------------->> Só Opitar por Numeros
Args1                  = string.format("%d,%d", HwndInput, -16)
GetWinLong             = DLL.CallFunction("user32.dll", "GetWindowLongA", Args1, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
Args2                  = string.format("%d,%d,%d", HwndInput, -16, GetWinLong + 8192)
DLL.CallFunction("user32.dll", "SetWindowLongA", Args2, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
end

-----------------------------------------------------------------------------------------------------------------------------------------------------------==
function HabilitarObjetos()------------->> Habilitar verdadeiro
if (i == 1) then
for count = 1,3 do
tProperties = {};
tProperties.ReadOnly = false;
Input.SetProperties("Input"..count, tProperties);
WinApi.EnableWindow(DialogEx.Close(IDOK), true);
i = 0;
end 
end
end

-----------------------------------------------------------------------------------------------------------------------------------------------------------==
function DesabilitarObjetos()------------->> Desabilitar falso
if (i == 1) then
else
for count = 1,3 do
tProperties = {};
tProperties.ReadOnly = true;
Input.SetProperties("Input"..count, tProperties);
i = 1;
end 
end
end
DesabilitarObjetos()

-----------------------------------------------------------------------------------------------------------------------------------------------------------==

Page.StartTimer(100, 1);
Page.StartTimer(100, 2);

-----------------------------------------------------------------------------------------------------------------------------------------------------------==
function Pesquisar_Tabela()

Grid.DeleteNonFixedRows("Grid1", true);----->> Adicionar textos ao cabeçalho das colunas da grade
Grid.SetCellText("Grid1", 0, 0,        "ID", false); 
Grid.SetCellText("Grid1", 0, 1,      "DATA", false);  
Grid.SetCellText("Grid1", 0, 2,      "TIPO", false);
Grid.SetCellText("Grid1", 0, 3, "DESCRIÇÃO", false);
Grid.SetCellText("Grid1", 0, 4,   "ENTRADA", false);
Grid.SetCellText("Grid1", 0, 5,     "SAÍDA", false);
Grid.SetCellText("Grid1", 0, 6,     "SALDO", false);
Grid.Refresh("Grid1")


tInfo_Selected = SQLite3.QueryToTable(db, "Select * from Ussers", true)
for nRow = 1, tInfo_Selected.Rows do

for i, v in pairs (Pesquisar) do	
if (String.Find(tInfo_Selected.Data[nRow]["TIPO"]..tInfo_Selected.Data[nRow]["DATA"], v, 1, false) ~= -1) then

local nLine = Grid.InsertRow("Grid1", -1, false);  
Grid.SetCellText("Grid1",  nLine, 0, tInfo_Selected.Data[nRow]["RecordID"], false);    
Grid.SetCellText("Grid1",      nLine, 1, tInfo_Selected.Data[nRow]["DATA"], false);
Grid.SetCellText("Grid1",      nLine, 2, tInfo_Selected.Data[nRow]["TIPO"], false);
Grid.SetCellText("Grid1", nLine, 3, tInfo_Selected.Data[nRow]["DESCRISAO"], false);
Grid.SetCellText("Grid1", nLine, 4, tInfo_Selected.Data[nRow]["ENTRADA_1"], false);
Grid.SetCellText("Grid1",   nLine, 5, tInfo_Selected.Data[nRow]["SAIDA_1"], false);
Grid.SetCellText("Grid1",     nLine, 6, tInfo_Selected.Data[nRow]["SALDO"], false);

    end
    end
end

-----------------------------------------------------------------------------------------------------------------------------------------------------------==
saldo = 0;
for x = 1, Grid.GetRowCount ("Grid1")-1 do
if Grid.GetCellText("Grid1", x, 4) ~= nil then
saldo = saldo + String.ToNumber (Grid.GetCellText("Grid1", x, 4)) - String.ToNumber (Grid.GetCellText("Grid1", x, 5)) --->> Somar
local   nNumber = saldo
local  sCountry = "R$"
local  bDecimal = true
local sCurrency = CurrencyGeran.ToCurrency(nNumber, sCountry, bDecimal);
Grid.SetCellText("Grid1", x, 6, sCurrency, true); --->> Resultado
end
end


-----------------------------------------------------------------------------------------------------------------------------------------------------------==
entrada = 0;
for x = 1, Grid.GetRowCount ("Grid1")-1 do
if Grid.GetCellText("Grid1", x, 4) ~= nil then
entrada = entrada + String.ToNumber (Grid.GetCellText("Grid1", x, 4))
local   nNumber = entrada
local  sCountry = "R$"
local  bDecimal = true
local sCurrency = CurrencyGeran.ToCurrency(nNumber, sCountry, bDecimal);
Input.SetText("Input8", sCurrency);
end
end

saida = 0
for x = 1, Grid.GetRowCount ("Grid1")-1 do
if Grid.GetCellText("Grid1", x, 5) ~= nil then
saida = saida + String.ToNumber (Grid.GetCellText("Grid1", x, 5))
local   nNumber = saida
local  sCountry = "R$"
local  bDecimal = true
local sCurrency = CurrencyGeran.ToCurrency(nNumber, sCountry, bDecimal);
Input.SetText("Input9", sCurrency);

end
end
returnNumber = 0
function OPERATION(operat)
number = entrada
if number == "" then
returnNumber = 0
else
returnNumber =  String.ToNumber(number)
operation = operat
end
end
OPERATION("moins")
number = saida
if operation == "moins" then
returnNumber = returnNumber - String.ToNumber(number) 
end

local   nNumber = returnNumber
local  sCountry = "R$"
local  bDecimal = true
local sCurrency = CurrencyGeran.ToCurrency(nNumber, sCountry, bDecimal);
Input.SetText("Input10", sCurrency);

-----------------------------------------------------------------------------------------------------------------------------------------------------------==


-------------------------------->> Entrada
entrada = 0;
for x = 1, Grid.GetRowCount ("Grid1")-1 do
if Grid.GetCellText ("Grid1", x, 4) ~= "" and String.ToNumber (Grid.GetCellText ("Grid1", x, 4)) ~= 0 then --->> Virificar se ha numero
entrada = String.ToNumber (Grid.GetCellText("Grid1", x, 4))
local   nNumber = entrada
local  sCountry = "R$"
local  bDecimal = true
local sCurrency = CurrencyGeran.ToCurrency(nNumber, sCountry, bDecimal);
Grid.SetCellText("Grid1", x, 4, sCurrency, true);
end
end

-------------------------------->> Saida
saida = 0;
for x = 1, Grid.GetRowCount ("Grid1")-1 do
if Grid.GetCellText ("Grid1", x, 5) ~= "" and String.ToNumber (Grid.GetCellText ("Grid1", x, 5)) ~= 0 then --->> Virificar se ha numero
saida = String.ToNumber (Grid.GetCellText("Grid1", x, 5))
local   nNumber = saida
local  sCountry = "R$"
local  bDecimal = true
local sCurrency = CurrencyGeran.ToCurrency(nNumber, sCountry, bDecimal);
Grid.SetCellText("Grid1", x, 5, sCurrency, false);
end
end
--------------------------------------------------------------------------------------------------------------------------------------------------==

Grid.AutoSize("Grid1", GVS_BOTH, true);
Grid.AutoSizeColumns("Grid1", GVS_BOTH, true);
Grid.ExpandColumnsToFit("Grid1", true, true);
--Grid.ExpandRowsToFit("Grid1", true, true);
Grid.Refresh("Grid1")

end

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 13 Nov 2017 04:56
por Dow Sher
Gracias por tu aporte... Le echaré un ojo...
Muevo a foro correspondiente 'Ejemplos y Plantillas'

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 14 Nov 2017 04:23
por luasqlite
El gran dipro :pc: :pc:

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 14 Nov 2017 15:32
por dripro
luasqlite escribió:
14 Nov 2017 04:23
El gran dipro :pc: :pc:
grande amigo lene

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 19 Dic 2017 03:16
por oussemaTN
thnkssssssssssssssss

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 20 Ene 2018 00:39
por usamakey
tnks m8

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 10 May 2018 20:33
por THEBEST1
gracias

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 17 May 2018 14:20
por mrflowers
Gracias

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 30 May 2018 14:30
por miguelangel_one
muchas gracias...

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 28 Nov 2019 01:31
por traveler
gracias

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 27 Dic 2019 17:43
por traveler
Would anyone have this project to pass me because the Mega link is no longer available?
Thanks.

¿Alguien tendría este proyecto para aprobarme porque el enlace Mega ya no está disponible?
Gracias.

Alguém teria este projeto para me passar pois o link do Mega já não está mais disponível?
Obrigado.

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 03 Ene 2020 21:17
por marcpv89
probando

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 04 Ene 2020 16:17
por patch
Not something I would ever use but I have to say it's a nice example well done.

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 15 Ene 2020 22:45
por RuHor
thanks

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 10 Feb 2020 20:15
por sistemci1988
thank you

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 25 Abr 2021 04:27
por orthiismusic
gracias

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 09 Oct 2021 05:39
por medo6704
Thank you

Re: Exemple SQLite3 - Entrada Saída e Saldo

Publicado: 17 Oct 2021 22:57
por plusteam
Parece Bonito..