Example #1
0
<?php

ob_start();
include "../config/config.php";
include "../includes/conectar.php";
include "../includes/funciones.php";
$iva = ivafecha(date("Y-m-d"));
//ACCESO A LOS DATOS DE LA FACTURA
$sql = "SELECT ps.id, ps.fecha, ps.numero, cl.cif, cl.nombre AS clnombre, cl.direccion, cl.cp, ci.nombre AS cinombre, pr.nombre AS prnombre\nFROM kng_presupuestos AS ps\nLEFT JOIN kng_clientes AS cl ON cl.id = ps.cliente\nLEFT JOIN kng_ciudades AS ci ON ci.id = cl.ciudad\nLEFT JOIN kng_provincias AS pr ON pr.id = cl.provincia\nWHERE ps.id = '" . $_GET['id'] . "'";
//echo $sql;
$res = mysql_query($sql);
mysql_query("SET NAMES 'utf8'");
$row = mysql_fetch_array($res);
//NUMERO FACTURA
$numi = "";
$largura = strlen($row['numero']);
for ($xz = $largura; $xz < 5; $xz++) {
    $numi .= "0";
}
$numpresupuesto = "SN-" . $numi . $row['numero'] . "/" . substr($row['fecha'], 0, 4);
include "../includes/mpdf60/mpdf.php";
$mpdf = new mPDF('win-1252', 'A4', '', '', 0, 0, 30, 25, 0, 0);
$mpdf->useOnlyCoreFonts = true;
// false is default
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("EMPRESA - Presupuesto");
$mpdf->SetAuthor("EMPRESA");
$mpdf->SetWatermarkText("PRESUPUESTO");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.05;
Example #2
0
    $tabla .= "<th>" . $col . "</th>";
}
$tabla .= "</tr>";
while ($row = mysql_fetch_array($res)) {
    $numi = "";
    $largura = strlen($row['numero']);
    for ($xz = $largura; $xz < 5; $xz++) {
        $numi .= "0";
    }
    $numi = 'SN_' . $numi . $row['numero'] . '/' . substr($row['fecha'], 0, 4);
    $sqlc = "SELECT precio, cantidad\n    FROM kng_conceptos\n    WHERE factura = '" . $row['faid'] . "'\n    ";
    $resc = mysql_query($sqlc);
    $tutti = 0;
    while ($rowc = mysql_fetch_array($resc)) {
        $tutti += $rowc['precio'] * $rowc['cantidad'];
    }
    $tabla .= "<tr>";
    $tabla .= "<td>" . $numi . "</td>";
    $tabla .= "<td>" . $row['presupuesto'] . "</td>";
    $tabla .= "<td>" . $row['titipo'] . "</td>";
    $tabla .= "<td>" . fechaes($row['fecha']) . "</td>";
    $tabla .= "<td>" . $row['nombre'] . "</td>";
    $tabla .= "<td>" . $row['titulo'] . "</td>";
    $tabla .= "<td>" . number_format($tutti, 2, ',', '.') . "</td>";
    $tabla .= "<td>" . ivafecha($row['fecha']) . "%</td>";
    $tabla .= "<td>" . number_format(iva($tutti, $row['fecha']), 2, ',', '.') . "</td>";
    $tabla .= "</tr>";
}
$tabla .= "</table>";
echo $tabla;
exit;
Example #3
0
    echo recortar_texto($row['titulo'], 35, " ", " [+]");
    ?>
</td>
    			<td style="text-align: right; padding-right: 10px;">
            		<?php 
    $sqlc = "SELECT precio, cantidad\n\t\t\t\t\tFROM kng_conceptos\n\t\t\t\t\tWHERE proforma = '" . $row['faid'] . "'\n\t\t\t\t\t";
    $resc = mysql_query($sqlc);
    $tutti = 0;
    while ($rowc = mysql_fetch_array($resc)) {
        $tutti += $rowc['precio'] * $rowc['cantidad'];
    }
    echo number_format($tutti, 2, ',', '.') . ' €';
    ?>
            	</td>
            	<td><?php 
    echo ivafecha($row['fecha']) . '%';
    ?>
</td>
            	<td style="text-align: right; padding-right: 10px;"><?php 
    echo number_format(iva($tutti, $row['fecha']), 2, ',', '.') . ' €';
    ?>
  </td>
            	<td class="tcentrado">
                    <?php 
    //MIRAMSO SI YA EXISTE UNA FACTURA DE ESTA PROFORMA
    $sqlp = "SELECT id FROM kng_facturas WHERE presupuesto = '" . $row['presupuesto'] . "'";
    //echo $sqlp.'<br /><br />';
    $resp = mysql_query($sqlp);
    if (mysql_num_rows($resp) > 0) {
        $rowp = mysql_fetch_array($resp);
        ?>
Example #4
0
function iva($valor, $fecha)
{
    $ivaf = ivafecha($fecha);
    $precio = $valor + $valor * $ivaf / 100;
    return $precio;
}