#include 'protheus.ch'
User Function MNTA4107()
Local aItens := ParamIXB[1]
Local aCabec := ParamIXB[2]
Local aRet := {}
Local nPProd := GDFieldPos( 'TL_XPROFO' , aCabec )
Local nPAlmo := GDFieldPos( 'TL_XLOCPR' , aCabec )
Local nPTipo := GDFieldPos( 'TL_TIPOREG', aCabec )
Local nPTare := GDFieldPos( 'TL_TAREFA' , aCabec )
Local nPCodi := GDFieldPos( 'TL_CODIGO' , aCabec )
If STL->TL_TIPOREG == 'T'
If ( nPosIns := aScan( aItens, { |x| !aTail( x ) .And. Trim( x[nPTare] ) == Trim( STL->TL_TAREFA ) .And.;
STL->TL_TIPOREG == x[nPTipo] .And. STL->TL_CODIGO == x[nPCodi] } ) ) > 0
RecLock( 'STL', .F. )
STL->TL_XPROFO := aItens[nPosIns,nPProd]
STL->TL_XLOCPR := aItens[nPosIns,nPAlmo]
MsUnLock()
aAdd( aRet, aItens[nPosIns,nPProd] )
aAdd( aRet, aItens[nPosIns,nPAlmo] )
EndIf
EndIf
Return aRet |