Compare commits
No commits in common. "1ce32959d2c16ee7d05aaa8b81e51de19f3ccaa3" and "3595e5ff641db788d0b23ae7c422ffd875694222" have entirely different histories.
1ce32959d2
...
3595e5ff64
26 changed files with 435 additions and 1108 deletions
|
|
@ -4,11 +4,11 @@ PARAM qtd AS INTEGER LIKE 10 DESCRIPTION "Quantity to add to stock"
|
|||
DESCRIPTION "Add stock quantity for a product by SKU"
|
||||
|
||||
person = FIND "People.xlsx", "id=" + mobile
|
||||
vendor = FIND ".Vendedores", "id=" + person.erpId
|
||||
vendor = FIND "maria.Vendedores", "id=" + person.erpId
|
||||
|
||||
TALK "Olá " + vendor.Contato_Nome + "!"
|
||||
|
||||
produto = FIND ".Produtos", "sku=" + sku
|
||||
produto = FIND "maria.Produtos", "sku=" + sku
|
||||
|
||||
IF NOT produto THEN
|
||||
TALK "Produto não encontrado."
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ DO WHILE page > 0 AND page <= pages
|
|||
itemCount = UBOUND(items)
|
||||
|
||||
IF itemCount > 0 THEN
|
||||
MERGE ".ContasAReceber" WITH items BY "Id"
|
||||
MERGE "maria.ContasAReceber" WITH items BY "Id"
|
||||
totalReceber = totalReceber + itemCount
|
||||
page = page + 1
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ DO WHILE page > 0 AND page <= pages
|
|||
itemCount = UBOUND(items)
|
||||
|
||||
IF itemCount > 0 THEN
|
||||
MERGE ".ContasAPagar" WITH items BY "Id"
|
||||
MERGE "maria.ContasAPagar" WITH items BY "Id"
|
||||
totalPagar = totalPagar + itemCount
|
||||
page = page + 1
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ DO WHILE i > 0 AND i < pages
|
|||
produto.hierarquia = "s"
|
||||
END IF
|
||||
|
||||
produtoDB = FIND ".Produtos", "sku=" + produto.codigo
|
||||
produtoDB = FIND "maria.Produtos", "sku=" + produto.codigo
|
||||
IF produtoDB THEN
|
||||
IF produtoDB.preco <> produto.preco THEN
|
||||
hist = NEW OBJECT
|
||||
|
|
@ -51,7 +51,7 @@ DO WHILE i > 0 AND i < pages
|
|||
hist.precoAtual = produto.preco
|
||||
hist.produto_id = produto.id
|
||||
hist.dataModificado = FORMAT today, "yyyy-MM-dd"
|
||||
SAVE ".HistoricoPreco", hist
|
||||
SAVE "maria.HistoricoPreco", hist
|
||||
hist = null
|
||||
END IF
|
||||
END IF
|
||||
|
|
@ -63,7 +63,7 @@ DO WHILE i > 0 AND i < pages
|
|||
list = null
|
||||
list = items
|
||||
|
||||
MERGE ".Produtos" WITH list BY "Id"
|
||||
MERGE "maria.Produtos" WITH list BY "Id"
|
||||
list = items
|
||||
|
||||
j = 0
|
||||
|
|
@ -86,7 +86,7 @@ DO WHILE i > 0 AND i < pages
|
|||
k = 0
|
||||
DO WHILE k < ubound(listV)
|
||||
listV[k].hierarquia = 'f'
|
||||
DELETE ".ProdutoImagem", "sku=" + listV[k].sku
|
||||
DELETE "maria.ProdutoImagem", "sku=" + listV[k].sku
|
||||
|
||||
images = listV[k]?.midia?.imagens?.externas
|
||||
l = 0
|
||||
|
|
@ -96,16 +96,16 @@ DO WHILE i > 0 AND i < pages
|
|||
images[l].id = random()
|
||||
l = l + 1
|
||||
LOOP
|
||||
SAVE ".ProdutoImagem", images
|
||||
SAVE "maria.ProdutoImagem", images
|
||||
images = null
|
||||
k = k + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Produtos" WITH listV BY "Id"
|
||||
MERGE "maria.Produtos" WITH listV BY "Id"
|
||||
END IF
|
||||
listV = null
|
||||
|
||||
DELETE ".ProdutoImagem", "sku=" + list[j].sku
|
||||
DELETE "maria.ProdutoImagem", "sku=" + list[j].sku
|
||||
k = 0
|
||||
images = list[j].midia?.imagens?.externas
|
||||
DO WHILE k < ubound(images)
|
||||
|
|
@ -114,7 +114,7 @@ DO WHILE i > 0 AND i < pages
|
|||
images[k].id = random()
|
||||
k = k + 1
|
||||
LOOP
|
||||
SAVE ".ProdutoImagem", images
|
||||
SAVE "maria.ProdutoImagem", images
|
||||
j = j + 1
|
||||
LOOP
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ DO WHILE i > 0 AND i < pages
|
|||
items[k].custo = items[k].valor / 2
|
||||
k = k + 1
|
||||
LOOP
|
||||
MERGE ".PedidosItem" WITH items BY "Id"
|
||||
MERGE "maria.PedidosItem" WITH items BY "Id"
|
||||
|
||||
items = res.data.parcelas
|
||||
k = 0
|
||||
|
|
@ -163,14 +163,14 @@ DO WHILE i > 0 AND i < pages
|
|||
items[k].pedido_id = pedido_id
|
||||
k = k + 1
|
||||
LOOP
|
||||
MERGE ".Parcela" WITH items BY "Id"
|
||||
MERGE "maria.Parcela" WITH items BY "Id"
|
||||
|
||||
fullList[j] = res.data
|
||||
res = null
|
||||
j = j + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Pedidos" WITH fullList BY "Id"
|
||||
MERGE "maria.Pedidos" WITH fullList BY "Id"
|
||||
i = i + 1
|
||||
IF list?.length < limit THEN
|
||||
i = 0
|
||||
|
|
@ -201,7 +201,7 @@ DO WHILE syncPage > 0 AND syncPage <= pages
|
|||
syncCount = UBOUND(syncItems)
|
||||
|
||||
IF syncCount > 0 THEN
|
||||
MERGE ".CategoriaReceita" WITH syncItems BY "Id"
|
||||
MERGE "maria.CategoriaReceita" WITH syncItems BY "Id"
|
||||
totalCategoria = totalCategoria + syncCount
|
||||
syncPage = syncPage + 1
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ DO WHILE syncPage > 0 AND syncPage <= pages
|
|||
syncCount = UBOUND(syncItems)
|
||||
|
||||
IF syncCount > 0 THEN
|
||||
MERGE ".FormaDePagamento" WITH syncItems BY "Id"
|
||||
MERGE "maria.FormaDePagamento" WITH syncItems BY "Id"
|
||||
totalForma = totalForma + syncCount
|
||||
syncPage = syncPage + 1
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ DO WHILE i > 0 AND i < pages
|
|||
j = j + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Contatos" WITH items BY "Id"
|
||||
MERGE "maria.Contatos" WITH items BY "Id"
|
||||
i = i + 1
|
||||
IF list?.length < limit THEN
|
||||
i = 0
|
||||
|
|
@ -305,7 +305,7 @@ DO WHILE i > 0 AND i < pages
|
|||
j = j + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Vendedores" WITH items BY "Id"
|
||||
MERGE "maria.Vendedores" WITH items BY "Id"
|
||||
i = i + 1
|
||||
IF list?.length < limit THEN
|
||||
i = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ SET SCHEDULE "0 30 23 * * *"
|
|||
|
||||
SEND EMAIL admin, "Inventory sync started..."
|
||||
|
||||
fullList = FIND ".Produtos"
|
||||
fullList = FIND "maria.Produtos"
|
||||
|
||||
chunkSize = 100
|
||||
startIndex = 0
|
||||
|
|
@ -30,11 +30,11 @@ DO WHILE startIndex < ubound(fullList)
|
|||
k = 0
|
||||
DO WHILE k < ubound(items)
|
||||
depositos = items[k].depositos
|
||||
pSku = FIND ".Produtos", "id=${items[k].produto.id}"
|
||||
pSku = FIND "maria.Produtos", "id=${items[k].produto.id}"
|
||||
|
||||
IF pSku THEN
|
||||
prdSku = pSku.sku
|
||||
DELETE ".Depositos", "Sku=" + prdSku
|
||||
DELETE "maria.Depositos", "Sku=" + prdSku
|
||||
|
||||
l = 0
|
||||
DO WHILE l < ubound(depositos)
|
||||
|
|
@ -42,7 +42,7 @@ DO WHILE startIndex < ubound(fullList)
|
|||
l = l + 1
|
||||
LOOP
|
||||
|
||||
SAVE ".Depositos", depositos
|
||||
SAVE "maria.Depositos", depositos
|
||||
depositos = null
|
||||
END IF
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ DESCRIPTION "Sync product suppliers from Bling ERP to local database"
|
|||
SEND EMAIL admin, "Suppliers sync started..."
|
||||
|
||||
FUNCTION SyncProdutoFornecedor(idProduto)
|
||||
DELETE ".ProdutoFornecedor", "Produto_id=" + idProduto
|
||||
DELETE "maria.ProdutoFornecedor", "Produto_id=" + idProduto
|
||||
|
||||
i1 = 1
|
||||
DO WHILE i1 > 0 AND i1 < pages
|
||||
|
|
@ -26,7 +26,7 @@ FUNCTION SyncProdutoFornecedor(idProduto)
|
|||
j1 = j1 + 1
|
||||
LOOP
|
||||
|
||||
SAVE ".ProdutoFornecedor", items1
|
||||
SAVE "maria.ProdutoFornecedor", items1
|
||||
items1 = null
|
||||
i1 = i1 + 1
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ FUNCTION SyncProdutoFornecedor(idProduto)
|
|||
LOOP
|
||||
END FUNCTION
|
||||
|
||||
fullList = FIND ".Produtos"
|
||||
fullList = FIND "maria.Produtos"
|
||||
|
||||
chunkSize = 100
|
||||
startIndex = 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
TABLE Contatos
|
||||
TABLE Contatos ON maria
|
||||
Id number key
|
||||
Nome string(150)
|
||||
Codigo string(50)
|
||||
|
|
@ -37,7 +37,7 @@ TABLE Contatos
|
|||
Pais_nome string(100)
|
||||
END TABLE
|
||||
|
||||
TABLE Pedidos
|
||||
TABLE Pedidos ON maria
|
||||
Id number key
|
||||
Numero integer
|
||||
NumeroLoja string(15)
|
||||
|
|
@ -59,7 +59,7 @@ TABLE Pedidos
|
|||
NotaFiscal_id number
|
||||
END TABLE
|
||||
|
||||
TABLE PedidosItem
|
||||
TABLE PedidosItem ON maria
|
||||
Id number key
|
||||
Numero integer
|
||||
Sku string(20)
|
||||
|
|
@ -75,14 +75,14 @@ TABLE PedidosItem
|
|||
Pedido_id number
|
||||
END TABLE
|
||||
|
||||
TABLE ProdutoImagem
|
||||
TABLE ProdutoImagem ON maria
|
||||
Id number key
|
||||
Ordinal number
|
||||
Sku string(20)
|
||||
Link string(250)
|
||||
END TABLE
|
||||
|
||||
TABLE Produtos
|
||||
TABLE Produtos ON maria
|
||||
Id number key
|
||||
Nome string(150)
|
||||
Sku string(20)
|
||||
|
|
@ -146,7 +146,7 @@ TABLE Produtos
|
|||
Estrutura_componentes_0_produto_Quantidade double
|
||||
END TABLE
|
||||
|
||||
TABLE Depositos
|
||||
TABLE Depositos ON maria
|
||||
Internal_Id number key
|
||||
Id number
|
||||
Sku string(20)
|
||||
|
|
@ -154,7 +154,7 @@ TABLE Depositos
|
|||
SaldoVirtual double
|
||||
END TABLE
|
||||
|
||||
TABLE Vendedores
|
||||
TABLE Vendedores ON maria
|
||||
Id number key
|
||||
DescontoLimite double
|
||||
Loja_Id number
|
||||
|
|
@ -163,7 +163,7 @@ TABLE Vendedores
|
|||
Contato_Situacao string(1)
|
||||
END TABLE
|
||||
|
||||
TABLE ProdutoFornecedor
|
||||
TABLE ProdutoFornecedor ON maria
|
||||
Id number key
|
||||
Descricao string(255)
|
||||
Codigo string(50)
|
||||
|
|
@ -175,7 +175,7 @@ TABLE ProdutoFornecedor
|
|||
Garantia integer
|
||||
END TABLE
|
||||
|
||||
TABLE ContasAPagar
|
||||
TABLE ContasAPagar ON maria
|
||||
Id number key
|
||||
Situacao integer
|
||||
Vencimento date
|
||||
|
|
@ -195,7 +195,7 @@ TABLE ContasAPagar
|
|||
Ocorrencia_tipo integer
|
||||
END TABLE
|
||||
|
||||
TABLE ContasAReceber
|
||||
TABLE ContasAReceber ON maria
|
||||
Id number key
|
||||
Situacao integer
|
||||
Vencimento date
|
||||
|
|
@ -232,7 +232,7 @@ TABLE ContasAReceber
|
|||
Ocorrencia_tipo integer
|
||||
END TABLE
|
||||
|
||||
TABLE CategoriaReceita
|
||||
TABLE CategoriaReceita ON maria
|
||||
Id number key
|
||||
IdCategoriaPai number
|
||||
Descricao string(255)
|
||||
|
|
@ -240,7 +240,7 @@ TABLE CategoriaReceita
|
|||
Situacao integer
|
||||
END TABLE
|
||||
|
||||
TABLE FormaDePagamento
|
||||
TABLE FormaDePagamento ON maria
|
||||
Id number key
|
||||
Descricao string(255)
|
||||
TipoPagamento integer
|
||||
|
|
@ -258,14 +258,14 @@ TABLE FormaDePagamento
|
|||
DadosCartao_cnpjCredenciadora string(16)
|
||||
END TABLE
|
||||
|
||||
TABLE NaturezaDeOperacao
|
||||
TABLE NaturezaDeOperacao ON maria
|
||||
Id number key
|
||||
Situacao integer
|
||||
Padrao integer
|
||||
Descricao string(255)
|
||||
END TABLE
|
||||
|
||||
TABLE Parcela
|
||||
TABLE Parcela ON maria
|
||||
Id number key
|
||||
Pedido_id number
|
||||
DataVencimento date
|
||||
|
|
@ -274,7 +274,7 @@ TABLE Parcela
|
|||
FormaPagamento_id number
|
||||
END TABLE
|
||||
|
||||
TABLE HistoricoPreco
|
||||
TABLE HistoricoPreco ON maria
|
||||
Id number key
|
||||
Sku string(50)
|
||||
PrecoAntigo double
|
||||
|
|
|
|||
|
|
@ -1,102 +0,0 @@
|
|||
PARAM expression AS STRING LIKE "2 + 2" DESCRIPTION "Mathematical expression to calculate"
|
||||
|
||||
DESCRIPTION "Calculate mathematical expressions, conversions, and formulas"
|
||||
|
||||
WITH result
|
||||
expression = expression
|
||||
timestamp = NOW()
|
||||
END WITH
|
||||
|
||||
expr = REPLACE(expression, " ", "")
|
||||
|
||||
IF INSTR(expr, "+") > 0 THEN
|
||||
parts = SPLIT(expr, "+")
|
||||
IF UBOUND(parts) = 2 THEN
|
||||
result.answer = VAL(parts[0]) + VAL(parts[1])
|
||||
result.operation = "addition"
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(expr, "-") > 0 AND LEFT(expr, 1) <> "-" THEN
|
||||
parts = SPLIT(expr, "-")
|
||||
IF UBOUND(parts) = 2 THEN
|
||||
result.answer = VAL(parts[0]) - VAL(parts[1])
|
||||
result.operation = "subtraction"
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(expr, "*") > 0 THEN
|
||||
parts = SPLIT(expr, "*")
|
||||
IF UBOUND(parts) = 2 THEN
|
||||
result.answer = VAL(parts[0]) * VAL(parts[1])
|
||||
result.operation = "multiplication"
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(expr, "/") > 0 THEN
|
||||
parts = SPLIT(expr, "/")
|
||||
IF UBOUND(parts) = 2 THEN
|
||||
IF VAL(parts[1]) <> 0 THEN
|
||||
result.answer = VAL(parts[0]) / VAL(parts[1])
|
||||
result.operation = "division"
|
||||
ELSE
|
||||
TALK "Error: Division by zero"
|
||||
RETURN NULL
|
||||
END IF
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(LCASE(expr), "sqrt") > 0 THEN
|
||||
start_pos = INSTR(LCASE(expr), "sqrt(") + 5
|
||||
end_pos = INSTR(start_pos, expr, ")")
|
||||
IF end_pos > start_pos THEN
|
||||
num = VAL(MID(expr, start_pos, end_pos - start_pos))
|
||||
IF num >= 0 THEN
|
||||
result.answer = SQR(num)
|
||||
result.operation = "square root"
|
||||
ELSE
|
||||
TALK "Error: Cannot calculate square root of negative number"
|
||||
RETURN NULL
|
||||
END IF
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(expr, "^") > 0 THEN
|
||||
parts = SPLIT(expr, "^")
|
||||
IF UBOUND(parts) = 2 THEN
|
||||
result.answer = VAL(parts[0]) ^ VAL(parts[1])
|
||||
result.operation = "power"
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(LCASE(expr), "abs") > 0 THEN
|
||||
start_pos = INSTR(LCASE(expr), "abs(") + 4
|
||||
end_pos = INSTR(start_pos, expr, ")")
|
||||
IF end_pos > start_pos THEN
|
||||
result.answer = ABS(VAL(MID(expr, start_pos, end_pos - start_pos)))
|
||||
result.operation = "absolute value"
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(LCASE(expr), "round") > 0 THEN
|
||||
start_pos = INSTR(LCASE(expr), "round(") + 6
|
||||
end_pos = INSTR(start_pos, expr, ")")
|
||||
IF end_pos > start_pos THEN
|
||||
result.answer = ROUND(VAL(MID(expr, start_pos, end_pos - start_pos)), 0)
|
||||
result.operation = "rounding"
|
||||
END IF
|
||||
|
||||
ELSE IF INSTR(expr, "%") > 0 AND INSTR(LCASE(expr), "of") > 0 THEN
|
||||
expr_lower = LCASE(expr)
|
||||
of_pos = INSTR(expr_lower, "of")
|
||||
percent_part = REPLACE(LEFT(expr, of_pos - 1), "%", "")
|
||||
percent_val = VAL(TRIM(percent_part))
|
||||
base_val = VAL(TRIM(MID(expr, of_pos + 2)))
|
||||
result.answer = (percent_val / 100) * base_val
|
||||
result.operation = "percentage"
|
||||
|
||||
ELSE
|
||||
result.answer = VAL(expr)
|
||||
result.operation = "direct value"
|
||||
END IF
|
||||
|
||||
IF result.answer <> NULL THEN
|
||||
TALK "Result: " + result.answer
|
||||
RETURN result
|
||||
ELSE
|
||||
TALK "Could not calculate expression"
|
||||
RETURN NULL
|
||||
END IF
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
PARAM to_email AS EMAIL LIKE "user@example.com" DESCRIPTION "Recipient email address"
|
||||
PARAM subject AS STRING LIKE "Important Message" DESCRIPTION "Email subject line"
|
||||
PARAM body AS STRING LIKE "Hello, this is the email content." DESCRIPTION "Email body content"
|
||||
PARAM from_email AS EMAIL LIKE "noreply@company.com" DESCRIPTION "Sender email address" OPTIONAL
|
||||
|
||||
DESCRIPTION "Send an email to any recipient with subject and body"
|
||||
|
||||
IF NOT from_email THEN
|
||||
from_email = "noreply@pragmatismo.com.br"
|
||||
END IF
|
||||
|
||||
WITH email_data
|
||||
to = to_email
|
||||
from = from_email
|
||||
subject = subject
|
||||
body = body
|
||||
timestamp = NOW()
|
||||
END WITH
|
||||
|
||||
SEND EMAIL to_email, subject, body
|
||||
|
||||
SAVE "email_log.csv", email_data
|
||||
|
||||
TALK "Email sent to " + to_email
|
||||
|
||||
RETURN email_data
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
PARAM phone_number AS PHONE LIKE "+1234567890" DESCRIPTION "Phone number with country code"
|
||||
PARAM message AS STRING LIKE "Hello, this is your message" DESCRIPTION "SMS message content"
|
||||
PARAM from_number AS PHONE LIKE "+1987654321" DESCRIPTION "Sender phone number" OPTIONAL
|
||||
|
||||
DESCRIPTION "Send an SMS message to any phone number"
|
||||
|
||||
message_length = LEN(message)
|
||||
segments = INT((message_length - 1) / 160) + 1
|
||||
|
||||
IF message_length > 160 THEN
|
||||
TALK "Message will be split into " + segments + " segments"
|
||||
END IF
|
||||
|
||||
WITH sms
|
||||
to = phone_number
|
||||
from = from_number
|
||||
body = message
|
||||
timestamp = NOW()
|
||||
segmentCount = segments
|
||||
END WITH
|
||||
|
||||
SEND SMS phone_number, message
|
||||
|
||||
SAVE "sms_log.csv", sms
|
||||
|
||||
TALK "SMS sent to " + phone_number
|
||||
|
||||
RETURN sms
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
PARAM text AS STRING LIKE "Hello, how are you?" DESCRIPTION "Text to translate"
|
||||
PARAM from_lang AS STRING LIKE "en" DESCRIPTION "Source language code (en, es, pt, fr, de, etc)" OPTIONAL
|
||||
PARAM to_lang AS STRING LIKE "es" DESCRIPTION "Target language code (en, es, pt, fr, de, etc)" OPTIONAL
|
||||
|
||||
DESCRIPTION "Translate text between languages using free translation API"
|
||||
|
||||
IF NOT from_lang THEN
|
||||
from_lang = "en"
|
||||
END IF
|
||||
|
||||
IF NOT to_lang THEN
|
||||
to_lang = "es"
|
||||
END IF
|
||||
|
||||
TALK "Translating from " + from_lang + " to " + to_lang + "..."
|
||||
|
||||
WITH post_data
|
||||
q = text
|
||||
source = from_lang
|
||||
target = to_lang
|
||||
format = "text"
|
||||
END WITH
|
||||
|
||||
SET HEADER "Content-Type" = "application/json"
|
||||
|
||||
translation_result = POST "https://libretranslate.com/translate", post_data
|
||||
|
||||
IF translation_result.translatedText THEN
|
||||
WITH result
|
||||
original = text
|
||||
translated = translation_result.translatedText
|
||||
from = from_lang
|
||||
to = to_lang
|
||||
END WITH
|
||||
|
||||
TALK "Original (" + from_lang + "): " + text
|
||||
TALK "Translated (" + to_lang + "): " + result.translated
|
||||
|
||||
RETURN result
|
||||
ELSE
|
||||
mymemory_url = "https://api.mymemory.translated.net/get?q=" + text + "&langpair=" + from_lang + "|" + to_lang
|
||||
fallback_result = GET mymemory_url
|
||||
|
||||
IF fallback_result.responseData.translatedText THEN
|
||||
WITH result
|
||||
original = text
|
||||
translated = fallback_result.responseData.translatedText
|
||||
from = from_lang
|
||||
to = to_lang
|
||||
END WITH
|
||||
|
||||
TALK "Original (" + from_lang + "): " + text
|
||||
TALK "Translated (" + to_lang + "): " + result.translated
|
||||
|
||||
RETURN result
|
||||
ELSE
|
||||
TALK "Could not translate text"
|
||||
RETURN NULL
|
||||
END IF
|
||||
END IF
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
PARAM location AS STRING LIKE "New York" DESCRIPTION "City or location to get weather forecast"
|
||||
|
||||
DESCRIPTION "Get current weather forecast for any city or location"
|
||||
|
||||
lat = 40.7128
|
||||
lon = -74.0060
|
||||
|
||||
location_lower = LCASE(location)
|
||||
|
||||
IF INSTR(location_lower, "new york") > 0 THEN
|
||||
lat = 40.7128
|
||||
lon = -74.0060
|
||||
ELSE IF INSTR(location_lower, "london") > 0 THEN
|
||||
lat = 51.5074
|
||||
lon = -0.1278
|
||||
ELSE IF INSTR(location_lower, "paris") > 0 THEN
|
||||
lat = 48.8566
|
||||
lon = 2.3522
|
||||
ELSE IF INSTR(location_lower, "tokyo") > 0 THEN
|
||||
lat = 35.6762
|
||||
lon = 139.6503
|
||||
ELSE IF INSTR(location_lower, "sydney") > 0 THEN
|
||||
lat = -33.8688
|
||||
lon = 151.2093
|
||||
ELSE IF INSTR(location_lower, "berlin") > 0 THEN
|
||||
lat = 52.5200
|
||||
lon = 13.4050
|
||||
ELSE IF INSTR(location_lower, "madrid") > 0 THEN
|
||||
lat = 40.4168
|
||||
lon = -3.7038
|
||||
ELSE IF INSTR(location_lower, "sao paulo") > 0 OR INSTR(location_lower, "são paulo") > 0 THEN
|
||||
lat = -23.5505
|
||||
lon = -46.6333
|
||||
ELSE IF INSTR(location_lower, "rio") > 0 THEN
|
||||
lat = -22.9068
|
||||
lon = -43.1729
|
||||
ELSE IF INSTR(location_lower, "los angeles") > 0 THEN
|
||||
lat = 34.0522
|
||||
lon = -118.2437
|
||||
ELSE IF INSTR(location_lower, "chicago") > 0 THEN
|
||||
lat = 41.8781
|
||||
lon = -87.6298
|
||||
ELSE IF INSTR(location_lower, "toronto") > 0 THEN
|
||||
lat = 43.6532
|
||||
lon = -79.3832
|
||||
ELSE IF INSTR(location_lower, "dubai") > 0 THEN
|
||||
lat = 25.2048
|
||||
lon = 55.2708
|
||||
ELSE IF INSTR(location_lower, "singapore") > 0 THEN
|
||||
lat = 1.3521
|
||||
lon = 103.8198
|
||||
ELSE IF INSTR(location_lower, "mumbai") > 0 THEN
|
||||
lat = 19.0760
|
||||
lon = 72.8777
|
||||
ELSE IF INSTR(location_lower, "beijing") > 0 THEN
|
||||
lat = 39.9042
|
||||
lon = 116.4074
|
||||
END IF
|
||||
|
||||
weather_url = "https://api.open-meteo.com/v1/forecast?latitude=" + lat + "&longitude=" + lon + "¤t_weather=true&timezone=auto"
|
||||
|
||||
weather_data = GET weather_url
|
||||
|
||||
IF weather_data.current_weather THEN
|
||||
current = weather_data.current_weather
|
||||
|
||||
code = current.weathercode
|
||||
condition = "Clear"
|
||||
icon = "☀️"
|
||||
|
||||
IF code = 0 THEN
|
||||
condition = "Clear sky"
|
||||
icon = "☀️"
|
||||
ELSE IF code >= 1 AND code <= 3 THEN
|
||||
condition = "Partly cloudy"
|
||||
icon = "⛅"
|
||||
ELSE IF code >= 45 AND code <= 48 THEN
|
||||
condition = "Foggy"
|
||||
icon = "🌫️"
|
||||
ELSE IF code >= 51 AND code <= 67 THEN
|
||||
condition = "Rainy"
|
||||
icon = "🌧️"
|
||||
ELSE IF code >= 71 AND code <= 77 THEN
|
||||
condition = "Snowy"
|
||||
icon = "❄️"
|
||||
ELSE IF code >= 80 AND code <= 82 THEN
|
||||
condition = "Rain showers"
|
||||
icon = "🌦️"
|
||||
ELSE IF code >= 95 AND code <= 99 THEN
|
||||
condition = "Thunderstorm"
|
||||
icon = "⛈️"
|
||||
END IF
|
||||
|
||||
WITH result
|
||||
loc = location
|
||||
temperature = current.temperature
|
||||
windspeed = current.windspeed
|
||||
weathercode = code
|
||||
cond = condition
|
||||
ico = icon
|
||||
END WITH
|
||||
|
||||
TALK icon + " Weather for " + location + ":"
|
||||
TALK "Temperature: " + current.temperature + "°C"
|
||||
TALK "Condition: " + condition
|
||||
TALK "Wind: " + current.windspeed + " km/h"
|
||||
|
||||
RETURN result
|
||||
ELSE
|
||||
TALK "Could not fetch weather for: " + location
|
||||
RETURN NULL
|
||||
END IF
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
# Getting Started with General Bots
|
||||
|
||||
## Overview
|
||||
|
||||
Welcome to General Bots! This guide will help you understand the basic features available in your default bot installation.
|
||||
|
||||
## Available Features
|
||||
|
||||
### Calculator
|
||||
|
||||
Perform mathematical calculations by asking the bot to calculate expressions.
|
||||
|
||||
**Examples:**
|
||||
- "Calculate 25 * 4"
|
||||
- "What is 1500 / 12?"
|
||||
- "Calculate 15% of 200"
|
||||
|
||||
### Send Email
|
||||
|
||||
Send emails directly through the bot.
|
||||
|
||||
**How to use:**
|
||||
1. Say "Send email" or "Send an email"
|
||||
2. Provide the recipient's email address
|
||||
3. Enter the subject line
|
||||
4. Type your message content
|
||||
|
||||
**Example:**
|
||||
- "Send an email to john@example.com"
|
||||
- "I need to email my team"
|
||||
|
||||
### Send SMS
|
||||
|
||||
Send text messages to mobile phones.
|
||||
|
||||
**How to use:**
|
||||
1. Say "Send SMS" or "Send a text message"
|
||||
2. Provide the phone number (with country code)
|
||||
3. Enter your message
|
||||
|
||||
**Example:**
|
||||
- "Send SMS to +1234567890"
|
||||
- "Text message to my contact"
|
||||
|
||||
### Translation
|
||||
|
||||
Translate text between different languages.
|
||||
|
||||
**How to use:**
|
||||
1. Say "Translate" followed by the text
|
||||
2. Specify the target language
|
||||
|
||||
**Examples:**
|
||||
- "Translate 'Hello, how are you?' to Spanish"
|
||||
- "Translate this text to Portuguese"
|
||||
- "How do you say 'thank you' in French?"
|
||||
|
||||
### Weather
|
||||
|
||||
Get current weather information for any location.
|
||||
|
||||
**How to use:**
|
||||
1. Ask about the weather for a specific location
|
||||
|
||||
**Examples:**
|
||||
- "What's the weather in New York?"
|
||||
- "Weather forecast for London"
|
||||
- "Is it going to rain in Tokyo?"
|
||||
|
||||
## Tips for Better Interactions
|
||||
|
||||
### Be Specific
|
||||
The more specific your request, the better the bot can help you. Include relevant details like:
|
||||
- Email addresses for sending emails
|
||||
- Phone numbers with country codes for SMS
|
||||
- City names for weather queries
|
||||
|
||||
### Natural Language
|
||||
You can speak naturally to the bot. It understands various ways of asking for the same thing:
|
||||
- "Calculate 10 + 5" or "What is 10 plus 5?"
|
||||
- "Send email" or "I need to email someone"
|
||||
- "Translate to Spanish" or "How do you say this in Spanish?"
|
||||
|
||||
### Confirmation
|
||||
The bot will ask for confirmation before performing actions like sending emails or SMS to ensure accuracy.
|
||||
|
||||
## Extending Your Bot
|
||||
|
||||
This default template provides basic functionality. You can extend your bot by:
|
||||
|
||||
1. **Adding Knowledge Base**: Create `.md` files in the `.gbkb` folder to give your bot domain-specific knowledge
|
||||
2. **Creating Dialogs**: Add `.bas` files in the `.gbdialog` folder for custom conversations
|
||||
3. **Installing Templates**: Add pre-built templates for CRM, HR, helpdesk, and more
|
||||
4. **Connecting APIs**: Integrate external services for expanded functionality
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
**Q: How do I add more features to my bot?**
|
||||
A: Install additional templates or create custom dialog scripts in the `.gbdialog` folder.
|
||||
|
||||
**Q: Can the bot remember previous conversations?**
|
||||
A: Yes, the bot maintains context within a session. For persistent memory, use the memory features in custom dialogs.
|
||||
|
||||
**Q: What languages are supported?**
|
||||
A: The bot supports multiple languages for both interface and translation. Common languages include English, Portuguese, Spanish, French, German, and many others.
|
||||
|
||||
**Q: How do I change the bot's appearance?**
|
||||
A: Modify the `config.csv` file in the `.gbot` folder to change colors, logo, and title.
|
||||
|
||||
**Q: Is my data secure?**
|
||||
A: Yes, all communications are encrypted. Sensitive data like passwords should never be shared in chat.
|
||||
|
||||
## Getting Help
|
||||
|
||||
If you need assistance:
|
||||
- Ask the bot "Help" for available commands
|
||||
- Check the documentation at docs.pragmatismo.com.br
|
||||
- Contact support for technical issues
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Try out each feature to see how it works
|
||||
2. Explore the template library for pre-built solutions
|
||||
3. Customize your bot with your own knowledge base
|
||||
4. Create custom dialogs for your specific use cases
|
||||
|
||||
Welcome aboard, and enjoy using General Bots!
|
||||
|
|
@ -1,227 +0,0 @@
|
|||
name,value
|
||||
,
|
||||
# ============================================================================
|
||||
# SERVER CONFIGURATION
|
||||
# ============================================================================
|
||||
server_host,0.0.0.0
|
||||
server_port,8088
|
||||
sites_root,/tmp
|
||||
,
|
||||
# ============================================================================
|
||||
# LLM CONFIGURATION
|
||||
# ============================================================================
|
||||
llm-key,none
|
||||
llm-model,../../../../data/llm/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf
|
||||
,
|
||||
llm-cache,false
|
||||
llm-cache-ttl,3600
|
||||
llm-cache-semantic,true
|
||||
llm-cache-threshold,0.95
|
||||
,
|
||||
episodic-memory-threshold,4
|
||||
,
|
||||
mcp-server,false
|
||||
,
|
||||
# ============================================================================
|
||||
# EMBEDDING CONFIGURATION
|
||||
# ============================================================================
|
||||
embedding-url,http://localhost:8082
|
||||
embedding-model,../../../../data/llm/bge-small-en-v1.5-f32.gguf
|
||||
,
|
||||
# ============================================================================
|
||||
# LLM SERVER CONFIGURATION
|
||||
# ============================================================================
|
||||
llm-server,true
|
||||
llm-server-path,botserver-stack/bin/llm/build/bin
|
||||
llm-server-host,0.0.0.0
|
||||
llm-server-port,8081
|
||||
llm-server-gpu-layers,0
|
||||
llm-server-n-moe,0
|
||||
llm-server-ctx-size,4096
|
||||
llm-server-n-predict,1024
|
||||
llm-server-parallel,6
|
||||
llm-server-cont-batching,true
|
||||
llm-server-mlock,false
|
||||
llm-server-no-mmap,false
|
||||
,
|
||||
# ============================================================================
|
||||
# EMAIL CONFIGURATION
|
||||
# ============================================================================
|
||||
email-from,from@domain.com
|
||||
email-server,mail.domain.com
|
||||
email-port,587
|
||||
email-user,user@domain.com
|
||||
email-pass,
|
||||
,
|
||||
# ============================================================================
|
||||
# DATABASE CONFIGURATION
|
||||
# ============================================================================
|
||||
custom-server,localhost
|
||||
custom-port,5432
|
||||
custom-database,mycustomdb
|
||||
custom-username,
|
||||
custom-password,
|
||||
,
|
||||
# ============================================================================
|
||||
# WEBSITE CRAWLER CONFIGURATION
|
||||
# ============================================================================
|
||||
website-expires,1d
|
||||
website-max-depth,3
|
||||
website-max-pages,100
|
||||
,
|
||||
# ============================================================================
|
||||
# IMAGE GENERATOR CONFIGURATION
|
||||
# ============================================================================
|
||||
image-generator-model,../../../../data/diffusion/sd_turbo_f16.gguf
|
||||
image-generator-steps,4
|
||||
image-generator-width,512
|
||||
image-generator-height,512
|
||||
image-generator-gpu-layers,20
|
||||
image-generator-batch-size,1
|
||||
,
|
||||
# ============================================================================
|
||||
# VIDEO GENERATOR CONFIGURATION
|
||||
# ============================================================================
|
||||
video-generator-model,../../../../data/diffusion/zeroscope_v2_576w
|
||||
video-generator-frames,24
|
||||
video-generator-fps,8
|
||||
video-generator-width,320
|
||||
video-generator-height,576
|
||||
video-generator-gpu-layers,15
|
||||
video-generator-batch-size,1
|
||||
,
|
||||
# ============================================================================
|
||||
# BOTMODELS CONFIGURATION
|
||||
# ============================================================================
|
||||
botmodels-enabled,true
|
||||
botmodels-host,0.0.0.0
|
||||
botmodels-port,8085
|
||||
,
|
||||
default-generator,all
|
||||
,
|
||||
# ============================================================================
|
||||
# OAUTH AUTHENTICATION CONFIGURATION
|
||||
# ============================================================================
|
||||
# Enable social login providers by setting the corresponding -enabled flag
|
||||
# to "true" and providing valid client credentials.
|
||||
#
|
||||
# Each provider requires:
|
||||
# - oauth-{provider}-enabled: Set to "true" to enable the provider
|
||||
# - oauth-{provider}-client-id: The Client ID from the provider
|
||||
# - oauth-{provider}-client-secret: The Client Secret from the provider
|
||||
# - oauth-{provider}-redirect-uri: (Optional) Custom callback URL
|
||||
#
|
||||
# Default redirect URI format: http://your-domain/auth/oauth/{provider}/callback
|
||||
# ============================================================================
|
||||
,
|
||||
# ----------------------------------------------------------------------------
|
||||
# GOOGLE OAUTH
|
||||
# ----------------------------------------------------------------------------
|
||||
# Setup Instructions:
|
||||
# 1. Go to https://console.cloud.google.com/apis/credentials
|
||||
# 2. Create a new project or select existing
|
||||
# 3. Click "Create Credentials" > "OAuth client ID"
|
||||
# 4. Select "Web application" as application type
|
||||
# 5. Add authorized redirect URI: http://your-domain/auth/oauth/google/callback
|
||||
# 6. Copy the Client ID and Client Secret below
|
||||
#
|
||||
# Documentation: https://developers.google.com/identity/protocols/oauth2/web-server
|
||||
# ----------------------------------------------------------------------------
|
||||
oauth-google-enabled,false
|
||||
oauth-google-client-id,
|
||||
oauth-google-client-secret,
|
||||
oauth-google-redirect-uri,
|
||||
,
|
||||
# ----------------------------------------------------------------------------
|
||||
# MICROSOFT OAUTH (Azure AD)
|
||||
# ----------------------------------------------------------------------------
|
||||
# Setup Instructions:
|
||||
# 1. Go to https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
|
||||
# 2. Click "New registration"
|
||||
# 3. Enter application name and select "Accounts in any organizational directory and personal Microsoft accounts"
|
||||
# 4. Add redirect URI: http://your-domain/auth/oauth/microsoft/callback (Web platform)
|
||||
# 5. Go to "Certificates & secrets" > "New client secret"
|
||||
# 6. Copy the Application (client) ID and secret value below
|
||||
#
|
||||
# Documentation: https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
|
||||
# ----------------------------------------------------------------------------
|
||||
oauth-microsoft-enabled,false
|
||||
oauth-microsoft-client-id,
|
||||
oauth-microsoft-client-secret,
|
||||
oauth-microsoft-redirect-uri,
|
||||
,
|
||||
# ----------------------------------------------------------------------------
|
||||
# DISCORD OAUTH
|
||||
# ----------------------------------------------------------------------------
|
||||
# Setup Instructions:
|
||||
# 1. Go to https://discord.com/developers/applications
|
||||
# 2. Click "New Application" and enter a name
|
||||
# 3. Go to "OAuth2" in the left sidebar
|
||||
# 4. Add redirect URL: http://your-domain/auth/oauth/discord/callback
|
||||
# 5. Copy the Client ID and Client Secret below
|
||||
# 6. Under "OAuth2 URL Generator", select scopes: identify, email
|
||||
#
|
||||
# Documentation: https://discord.com/developers/docs/topics/oauth2
|
||||
# ----------------------------------------------------------------------------
|
||||
oauth-discord-enabled,false
|
||||
oauth-discord-client-id,
|
||||
oauth-discord-client-secret,
|
||||
oauth-discord-redirect-uri,
|
||||
,
|
||||
# ----------------------------------------------------------------------------
|
||||
# FACEBOOK OAUTH
|
||||
# ----------------------------------------------------------------------------
|
||||
# Setup Instructions:
|
||||
# 1. Go to https://developers.facebook.com/apps/
|
||||
# 2. Click "Create App" > Select "Consumer" or "Business"
|
||||
# 3. Add "Facebook Login" product to your app
|
||||
# 4. Go to Facebook Login > Settings
|
||||
# 5. Add Valid OAuth Redirect URI: http://your-domain/auth/oauth/facebook/callback
|
||||
# 6. Go to Settings > Basic to get App ID and App Secret
|
||||
#
|
||||
# Documentation: https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow
|
||||
# ----------------------------------------------------------------------------
|
||||
oauth-facebook-enabled,false
|
||||
oauth-facebook-client-id,
|
||||
oauth-facebook-client-secret,
|
||||
oauth-facebook-redirect-uri,
|
||||
,
|
||||
# ----------------------------------------------------------------------------
|
||||
# TWITTER (X) OAUTH 2.0
|
||||
# ----------------------------------------------------------------------------
|
||||
# Setup Instructions:
|
||||
# 1. Go to https://developer.twitter.com/en/portal/dashboard
|
||||
# 2. Create a new project and app (or use existing)
|
||||
# 3. Go to your app's "Keys and tokens" tab
|
||||
# 4. Under "OAuth 2.0 Client ID and Client Secret", generate credentials
|
||||
# 5. Go to "User authentication settings" and configure:
|
||||
# - Enable OAuth 2.0
|
||||
# - Type: Web App
|
||||
# - Callback URL: http://your-domain/auth/oauth/twitter/callback
|
||||
# 6. Copy Client ID and Client Secret below
|
||||
#
|
||||
# Note: Twitter requires OAuth 2.0 with PKCE for web apps
|
||||
# Documentation: https://developer.twitter.com/en/docs/authentication/oauth-2-0
|
||||
# ----------------------------------------------------------------------------
|
||||
oauth-twitter-enabled,false
|
||||
oauth-twitter-client-id,
|
||||
oauth-twitter-client-secret,
|
||||
oauth-twitter-redirect-uri,
|
||||
,
|
||||
# ----------------------------------------------------------------------------
|
||||
# REDDIT OAUTH
|
||||
# ----------------------------------------------------------------------------
|
||||
# Setup Instructions:
|
||||
# 1. Go to https://www.reddit.com/prefs/apps
|
||||
# 2. Click "create another app..." at the bottom
|
||||
# 3. Select "web app" as the application type
|
||||
# 4. Enter redirect URI: http://your-domain/auth/oauth/reddit/callback
|
||||
# 5. Copy the client ID (under app name) and secret below
|
||||
#
|
||||
# Note: Reddit requires Basic Auth for token exchange and custom User-Agent
|
||||
# Documentation: https://github.com/reddit-archive/reddit/wiki/OAuth2
|
||||
# ----------------------------------------------------------------------------
|
||||
oauth-reddit-enabled,false
|
||||
oauth-reddit-client-id,
|
||||
oauth-reddit-client-secret,
|
||||
oauth-reddit-redirect-uri,
|
||||
|
Can't render this file because it contains an unexpected character in line 106 and column 6.
|
|
|
@ -1 +0,0 @@
|
|||
/bin/bash: line 3: ./target/debug/botserver: No such file or directory
|
||||
|
|
@ -6,86 +6,86 @@
|
|||
|
||||
' Items/Products master table
|
||||
TABLE items
|
||||
id UUID KEY
|
||||
item_code STRING(50)
|
||||
barcode STRING(50)
|
||||
name STRING(255)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
item_code VARCHAR(50) UNIQUE NOT NULL
|
||||
barcode VARCHAR(50) UNIQUE
|
||||
name VARCHAR(255) NOT NULL
|
||||
description TEXT
|
||||
category STRING(100)
|
||||
subcategory STRING(100)
|
||||
unit_of_measure STRING(20)
|
||||
weight NUMBER(10,3)
|
||||
dimensions_length NUMBER(10,2)
|
||||
dimensions_width NUMBER(10,2)
|
||||
dimensions_height NUMBER(10,2)
|
||||
minimum_stock_level INTEGER
|
||||
category VARCHAR(100)
|
||||
subcategory VARCHAR(100)
|
||||
unit_of_measure VARCHAR(20) DEFAULT 'EACH'
|
||||
weight DECIMAL(10,3)
|
||||
dimensions_length DECIMAL(10,2)
|
||||
dimensions_width DECIMAL(10,2)
|
||||
dimensions_height DECIMAL(10,2)
|
||||
minimum_stock_level INTEGER DEFAULT 0
|
||||
reorder_point INTEGER
|
||||
reorder_quantity INTEGER
|
||||
lead_time_days INTEGER
|
||||
is_active BOOLEAN
|
||||
is_purchasable BOOLEAN
|
||||
is_saleable BOOLEAN
|
||||
is_manufactured BOOLEAN
|
||||
standard_cost NUMBER(15,4)
|
||||
last_cost NUMBER(15,4)
|
||||
average_cost NUMBER(15,4)
|
||||
selling_price NUMBER(15,4)
|
||||
created_at TIMESTAMP
|
||||
updated_at TIMESTAMP
|
||||
lead_time_days INTEGER DEFAULT 0
|
||||
is_active BOOLEAN DEFAULT TRUE
|
||||
is_purchasable BOOLEAN DEFAULT TRUE
|
||||
is_saleable BOOLEAN DEFAULT TRUE
|
||||
is_manufactured BOOLEAN DEFAULT FALSE
|
||||
standard_cost DECIMAL(15,4)
|
||||
last_cost DECIMAL(15,4)
|
||||
average_cost DECIMAL(15,4)
|
||||
selling_price DECIMAL(15,4)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
' Warehouses table
|
||||
TABLE warehouses
|
||||
id UUID KEY
|
||||
code STRING(20)
|
||||
name STRING(100)
|
||||
type STRING(50)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
code VARCHAR(20) UNIQUE NOT NULL
|
||||
name VARCHAR(100) NOT NULL
|
||||
type VARCHAR(50) DEFAULT 'standard'
|
||||
address TEXT
|
||||
city STRING(100)
|
||||
state STRING(50)
|
||||
country STRING(50)
|
||||
postal_code STRING(20)
|
||||
contact_person STRING(100)
|
||||
contact_phone STRING(50)
|
||||
contact_email STRING(100)
|
||||
city VARCHAR(100)
|
||||
state VARCHAR(50)
|
||||
country VARCHAR(50)
|
||||
postal_code VARCHAR(20)
|
||||
contact_person VARCHAR(100)
|
||||
contact_phone VARCHAR(50)
|
||||
contact_email VARCHAR(100)
|
||||
capacity_units INTEGER
|
||||
current_occupancy INTEGER
|
||||
current_occupancy INTEGER DEFAULT 0
|
||||
is_active BOOLEAN DEFAULT TRUE
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
' Inventory stock levels
|
||||
TABLE inventory_stock
|
||||
id UUID KEY
|
||||
item_id UUID
|
||||
warehouse_id UUID
|
||||
location_code STRING(50)
|
||||
quantity_on_hand NUMBER(15,3)
|
||||
quantity_reserved NUMBER(15,3)
|
||||
quantity_available NUMBER(15,3)
|
||||
quantity_on_order NUMBER(15,3)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
item_id UUID REFERENCES items(id)
|
||||
warehouse_id UUID REFERENCES warehouses(id)
|
||||
location_code VARCHAR(50)
|
||||
quantity_on_hand DECIMAL(15,3) DEFAULT 0
|
||||
quantity_reserved DECIMAL(15,3) DEFAULT 0
|
||||
quantity_available DECIMAL(15,3) GENERATED ALWAYS AS (quantity_on_hand - quantity_reserved) STORED
|
||||
quantity_on_order DECIMAL(15,3) DEFAULT 0
|
||||
last_counted_date DATE
|
||||
last_movement_date TIMESTAMP
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
(item_id, warehouse_id, location_code)
|
||||
UNIQUE(item_id, warehouse_id, location_code)
|
||||
END TABLE
|
||||
|
||||
' Inventory transactions
|
||||
TABLE inventory_transactions
|
||||
id UUID KEY
|
||||
transaction_type STRING(50)
|
||||
transaction_number STRING(50)
|
||||
item_id UUID
|
||||
warehouse_id UUID
|
||||
location_code STRING(50)
|
||||
quantity NUMBER(15,3)
|
||||
unit_cost NUMBER(15,4)
|
||||
total_cost NUMBER(15,2)
|
||||
reference_type STRING(50)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
transaction_type VARCHAR(50) NOT NULL
|
||||
transaction_number VARCHAR(50) UNIQUE
|
||||
item_id UUID REFERENCES items(id)
|
||||
warehouse_id UUID REFERENCES warehouses(id)
|
||||
location_code VARCHAR(50)
|
||||
quantity DECIMAL(15,3) NOT NULL
|
||||
unit_cost DECIMAL(15,4)
|
||||
total_cost DECIMAL(15,2)
|
||||
reference_type VARCHAR(50)
|
||||
reference_id UUID
|
||||
notes TEXT
|
||||
created_by STRING(100)
|
||||
created_by VARCHAR(100)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
|
|
@ -93,28 +93,28 @@ END TABLE
|
|||
|
||||
' Vendors/Suppliers table
|
||||
TABLE vendors
|
||||
id UUID KEY
|
||||
vendor_code STRING(50)
|
||||
name STRING(255)
|
||||
legal_name STRING(255)
|
||||
tax_id STRING(50)
|
||||
vendor_type STRING(50)
|
||||
status STRING(20)
|
||||
rating INTEGER
|
||||
payment_terms STRING(50)
|
||||
credit_limit NUMBER(15,2)
|
||||
currency_code STRING(3)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
vendor_code VARCHAR(50) UNIQUE NOT NULL
|
||||
name VARCHAR(255) NOT NULL
|
||||
legal_name VARCHAR(255)
|
||||
tax_id VARCHAR(50)
|
||||
vendor_type VARCHAR(50)
|
||||
status VARCHAR(20) DEFAULT 'active'
|
||||
rating INTEGER CHECK (rating >= 1 AND rating <= 5)
|
||||
payment_terms VARCHAR(50)
|
||||
credit_limit DECIMAL(15,2)
|
||||
currency_code VARCHAR(3) DEFAULT 'USD'
|
||||
address TEXT
|
||||
city STRING(100)
|
||||
state STRING(50)
|
||||
country STRING(50)
|
||||
postal_code STRING(20)
|
||||
phone STRING(50)
|
||||
email STRING(100)
|
||||
website STRING(255)
|
||||
contact_person STRING(100)
|
||||
bank_account_number STRING(50)
|
||||
bank_name STRING(100)
|
||||
city VARCHAR(100)
|
||||
state VARCHAR(50)
|
||||
country VARCHAR(50)
|
||||
postal_code VARCHAR(20)
|
||||
phone VARCHAR(50)
|
||||
email VARCHAR(100)
|
||||
website VARCHAR(255)
|
||||
contact_person VARCHAR(100)
|
||||
bank_account_number VARCHAR(50)
|
||||
bank_name VARCHAR(100)
|
||||
notes TEXT
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
|
|
@ -122,75 +122,75 @@ END TABLE
|
|||
|
||||
' Purchase orders
|
||||
TABLE purchase_orders
|
||||
id UUID KEY
|
||||
po_number STRING(50)
|
||||
vendor_id UUID
|
||||
order_date DATE
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
po_number VARCHAR(50) UNIQUE NOT NULL
|
||||
vendor_id UUID REFERENCES vendors(id)
|
||||
order_date DATE NOT NULL
|
||||
expected_date DATE
|
||||
status STRING(50)
|
||||
buyer_id STRING(100)
|
||||
ship_to_warehouse_id UUID
|
||||
shipping_method STRING(50)
|
||||
payment_terms STRING(50)
|
||||
currency_code STRING(3)
|
||||
exchange_rate NUMBER(10,6)
|
||||
subtotal NUMBER(15,2)
|
||||
tax_amount NUMBER(15,2)
|
||||
shipping_cost NUMBER(15,2)
|
||||
total_amount NUMBER(15,2)
|
||||
status VARCHAR(50) DEFAULT 'draft'
|
||||
buyer_id VARCHAR(100)
|
||||
ship_to_warehouse_id UUID REFERENCES warehouses(id)
|
||||
shipping_method VARCHAR(50)
|
||||
payment_terms VARCHAR(50)
|
||||
currency_code VARCHAR(3) DEFAULT 'USD'
|
||||
exchange_rate DECIMAL(10,6) DEFAULT 1.0
|
||||
subtotal DECIMAL(15,2)
|
||||
tax_amount DECIMAL(15,2)
|
||||
shipping_cost DECIMAL(15,2)
|
||||
total_amount DECIMAL(15,2)
|
||||
notes TEXT
|
||||
approved_by STRING(100)
|
||||
approved_by VARCHAR(100)
|
||||
approved_date TIMESTAMP
|
||||
created_by STRING(100)
|
||||
created_by VARCHAR(100)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
' Purchase order lines
|
||||
TABLE purchase_order_lines
|
||||
id UUID KEY
|
||||
po_id UUID
|
||||
line_number INTEGER
|
||||
item_id UUID
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
po_id UUID REFERENCES purchase_orders(id) ON DELETE CASCADE
|
||||
line_number INTEGER NOT NULL
|
||||
item_id UUID REFERENCES items(id)
|
||||
description TEXT
|
||||
quantity_ordered NUMBER(15,3)
|
||||
quantity_received NUMBER(15,3)
|
||||
quantity_remaining NUMBER(15,3)
|
||||
unit_price NUMBER(15,4)
|
||||
discount_percent NUMBER(5,2)
|
||||
tax_rate NUMBER(5,2)
|
||||
line_total NUMBER(15,2)
|
||||
quantity_ordered DECIMAL(15,3) NOT NULL
|
||||
quantity_received DECIMAL(15,3) DEFAULT 0
|
||||
quantity_remaining DECIMAL(15,3) GENERATED ALWAYS AS (quantity_ordered - quantity_received) STORED
|
||||
unit_price DECIMAL(15,4) NOT NULL
|
||||
discount_percent DECIMAL(5,2) DEFAULT 0
|
||||
tax_rate DECIMAL(5,2) DEFAULT 0
|
||||
line_total DECIMAL(15,2) GENERATED ALWAYS AS (quantity_ordered * unit_price * (1 - discount_percent/100)) STORED
|
||||
expected_date DATE
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
(po_id, line_number)
|
||||
UNIQUE(po_id, line_number)
|
||||
END TABLE
|
||||
|
||||
' === SALES MODULE ===
|
||||
|
||||
' Customers table
|
||||
TABLE customers
|
||||
id UUID KEY
|
||||
customer_code STRING(50)
|
||||
name STRING(255)
|
||||
legal_name STRING(255)
|
||||
tax_id STRING(50)
|
||||
customer_type STRING(50)
|
||||
status STRING(20)
|
||||
credit_rating STRING(10)
|
||||
credit_limit NUMBER(15,2)
|
||||
payment_terms STRING(50)
|
||||
discount_percent NUMBER(5,2)
|
||||
currency_code STRING(3)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
customer_code VARCHAR(50) UNIQUE NOT NULL
|
||||
name VARCHAR(255) NOT NULL
|
||||
legal_name VARCHAR(255)
|
||||
tax_id VARCHAR(50)
|
||||
customer_type VARCHAR(50)
|
||||
status VARCHAR(20) DEFAULT 'active'
|
||||
credit_rating VARCHAR(10)
|
||||
credit_limit DECIMAL(15,2)
|
||||
payment_terms VARCHAR(50)
|
||||
discount_percent DECIMAL(5,2) DEFAULT 0
|
||||
currency_code VARCHAR(3) DEFAULT 'USD'
|
||||
billing_address TEXT
|
||||
shipping_address TEXT
|
||||
city STRING(100)
|
||||
state STRING(50)
|
||||
country STRING(50)
|
||||
postal_code STRING(20)
|
||||
phone STRING(50)
|
||||
email STRING(100)
|
||||
website STRING(255)
|
||||
sales_person_id STRING(100)
|
||||
city VARCHAR(100)
|
||||
state VARCHAR(50)
|
||||
country VARCHAR(50)
|
||||
postal_code VARCHAR(20)
|
||||
phone VARCHAR(50)
|
||||
email VARCHAR(100)
|
||||
website VARCHAR(255)
|
||||
sales_person_id VARCHAR(100)
|
||||
notes TEXT
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
|
|
@ -198,74 +198,74 @@ END TABLE
|
|||
|
||||
' Sales orders
|
||||
TABLE sales_orders
|
||||
id UUID KEY
|
||||
order_number STRING(50)
|
||||
customer_id UUID
|
||||
order_date DATE
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
order_number VARCHAR(50) UNIQUE NOT NULL
|
||||
customer_id UUID REFERENCES customers(id)
|
||||
order_date DATE NOT NULL
|
||||
required_date DATE
|
||||
promised_date DATE
|
||||
status STRING(50)
|
||||
sales_person_id STRING(100)
|
||||
ship_from_warehouse_id UUID
|
||||
shipping_method STRING(50)
|
||||
payment_terms STRING(50)
|
||||
payment_method STRING(50)
|
||||
currency_code STRING(3)
|
||||
exchange_rate NUMBER(10,6)
|
||||
subtotal NUMBER(15,2)
|
||||
discount_amount NUMBER(15,2)
|
||||
tax_amount NUMBER(15,2)
|
||||
shipping_cost NUMBER(15,2)
|
||||
total_amount NUMBER(15,2)
|
||||
status VARCHAR(50) DEFAULT 'draft'
|
||||
sales_person_id VARCHAR(100)
|
||||
ship_from_warehouse_id UUID REFERENCES warehouses(id)
|
||||
shipping_method VARCHAR(50)
|
||||
payment_terms VARCHAR(50)
|
||||
payment_method VARCHAR(50)
|
||||
currency_code VARCHAR(3) DEFAULT 'USD'
|
||||
exchange_rate DECIMAL(10,6) DEFAULT 1.0
|
||||
subtotal DECIMAL(15,2)
|
||||
discount_amount DECIMAL(15,2) DEFAULT 0
|
||||
tax_amount DECIMAL(15,2)
|
||||
shipping_cost DECIMAL(15,2)
|
||||
total_amount DECIMAL(15,2)
|
||||
notes TEXT
|
||||
approved_by STRING(100)
|
||||
approved_by VARCHAR(100)
|
||||
approved_date TIMESTAMP
|
||||
created_by STRING(100)
|
||||
created_by VARCHAR(100)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
' Sales order lines
|
||||
TABLE sales_order_lines
|
||||
id UUID KEY
|
||||
order_id UUID
|
||||
line_number INTEGER
|
||||
item_id UUID
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
order_id UUID REFERENCES sales_orders(id) ON DELETE CASCADE
|
||||
line_number INTEGER NOT NULL
|
||||
item_id UUID REFERENCES items(id)
|
||||
description TEXT
|
||||
quantity_ordered NUMBER(15,3)
|
||||
quantity_shipped NUMBER(15,3)
|
||||
quantity_invoiced NUMBER(15,3)
|
||||
unit_price NUMBER(15,4)
|
||||
discount_percent NUMBER(5,2)
|
||||
tax_rate NUMBER(5,2)
|
||||
line_total NUMBER(15,2)
|
||||
cost_of_goods_sold NUMBER(15,2)
|
||||
margin NUMBER(15,2)
|
||||
warehouse_id UUID
|
||||
quantity_ordered DECIMAL(15,3) NOT NULL
|
||||
quantity_shipped DECIMAL(15,3) DEFAULT 0
|
||||
quantity_invoiced DECIMAL(15,3) DEFAULT 0
|
||||
unit_price DECIMAL(15,4) NOT NULL
|
||||
discount_percent DECIMAL(5,2) DEFAULT 0
|
||||
tax_rate DECIMAL(5,2) DEFAULT 0
|
||||
line_total DECIMAL(15,2) GENERATED ALWAYS AS (quantity_ordered * unit_price * (1 - discount_percent/100)) STORED
|
||||
cost_of_goods_sold DECIMAL(15,2)
|
||||
margin DECIMAL(15,2) GENERATED ALWAYS AS (line_total - cost_of_goods_sold) STORED
|
||||
warehouse_id UUID REFERENCES warehouses(id)
|
||||
promised_date DATE
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
(order_id, line_number)
|
||||
UNIQUE(order_id, line_number)
|
||||
END TABLE
|
||||
|
||||
' === MANUFACTURING MODULE ===
|
||||
|
||||
' Bill of Materials (BOM) header
|
||||
TABLE bill_of_materials
|
||||
id UUID KEY
|
||||
bom_number STRING(50)
|
||||
item_id UUID
|
||||
revision STRING(20)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
bom_number VARCHAR(50) UNIQUE NOT NULL
|
||||
item_id UUID REFERENCES items(id)
|
||||
revision VARCHAR(20) DEFAULT 'A'
|
||||
description TEXT
|
||||
quantity_per_assembly NUMBER(15,3)
|
||||
unit_of_measure STRING(20)
|
||||
status STRING(20)
|
||||
quantity_per_assembly DECIMAL(15,3) DEFAULT 1
|
||||
unit_of_measure VARCHAR(20)
|
||||
status VARCHAR(20) DEFAULT 'active'
|
||||
effective_date DATE
|
||||
expiration_date DATE
|
||||
total_cost NUMBER(15,4)
|
||||
labor_cost NUMBER(15,4)
|
||||
overhead_cost NUMBER(15,4)
|
||||
created_by STRING(100)
|
||||
approved_by STRING(100)
|
||||
total_cost DECIMAL(15,4)
|
||||
labor_cost DECIMAL(15,4)
|
||||
overhead_cost DECIMAL(15,4)
|
||||
created_by VARCHAR(100)
|
||||
approved_by VARCHAR(100)
|
||||
approved_date DATE
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
|
|
@ -273,42 +273,42 @@ END TABLE
|
|||
|
||||
' BOM components
|
||||
TABLE bom_components
|
||||
id UUID KEY
|
||||
bom_id UUID
|
||||
component_item_id UUID
|
||||
line_number INTEGER
|
||||
quantity_required NUMBER(15,6)
|
||||
unit_of_measure STRING(20)
|
||||
scrap_percent NUMBER(5,2)
|
||||
total_quantity NUMBER(15,6)
|
||||
cost_per_unit NUMBER(15,4)
|
||||
total_cost NUMBER(15,4)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
bom_id UUID REFERENCES bill_of_materials(id) ON DELETE CASCADE
|
||||
component_item_id UUID REFERENCES items(id)
|
||||
line_number INTEGER NOT NULL
|
||||
quantity_required DECIMAL(15,6) NOT NULL
|
||||
unit_of_measure VARCHAR(20)
|
||||
scrap_percent DECIMAL(5,2) DEFAULT 0
|
||||
total_quantity DECIMAL(15,6) GENERATED ALWAYS AS (quantity_required * (1 + scrap_percent/100)) STORED
|
||||
cost_per_unit DECIMAL(15,4)
|
||||
total_cost DECIMAL(15,4) GENERATED ALWAYS AS (total_quantity * cost_per_unit) STORED
|
||||
notes TEXT
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
(bom_id, line_number)
|
||||
UNIQUE(bom_id, line_number)
|
||||
END TABLE
|
||||
|
||||
' Work orders
|
||||
TABLE work_orders
|
||||
id UUID KEY
|
||||
wo_number STRING(50)
|
||||
item_id UUID
|
||||
bom_id UUID
|
||||
quantity_to_produce NUMBER(15,3)
|
||||
quantity_completed NUMBER(15,3)
|
||||
quantity_scrapped NUMBER(15,3)
|
||||
status STRING(50)
|
||||
priority STRING(20)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
wo_number VARCHAR(50) UNIQUE NOT NULL
|
||||
item_id UUID REFERENCES items(id)
|
||||
bom_id UUID REFERENCES bill_of_materials(id)
|
||||
quantity_to_produce DECIMAL(15,3) NOT NULL
|
||||
quantity_completed DECIMAL(15,3) DEFAULT 0
|
||||
quantity_scrapped DECIMAL(15,3) DEFAULT 0
|
||||
status VARCHAR(50) DEFAULT 'planned'
|
||||
priority VARCHAR(20) DEFAULT 'normal'
|
||||
planned_start_date TIMESTAMP
|
||||
planned_end_date TIMESTAMP
|
||||
actual_start_date TIMESTAMP
|
||||
actual_end_date TIMESTAMP
|
||||
warehouse_id UUID
|
||||
work_center STRING(50)
|
||||
labor_hours_estimated NUMBER(10,2)
|
||||
labor_hours_actual NUMBER(10,2)
|
||||
warehouse_id UUID REFERENCES warehouses(id)
|
||||
work_center VARCHAR(50)
|
||||
labor_hours_estimated DECIMAL(10,2)
|
||||
labor_hours_actual DECIMAL(10,2)
|
||||
notes TEXT
|
||||
created_by STRING(100)
|
||||
created_by VARCHAR(100)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
|
@ -317,13 +317,13 @@ END TABLE
|
|||
|
||||
' General ledger accounts
|
||||
TABLE gl_accounts
|
||||
id UUID KEY
|
||||
account_number STRING(20)
|
||||
account_name STRING(100)
|
||||
account_type STRING(50)
|
||||
parent_account_id UUID
|
||||
currency_code STRING(3)
|
||||
normal_balance STRING(10)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
account_number VARCHAR(20) UNIQUE NOT NULL
|
||||
account_name VARCHAR(100) NOT NULL
|
||||
account_type VARCHAR(50) NOT NULL
|
||||
parent_account_id UUID REFERENCES gl_accounts(id)
|
||||
currency_code VARCHAR(3) DEFAULT 'USD'
|
||||
normal_balance VARCHAR(10) CHECK (normal_balance IN ('debit', 'credit'))
|
||||
is_active BOOLEAN DEFAULT TRUE
|
||||
is_control_account BOOLEAN DEFAULT FALSE
|
||||
allow_manual_entry BOOLEAN DEFAULT TRUE
|
||||
|
|
@ -334,65 +334,65 @@ END TABLE
|
|||
|
||||
' Journal entries header
|
||||
TABLE journal_entries
|
||||
id UUID KEY
|
||||
journal_number STRING(50)
|
||||
journal_date DATE
|
||||
posting_date DATE
|
||||
period STRING(20)
|
||||
journal_type STRING(50)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
journal_number VARCHAR(50) UNIQUE NOT NULL
|
||||
journal_date DATE NOT NULL
|
||||
posting_date DATE NOT NULL
|
||||
period VARCHAR(20)
|
||||
journal_type VARCHAR(50)
|
||||
description TEXT
|
||||
reference_type STRING(50)
|
||||
reference_number STRING(50)
|
||||
status STRING(20)
|
||||
total_debit NUMBER(15,2)
|
||||
total_credit NUMBER(15,2)
|
||||
is_balanced BOOLEAN
|
||||
posted_by STRING(100)
|
||||
reference_type VARCHAR(50)
|
||||
reference_number VARCHAR(50)
|
||||
status VARCHAR(20) DEFAULT 'draft'
|
||||
total_debit DECIMAL(15,2)
|
||||
total_credit DECIMAL(15,2)
|
||||
is_balanced BOOLEAN GENERATED ALWAYS AS (total_debit = total_credit) STORED
|
||||
posted_by VARCHAR(100)
|
||||
posted_at TIMESTAMP
|
||||
reversed_by_id UUID
|
||||
created_by STRING(100)
|
||||
reversed_by_id UUID REFERENCES journal_entries(id)
|
||||
created_by VARCHAR(100)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
' Journal entry lines
|
||||
TABLE journal_entry_lines
|
||||
id UUID KEY
|
||||
journal_entry_id UUID
|
||||
line_number INTEGER
|
||||
account_id UUID
|
||||
debit_amount NUMBER(15,2)
|
||||
credit_amount NUMBER(15,2)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
journal_entry_id UUID REFERENCES journal_entries(id) ON DELETE CASCADE
|
||||
line_number INTEGER NOT NULL
|
||||
account_id UUID REFERENCES gl_accounts(id)
|
||||
debit_amount DECIMAL(15,2) DEFAULT 0
|
||||
credit_amount DECIMAL(15,2) DEFAULT 0
|
||||
description TEXT
|
||||
dimension1 STRING(50)
|
||||
dimension2 STRING(50)
|
||||
dimension3 STRING(50)
|
||||
dimension1 VARCHAR(50)
|
||||
dimension2 VARCHAR(50)
|
||||
dimension3 VARCHAR(50)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
(journal_entry_id, line_number)
|
||||
|
||||
UNIQUE(journal_entry_id, line_number)
|
||||
CHECK (debit_amount = 0 OR credit_amount = 0)
|
||||
END TABLE
|
||||
|
||||
' Invoices
|
||||
TABLE invoices
|
||||
id UUID KEY
|
||||
invoice_number STRING(50)
|
||||
invoice_type STRING(20)
|
||||
customer_id UUID
|
||||
vendor_id UUID
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
invoice_number VARCHAR(50) UNIQUE NOT NULL
|
||||
invoice_type VARCHAR(20) DEFAULT 'standard'
|
||||
customer_id UUID REFERENCES customers(id)
|
||||
vendor_id UUID REFERENCES vendors(id)
|
||||
order_id UUID
|
||||
invoice_date DATE
|
||||
due_date DATE
|
||||
status STRING(20)
|
||||
currency_code STRING(3)
|
||||
exchange_rate NUMBER(10,6)
|
||||
subtotal NUMBER(15,2)
|
||||
discount_amount NUMBER(15,2)
|
||||
tax_amount NUMBER(15,2)
|
||||
total_amount NUMBER(15,2)
|
||||
amount_paid NUMBER(15,2)
|
||||
balance_due NUMBER(15,2)
|
||||
payment_terms STRING(50)
|
||||
invoice_date DATE NOT NULL
|
||||
due_date DATE NOT NULL
|
||||
status VARCHAR(20) DEFAULT 'draft'
|
||||
currency_code VARCHAR(3) DEFAULT 'USD'
|
||||
exchange_rate DECIMAL(10,6) DEFAULT 1.0
|
||||
subtotal DECIMAL(15,2)
|
||||
discount_amount DECIMAL(15,2) DEFAULT 0
|
||||
tax_amount DECIMAL(15,2)
|
||||
total_amount DECIMAL(15,2)
|
||||
amount_paid DECIMAL(15,2) DEFAULT 0
|
||||
balance_due DECIMAL(15,2) GENERATED ALWAYS AS (total_amount - amount_paid) STORED
|
||||
payment_terms VARCHAR(50)
|
||||
notes TEXT
|
||||
created_by STRING(100)
|
||||
created_by VARCHAR(100)
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
|
@ -401,38 +401,38 @@ END TABLE
|
|||
|
||||
' Employees table
|
||||
TABLE employees
|
||||
id UUID KEY
|
||||
employee_number STRING(50)
|
||||
first_name STRING(100)
|
||||
last_name STRING(100)
|
||||
middle_name STRING(100)
|
||||
full_name STRING(255)
|
||||
email STRING(100)
|
||||
phone STRING(50)
|
||||
mobile STRING(50)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
employee_number VARCHAR(50) UNIQUE NOT NULL
|
||||
first_name VARCHAR(100) NOT NULL
|
||||
last_name VARCHAR(100) NOT NULL
|
||||
middle_name VARCHAR(100)
|
||||
full_name VARCHAR(255) GENERATED ALWAYS AS (first_name || ' ' || COALESCE(middle_name || ' ', '') || last_name) STORED
|
||||
email VARCHAR(100) UNIQUE
|
||||
phone VARCHAR(50)
|
||||
mobile VARCHAR(50)
|
||||
address TEXT
|
||||
city STRING(100)
|
||||
state STRING(50)
|
||||
country STRING(50)
|
||||
postal_code STRING(20)
|
||||
city VARCHAR(100)
|
||||
state VARCHAR(50)
|
||||
country VARCHAR(50)
|
||||
postal_code VARCHAR(20)
|
||||
date_of_birth DATE
|
||||
gender STRING(20)
|
||||
marital_status STRING(20)
|
||||
national_id STRING(50)
|
||||
passport_number STRING(50)
|
||||
gender VARCHAR(20)
|
||||
marital_status VARCHAR(20)
|
||||
national_id VARCHAR(50)
|
||||
passport_number VARCHAR(50)
|
||||
department_id UUID
|
||||
position_title STRING(100)
|
||||
manager_id UUID
|
||||
hire_date DATE
|
||||
employment_status STRING(50)
|
||||
employment_type STRING(50)'full-time'
|
||||
salary NUMBER(15,2)
|
||||
hourly_rate NUMBER(10,2)
|
||||
commission_percent NUMBER(5,2)
|
||||
bank_account_number STRING(50)
|
||||
bank_name STRING(100)
|
||||
emergency_contact_name STRING(100)
|
||||
emergency_contact_phone STRING(50)
|
||||
position_title VARCHAR(100)
|
||||
manager_id UUID REFERENCES employees(id)
|
||||
hire_date DATE NOT NULL
|
||||
employment_status VARCHAR(50) DEFAULT 'active'
|
||||
employment_type VARCHAR(50) DEFAULT 'full-time'
|
||||
salary DECIMAL(15,2)
|
||||
hourly_rate DECIMAL(10,2)
|
||||
commission_percent DECIMAL(5,2)
|
||||
bank_account_number VARCHAR(50)
|
||||
bank_name VARCHAR(100)
|
||||
emergency_contact_name VARCHAR(100)
|
||||
emergency_contact_phone VARCHAR(50)
|
||||
notes TEXT
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
|
|
@ -440,26 +440,26 @@ END TABLE
|
|||
|
||||
' Payroll records
|
||||
TABLE payroll
|
||||
id UUID KEY
|
||||
payroll_number STRING(50)
|
||||
employee_id UUID
|
||||
pay_period_start DATE
|
||||
pay_period_end DATE
|
||||
payment_date DATE
|
||||
hours_worked NUMBER(10,2)
|
||||
overtime_hours NUMBER(10,2)
|
||||
regular_pay NUMBER(15,2)
|
||||
overtime_pay NUMBER(15,2)
|
||||
commission NUMBER(15,2)
|
||||
bonus NUMBER(15,2)
|
||||
gross_pay NUMBER(15,2)
|
||||
tax_deductions NUMBER(15,2)
|
||||
other_deductions NUMBER(15,2)
|
||||
net_pay NUMBER(15,2)
|
||||
payment_method STRING(50)
|
||||
payment_reference STRING(100)
|
||||
status STRING(20)
|
||||
approved_by STRING(100)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
payroll_number VARCHAR(50) UNIQUE NOT NULL
|
||||
employee_id UUID REFERENCES employees(id)
|
||||
pay_period_start DATE NOT NULL
|
||||
pay_period_end DATE NOT NULL
|
||||
payment_date DATE NOT NULL
|
||||
hours_worked DECIMAL(10,2)
|
||||
overtime_hours DECIMAL(10,2)
|
||||
regular_pay DECIMAL(15,2)
|
||||
overtime_pay DECIMAL(15,2)
|
||||
commission DECIMAL(15,2)
|
||||
bonus DECIMAL(15,2)
|
||||
gross_pay DECIMAL(15,2)
|
||||
tax_deductions DECIMAL(15,2)
|
||||
other_deductions DECIMAL(15,2)
|
||||
net_pay DECIMAL(15,2)
|
||||
payment_method VARCHAR(50)
|
||||
payment_reference VARCHAR(100)
|
||||
status VARCHAR(20) DEFAULT 'pending'
|
||||
approved_by VARCHAR(100)
|
||||
approved_date TIMESTAMP
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
|
@ -468,42 +468,42 @@ END TABLE
|
|||
|
||||
' Audit trail
|
||||
TABLE erp_audit_log
|
||||
id UUID KEY
|
||||
table_name STRING(50)
|
||||
record_id UUID
|
||||
action STRING(20)
|
||||
changed_fieldsTEXT
|
||||
old_valuesTEXT
|
||||
new_valuesTEXT
|
||||
user_id STRING(100)
|
||||
user_ip STRING(45)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
table_name VARCHAR(50) NOT NULL
|
||||
record_id UUID NOT NULL
|
||||
action VARCHAR(20) NOT NULL
|
||||
changed_fields JSONB
|
||||
old_values JSONB
|
||||
new_values JSONB
|
||||
user_id VARCHAR(100)
|
||||
user_ip VARCHAR(45)
|
||||
user_agent TEXT
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
END TABLE
|
||||
|
||||
' System settings
|
||||
TABLE erp_settings
|
||||
id UUID KEY
|
||||
module STRING(50)
|
||||
setting_key STRING(100)
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4()
|
||||
module VARCHAR(50) NOT NULL
|
||||
setting_key VARCHAR(100) NOT NULL
|
||||
setting_value TEXT
|
||||
data_type STRING(20)
|
||||
data_type VARCHAR(20)
|
||||
description TEXT
|
||||
is_encrypted BOOLEAN DEFAULT FALSE
|
||||
created_at TIMESTAMP DEFAULT NOW()
|
||||
updated_at TIMESTAMP DEFAULT NOW()
|
||||
(module, setting_key)
|
||||
UNIQUE(module, setting_key)
|
||||
END TABLE
|
||||
|
||||
' Create indexes for performance
|
||||
'CREATE INDEX idx_inventory_item_warehouse ON inventory_stock(item_id, warehouse_id)
|
||||
'CREATE INDEX idx_po_vendor ON purchase_orders(vendor_id)
|
||||
'CREATE INDEX idx_po_status ON purchase_orders(status)
|
||||
'CREATE INDEX idx_so_customer ON sales_orders(customer_id)
|
||||
'CREATE INDEX idx_so_status ON sales_orders(status)
|
||||
'CREATE INDEX idx_wo_status ON work_orders(status)
|
||||
'CREATE INDEX idx_invoice_customer ON invoices(customer_id)
|
||||
'CREATE INDEX idx_invoice_status ON invoices(status)
|
||||
'CREATE INDEX idx_employee_manager ON employees(manager_id)
|
||||
'CREATE INDEX idx_journal_date ON journal_entries(journal_date)
|
||||
'CREATE INDEX idx_audit_table_record ON erp_audit_log(table_name, record_id)
|
||||
CREATE INDEX idx_inventory_item_warehouse ON inventory_stock(item_id, warehouse_id)
|
||||
CREATE INDEX idx_po_vendor ON purchase_orders(vendor_id)
|
||||
CREATE INDEX idx_po_status ON purchase_orders(status)
|
||||
CREATE INDEX idx_so_customer ON sales_orders(customer_id)
|
||||
CREATE INDEX idx_so_status ON sales_orders(status)
|
||||
CREATE INDEX idx_wo_status ON work_orders(status)
|
||||
CREATE INDEX idx_invoice_customer ON invoices(customer_id)
|
||||
CREATE INDEX idx_invoice_status ON invoices(status)
|
||||
CREATE INDEX idx_employee_manager ON employees(manager_id)
|
||||
CREATE INDEX idx_journal_date ON journal_entries(journal_date)
|
||||
CREATE INDEX idx_audit_table_record ON erp_audit_log(table_name, record_id)
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ PARAM qtd AS INTEGER LIKE 10 DESCRIPTION "Quantity to add to stock"
|
|||
DESCRIPTION "Add stock quantity for a product by SKU"
|
||||
|
||||
person = FIND "People.xlsx", "id=" + mobile
|
||||
vendor = FIND ".Vendedores", "id=" + person.erpId
|
||||
vendor = FIND "maria.Vendedores", "id=" + person.erpId
|
||||
|
||||
TALK "Olá " + vendor.Contato_Nome + "!"
|
||||
|
||||
produto = FIND ".Produtos", "sku=" + sku
|
||||
produto = FIND "maria.Produtos", "sku=" + sku
|
||||
|
||||
IF NOT produto THEN
|
||||
TALK "Produto não encontrado."
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ DO WHILE page > 0 AND page <= pages
|
|||
itemCount = UBOUND(items)
|
||||
|
||||
IF itemCount > 0 THEN
|
||||
MERGE ".ContasAReceber" WITH items BY "Id"
|
||||
MERGE "maria.ContasAReceber" WITH items BY "Id"
|
||||
totalReceber = totalReceber + itemCount
|
||||
page = page + 1
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ DO WHILE page > 0 AND page <= pages
|
|||
itemCount = UBOUND(items)
|
||||
|
||||
IF itemCount > 0 THEN
|
||||
MERGE ".ContasAPagar" WITH items BY "Id"
|
||||
MERGE "maria.ContasAPagar" WITH items BY "Id"
|
||||
totalPagar = totalPagar + itemCount
|
||||
page = page + 1
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ DO WHILE i > 0 AND i < pages
|
|||
produto.hierarquia = "s"
|
||||
END IF
|
||||
|
||||
produtoDB = FIND ".Produtos", "sku=" + produto.codigo
|
||||
produtoDB = FIND "maria.Produtos", "sku=" + produto.codigo
|
||||
IF produtoDB THEN
|
||||
IF produtoDB.preco <> produto.preco THEN
|
||||
hist = NEW OBJECT
|
||||
|
|
@ -51,7 +51,7 @@ DO WHILE i > 0 AND i < pages
|
|||
hist.precoAtual = produto.preco
|
||||
hist.produto_id = produto.id
|
||||
hist.dataModificado = FORMAT today, "yyyy-MM-dd"
|
||||
SAVE ".HistoricoPreco", hist
|
||||
SAVE "maria.HistoricoPreco", hist
|
||||
hist = null
|
||||
END IF
|
||||
END IF
|
||||
|
|
@ -63,7 +63,7 @@ DO WHILE i > 0 AND i < pages
|
|||
list = null
|
||||
list = items
|
||||
|
||||
MERGE ".Produtos" WITH list BY "Id"
|
||||
MERGE "maria.Produtos" WITH list BY "Id"
|
||||
list = items
|
||||
|
||||
j = 0
|
||||
|
|
@ -86,7 +86,7 @@ DO WHILE i > 0 AND i < pages
|
|||
k = 0
|
||||
DO WHILE k < ubound(listV)
|
||||
listV[k].hierarquia = 'f'
|
||||
DELETE ".ProdutoImagem", "sku=" + listV[k].sku
|
||||
DELETE "maria.ProdutoImagem", "sku=" + listV[k].sku
|
||||
|
||||
images = listV[k]?.midia?.imagens?.externas
|
||||
l = 0
|
||||
|
|
@ -96,16 +96,16 @@ DO WHILE i > 0 AND i < pages
|
|||
images[l].id = random()
|
||||
l = l + 1
|
||||
LOOP
|
||||
SAVE ".ProdutoImagem", images
|
||||
SAVE "maria.ProdutoImagem", images
|
||||
images = null
|
||||
k = k + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Produtos" WITH listV BY "Id"
|
||||
MERGE "maria.Produtos" WITH listV BY "Id"
|
||||
END IF
|
||||
listV = null
|
||||
|
||||
DELETE ".ProdutoImagem", "sku=" + list[j].sku
|
||||
DELETE "maria.ProdutoImagem", "sku=" + list[j].sku
|
||||
k = 0
|
||||
images = list[j].midia?.imagens?.externas
|
||||
DO WHILE k < ubound(images)
|
||||
|
|
@ -114,7 +114,7 @@ DO WHILE i > 0 AND i < pages
|
|||
images[k].id = random()
|
||||
k = k + 1
|
||||
LOOP
|
||||
SAVE ".ProdutoImagem", images
|
||||
SAVE "maria.ProdutoImagem", images
|
||||
j = j + 1
|
||||
LOOP
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ DO WHILE i > 0 AND i < pages
|
|||
items[k].custo = items[k].valor / 2
|
||||
k = k + 1
|
||||
LOOP
|
||||
MERGE ".PedidosItem" WITH items BY "Id"
|
||||
MERGE "maria.PedidosItem" WITH items BY "Id"
|
||||
|
||||
items = res.data.parcelas
|
||||
k = 0
|
||||
|
|
@ -163,14 +163,14 @@ DO WHILE i > 0 AND i < pages
|
|||
items[k].pedido_id = pedido_id
|
||||
k = k + 1
|
||||
LOOP
|
||||
MERGE ".Parcela" WITH items BY "Id"
|
||||
MERGE "maria.Parcela" WITH items BY "Id"
|
||||
|
||||
fullList[j] = res.data
|
||||
res = null
|
||||
j = j + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Pedidos" WITH fullList BY "Id"
|
||||
MERGE "maria.Pedidos" WITH fullList BY "Id"
|
||||
i = i + 1
|
||||
IF list?.length < limit THEN
|
||||
i = 0
|
||||
|
|
@ -201,7 +201,7 @@ DO WHILE syncPage > 0 AND syncPage <= pages
|
|||
syncCount = UBOUND(syncItems)
|
||||
|
||||
IF syncCount > 0 THEN
|
||||
MERGE ".CategoriaReceita" WITH syncItems BY "Id"
|
||||
MERGE "maria.CategoriaReceita" WITH syncItems BY "Id"
|
||||
totalCategoria = totalCategoria + syncCount
|
||||
syncPage = syncPage + 1
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ DO WHILE syncPage > 0 AND syncPage <= pages
|
|||
syncCount = UBOUND(syncItems)
|
||||
|
||||
IF syncCount > 0 THEN
|
||||
MERGE ".FormaDePagamento" WITH syncItems BY "Id"
|
||||
MERGE "maria.FormaDePagamento" WITH syncItems BY "Id"
|
||||
totalForma = totalForma + syncCount
|
||||
syncPage = syncPage + 1
|
||||
|
||||
|
|
@ -275,7 +275,7 @@ DO WHILE i > 0 AND i < pages
|
|||
j = j + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Contatos" WITH items BY "Id"
|
||||
MERGE "maria.Contatos" WITH items BY "Id"
|
||||
i = i + 1
|
||||
IF list?.length < limit THEN
|
||||
i = 0
|
||||
|
|
@ -305,7 +305,7 @@ DO WHILE i > 0 AND i < pages
|
|||
j = j + 1
|
||||
LOOP
|
||||
|
||||
MERGE ".Vendedores" WITH items BY "Id"
|
||||
MERGE "maria.Vendedores" WITH items BY "Id"
|
||||
i = i + 1
|
||||
IF list?.length < limit THEN
|
||||
i = 0
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ SET SCHEDULE "0 30 23 * * *"
|
|||
|
||||
SEND EMAIL admin, "Inventory sync started..."
|
||||
|
||||
fullList = FIND ".Produtos"
|
||||
fullList = FIND "maria.Produtos"
|
||||
|
||||
chunkSize = 100
|
||||
startIndex = 0
|
||||
|
|
@ -30,11 +30,11 @@ DO WHILE startIndex < ubound(fullList)
|
|||
k = 0
|
||||
DO WHILE k < ubound(items)
|
||||
depositos = items[k].depositos
|
||||
pSku = FIND ".Produtos", "id=${items[k].produto.id}"
|
||||
pSku = FIND "maria.Produtos", "id=${items[k].produto.id}"
|
||||
|
||||
IF pSku THEN
|
||||
prdSku = pSku.sku
|
||||
DELETE ".Depositos", "Sku=" + prdSku
|
||||
DELETE "maria.Depositos", "Sku=" + prdSku
|
||||
|
||||
l = 0
|
||||
DO WHILE l < ubound(depositos)
|
||||
|
|
@ -42,7 +42,7 @@ DO WHILE startIndex < ubound(fullList)
|
|||
l = l + 1
|
||||
LOOP
|
||||
|
||||
SAVE ".Depositos", depositos
|
||||
SAVE "maria.Depositos", depositos
|
||||
depositos = null
|
||||
END IF
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ DESCRIPTION "Sync product suppliers from Bling ERP to local database"
|
|||
SEND EMAIL admin, "Suppliers sync started..."
|
||||
|
||||
FUNCTION SyncProdutoFornecedor(idProduto)
|
||||
DELETE ".ProdutoFornecedor", "Produto_id=" + idProduto
|
||||
DELETE "maria.ProdutoFornecedor", "Produto_id=" + idProduto
|
||||
|
||||
i1 = 1
|
||||
DO WHILE i1 > 0 AND i1 < pages
|
||||
|
|
@ -26,7 +26,7 @@ FUNCTION SyncProdutoFornecedor(idProduto)
|
|||
j1 = j1 + 1
|
||||
LOOP
|
||||
|
||||
SAVE ".ProdutoFornecedor", items1
|
||||
SAVE "maria.ProdutoFornecedor", items1
|
||||
items1 = null
|
||||
i1 = i1 + 1
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ FUNCTION SyncProdutoFornecedor(idProduto)
|
|||
LOOP
|
||||
END FUNCTION
|
||||
|
||||
fullList = FIND ".Produtos"
|
||||
fullList = FIND "maria.Produtos"
|
||||
|
||||
chunkSize = 100
|
||||
startIndex = 0
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
TABLE Contatos
|
||||
TABLE Contatos ON maria
|
||||
Id number key
|
||||
Nome string(150)
|
||||
Codigo string(50)
|
||||
|
|
@ -37,7 +37,7 @@ TABLE Contatos
|
|||
Pais_nome string(100)
|
||||
END TABLE
|
||||
|
||||
TABLE Pedidos
|
||||
TABLE Pedidos ON maria
|
||||
Id number key
|
||||
Numero integer
|
||||
NumeroLoja string(15)
|
||||
|
|
@ -59,7 +59,7 @@ TABLE Pedidos
|
|||
NotaFiscal_id number
|
||||
END TABLE
|
||||
|
||||
TABLE PedidosItem
|
||||
TABLE PedidosItem ON maria
|
||||
Id number key
|
||||
Numero integer
|
||||
Sku string(20)
|
||||
|
|
@ -75,14 +75,14 @@ TABLE PedidosItem
|
|||
Pedido_id number
|
||||
END TABLE
|
||||
|
||||
TABLE ProdutoImagem
|
||||
TABLE ProdutoImagem ON maria
|
||||
Id number key
|
||||
Ordinal number
|
||||
Sku string(20)
|
||||
Link string(250)
|
||||
END TABLE
|
||||
|
||||
TABLE Produtos
|
||||
TABLE Produtos ON maria
|
||||
Id number key
|
||||
Nome string(150)
|
||||
Sku string(20)
|
||||
|
|
@ -146,7 +146,7 @@ TABLE Produtos
|
|||
Estrutura_componentes_0_produto_Quantidade double
|
||||
END TABLE
|
||||
|
||||
TABLE Depositos
|
||||
TABLE Depositos ON maria
|
||||
Internal_Id number key
|
||||
Id number
|
||||
Sku string(20)
|
||||
|
|
@ -154,7 +154,7 @@ TABLE Depositos
|
|||
SaldoVirtual double
|
||||
END TABLE
|
||||
|
||||
TABLE Vendedores
|
||||
TABLE Vendedores ON maria
|
||||
Id number key
|
||||
DescontoLimite double
|
||||
Loja_Id number
|
||||
|
|
@ -163,7 +163,7 @@ TABLE Vendedores
|
|||
Contato_Situacao string(1)
|
||||
END TABLE
|
||||
|
||||
TABLE ProdutoFornecedor
|
||||
TABLE ProdutoFornecedor ON maria
|
||||
Id number key
|
||||
Descricao string(255)
|
||||
Codigo string(50)
|
||||
|
|
@ -175,7 +175,7 @@ TABLE ProdutoFornecedor
|
|||
Garantia integer
|
||||
END TABLE
|
||||
|
||||
TABLE ContasAPagar
|
||||
TABLE ContasAPagar ON maria
|
||||
Id number key
|
||||
Situacao integer
|
||||
Vencimento date
|
||||
|
|
@ -195,7 +195,7 @@ TABLE ContasAPagar
|
|||
Ocorrencia_tipo integer
|
||||
END TABLE
|
||||
|
||||
TABLE ContasAReceber
|
||||
TABLE ContasAReceber ON maria
|
||||
Id number key
|
||||
Situacao integer
|
||||
Vencimento date
|
||||
|
|
@ -232,7 +232,7 @@ TABLE ContasAReceber
|
|||
Ocorrencia_tipo integer
|
||||
END TABLE
|
||||
|
||||
TABLE CategoriaReceita
|
||||
TABLE CategoriaReceita ON maria
|
||||
Id number key
|
||||
IdCategoriaPai number
|
||||
Descricao string(255)
|
||||
|
|
@ -240,7 +240,7 @@ TABLE CategoriaReceita
|
|||
Situacao integer
|
||||
END TABLE
|
||||
|
||||
TABLE FormaDePagamento
|
||||
TABLE FormaDePagamento ON maria
|
||||
Id number key
|
||||
Descricao string(255)
|
||||
TipoPagamento integer
|
||||
|
|
@ -258,14 +258,14 @@ TABLE FormaDePagamento
|
|||
DadosCartao_cnpjCredenciadora string(16)
|
||||
END TABLE
|
||||
|
||||
TABLE NaturezaDeOperacao
|
||||
TABLE NaturezaDeOperacao ON maria
|
||||
Id number key
|
||||
Situacao integer
|
||||
Padrao integer
|
||||
Descricao string(255)
|
||||
END TABLE
|
||||
|
||||
TABLE Parcela
|
||||
TABLE Parcela ON maria
|
||||
Id number key
|
||||
Pedido_id number
|
||||
DataVencimento date
|
||||
|
|
@ -274,7 +274,7 @@ TABLE Parcela
|
|||
FormaPagamento_id number
|
||||
END TABLE
|
||||
|
||||
TABLE HistoricoPreco
|
||||
TABLE HistoricoPreco ON maria
|
||||
Id number key
|
||||
Sku string(50)
|
||||
PrecoAntigo double
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
/home/rodriguez/gb/restart.sh: line 19: ./target/debug/botserver: No such file or directory
|
||||
|
|
@ -1 +0,0 @@
|
|||
/home/rodriguez/gb/restart.sh: line 23: ./target/debug/botui: No such file or directory
|
||||
|
|
@ -4,7 +4,7 @@ name,value
|
|||
# SERVER CONFIGURATION
|
||||
# ============================================================================
|
||||
server_host,0.0.0.0
|
||||
server_port,8088
|
||||
server_port,9000
|
||||
sites_root,/tmp
|
||||
,
|
||||
# ============================================================================
|
||||
|
|
|
|||
|
30
edu.gbai/edu.gbdialog/register_student.bas
Normal file
30
edu.gbai/edu.gbdialog/register_student.bas
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
TABLE students
|
||||
Id uuid key
|
||||
Name string(255)
|
||||
Email string(255)
|
||||
RegisteredAt timestamp
|
||||
END TABLE
|
||||
|
||||
PARAM name AS STRING LIKE "John Doe" DESCRIPTION "Full name of the student"
|
||||
PARAM email AS STRING LIKE "john@example.com" DESCRIPTION "Email address of the student"
|
||||
|
||||
DESCRIPTION "Register a new student by saving their name and email to the students table"
|
||||
|
||||
studentId = UUID()
|
||||
registeredAt = NOW()
|
||||
|
||||
WITH student
|
||||
id = studentId
|
||||
name = name
|
||||
email = email
|
||||
registeredAt = registeredAt
|
||||
END WITH
|
||||
|
||||
SAVE "students", studentId, student
|
||||
|
||||
TALK "Student registered successfully!"
|
||||
TALK "Student ID: " + studentId
|
||||
TALK "Name: " + name
|
||||
TALK "Email: " + email
|
||||
|
||||
RETURN studentId
|
||||
|
|
@ -1,19 +1 @@
|
|||
name,value
|
||||
,
|
||||
bot-name,WhatsApp Integration
|
||||
bot-description,WhatsApp messaging integration
|
||||
,
|
||||
param-whatsappPhoneNumber,
|
||||
param-whatsappBusinessAccountID,
|
||||
param-whatsappAccessToken,
|
||||
param-whatsappWebhookURL,
|
||||
param-whatsappVerifyToken,
|
||||
,
|
||||
llm-model,gpt-4o-mini
|
||||
llm-temperature,0.3
|
||||
,
|
||||
sync-interval,60
|
||||
auto-reply,true
|
||||
,
|
||||
param-admin1,admin@yourdomain.com
|
||||
param-admin2,admin2@yourdomain.com
|
||||
Meta Challenge,
|
||||
|
|
|
|||
|
Loading…
Add table
Reference in a new issue