By changing the contract type in the listing, the application reloads the contract and its renewal plans.
This information comes from the "BusinessObjects" and "ContractObjects" tables, you can get the information directly from SQL and then populate the grid.
If you wish, you can run through the engines using the "RhpBEContrato Trabalho" object by editing the Renewal Plans using the following code:
Dim objCont As RhpBEContratoTrabalho
Dim i As Integer
Set objCont = BSO.RecursosHumanos.ContratosTrabalho.Edita(CmbContrato.Text)
For i = 1 To objCont.PlanoRenovCont.NumItens
With GrelhaPlano
GrelhaPlano.Col = 2
GrelhaPlano.Row = i
GrelhaPlano.TypeComboBoxList = m_strListaTiposVinculo
GrelhaPlano.TypeComboBoxCurSel = findIndexTContrato(objCont.PlanoRenovCont(i).TipoContrato)
GrelhaPlano.Col = 3
GrelhaPlano.Row = i
GrelhaPlano.TypeComboBoxCurSel = findIndexSituacao(objCont.PlanoRenovCont(i).Situacao)
.SetText 4, i, objCont.PlanoRenovCont.Edita(i).Duracao
.SetText 5, i, objCont.PlanoRenovCont.Edita(i).AvisoCadFunc
.SetText 6, i, objCont.PlanoRenovCont.Edita(i).AvisoCadEmp
.SetText 7, i, objCont.PlanoRenovCont.Edita(i).AvisoIntFunc
.SetText 8, i, objCont.PlanoRenovCont.Edita(i).AvisoIntEmp
.SetText 9, i, objCont.PlanoRenovCont.Edita(i).CompensCaducidade
VerificaContrato (i)
End With
Next
The employee object does not contain an object with the plans information, the employees table stores the value of the work contract in the "Contract" field.
This field is later used to fill the grid as follows:
Relate item checks which contract is in the "Contract" field of the "Employees" table.
Relate item loads object from work contract "RhpBConnect Work".
Relate the item fills the grid with the information found in this work contract.
(Code sent in response)
After updating the new work contract, the grid is loaded with the information in the table "NetResetFun". This data can be loaded with the following code:
objPlanoRenovFunc As RhpBEPlanoRenovFunc
Set mPlanoRenovFunc = BSO.RecursosHumanos.PlanoRenovFunc.ListaPlanoFuncionario(sChave)
For i = 1 To objPlanoRenovFunc.NumItens
//Preenche grelha com a informação do plano de renovações
With objPlanoRenovFunc.Edita(i)
GrelhaPlano.Col = 2
GrelhaPlano.Row = i
Grelha.TypeComboBoxCurSel = .TipoContrato
GrelhaPlano.Col = 3
GrelhaPlano.Row = i
GrelhaPlano.TypeComboBoxCurSel = .Situacao
GrelhaPlano.SetText 4, i, .Duracao
GrelhaPlano.SetText 5, i, .AvisoCadFunc
GrelhaPlano.SetText 6, i, .AvisoCadEmp
GrelhaPlano.SetText 7, i, .AvisoIntFunc
GrelhaPlano.SetText 8, i, .AvisoIntEmp
GrelhaPlano.SetText 9, i, .CompensCaducidade
GrelhaPlano.SetText 10, i, DevolvePeriodoExtenso(.CompensCaducidadePeriodo)
GrelhaPlano.SetText 11, i, .DataNovoRegime
End With
Next