-2
I have a "table" with the following fields: person, tree, date start (Default), datafim (Default),
My doubt in logic is as follows:
Register an employee and his area of responsibility with the start date. When re-registering with a new employee referring to the area that already has a responsible, automatically is filled by default the end date of the former responsible and create a new start date with the new responsible for that area without the end date. In fact, I’m trying to do a background on the employees responsible for certain areas, with their start and end date.
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 in the database!
The database is mysql, the logic would be for Codeigniter. I already have a record in the database, with the employee responsible for an area. When I register a new employee referring to some area that already has a registered responsible, be filled in the end date of the former responsible employee and create - if a new registration, with the new employee responsible for the area and the start date. By logic the end date of the former employee and the start date of the new employee. Excuse anything if my logic is not being clear!
– Andrew Maxwell