Example #1
0
function cargar_plantilla()
{
    $plantila = "";
    if ($_REQUEST["parte"] == 0) {
        //cabecera
        $asunto = $_REQUEST["asu"];
        $referencia = $_REQUEST["ref"];
        $numero = ObtenerNumeroDocumento($_REQUEST["tipo"]);
        $destinatario = strtoupper($_REQUEST["remit"]);
        $cargo = strtoupper($_REQUEST["cargo"]);
        $fecha = ObtenerFecha();
        $abreviatura = ObtenerAbreviaturaArea();
        $sql = "Select contenido \r\n\t\t\t\tFROM plantilla \r\n\t\t\t\tWHERE tipo_documento=" . $_REQUEST['tipo'] . " \r\n\t\t\t\tand cabecera_pie = 0";
        $query_sql = new Consulta($sql);
        $row = $query_sql->verRegistro();
        $plantilla = $row["contenido"];
        $plantilla = str_replace("txtasunto", $asunto, $plantilla);
        $plantilla = str_replace("txtreferencia", $referencia, $plantilla);
        $plantilla = str_replace("txtnumero", $numero, $plantilla);
        $plantilla = str_replace("txtdestinatario", $destinatario, $plantilla);
        $plantilla = str_replace("txtfecha", $fecha, $plantilla);
        $plantilla = str_replace("txtabreviatura", $abreviatura, $plantilla);
        $plantilla = str_replace("txtcargo", $cargo, $plantilla);
        echo $plantilla;
    } else {
        $jefe = new Usuario(ObtenerJefe());
        $nombre = $jefe->getNombreCompleto();
        $iniciales = $jefe->getIniciales();
        $cargo = $jefe->getCargo();
        $usuario = new Usuario($_SESSION['session'][0]);
        $sql = "Select contenido\r\n\t\t\t\tFROM plantilla\r\n\t\t\t\tWHERE tipo_documento=" . $_REQUEST['tipo'] . "\r\n\t\t\t\tand cabecera_pie=1";
        $query_sql = new Consulta($sql);
        $row = $query_sql->verRegistro();
        $plantilla = $row["contenido"];
        $plantilla = str_replace("txtjefe", $nombre, $plantilla);
        $plantilla = str_replace("txtcargo", $cargo, $plantilla);
        $plantilla = str_replace("txtiniciales", $iniciales, $plantilla);
        $plantilla = str_replace("txtusuario", $usuario->getIniciales(), $plantilla);
        echo $plantilla;
    }
}
		<div id="contenido_documento">
			<table width="100%" border="0" id="contenedor">
              <tr>
                <td width="3%" height="17">&nbsp;</td>
                <td width="90%">&nbsp;</td>
                <td width="3%">&nbsp;</td>
              </tr>
              <tr>
                <td colspan="3"><div id="membretado" style="display:none; height:80px;"></div></td>
              </tr>
              <tr>
                <td height="18">&nbsp;</td>
                <td>
				  <div id="cabecera_documento">
                  		<p>Lima, <?php 
    echo ObtenerFecha();
    ?>
 </p>
                  		<h1 style="text-decoration:underline">
							<strong>
							<?php 
    echo $tipo_doc->getNombre();
    ?>
 
							<?php 
    if (sizeof($_REQUEST["destinatario"]) > 1) {
        ?>
 MÚLTIPLE <?php 
    }
    ?>
 SGD  N&ordm;