Ejemplo n.º 1
0
        }
    }
    if ($contacto) {
        $mensaje .= implode(' - ', $contacto) . "\n";
    }
    $mensaje .= $Emisor->direccion . ', ' . $Emisor->getComuna()->comuna . "\n";
    $table = [];
    $checked = [];
    foreach ($emails as $k => $e) {
        $table[] = [$e, $k];
        if ($k == 'Email intercambio') {
            $checked = [$e];
        }
    }
    $f = new \sowerphp\general\View_Helper_Form();
    echo $f->begin(['action' => $_base . '/dte/dte_emitidos/enviar_email/' . $DteEmitido->dte . '/' . $DteEmitido->folio]);
    echo $f->input(['type' => 'tablecheck', 'name' => 'emails', 'label' => 'Para', 'titles' => ['Email', 'Origen'], 'table' => $table, 'checked' => $checked, 'help' => 'Seleccionar emails a los que se enviará el DTE']);
    echo $f->input(['name' => 'asunto', 'label' => 'Asunto', 'value' => $asunto, 'check' => 'notempty']);
    echo $f->input(['type' => 'textarea', 'name' => 'mensaje', 'label' => 'Mensaje', 'value' => $mensaje, 'rows' => 10, 'check' => 'notempty']);
    echo $f->input(['type' => 'checkbox', 'name' => 'cedible', 'label' => '¿Copia cedible?']);
    echo $f->end('Enviar PDF y XML por email');
} else {
    echo '<p>No hay emails registrados para el receptor ni el DTE.</p>', "\n";
}
?>
</div>
<!-- FIN ENVIAR POR EMAIL -->

<!-- INICIO INTERCAMBIO -->
<div role="tabpanel" class="tab-pane" id="intercambio">
<?php 
Ejemplo n.º 2
0
<a href="<?php 
echo $_base;
?>
/dte/dte_recibidos/listar" title="Volver a los documentos recibidos" class="pull-right"><span class="btn btn-default">Volver a DTE recibidos</span></a>

<h1>Agregar DTE recibido</h1>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['onsubmit' => 'Form.check()']);
echo $f->input(['name' => 'emisor', 'label' => 'RUT emisor', 'check' => 'notempty rut']);
echo $f->input(['type' => 'select', 'name' => 'dte', 'label' => 'Documento', 'options' => ['' => 'Seleccionar tipo de DTE'] + $tipos_documentos, 'check' => 'notempty']);
echo $f->input(['name' => 'folio', 'label' => 'Folio', 'check' => 'notempty integer']);
echo $f->input(['type' => 'date', 'name' => 'fecha', 'label' => 'Fecha documento', 'check' => 'notempty date']);
echo $f->input(['name' => 'tasa', 'label' => 'Tasa IVA', 'check' => 'integer']);
echo $f->input(['name' => 'exento', 'label' => 'Monto exento', 'check' => 'integer']);
echo $f->input(['name' => 'neto', 'label' => 'Neto', 'check' => 'integer']);
echo $f->input(['name' => 'iva_uso_comun', 'label' => 'IVA uso común', 'check' => 'integer', 'help' => 'Si el IVA es de uso común aquí va el factor de proporcionalidad']);
echo $f->input(['type' => 'select', 'name' => 'iva_no_recuperable', 'label' => 'IVA no recuperable', 'options' => ['' => 'El IVA es recuperable'] + $iva_no_recuperables]);
echo $f->input(['type' => 'select', 'name' => 'impuesto_adicional', 'label' => 'Impuesto adicional', 'options' => ['' => 'Sin impuesto adicional'] + $impuesto_adicionales]);
echo $f->input(['name' => 'impuesto_adicional_tasa', 'label' => 'Tasa Imp. adic.', 'check' => 'integer', 'help' => 'Tasa del impuesto adicional (obligatorio si hay impuesto adicional)']);
echo $f->input(['type' => 'select', 'name' => 'impuesto_tipo', 'label' => 'Tipo de impuesto', 'options' => [1 => 'IVA', 2 => 'Ley 18211']]);
echo $f->input(['type' => 'checkbox', 'name' => 'anulado', 'label' => '¿Anulado?']);
echo $f->input(['name' => 'impuesto_sin_credito', 'label' => 'Impuesto sin crédito', 'check' => 'integer']);
echo $f->input(['name' => 'monto_activo_fijo', 'label' => 'Monto activo fijo', 'check' => 'integer']);
echo $f->input(['name' => 'monto_iva_activo_fijo', 'label' => 'IVA activo fijo', 'check' => 'integer']);
echo $f->input(['name' => 'iva_no_retenido', 'label' => 'IVA no retenido', 'check' => 'integer']);
echo $f->end('Agregar DTE recibido');
Ejemplo n.º 3
0
<h1>Generar XML de DTE</h1>
<script type="text/javascript">
    var plantillas_dte = JSON.parse('<?php 
echo json_encode($plantillas_dte);
?>
');
</script>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['id' => 'generar_xml', 'onsubmit' => 'dte_generar_xml_validar()']);
?>
<div class="row">
    <div class="col-md-6">
        <h2>Emisor</h2>
