Páginas filhas
  • ATFA036 - Automatic Routine - Fixed_Asset_Posting

Versões comparadas

Chave

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

Índice


01. OVERVIEW

This documentation contains details on automatic executions (MsExecAuto) of Asset Posting through routine (ATFA036).

This feature allows automating the Asset Posting process.

02. EXAMPLE


Bloco de código
languagegroovy
themeMidnight
titleExample of Posting
linenumberstrue
collapsetrue
#INCLUDE "Protheus.ch"

User Function MyATF036()
Local aArea := GetArea()
Local cBase := "0000000005"
Local cItem := "0001"
Local cTipo := "01"
Local cTpSaldo := "1"
Local cBaixa := "0"
Local nQtdAtu := 1
Local nQtdBaixa := 1
Local cMotivo := "08"
Local cMetDepr := GetMV('MV_ATFDPBX')
Local cNumNF := ""
Local cSerieNF := ""
Local nValNF := 0

Local aCab := {}
Local aAtivo := {}
Local aParam := {}

Private lMsErroAuto := .F.
Private lMsHelpAuto := .T.

aCab := { {"FN6_FILIAL" ,XFilial("FN6") ,NIL},;
{"FN6_CBASE" ,cBase ,NIL},;
{"FN6_CITEM" ,cItem ,NIL},;
{"FN6_MOTIVO" ,cMotivo ,NIL},;
{"FN6_BAIXA" ,100 ,NIL},;
{"FN6_QTDBX" ,nQtdBaixa ,NIL},;
{"FN6_DTBAIX" ,dDatabase ,NIL},;
{"FN6_DEPREC" ,cMetDepr ,NIL}}

aAtivo := {{"N3_FILIAL" ,XFilial("SN3") ,NIL},;
{"N3_CBASE" ,cBase ,NIL},;
{"N3_ITEM" ,cItem ,NIL},;
{"N3_TIPO" ,cTipo ,NIL},;
{"N3_BAIXA" ,cBaixa ,NIL},;
{"N3_TPSALDO" ,cTpSaldo ,NIL}}

//Array containing F12 parameters
aAdd( aParam, {"MV_PAR01", 1} ) //Question 01 - Display Accounting Entry? 1 = Yes ; 2 = No
aAdd( aParam, {"MV_PAR02", 2} ) //Questioin 02 - Group Accounting Entry? 1 = Yes ; 2 = No
aAdd( aParam, {"MV_PAR03", 1} ) //Question 03 - Online Booking? 1 = Yes ; 2 = No
aAdd( aParam, {"MV_PAR04", 2} ) //Question 04 - Viewing? 2 = Asset Types   // requires use of number 2 

Begin Transaction
MsExecAuto({|a,b,c,d,e,f|ATFA036(a,b,c,d,e,f)},aCab,aAtivo,3,,.T./*lBaixaTodos*/,aParam)
If lMsErroAuto
MostraErro()
DisarmTransaction()
EndIf
End Transaction

RestArea(aArea)

Return
Bloco de código
languagegroovy
themeMidnight
titleExample of Posting Cancellation
linenumberstrue
collapsetrue
  #INCLUDE "Protheus.ch"


User Function MyATF036()

Local aArea := GetArea()

Local cBase := "0000000005"

Local cItem := "0001"

Local cTipo := "01"

Local cTpSaldo := "1"

Local cBaixa := "1"

Local cSeq := "001"

Local cSeqReav := ""

Local cFilOri := "D MG 01"

Local cMotivo := "08"

Local cMetDepr := GetMV('MV_ATFDPBX')

Local aCab := {}

Local aAtivo := {}

Local aParam := {}


Private lMsErroAuto := .F.

Private lMsHelpAuto := .T.

aCab := { {"FN6_FILIAL" ,XFilial("FN6") ,NIL},; 
{"FN6_CBASE" ,cBase ,NIL},; 
{"FN6_CITEM" ,cItem ,NIL},; 
{"FN6_MOTIVO" ,cMotivo ,NIL},; 
{"FN6_DEPREC" ,cMetDepr ,NIL}}


aAtivo := {{"N3_FILIAL" ,XFilial("SN3") ,NIL},; 
{"N3_CBASE" ,cBase ,NIL},; 
{"N3_ITEM" ,cItem ,NIL},; 
{"N3_TIPO" ,cTipo ,NIL},; 
{"N3_BAIXA" ,cBaixa ,NIL},; 
{"N3_TPSALDO" ,cTpSaldo ,NIL},; 
{"N3_SEQ" ,cSeq ,NIL},; 
{"N3_SEQREAV" ,cSeqReav ,NIL},; 
{"N3_FILORIG" ,cFilOri ,NIL}}


//Array containing F12 parameters
aAdd( aParam, {"MV_PAR01", 1} ) //Question 01 - Display Accounting Entry? 1 = Yes ; 2 = No
aAdd( aParam, {"MV_PAR02", 2} ) //Questioin 02 - Group Accounting Entry? 1 = Yes ; 2 = No
aAdd( aParam, {"MV_PAR03", 1} ) //Question 03 - Online Booking? 1 = Yes ; 2 = No
aAdd( aParam, {"MV_PAR04", 1} ) //Question 04 - Viewing? 1 = Asset Posting // requires use of number 1

Begin Transaction 

MsExecAuto({|a,b,c,d,e,f|ATFA036(a,b,c,d,e,f)},aCab,aAtivo,5,,.T./*lBaixaTodos*/,aParam) 

If lMsErroAuto 

MostraErro() 

DisarmTransaction() 

EndIf

End Transaction

RestArea(aArea)

Return



Aviso
titleImportant

To use the 5th parameter Post All as .F., enter in header (aCab) the field FN6_PERCBX (% posted) due to validations.


03. RELATED SUBJECTS