public function generarPeriodos()
 {
     switch ($this->tippernom) {
         case '0':
             // Semanal
             $this->totalperiodos = 52;
             break;
         case '1':
             // Quincenal
             $this->totalperiodos = 24;
             break;
         case '2':
             // Mensual
             $this->totalperiodos = 12;
             break;
         case '3':
             // Anual
             $this->totalperiodos = 1;
             break;
     }
     $diasperiodo = round(365 / $this->totalperiodos, 0);
     $fecha = $this->fecininom;
     $anioinicial = substr($fecha, 0, 4);
     for ($i = 1; $i <= $this->totalperiodos && $this->valido; $i++) {
         $objPeriodo = new Periodo();
         $objPeriodo->codemp = $this->codemp;
         $objPeriodo->codnom = $this->codnom;
         $objPeriodo->codperi = str_pad($i, 3, '0', 0);
         $objPeriodo->fecdesper = $fecha;
         $objPeriodo->fechasper = $this->obtenerFinalPeriodo($fecha, $diasperiodo);
         $objPeriodo->totper = 0;
         $objPeriodo->cerper = 0;
         $objPeriodo->conper = 0;
         $objPeriodo->apoconper = 0;
         $objPeriodo->ingconper = 0;
         $objPeriodo->fidconper = 0;
         $objPeriodo->peradi = 0;
         $objPeriodo->obsper = '';
         $objPeriodo->incluir();
         $fecha = sumarDias($objPeriodo->fechasper, 1);
         unset($objPeriodo);
         if ($this->tippernom != 0) {
             $anioactual = substr($fecha, 0, 4);
             if ($anioinicial != $anioactual) {
                 break;
             }
         }
     }
     $objPeriodo = new Periodo();
     $objPeriodo->codemp = $this->codemp;
     $objPeriodo->codnom = $this->codnom;
     $objPeriodo->codperi = '000';
     $objPeriodo->fecdesper = '1900-01-01';
     $objPeriodo->fechasper = '1900-01-01';
     $objPeriodo->totper = 0;
     $objPeriodo->cerper = 0;
     $objPeriodo->conper = 0;
     $objPeriodo->apoconper = 0;
     $objPeriodo->ingconper = 0;
     $objPeriodo->fidconper = 0;
     $objPeriodo->peradi = 0;
     $objPeriodo->obsper = 'Periodo Nulo';
     $objPeriodo->incluir();
     unset($objPeriodo);
 }