<?php 
$f->setStyle(false);
echo $f->input(['name' => 'RUTEmisor', 'label' => 'RUT', 'placeholder' => 'RUT del emisor: 11222333-4', 'check' => 'notempty rut', 'attr' => 'maxlength="12" onblur="Emisor.setDatos(\'generar_xml\')"']);
echo '<br/>';
echo $f->input(['name' => 'RznSoc', 'label' => 'Razón social', 'placeholder' => 'Razón social del emisor: Empresa S.A.', 'check' => 'notempty', 'attr' => 'maxlength="100"']);
echo '<br/>';
echo $f->input(['name' => 'GiroEmis', 'label' => 'Giro', 'placeholder' => 'Giro del emisor', 'check' => 'notempty', 'attr' => 'maxlength="80"']);
echo '<br/>';
echo $f->input(['type' => 'select', 'name' => 'Acteco', 'label' => 'Actividad económica', 'options' => ['' => 'Actividad económica del emisor'] + $actividades_economicas, 'check' => 'notempty']);
echo '<br/>';
echo $f->input(['name' => 'DirOrigen', 'label' => 'Dirección', 'placeholder' => 'Dirección del emisor', 'check' => 'notempty', 'attr' => 'maxlength="70"']);
echo '<br/>';
echo $f->input(['type' => 'select', 'name' => 'CmnaOrigen', 'label' => 'Comuna', 'options' => ['' => 'Comuna del emisor'] + $comunas, 'check' => 'notempty']);
echo '<br/>';
echo $f->input(['name' => 'Telefono', 'label' => 'Teléfono', 'placeholder' => 'Teléfono del emisor (opcional)', 'attr' => 'maxlength="20"']);
echo '<br/>';
echo $f->input(['name' => 'CorreoEmisor', 'label' => 'Email', 'placeholder' => 'Email del emisor (opcional)', 'attr' => 'maxlength="80"']);
<a href="<?php 
echo $_base;
?>
/dte/dte_compras" title="Volver a IEC" class="pull-right"><span class="btn btn-default">Volver a IEC</span></a>

<h1>Enviar libro de compras (IEC) sin movimientos</h1>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['onsubmit' => 'Form.check() && Form.checkSend(\'¿Está seguro de enviar el libro sin movimientos?\')']);
echo $f->input(['name' => 'periodo', 'label' => 'Período', 'placeholder' => date('Ym'), 'help' => 'Período en formato AAAAMM, ejemplo: ' . date('Ym'), 'check' => 'notempty integer']);
echo $f->end('Enviar libro sin movimientos');
Ejemplo n.º 5
0
</div>
<!-- FIN DATOS BÁSICOS -->

<!-- INICIO DOCUMENTOS -->
<div role="tabpanel" class="tab-pane" id="documentos">
<p>Aquí podrá generar y enviar la respuesta para los documentos que <?php 
echo $DteIntercambio->getEmisor()->razon_social;
?>
 envió a <?php 
