#INCLUDE "TBICONN.CH"
#INCLUDE "PROTHEUS.CH"
#INCLUDE "FWMVCDef.CH"
//-----------------------------------------------------------------
//Función de usuario para inclusión de proveedor vía execauto (MVC)
//-----------------------------------------------------------------
User Function MT020MVC()
Local oModel := Nil
Local cFornec := '000100'
Local cForLoja := '01'
Local lIncOk := .F.
PREPARE ENVIRONMENT EMPRESA "01" FILIAL "0101" MODULO "FIN" TABLES "SA2", "F72"
oModel := FwLoadModel ("MATA020")
oModel:SetOperation(MODEL_OPERATION_INSERT)
oModel:Activate()
oModel:SetValue("SA2MASTER","A2_COD" , cFornec)
oModel:SetValue("SA2MASTER","A2_LOJA" , cForLoja)
oModel:SetValue("SA2MASTER","A2_NOME" , "FORN TESTE PIX")
oModel:SetValue("SA2MASTER","A2_NREDUZ", "F TESTE PIX")
oModel:SetValue("SA2MASTER","A2_END" , "RUA FORN PIX ")
oModel:SetValue("SA2MASTER","A2_EST" , "SP")
oModel:SetValue("SA2MASTER","A2_MUN" , "SAO PAULO")
oModel:SetValue("SA2MASTER","A2_TIPO" , "F")
If oModel:VldData()
oModel:CommitData()
MsgInfo("¡Registro INCLUIDO!", "Atención")
lIncOk:=.T.
Else
VarInfo("",oModel:GetErrorMessage())
EndIf
oModel:DeActivate()
oModel:Destroy()
oModel := NIL
If lIncOk
U_F885MVC(cFornec,cForLoja)
EndIf
RESET ENVIRONMENT
Return Nil
//-----------------------------------------------------------------
//Función de usuario para inclusión de clave PIX para proveedor vía execauto (MVC)
//-----------------------------------------------------------------
User Function F885MVC(cFornec As Character, cForLoja As Character)
Local oModel := Nil
Default cFornec := ""
Default cForLoja := ""
DbSelectArea("SA2")
SA2->(DbSetOrder(1))
If SA2->(DBSeek(xFilial("SA2") + cFornec + cForLoja))
oModel := FwLoadModel ("FINA885")
oModel:SetOperation(MODEL_OPERATION_INSERT)
oModel:Activate()
oModel:SetValue("FORMCAB","F72_FILIAL", xFilial("SA2"))
oModel:SetValue("FORMCAB","F72_COD" , cFornec)
oModel:SetValue("FORMCAB","F72_LOJA" , cForLoja)
oModel:SetValue("FORMCAB","F72_NOME" , SA2->A2_NOME)
oModel:SetValue("FORDETAIL", "F72_TPCHV" , "02")
oModel:SetValue("FORDETAIL", "F72_CHVPIX", "[email protected]")
oModel:SetValue("FORDETAIL", "F72_ACTIVE", "1")
If oModel:VldData()
oModel:CommitData()
MsgInfo("¡Registro INCLUIDO!", "Atención")
Else
VarInfo("",oModel:GetErrorMessage())
EndIf
oModel:DeActivate()
oModel:Destroy()
oModel := NIL
EndiF
Return Nil