Índice | ||
---|---|---|
|
Example of how to use the automatic routine ATFA060 - Asset Transfer
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
User Function MyATFA060()
Local aDadosAuto := {} // Array with data to be sent by MsExecAuto() for automatic recording.
Local aParamAuto := {}
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 in relation to the parameters entered
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ The example below was considered using only ledger account and cost center data. If ³
//³ needed, transmit the fields related to accounting items and value classes. ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
dDatabase := cTod("08/02/2010")
aDadosAuto:= { {'N3_FILIAL' ,ALLTRIM(xfilial("SN3")),Nil},; // Code of branch
{'N3_CBASE' , "0000000002" , Nil},; // Base code of asset
{'N3_ITEM' , "0001" , Nil},; // Sequential Item of asset base code
{'N3_TIPO' , "10" , Nil},; // Asset Type
{'N4_DATA' , dDatabase , Nil},; // Asset acquisition date
{'N3_CCUSTO' , "123" , Nil},; // Cost Center of Expense
{'N3_CCONTAB' , "123" , Nil},; // Ledger Account
{'N3_CCORREC' , "123" , Nil},; // Asset Correction Account
{'N3_CDEPREC' , "123" , Nil},; // Depreciation Expense Account
{'N3_CCDEPR' , "123" , Nil},; // Accrued Depreciation Account
{'N3_CDESP' , "123" , Nil},; // Depreciation Correction Account
{'N3_CUSTBEM' , "123" , Nil},; // Cost Center of Asset Account
{'N3_CCCORR' , "123" , Nil},; // Indexation Correction Cost Center
{'N3_CCDESP' , "123" , Nil},; // Depreciation Expense Cost Center
{'N3_CCCDEP' , "123" , Nil},; // Accrued Expense Cost Center
{'N3_CCCDES' , "123" , Nil},; // Depreciation Correction Cost Center
{'N1_GRUPO' , "GR01" , Nil},; // Asset Group Code
{'N1_LOCAL' , "LOCAL" , Nil},; // Asset Location
{'N1_NFISCAL' , "NF001" , Nil},; // Invoice Number
{'N1_NSERIE' , "SERIE" , Nil},; // Invoice Series
{'N1_TAXAPAD' , "999999" , Nil},; // Default Rate Code
{'TPN_CTRAB' , "CT01 " , Nil},; // Asset Work Center, used only when integrated to SIGAMNT
{'TPN_POSCON' , "150" , Nil},; // First Asset Counter, used only when integrated to SIGAMNT
{'TPN_POSCO2' , "100" , Nil}} // Second Asset Counter, used only when integrated to SIGAMNT
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ If you want to transmit values to the fields, Group, Location, Invoice/Series, Default Rate, consider ³
//³ how the example above uses the corresponding fields of table SN1. ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
// Question parameters of routine atfa060
aAdd( aParamAuto, {"MV_PAR01", 1} ) //Question 01 - Book it ? 1 = Yes ; 2 = No
aAdd( aParamAuto, {"MV_PAR02", 2} ) //Question 02 - Display Accounting Entry ? 1 = Yes ; 2 = No
aAdd( aParamAuto, {"MV_PAR03", 2} ) //Question 02 - Group Entries ? 1 = Yes ; 2 = No
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
// You can set the fourth parameter with the following states.
//.T. = Mirror.
//.F. = Update.
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
MSExecAuto({|x, y, w, z| AtfA060(x, y, w, z)},aDadosAuto, 4 ,, .F.)
If lMsErroAuto
lRetorno := .F.
MostraErro()
Else
lRetorno:=.T.
EndIf
Return
|
Aviso | ||
---|---|---|
| ||
In accounting transfer, the Execauto call for each asset must be done separately, because the automatic execution is prepared for transferring one asset type at a time. |
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#Include 'Protheus.ch'
#Include 'Protheus.ch'
#Include 'tbiconn.ch'
User Function MyATFA060()
Local aDadosAuto := {} // Array with data to be sent by MsExecAuto() for automatic recording.
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 in relation to
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ The example below was considered using only ledger account and cost center data. If ³
//³ needed, transmit the fields related to accounting items and value classes. ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
dDatabase := cTod("08/02/2010")
aDadosAuto:= {{'N3_CBASE' , "TRANSF " , Nil},; // Base code of asset
{'N3_ITEM' , "001 " , Nil},; // Sequential item of asset base code
{'N3_TIPO' , "10" , Nil},; // Asset Type
{'N1_FILIAL' , "D MG 02 " , Nil},; // Asset Destination Branch
{'N4_DATA' , dDatabase , Nil},; // Asset acquisition date
{'N3_CCUSTO' , " " , Nil},; // Cost Center of Expense
{'N3_CCONTAB' , "101010100 " , Nil},; // Ledger Account
{'N3_CCORREC' , " " , Nil},; // Asset Correction Account
{'N3_CDEPREC' , "201010100 " , Nil},; // Depreciation Expense Account
{'N3_CCDEPR' , "101010300 " , Nil},; // Accrued Depreciation Account
{'N3_CDESP' , " " , Nil},; // Depreciation Correction Account
{'N3_CUSTBEM' , " " , Nil},; // Cost Center of Asset Account
{'N3_CCCORR' , " " , Nil},; // Indexation Correction Cost Center
{'N3_CCDESP' , " " , Nil},; // Depreciation Expense Cost Center
{'N3_CCCDEP' , " " , Nil},; // Accrued Expense Cost Center
{'N3_CCCDES' , " " , Nil},; // Depreciation Correction Cost Center
{'N1_GRUPO' , " " , Nil},; // Asset Group Code
{'N1_LOCAL' , " " , Nil},; // Asset Location
{'N1_NFISCAL' , " " , Nil},; // Invoice Number
{'N1_NSERIE' , " " , Nil},; // Invoice Series
{'N1_TAXAPAD' , " " , Nil}} // Default Rate Code
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ If you want to transmit values to the fields, Group, Location, Invoice/Series, Default Rate, consider ³
//³ how the example above uses the corresponding fields of table SN1. ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
// You can set the fourth parameter with the following states.
//.T. = Mirror.
//.F. = Update.
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
MSExecAuto({|x, y, w, z| AtfA060(x, y, w, z)},aDadosAuto, 4, aParamAuto , .F.)
If lMsErroAuto
lRetorno := .F.
MostraErro()
Else
lRetorno:=.T.
EndIf
Return |
Bloco de código | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
#Include 'Protheus.ch'
#Include 'Protheus.ch'
#Include 'tbiconn.ch'
User Function MyATFA060()
Local aDadosAuto := {} // Array with data to be sent by MsExecAuto() for automatic recording.
Local aParamAuto := {}
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 in relation to
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ The example below was considered using only ledger account and cost center data. If ³
//³ needed, transmit the fields related to accounting items and value classes. ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
PREPARE ENVIRONMENT COMPANY 'T1' BRANCH 'D MG 01 ' TABLES 'SN1','SN3','SN4','FNR' MODULE 'ATF'
dDatabase := cTod("02/10/2023")
aDadosAuto:= {{'N3_CBASE' , "TRANSF6 " , Nil},; // Base code of asset
{'N3_ITEM' , "001 " , Nil},; // Sequential item of asset base code
{'N3_TIPO' , "10" , Nil},; // Asset Type
{'N1_FILIAL' , "D MG 02 " , Nil},; // Asset Destination Branch
{'N1_QUANTD' , 4 , Nil},; // Target quantity
{'N4_DATA' , dDatabase , Nil},; // Asset acquisition date
{'N3_CCUSTO' , " " , Nil},; // Cost Center of Expense
{'N3_CCONTAB' , "101010100 " , Nil},; // Ledger Account
{'N3_CCORREC' , " " , Nil},; // Asset Correction Account
{'N3_CDEPREC' , "201010100 " , Nil},; // Depreciation Expense Account
{'N3_CCDEPR' , " " , Nil},; // Accrued Depreciation Account
{'N3_CDESP' , " " , Nil},; // Depreciation Correction Account
{'N3_CUSTBEM' , " " , Nil},; // Cost Center of Asset Account
{'N3_CCCORR' , " " , Nil},; // Indexation Correction Cost Center
{'N3_CCDESP' , " " , Nil},; // Depreciation Expense Cost Center
{'N3_CCCDEP' , " " , Nil},; // Accrued Expense Cost Center
{'N3_CCCDES' , " " , Nil},; // Depreciation Correction Cost Center
{'N1_GRUPO' , " " , Nil},; // Asset Group Code
{'N1_LOCAL' , " " , Nil},; // Asset Location
{'N1_NFISCAL' , " " , Nil},; // Invoice Number
{'N1_NSERIE' , " " , Nil},; // Invoice Series
{'N1_TAXAPAD' , " " , Nil} } // Default Rate Code
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
//³ If you want to transmit values to the fields, Group, Location, Invoice/Series, Default Rate, consider ³
//³ how the example above uses the corresponding fields of table SN1. ³
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
// Question parameters of routine atfa060
aAdd( aParamAuto, {"MV_PAR01", 1} ) //Question 01 - Book it ? 1 = Yes ; 2 = No
aAdd( aParamAuto, {"MV_PAR02", 2} ) //Question 02 - Display Accounting Entry ? 1 = Yes ; 2 = No
aAdd( aParamAuto, {"MV_PAR03", 2} ) //Question 02 - Group Entries ? 1 = Yes ; 2 = No
//ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
// You can set the fourth parameter with the following states.
//.T. = Mirror.
//.F. = Update.
//ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
MSExecAuto({|x, y, w, z| AtfA060(x, y, w, z)},aDadosAuto, 4, aParamAuto , .F.)
If lMsErroAuto
lRetorno := .F.
MostraErro()
Else
lRetorno:=.T.
EndIf
Return |