I have a "table" with the following fields: person_id, area_id, default, datafim (Default),
My logic doubt is as follows:
Register an employee and their area of responsibility with the start date. When you register again with a new employee regarding the area that already has a person in charge, the default date is automatically filled by the previous person and create a new start date with the new person in that area without the end date. In fact, I'm trying to make a history of the employees responsible for certain areas, with their start and end dates.
How should I proceed in logic?
public function cadastrar(){
esta_logado();
$this->form_validation->set_rules('pessoa', 'FUNCIÓANARIO', 'trim|required');
$this->form_validation->set_rules('area', 'ÁREA', 'trim|required');
if($this->form_validation->run() == TRUE):
$dados['pessoa_id'] = $this->input->post('pessoa', TRUE);
$dados['area_id'] = $this->input->post('area', TRUE);
$this->responsavel->do_insert($dados);
endif;
set_tema('titulo', 'Cadastrar responsável');
set_tema('conteudo', load_modulo('responsavel', 'cadastrar'));
load_template();
}
The logic should be done in this controller! this function is registering at the bank!