Skip to content

Instantly share code, notes, and snippets.

View Dadinel's full-sized avatar
🍺
Working/Studying at TOTVS

Daniel Mendes Dadinel

🍺
Working/Studying at TOTVS
View GitHub Profile
@Dadinel
Dadinel / Dnl_FWTemporaryTable.prw
Last active November 10, 2022 12:55
Exemplo de utilização comentado da FWTemporaryTable, classe que possibilidade a criação de tabelas temporárias no banco de dados
#include "protheus.ch"
user function DnlTmpTbl()
local oTable as object
local aFields as array
local nConnect as numeric
local lCloseConnect as logical
local cAlias as char
local cTableName as char
local cAreaQuery as char
@Dadinel
Dadinel / MenuDef_Default.prw
Last active February 22, 2024 17:54
Exemplos de MenuDef
static function MenuDef()
local aRotina as array
aRotina := {}
aAdd(aRotina, {"Pesquisar", "AxPesqui", 0, 1})
aAdd(aRotina, {"Visualizar", "AxVisual", 0, 2})
aAdd(aRotina, {"Incluir", "AxInclui", 0, 3})
aAdd(aRotina, {"Alterar", "AxAltera", 0, 4})
aAdd(aRotina, {"Excluir", "AxDeleta", 0, 5})
@Dadinel
Dadinel / MenuDef_Simple.prw
Last active June 11, 2019 23:28
Exemplo de MenuDef - Simples
static function MenuDef()
local aRotina as array
aRotina := {}
aAdd(aRotina, {"Pesquisar", "AxPesqui", 0, 1})
aAdd(aRotina, {"Visualizar", "AxVisual", 0, 2})
aAdd(aRotina, {"Incluir", "AxInclui", 0, 3})
aAdd(aRotina, {"Alterar", "AxAltera", 0, 4})
aAdd(aRotina, {"Excluir", "AxDeleta", 0, 5})
@Dadinel
Dadinel / MenuDef_SubMenu.prw
Last active June 11, 2019 23:28
Exemplo de MenuDef - Submenu
static function MenuDef()
local aRotina as array
local aSubVisl as array
local aSubAlter as array
aRotina := {}
aSubVisl := {}
aSubAlter := {}
aAdd(aSubVisl, {"Pesquisar", "AxPesqui", 0, 1})
@Dadinel
Dadinel / MenuDef_XCommand.prw
Last active June 11, 2019 23:29
Exemplo de MenuDef - Utilizando o xcommand
static function MenuDef()
local aRotina as array
aRotina := {}
ADD OPTION aRotina TITLE "Pesquisar" ACTION "AxPesqui" OPERATION 1 ACCESS 0
ADD OPTION aRotina TITLE "Visualizar" ACTION "AxVisual" OPERATION 2 ACCESS 0
ADD OPTION aRotina TITLE "Incluir" ACTION "AxInclui" OPERATION 3 ACCESS 0
ADD OPTION aRotina TITLE "Alterar" ACTION "AxAltera" OPERATION 4 ACCESS 0
ADD OPTION aRotina TITLE "Excluir" ACTION "AxDeleta" OPERATION 5 ACCESS 0
@Dadinel
Dadinel / DNL_SED.prw
Last active June 26, 2019 14:33
MVC - SED - Função principal
user function DNL_SED()
local oBrowse as object
oBrowse := FWLoadBrw("DNL_SED")
oBrowse:Activate()
oBrowse:DeActivate()
oBrowse:Destroy()
FreeObj(oBrowse)
oBrowse := nil
@Dadinel
Dadinel / DNL_SED.prw
Created June 19, 2019 14:51
MVC - SED - BrowseDef
static function BrowseDef()
local oBrowse as object
oBrowse := FWMBrowse():New()
oBrowse:SetAlias("SED")
oBrowse:SetDescription("Testando o MVC - Tabela SED")
return oBrowse
@Dadinel
Dadinel / DNL_SED.prw
Created June 19, 2019 14:51
MVC - SED - ModelDef
static function ModelDef()
local oModel as object
local oStruct as object
oModel := MPFormModel():New( "MODEL_SED", /*bPre*/ , /*bPos*/, /*bCommit*/, /*bCancel*/ )
oStruct := FwFormStruct( 1, "SED", /*bFiltro*/ )
oModel:AddFields( "FIELDS_SED", /*Owner*/ , oStruct, /*bPre*/ , /*bPos*/ , /*bLoad*/ )
return oModel
@Dadinel
Dadinel / DNL_SED.prw
Created June 19, 2019 14:52
MVC - SED - ViewDef
static function ViewDef()
local oView as object
local oStruct as object
local oModel as object
oView := FwFormView():New()
oModel := FwLoadModel("DNL_SED")
oStruct := FwFormStruct( 2, "SED", /*bFiltro*/ )
oView:SetModel(oModel)
@Dadinel
Dadinel / DNL_SED.prw
Last active June 26, 2019 14:31
MVC - SED - MenuDef
static function MenuDef()
local aRotina as array
aRotina := {}
Add Option aRotina Title "Pesquisar" Action "PesqBrw" Operation OP_PESQUISAR Access 0
Add Option aRotina Title "Visualizar" Action "ViewDef.DNL_SED" Operation OP_VISUALIZAR Access 0
Add Option aRotina Title "Incluir" Action "ViewDef.DNL_SED" Operation OP_INCLUIR Access 0
Add Option aRotina Title "Alterar" Action "ViewDef.DNL_SED" Operation OP_ALTERAR Access 0
Add Option aRotina Title "Excluir" Action "ViewDef.DNL_SED" Operation OP_EXCLUIR Access 0