Advances (FINA667) are the amounts credited to employees to cover the costs of a trip, such as food, transportation, communication, etc.
These values are calculated through the configuration of the company's travel policy, which can be:
In the Travel routine (FINA665), it is still possible to request advance complements. If an employee needs more money on a trip, this request can be made by selecting the trip and the option Individual Advance Payment. In this case, an additional advance linked to the trip is generated.
The bill generation rules, such as Prefix, Class, Due Date for regular and urgent advances (those requested outside the advance policy rule) are in the Configuration Wizard.
Advances requested either via Reserve, Travel Request or individually are not approved together with the trip and generate a pending issue for the superior of the traveler, if configured.
Example:
If the superior's approval and financial evaluation is necessary, we have:

Or, we will have the following scenarios if a step can be performed automatically:


The advance is accounted for by the standard entry of a bill. For cases in which the advance is in another currency and the rate informed after the bill is generated, it must be accounted for offline. |
This process is not mandatory. |
The advance can be generated from the travel request (FINA666) by selecting this option on the Advances tab:

Or after the Trip has already been sent to the travel department (FINA665) by clicking on the "Request Advance” and selecting the participants that will received the advance:

Then, through the routine FINA667, the advance can be viewed, and follow its flow of actions:

To execute the automatic routine, we illustrate the request for the advance after the trip is completed (MyFA667A), in the following example:
#INCLUDE "PROTHEUS.CH"
#INCLUDE "FWMVCDEF.CH"
//---------- Travel advance request ----------//
User Function MyFA667A()
Local aKeyFLC := {}
Local aUser := {}
Local oModel := Nil
Local oModelFLC := Nil
Local oModelFLD := Nil
Local cViagem := "0000000001"
Local cPartic := "000002"
RpcSetEnv("T1","D MG 01 ","claudio.ribeiro","1") // Starts environment with requesting user
dbSelectArea("FL5")
dbSetOrder(1)
dbSeek(xFilial("FL5")+cViagem) // Travel already requested
// Load data model with travel request positioned
oModel := FWLoadModel("FINA667A")
oModelFLC := oModel:GetModel("FLCDETAIL") // Participants
oModelFLD := oModel:GetModel("FLDDETAIL") // Advances
// Participant search key within the travel
aKeyFLC := { {"FLC_FILIAL",xFilial("FLC")},{"FLC_VIAGEM",cViagem},{"FLC_PARTIC",cPartic} }
oModel:SetOperation(MODEL_OPERATION_UPDATE)
oModel:Activate()
If FINXUser(RetCodUsr(),aUser,.T.)
// Participant that will receive the advance
If oModelFLC:SeekLine(aKeyFLC)
oModelFLC:SetValue("OK",.T.)
oModelFLD:LoadValue("FLD_DTSOLI",dDatabase)
oModelFLD:LoadValue("FLD_DTPREV",DataValida(dDatabase+3))
oModelFLD:LoadValue("FLD_SOLIC" ,aUser[1])
oModelFLD:LoadValue("FLD_NOMESO",PadR(aUser[2],TamSx3("FLD_NOMESO")[1]))
oModelFLD:SetValue("FLD_VALOR",400)
oModelFLD:SetValue("FLD_MOEDA","1")
oModelFLD:SetValue("FLD_JUSTIF","Advance for traveller")
// Validation and recording of data, if consistent
If oModel:VldData()
oModel:CommitData()
Conout("Advance requested successfully.")
Else
VarInfo("",oModel:GetErrorMessage())
Conout("Validation error, advance not requested.")
EndIf
Else
Conout("Traveler not found in this trip.")
EndIf
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>
|