Árvore de páginas

Versões comparadas

Chave

  • Esta linha foi adicionada.
  • Esta linha foi removida.
  • A formatação mudou.

...

     Exemplo de uso do ponto de entrada:

Bloco de código
languagedelphiactionscript3
titlePonto de Entrada
linenumberstrue
#INCLUDE "TOTVS.CH"

User Function FT210OPC()

Local _nRet  := 01
Local lNopc_nOpca := paramixbParamixb[1] // Default: igual a 1 libaraçãoliberação continua 

	If lNopc == 1 .And.LiberPed()
		nRet := 1
	EndIf

Return nRet 

Static Function LiberPed()
Local lRet   := .F.
Local cRisco   := ""
Local cCondPg  := ""
Local cNumPed  := ""
Local nTotVen  := 0 
Local aArea    := GetArea()
Local aAreSA1  := SA1->(GetArea()) 
Local aAreSC6  := SC6->(GetArea())
Local aAreaSE4 := SE4->(GetArea())

DbSelectArea("SE4")
DbSetorder(1)
DbSeek(xFilial("SE4")+SC5->C5_CONDPAG)
cCondPg := AllTrim(SE4->E4_COND) 

If cCondPg == "00"
	lRet := .T.  // Pg a vista pode seguir 
Else 
	DbSelectArea("SA1")
	DbSetorder(1)
	DbSeek(xFilial("SA1")+SC5->C5_CLIENTE+SC5->C5_LOJACLI )
	cRisco := SA1->A1_RISCO

	DbSelectArea("SC6")
	DbSetorder(1)
	DbSeek(xFilial("SC6")+SC5->C5_NUM  )
	cNumPed := SC5->C5_NUM 
	While !Eof() .And. cNumPed = SC6->C6_NUM 
		nTotVen := SC6->C6_VALOR
		SC6->(DbSkip())
	End 

	If nTotVen <= 100000 .And. cRisco $ "B,C, "
		lRet := .T.
	Else
		MsgAlert("Pedido nâo pode ser Liberado acione o Gerente")
	EndIf		

	RestArea(aAreSA1)
	RestArea(aAreSC6)	
EndIf	

ResTArea(aAreaSE4)
RestArea(aArea)

Return lRet 
//Bloqueia a liberação do Cliente: 000001 / Loja: 02
If _nOpca == 1 .And. SC5->C5_CLIENTE == "000001" .And. SC5->C5_LOJACLI == "02"
	_nRet := 0	//Interrompe a liberação
EndIf

Return _nRet