01. GENERAL DATA

Product:

TOTVS Backoffice

Product Line:

Protheus Line

Industry:

Services

Module:

TOTVS Backoffice (Protheus Line) - Fixed Assets (SIGAATF)

Function:

ATFA380

Country:

Brazil

Ticket:

Internal

Requisite/Story/Issue

DSERCTR1-46748

02. DESCRIPTION

Entry point AF380VLIN is used for validating each grid row in the Recoverable Value Adjustment routine. It allows the application of specific business rules to check and control the data entered or adjusted on the grid.

Operation:

    • Executing during interaction with the grid, assessing each line before continuing.
    • It allows the developer to implement custom validations, ensuring that all entered values and data meet the expected criteria.

Benefits:

    • Dynamic Validation: Ensures the consistency and integrity of data entered on the grid.
    • Customization: Flexibility to adapt system behavior to the specific needs of each customer or process.

This entry point is essential to scenarios in which the data adjusted in the Recoverable Value Adjustment routine demand validations that are rigorous or customized before confirmation.

03. OTHER INFORMATION


Handling of EP in the system
lRet := ExecBlock( "AF380VLIN", .F., .F.,{oGetD:aHeader,oGetD:aCols,nInc,nOpc,lEfetiva } )
EP Example
#Include 'Protheus.ch'

//Example entry point to validate row in export or import

User Function AF380VLIN()

      Local aHeaVLin := ParamIXB[1]
      Local aColsVLin := ParamIXB[2]
      Local nLinAt := ParamIXB[3]
      Local nOpc := ParamIXB[4]
      Local lEfetiva_ := ParamIXB[5]
      Local lRet := .T.
      Local cQuery := ""
      Local aArea := GetArea()
      Local cAliasQry := CriaTrab(,.F.)
      Local nPosBem := aScan( aHeaVLin, {|x| Upper( AllTrim( x[2] ) ) == "NJ_BEM" } )
      Local nPosItBem := aScan( aHeaVLin, {|x| Upper( AllTrim( x[2] ) ) == "NJ_ITBEM" } )

      If nOpc == 7 .And. lEfetiva_ .And. nPosBem > 0 .And. nPosItBem > 0

            //import with activation has to validate if the asset is not already in another simulation

            cQuery := " SELECT NI_STATUS FROM "
            cQuery += " SNI000 SNI, SNJ000 SNJ "
            cQuery += " WHERE "          
            cQuery += "  NI_STATUS = '1' "
            cQuery += " AND SNI.D_E_L_E_T_ = ' ' "
            cQuery += " AND NI_FILIAL = NJ_FILIAL "
            cQuery += " AND NI_PROC = NJ_PROC "  
            cQuery += " AND SNJ.D_E_L_E_T_ = ' ' "

            dbUseArea(.T., "TOPCONN", TcGenQry(,, cQuery ), cAliasQry, .T.,.F. )

            If (cAliasQry)->( !Eof() ) //if found it returns .F. to caller
               (cAliasQry)->( DbCloseArea() )
               //MsgInfo("Asset : "+aColsVLin[nLinAt, nPosBem]+"/"+aColsVLin[nLinAt, nPosItBem]+" - found in another simulation, File cannot be imported.")
               lRet := .F.
            EndIf

      EndIf

      RestArea(aArea)

Return(lRet)

Important

  • It is noteworthy that the customer is responsible for EP utilization and its impacts on the system.
  • The examples used in this documentation are for demonstration purposes only. Each customer must check what behavior they want to perform according to the scope of the entry point.

04. RELATED SUBJECTS

  • Not Applicable.