Árvore de páginas

Ponto de Entrada

Descrição:

Ponto de Entrada para tratamento da Alçada de Liberação de Margem de Peças.

Localização:

Atualizações / Mov. Gerencial / Autorização Venda

Eventos:

Function OX003TUDOK(nOpc)

Local nCntFor
Local lVS7DIVERG := VS7->(FieldPos("VS7_DIVERG")) > 0
Local lLibOK := .f.
//
lProcessa := .t.
//

If nOpc == 2
Return .t.
EndIf

DBSelectArea("VAI")
DBSetOrder(4)
DBSeek(xFilial("VAI")+__cUserId)
//
If lTemPedPec

// Ponto de entrada para tratamento da Alçada de Liberação de Margem de Peças
if ExistBlock("OX003TO1")

if !ExecBlock("OX003TO1",.f.,.f.)
return .f.
Endif
lLibOK := .t.

Else

For nCntFor:=1 to Len(aColsP)
If !lVS7DIVERG .or. (lVS7DIVERG .and. aColsP[nCntFor,1]) // não tem o campo VS7_DIVERG OU tem o campo e tem divergencia
if VAI->(FieldPos("VAI_ADEPEC")) > 0
if aColsP[nCntFor,5] > VAI->VAI_ADEPEC .or. aColsP[nCntFor,9] < VAI->VAI_AMLPEC
MsgInfo(STR0036,STR0033) // "Usuário não possui alçada para esta operação."
return .f.
endif
endif
lLibOk := .t.
endif
Next

Endif

Endif

If lTemPedSrv
For nCntFor:=1 to Len(aColsS)
If !lVS7DIVERG .or. (lVS7DIVERG .and. aColsS[nCntFor,1]) // não tem o campo VS7_DIVERG OU tem o campo e tem divergencia
lLibOk := .t.
endif
Next
Endif

If lLibOk
if !MsgYesNo(STR0034,STR0033) // Deseja liberar a venda?
return .f.
Endif
Else
// Não há porque entrar aqui se não houver o PE OX003TO1 compilado no cliente e mesmo compilado, dependendo da customização do cliente, não irá entrar aqui
if !Empty(VS6->VS6_NUMORC)
if MsgYesNo(STR0035,STR0033) // "A venda não foi liberada. Deseja reabrir o orçamento?"
OXI001REVF(VS6->VS6_NUMORC, "0")
endif
endif
lProcessa := .f.
endif
//
return .t.

Programa Fonte:

OFIXX003.PRW

Parâmetros:N/A

Função:

OX003TUDOK()

Retorno:

Lógico (True ou False) - True continua o processo

 

Exemplo:

User Function OX003TO1()


MsgInfo("Ponto de Entrada OX003TO1 executado com sucesso!")


Return .t.