echo $Emisor->razon_social;
?>
.</p>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['action' => $_base . '/dte/dte_intercambios/responder/' . $DteIntercambio->codigo, 'onsubmit' => 'Form.check() && Form.checkSend()']);
echo $f->input(['name' => 'NmbContacto', 'label' => 'Contacto', 'value' => substr($_Auth->User->nombre, 0, 40), 'attr' => 'maxlength="40"', 'check' => 'notempty']);
echo $f->input(['name' => 'MailContacto', 'label' => 'Email contacto', 'value' => substr($_Auth->User->email, 0, 80), 'attr' => 'maxlength="80"', 'check' => 'notempty email']);
echo $f->input(['name' => 'Recinto', 'label' => 'Recinto', 'value' => substr($Emisor->direccion . ', ' . $Emisor->getComuna()->comuna, 0, 80), 'check' => 'notempty', 'attr' => 'maxlength="80"', 'help' => 'Lugar donde se recibieron los productos o prestaron los servicios']);
echo $f->input(['name' => 'responder_a', 'label' => 'Responder a', 'value' => $DteIntercambio->de, 'check' => 'notempty email']);
$estado = $EnvioDte->getEstadoValidacion(['RutReceptor' => $Emisor->rut . '-' . $Emisor->dv]);
echo $f->input(['type' => 'select', 'name' => 'EstadoRecepEnv', 'label' => 'Estado envío', 'options' => \sasco\LibreDTE\Sii\RespuestaEnvio::$estados['envio'], 'value' => $estado, 'check' => 'notempty', 'attr' => 'onchange="document.getElementById(\'RecepEnvGlosaField\').value=this.selectedOptions[0].textContent"']);
echo $f->input(['name' => 'RecepEnvGlosa', 'label' => 'Glosa estado envío', 'value' => \sasco\LibreDTE\Sii\RespuestaEnvio::$estados['envio'][$estado], 'check' => 'notempty']);
// Recepción de envío
$RecepcionDTE = [];
foreach ($Documentos as $Dte) {
    $estado_sii = !isset($DteIntercambio->estado) ? $Dte->getEstado($Firma) : ['GLOSA' => ''];
    $estado = $Dte->getEstadoValidacion(['RUTEmisor' => $DteIntercambio->getEmisor()->rut . '-' . $DteIntercambio->getEmisor()->dv, 'RUTRecep' => $Emisor->rut . '-' . $Emisor->dv]);
    $RecepcionDTE[] = ['TipoDTE' => $Dte->getTipo(), 'Folio' => $Dte->getFolio(), 'FchEmis' => $Dte->getFechaEmision(), 'RUTEmisor' => $Dte->getEmisor(), 'RUTRecep' => $Dte->getReceptor(), 'MntTotal' => $Dte->getMontoTotal(), 'estado_sii' => isset($estado_sii['GLOSA']) ? $estado_sii['GLOSA'] : (isset($estado_sii['GLOSA_ERR']) ? $estado_sii['GLOSA_ERR'] : 'No determinado'), 'EstadoRecepDTE' => $estado, 'RecepDTEGlosa' => \sasco\LibreDTE\Sii\RespuestaEnvio::$estados['documento'][$estado], 'acuse' => (int) (bool) (!$estado)];
}
echo $f->input(['type' => 'js', 'id' => 'documentos', 'label' => 'Documentos', 'titles' => ['DTE', 'Folio', 'Total', 'Estado SII', 'Estado', 'Glosa', 'Acuse'], 'inputs' => [['name' => 'TipoDTE', 'attr' => 'readonly="readonly" size="3"'], ['name' => 'Folio', 'attr' => 'readonly="readonly" size="10"'], ['name' => 'FchEmis', 'type' => 'hidden'], ['name' => 'RUTEmisor', 'type' => 'hidden'], ['name' => 'RUTRecep', 'type' => 'hidden'], ['name' => 'MntTotal', 'attr' => 'readonly="readonly" size="10"'], ['name' => 'estado_sii'], ['name' => 'EstadoRecepDTE', 'type' => 'select', 'options' => \sasco\LibreDTE\Sii\RespuestaEnvio::$estados['documento'], 'attr' => 'style="width:12em" onchange="this.parentNode.parentNode.parentNode.childNodes[8].firstChild.firstChild.value=this.selectedOptions[0].textContent"'], ['name' => 'RecepDTEGlosa'], ['name' => 'acuse', 'type' => 'select', 'options' => [1 => 'Si', 0 => 'No'], 'attr' => 'style="width:5em"']], 'values' => $RecepcionDTE, 'help' => 'Si el estado es diferente a "DTE Recibido OK" entonces el DTE será rechazado (no hay aceptado con reparos). Aquellos DTE con acuse de recibo serán agregados a los DTEs recibidos de ' . $Emisor->razon_social]);
Ejemplo n.º 6
0
echo $Emisor->razon_social;
?>
 (<?php 
echo $Emisor->getRUT();
?>
)</h1>
<?php 
if (isset($DteEmitido)) {
    ?>
<script type="text/javascript">
    $(function() { DTE.calcular() });
</script>
<?php 
}
$f = new \sowerphp\general\View_Helper_Form(false);
echo $f->begin(['id' => 'emitir_dte', 'focus' => 'RUTRecepField', 'action' => $_base . '/dte/documentos/previsualizacion', 'onsubmit' => 'DTE.check()']);
?>
    <!-- DATOS DEL DOCUMENTO -->
    <div class="row">
        <div class="form-group col-md-8"><?php 
