Páginas filhas
  • Automatic Routine ATFA010 - Fixed Assets Update

Function: Automatic Routine ATFA010 - Fixed Assets Update


Scope:

Microsiga Protheus 11, Protheus 10

Versions:

Protheus 10

Compatible Countries:

All

Operating Systems:

All

Compatible with the following Databases:

All

Access Level:

Level 1 (Customer Access)

Languages:

Brazilian Portuguese, European Portuguese, Spanish, English



Description

This routine enables the automatic addition of assets.

Source Program:

atfa010.prw

Syntax:

MSExecAuto( {|X,Y,Z,W| ATFA010(X,Y,Z,W)} ,aCab ,aItens, nOpc,aParamAuto)

Parameters:


Name

Type

Description

aCabec

Array

Array containing fields of the header (SN1).

aItens

Array

Array containing fields of items (SN3).

nOpc

Array

3 - Addition

4 - Editing requires the use of field LINPOS to locate the asset

5 - Deletion requires the use of field LINPOS to locate the asset and AUTDELETA to delete it

aParamAuto

Array

Array containing the answers to routine Questions (SX1)



Examples


Example of Addition


User Function Myatfa010Inc()
Local aItens := {}
Local aDadosAuto := {} // Array with data to be sent by MsExecAuto() to automatically save the asset items
Local aCab := { {'N1_FILIAL' ,'01' ,NIL},;
{'N1_CBASE' ,'13 ' ,NIL},;
{'N1_ITEM' ,'01' ,NIL},;
{'N1_AQUISIC' ,dDataBase ,NIL},;
{'N1_DESCRIC' ,'MS EXEC AUTO' ,NIL},;
{'N1_QUANTD' , 1 ,NIL},;
{'N1_CHAPA' ,'987' ,NIL} }
// Array with data to be sent by MsExecAuto() to automatically save the asset cover
Private lMsHelpAuto := .f. // Determine whether help messages must be directed to log file
Private lMsErroAuto := .f. // Determine whether any inconsistency occurred when running the routine
aAdd(aItens,{ {'N3_TIPO' ,'01' , NIL},;
{'N3_HISTOR' ,"INCLUSAOTIPO 01 " , NIL},;
{'N3_TPSALDO' ,'1' , NIL},;
{'N3_TPDEPR' ,'1' , NIL},;
{'N3_CCONTAB' ,'11101001 ' , NIL},;
{'N3_VORIG1' , 10000 , NIL},;
{'N3_VORIG2' , 20000 , NIL},;
{'N3_VORIG3' , 30000 , NIL},;
{'N3_VMXDEPR' , 0 , NIL},;
{'N3_VLSALV1' , 0 , NIL},;
{'N3_PERDEPR' , 0 , NIL},;
{'N3_PRODMES' , 0 , NIL},;
{'N3_PRODANO' , 0 , NIL},;
{'N3_DINDEPR' ,dDataBase ,NIL} } )
//array with data to be sent by MsExecAuto() to automatically save the item of type 01
aAdd(aItens,{ {'N3_TIPO' ,'10' , NIL},;
{'N3_HISTOR' ,"INCLUSÃO TIPO 10 " , NIL},;
{'N3_TPSALDO' ,'1' , NIL},;
{'N3_TPDEPR' ,'1' , NIL},;
{'N3_CCONTAB' ,'11101001 ' , NIL},;
{'N3_VORIG1' , 10000 , NIL},;
{'N3_VORIG2' , 20000 , NIL},;
{'N3_VORIG3' , 30000 , NIL},;
{'N3_VMXDEPR' , 0 , NIL},;
{'N3_VLSALV1' , 0 , NIL},;
{'N3_PERDEPR' , 0 , NIL},;
{'N3_PRODMES' , 0 , NIL},;
{'N3_PRODANO' , 0 , NIL},;
{'N3_DINDEPR' ,dDataBase ,NIL} } ) //array with data to be sent by MsExecAuto() to automatically save the item of type 10
MSExecAuto( {|X,Y,Z| ATFA010(X,Y,Z)} ,aCab ,aItens, 3)
If lMsErroAuto
lRetorno := .F.
MostraErro()
Else
lRetorno:=.T.
EndIf
Return



Example of Editing

User Function AltMyatfa010()
Local aItens := {}
Local aDadosAuto := {} // Array with data to be sent by MsExecAuto() to automatically save the asset items
Local cHistorico := "Histórico "+ time()
Local aCab := { {'N1_FILIAL' ,(PADR('01',Len(SN1->N1_FILIAL)," ")) ,NIL},;
{'N1_CBASE' ,(PADR('13',Len(SN1->N1_CBASE)," ")) ,NIL},;
{'N1_ITEM' ,(PADR('01',Len(SN1->N1_ITEM)," ")) ,NIL},;
{'N1_DESCRIC' ,cHistorico ,NIL},;
{'N1_CHAPA' ,'987' ,NIL} }
// Array with data to be sent by MsExecAuto() to automatically save the asset cover
Private lMsHelpAuto := .f. // Determine whether help messages must be directed to log file Private
lMsErroAuto := .f. // Determine whether any inconsistency occurred when running the routine
aAdd(aItens,{ {'N3_TIPO' ,'01' , NIL},;
{'N3_HISTOR' ,"TIPO 01 "+cHistorico , NIL},;
{'N3_TPSALDO' ,'1' , NIL},;
{'N3_TPDEPR' ,'1' , NIL},;
{'N3_CCONTAB' ,'11101001 ' , NIL},;
{'N3_VORIG1' , 10000 , NIL},;
{'N3_VORIG2' , 20000 , NIL},;
{'N3_VORIG3' , 30000 , NIL},;
{'N3_VMXDEPR' , 0 , NIL},;
{'N3_VLSALV1' , 0 , NIL},;
{'N3_PERDEPR' , 0 , NIL},;
{'N3_PRODMES' , 0 , NIL},;
{'N3_PRODANO' , 0 , NIL},;
{'N3_DINDEPR' ,dDataBase ,NIL} ,;
{"LINPOS","N3_TIPO","01"} })

//array with data to be sent by MsExecAuto() to automatically save the item of type 01
aAdd(aItens,{ {'N3_TIPO' ,'10' , NIL},;
{'N3_HISTOR' ,"TIPO 10 "+cHistorico , NIL},;
{'N3_TPSALDO' ,'1' , NIL},;
{'N3_TPDEPR' ,'1' , NIL},;
{'N3_CCONTAB' ,'11101001 ' , NIL},;
{'N3_VORIG1' , 10000 , NIL},;
{'N3_VORIG2' , 20000 , NIL},;
{'N3_VORIG3' , 30000 , NIL},;
{'N3_VMXDEPR' , 0 , NIL},;
{'N3_VLSALV1' , 0 , NIL},;
{'N3_PERDEPR' , 0 , NIL},;
{'N3_PRODMES' , 0 , NIL},;
{'N3_PRODANO' , 0 , NIL},;
{'N3_DINDEPR' ,dDataBase ,NIL} ,;
{"LINPOS","N3_TIPO","10"} })

MSExecAuto( {|X,Y,Z| ATFA010(X,Y,Z)} ,aCab ,aItens, 4)
If lMsErroAuto
lRetorno := .F.
MostraErro()
Else
lRetorno:=.T.
EndIf
Return