Example #1
0
 public function telson($firstLine = false)
 {
     $entrada = new Entrada($this->entradaId);
     $mosca = new Mosca($entrada->moscaId);
     $mosca2 = Mosca::getBy('codigo', $entrada->logo2);
     $tipo = new Tipo($this->tipo);
     if ($firstLine) {
         $tf = "TF";
     } else {
         $tf = "  ";
     }
     $segmento = " ";
     if ($entrada->segmento > 0) {
         $segmento = "X";
     }
     if ($tipo->codigo == "P") {
         $type_material = "S";
     } elseif ($tipo->codigo == "C") {
         $type_material = "C";
     } else {
         $type_material = "I";
     }
     $output = str_replace("-", "", $this->getFecha()) . $this->getHora() . $tf . substr($this->duracion, 1, 11) . $segmento . "CP2-10" . " " . " " . "          " . "          " . "      " . str_pad($type_material, 3, " ", STR_PAD_RIGHT) . "      " . str_pad($entrada->tcIn, 11, " ", STR_PAD_RIGHT) . str_pad($this->houseNumber, 16, " ", STR_PAD_RIGHT) . str_pad(substr(utf8_decode($this->titulo), 0, 16), 16, " ", STR_PAD_RIGHT) . str_pad(substr(utf8_decode($this->titulo), 0, 32), 32, " ", STR_PAD_RIGHT) . " " . "   " . "                " . str_pad($mosca2->identificador, 6, " ", STR_PAD_RIGHT) . str_pad($mosca2->codigo, 16, " ", STR_PAD_RIGHT) . str_pad(substr($this->delay, 1), 10, " ", STR_PAD_RIGHT) . str_pad(substr($mosca2->duracion, 1), 10, " ", STR_PAD_RIGHT) . "      " . "                " . "          " . "          " . " " . " " . " " . " " . "                                      " . "                " . "                          " . str_pad($mosca->identificador, 6, " ", STR_PAD_RIGHT) . str_pad($mosca->codigo, 16, " ", STR_PAD_RIGHT) . "           " . "      " . "                " . "          " . "          " . "      " . "                                           " . "        " . "                " . "           " . "          " . "  " . "          ";
     return $output;
 }