echo $f->input(['name' => 'TpoDoc', 'type' => 'select', 'options' => $tipos_dte, 'value' => 33, 'attr' => 'onblur="DTE.setTipo(this.value)"']);
?>
</div>
        <div class="form-group col-md-4"><?php 
echo $f->input(['type' => 'date', 'name' => 'FchEmis', 'placeholder' => 'Fecha emisión DTE', 'popover' => 'Día en que se emite el documento', 'value' => date('Y-m-d'), 'check' => 'notempty date']);
?>
</div>
    </div>
    <!-- DATOS DEL EMISOR -->
    <div class="row">
        <div class="form-group col-md-3"><?php 
Ejemplo n.º 7
0
</div>
<!-- FIN DETALLES -->

<!-- INICIO ESTADÍSTICAS -->
<div role="tabpanel" class="tab-pane" id="estadisticas">
    <img src="<?php 
    echo $_base . '/dte/dte_guias/grafico_documentos_diarios/' . $Libro->periodo;
    ?>
" alt="Gráfico guías diarias del período" class="img-responsive thumbnail center" />
</div>
<!-- FIN ESTADÍSTICAS -->

<?php 
}
?>

<!-- INICIO REVISIÓN -->
<div role="tabpanel" class="tab-pane" id="revision">
<p>Aquí puede subir el XML con el resultado de la revisión del libro de guías de despacho envíado al SII.</p>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['action' => $_base . '/dte/dte_guias/subir_revision/' . $Libro->periodo, 'onsubmit' => 'Form.check()']);
echo $f->input(['type' => 'file', 'name' => 'xml', 'label' => 'XML revisión', 'check' => 'notempty', 'attr' => 'accept=".xml"']);
echo $f->end('Subir XML de revisión');
?>
</div>
<!-- FIN REVISIÓN -->

    </div>
</div>
<div role="tabpanel" class="tab-pane active" id="dte">
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['action' => $_base . '/certificacion/set_pruebas_dte', 'id' => 'form_dte', 'onsubmit' => 'Form.check(\'form_dte\')']);
echo $f->input(['type' => 'file', 'name' => 'archivo', 'label' => 'Set pruebas ventas', 'check' => 'notempty', 'help' => 'Archivo del set de pruebas con los casos (de un mismo SET) que se desean generar, debe estar codificado en ISO-8859-1. Puedes ver un ejemplo del archivo que se espera <a href="https://github.com/sascocl/LibreDTE/blob/master/examples/set_pruebas/001-basico.txt" target="_blank">para el set básico</a> o <a href="https://github.com/sascocl/LibreDTE/blob/master/examples/set_pruebas/004-factura_exenta.txt" target="_blank">para el set de factura exenta</a>', 'attr' => 'accept=".txt"']);
echo $f->input(['type' => 'js', 'name' => 'folios', 'label' => 'Folios a usar', 'titles' => ['Tipo documento', 'Folio desde'], 'inputs' => [['name' => 'folios'], ['name' => 'desde']], 'check' => 'notempty', 'help' => 'Se debe indicar el código del tipo de documento y el folio desde el cual se generarán los documentos']);
echo $f->end('Siguiente &raquo;');
?>
</div>
<!-- FIN EMISIÓN DTE -->

<!-- INICIO VENTAS -->
<div role="tabpanel" class="tab-pane" id="ventas">
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['action' => $_base . '/certificacion/set_pruebas_ventas', 'id' => 'form_ventas', 'onsubmit' => 'Form.check(\'form_ventas\')']);
echo $f->input(['type' => 'file', 'name' => 'archivo', 'label' => 'XML EnvioDTE', 'check' => 'notempty', 'help' => 'Archivo XML del EnvioDTE generado a partir del caso de prueba que se desea crear su libro de ventas', 'attr' => 'accept=".xml"']);
echo $f->input(['name' => 'PeriodoTributario', 'label' => 'Periodo tributario', 'value' => '1980-01', 'placeholder' => '1980-01', 'check' => 'notempty', 'help' => 'Debe ser un mes del año 1980']);
echo $f->end('Descargar Libro de Ventas');
?>
</div>
<!-- FIN VENTAS -->

<!-- INICIO COMPRAS -->
<div role="tabpanel" class="tab-pane" id="compras">
    <p>Para generar el libro de compras deberá crear un archivo en formato CSV que contendrá los datos de las compras del set de pruebas entregado por el SII. Luego deberá cargar dicho archivo CSV en el <a href="<?php 
echo $_base;
?>
/utilidades/generar_libro">Generador de XML de Libro de Compra</a> de LibreDTE.</p>
    <p>Ejemplos archivos:</p>
    <ul>
