Example #1
0
 /**
  * Comando que verifica el timbre del documento (sus datos)
  * @param ted String con el timbre electrónico
  * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
  * @version 2015-10-13
  */
 protected function _bot_timbre($timbre_xml = null)
 {
     // si no hay timbre se pide uno
     if (!$timbre_xml) {
         $this->Bot->send('Ahora envíame el XML del timbre');
         $this->setNextCommand('timbre');
     } else {
         $this->setNextCommand();
         $this->Bot->sendChatAction();
         $timbre_xml = implode(' ', func_get_args());
         $rest = new \sowerphp\core\Network_Http_Rest();
         $rest->setAuth(\sowerphp\core\Configure::read('api.default.token'));
         $response = $rest->post($this->request->url . '/api/dte/documentos/verificar_ted', json_encode(base64_encode($timbre_xml)));
         if ($response['status']['code'] != 200) {
             $this->Bot->send($response['body']);
             return;
         }
         $xml = new \SimpleXMLElement(utf8_encode($timbre_xml), LIBXML_COMPACT);
         list($rut, $dv) = explode('-', $xml->xpath('/TED/DD/RE')[0]);
         $this->Bot->send((new \website\Dte\Admin\Model_DteTipo($xml->xpath('/TED/DD/TD')[0]))->tipo . ' N° ' . $xml->xpath('/TED/DD/F')[0] . ' del ' . \sowerphp\general\Utility_Date::format($xml->xpath('/TED/DD/FE')[0]) . ' por $' . num($xml->xpath('/TED/DD/MNT')[0]) . '.-' . ' emitida por ' . $xml->xpath('/TED/DD/CAF/DA/RS')[0] . ' (' . num($rut) . '-' . $dv . ')' . ' a ' . $xml->xpath('/TED/DD/RSR')[0] . "\n\n" . $response['body']['ESTADO'] . ' - ' . $response['body']['GLOSA_ESTADO'] . "\n" . $response['body']['GLOSA_ERR']);
     }
 }
Example #2
0
                                        <div class="notification-description">
                                            <?php 
                echo $n['descripcion'];
                if ($n['enlace']) {
                    ?>
                                            <br />
                                            <a href="#" onclick="notificacion_abrir(<?php 
                    echo $n['id'];
                    ?>
); return false" title="Se abrirá y marcará como leída la notificación">Abrir la notificación</a>
<?php 
                }
                ?>
                                        </div>
                                        <div class="notification-ago"><?php 
                echo \sowerphp\general\Utility_Date::ago($n['fechahora']);
                ?>
</div>
                                        <div class="notification-icon <?php 
                echo $n['icono'];
                ?>
 bg-<?php 
                echo $n['tipo'];
                ?>
"></div>
                                    </div>
<?php 
            }
            ?>
                                </div>
                                <a href="<?php