An employee (in this scenario, they are called Participant) needs to take a corporate trip, for some reason, whatever it may be (ex: customer service/visit, business meeting, event). So this routine will have as main objective to register the request of this trip, considering relevant information to control the expenses of the trip and its policies.
This routine only covers requests from Protheus. Trips integrated with Reserve do not generate requests, as they are purchased and issued directly by the agency. |
In the items of the trip, you can select and justify/detail the following services:
|
When parameterized for approval after the request, a pending approval will be generated for the superior of the participants. Otherwise, it can be sent to the travel department (directly after the request or in a second moment through the sending option) and the trip will be generated automatically.
Example:
The company can decide to go through all the approvals, in this case the flow will be:
Or it may be that only one of the approvals is necessary, in this case we have:
Access the routine through: Updates > Travel > Travel Requests
The traveler must inform the basic data of the trip in the header of the request, such as origin and destination, departure and arrival dates, customer for assistance (if any), etc.
For each service, Participants and their respective Cost Entities must be informed.
Also, you can select which participants will receive an advance in the Advances tab.
The calculated value is a forecast and is displayed only when it is parameterized:
For the execution of the automatic routine, we illustrated some features such as Inclusion (MyFA666Inc), Edition (MyFA666Alt) and Exclusion (MyFA666Del), in the following examples:
#INCLUDE "PROTHEUS.CH" #INCLUDE "FWMVCDEF.CH" //---------- Add travel request ----------// User Function MyFA666Inc() Local oModel := Nil Local oModelFW3 := Nil Local oModelFW4 := Nil Local oModelFW5 := Nil Local oModelFW6 := Nil Local cFilAtu := "" RpcSetEnv("T1","D MG 01 ","claudio.ribeiro","1") // Starts environment with requesting user oModel := FWLoadModel("FINA666") oModelFW3 := oModel:GetModel("FW3MASTER") // Travel header oModelFW4 := oModel:GetModel("FW4DETAIL") // Services oModelFW5 := oModel:GetModel("FW5DETAIL") // Participants oModelFW6 := oModel:GetModel("FW6DETAIL") // Cost center cFilAtu := xFilial("FW3") oModel:SetOperation(MODEL_OPERATION_INSERT) oModel:Activate() // Fill in the travel request header oModelFW3:SetValue("FW3_FILIAL",cFilAtu) oModelFW3:SetValue("FW3_NACION","1") oModelFW3:SetValue("FW3_CODORI","SP") oModelFW3:SetValue("FW3_CODDES","RJ") oModelFW3:SetValue("FW3_DTINI",StoD("20190702")) oModelFW3:SetValue("FW3_DTFIM",StoD("20190705")) oModelFW3:SetValue("FW3_CLIENT","001 ") oModelFW3:SetValue("FW3_LOJA","01") oModelFW3:SetValue("FW3_STATUS","0") // Open, initial status // Fill in the service grid included in the travel request oModelFW4:SetValue("FW4_ITEM",StrZero(1,TamSX3("FW4_ITEM")[1])) oModelFW4:SetValue("FW4_TIPO","1") // Aereo oModelFW4:SetValue("FW4_OBS", “Customer visit") // Fills grid of traveling participants oModelFW5:SetValue("FW5_ITEM",StrZero(1,TamSX3("FW4_ITEM")[1])) oModelFW5:SetValue("FW5_PARTIC","000001") oModelFW5:SetValue("FW5_ADIANT",.T.) // Add advance to participant oModelFW5:AddLine() // Add line for a second traveler oModelFW5:SetValue("FW5_ITEM",StrZero(2,TamSX3("FW4_ITEM")[1])) oModelFW5:SetValue("FW5_PARTIC","000002") oModelFW5:SetValue("FW5_ADIANT",.T.) // Add advance to participant // Fill in cost center grid oModelFW6:SetValue("FW6_ITEM",StrZero(1,TamSX3("FW4_ITEM")[1])) oModelFW6:SetValue("FW6_CC","002 ") oModelFW6:SetValue("FW6_PORCEN",100) oModelFW5:GoLine(1) // Validation and recording of data, if consistent If oModel:VldData() oModel:CommitData() Conout("Travel request included successfully.") Else VarInfo("",oModel:GetErrorMessage()) Conout("Validation error, travel request not included.") EndIf oModel:DeActivate() oModel:Destroy() RpcClearEnv() Return //---------- Travel Request change ----------// User Function MyFA666Alt() Local aKeyFW4 := {} Local oModel := Nil Local oModelFW5 := Nil Local oModelFW6 := Nil Local cSolic := "0000000010" RpcSetEnv("T1","D MG 01 ","richard.santos","1") // Initialize environment with requesting user dbSelectArea("FW3") dbSetOrder(1) dbSeek(xFilial("FW3")+cSolic) // Load data model with travel request positioned oModel := FWLoadModel("FINA666") oModelFW5 := oModel:GetModel("FW5DETAIL") // Participants oModelFW6 := oModel:GetModel("FW6DETAIL") // Cost center // Participant search key within the travel request aKeyFW4 := { {"FW5_FILIAL",xFilial("FW5")},{"FW5_SOLICI",cSolic},{"FW5_ITEM","01"},{"FW5_PARTIC","000002"} } oModel:SetOperation(MODEL_OPERATION_UPDATE) oModel:Activate() // Remove one of the travelers, in this case, participant 000002 If oModelFW5:SeekLine(aKeyFLE) oModelFW5:DeleteLine() Else Conout("Traveler not found in this travel request.") EndIf // Change the cost center (automatically positioned on the first grid) oModelFW6:SetValue("FW6_CC","003 ") // Validation and recording of data, if consistent If oModel:VldData() oModel:CommitData() Conout("Travel request edited successfully.") Else VarInfo("",oModel:GetErrorMessage()) Conout("Validation error, travel request not edited.") EndIf oModel:DeActivate() oModel:Destroy() RpcClearEnv() Return //---------- Delete travel request ----------// User Function MyFA666Del() Local oModel := Nil Local cSolic := "0000000010" RpcSetEnv("T1","D MG 01 ","claudio.ribeiro","1") // Starts environment with requesting user dbSelectArea("FW3") dbSetOrder(1) dbSeek(xFilial("FW3")+cSolic) // Load data model with travel request positioned oModel:= FWLoadModel("FINA666") oModel:SetOperation(MODEL_OPERATION_DELETE) oModel:Activate() // Validating and saving deletion If oModel:VldData() oModel:CommitData() Conout("Travel request deleted successfully.") Else VarInfo("",oModel:GetErrorMessage()) Conout("Validation error, travel request not deleted.") EndIf oModel:DeActivate() oModel:Destroy() RpcClearEnv() Return |
<!-- esconder o menu --> <style> div.theme-default .ia-splitter #main { margin-left: 0px; } .ia-fixed-sidebar, .ia-splitter-left { display: none; } #main { padding-left: 10px; padding-right: 10px; overflow-x: hidden; } .aui-header-primary .aui-nav, .aui-page-panel { margin-left: 0px !important; } .aui-header-primary .aui-nav { margin-left: 0px !important; } </style> |