Ejemplo n.º 9
0
<h1>Consultar documento tributario electrónico (DTE)</h1>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['focus' => 'emisorField', 'onsubmit' => 'Form.check()']);
echo $f->input(['name' => 'emisor', 'label' => 'RUT emisor', 'check' => 'notempty rut']);
echo $f->input(['type' => 'select', 'name' => 'dte', 'label' => 'Tipo DTE', 'options' => ['' => 'Seleccionar un tipo de documento'] + $dtes, 'value' => $dte, 'check' => 'notempty']);
echo $f->input(['name' => 'folio', 'label' => 'Folio DTE', 'check' => 'notempty integer']);
echo $f->input(['type' => 'date', 'name' => 'fecha', 'label' => 'Fecha emisión', 'check' => 'notempty date']);
echo $f->input(['name' => 'total', 'label' => 'Monto total', 'check' => 'notempty integer']);
echo $f->end('Consultar DTE');
// si se encontró un DTE se muestra
if (isset($DteEmitido)) {
    ?>
<h2><?php 
    echo $DteEmitido->getTipo()->tipo;
    ?>
 #<?php 
    echo $DteEmitido->folio;
    ?>
 a <?php 
    echo \sowerphp\app\Utility_Rut::addDV($DteEmitido->receptor);
    ?>
</h2>
<div class="row">
    <div class="col-md-9">
<?php 
    new \sowerphp\general\View_Helper_Table([['Documento', 'Folio', 'Receptor', 'Exento', 'Neto', 'IVA', 'Total'], [$DteEmitido->getTipo()->tipo, $DteEmitido->folio, $DteEmitido->getReceptor()->razon_social, num($DteEmitido->exento), num($DteEmitido->neto), num($DteEmitido->iva), num($DteEmitido->total)]]);
    ?>
        <div class="row">
            <div class="col-md-6">
                <a class="btn btn-default btn-lg btn-block" href="<?php 
Ejemplo n.º 10
0
<a href="<?php 
echo $_base;
?>
/dte/dte_compras" title="Volver a IEC" class="pull-right"><span class="btn btn-default">Volver a IEC</span></a>
<h1>Importar libro de compras (IEC) desde archivo CSV</h1>
<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['onsubmit' => 'Form.check() && Form.checkSend(\'¿Está seguro de importar el libro seleccionado?\')']);
echo $f->input(['type' => 'file', 'name' => 'archivo', 'label' => 'Libro CSV', 'help' => 'Libro de compras en formato CSV. Puede consultar un <a href="https://raw.githubusercontent.com/LibreDTE/libredte-lib/master/examples/libros/libro_compras.csv">ejemplo del libro</a> o bien revisar la <a href="http://wiki.libredte.cl/doku.php/faq/libredte/general/libro_compras_ventas#detalle_libro_compra">documentación de las columnas</a>.', 'check' => 'notempty', 'attr' => 'accept="csv"']);
echo $f->end('Importar libro de compras');
Ejemplo n.º 11
0
<h1>Registrar nueva empresa</h1>
<p>Aquí podrá registrar una nueva empresa para la cual usted será el usuario administrador de la misma.</p>

<?php 
$f = new \sowerphp\general\View_Helper_Form();
echo $f->begin(['id' => 'registrarContribuyente', 'onsubmit' => 'Form.check() && Form.checkSend()']);
?>

<script type="text/javascript">
$(function() {
    var url = document.location.toString();
    if (url.match('#')) {
        $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ;
    }
});
</script>

<div role="tabpanel">
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#datos" aria-controls="datos" role="tab" data-toggle="tab">Datos básicos</a></li>
        <li role="presentation"><a href="#logo" aria-controls="logo" role="tab" data-toggle="tab">Logo</a></li>
        <li role="presentation"><a href="#ambientes" aria-controls="ambientes" role="tab" data-toggle="tab">Ambientes: producción y certificación</a></li>
        <li role="presentation"><a href="#emails" aria-controls="emails" role="tab" data-toggle="tab">Emails</a></li>
        <li role="presentation"><a href="#api" aria-controls="api" role="tab" data-toggle="tab">API</a></li>
    </ul>
    <div class="tab-content">

<!-- INICIO DATOS BÁSICOS -->
<div role="tabpanel" class="tab-pane active" id="datos">
<?php 
echo $f->input(['name' => 'rut', 'label' => 'RUT', 'check' => 'notempty rut', 'attr' => 'maxlength="12" onblur="Contribuyente.setDatos(\'registrarContribuyente\')"']);