示例#1
0
<?php

/*
 * se muestra el listado de personas con su respectiva liquidaciones en un mes dado
 */
require_once dirname(__FILE__) . "/../querys/getLiquidaciones.php";
$fecha = $_POST['fecha'];
$liquidaciones = getLiquidaciones($fecha);
echo json_encode($liquidaciones);
//este json_encode deberia parecerse al de abajo :(
//$labels = array('29 April 2015', '30 April 2015', '1 May 2015', '2 May 2015', '3 May 2015', '4 May 2015', '5 May 2015');
//$points = array('100', '250', '10', '35', '73', '0', '25');
//echo json_encode(array('labels' => $labels, 'points' => $points));
<?php

include_once dirname(dirname(__FILE__)) . "/Include/meses.php";
include_once dirname(dirname(__FILE__)) . "/querys/getLiquidaciones.php";
include_once dirname(dirname(__FILE__)) . "/querys/getTM.php";
$mes = $_POST['mes'];
//div en caso de errores ( horasRealizadas sin valoresHora asociadas)
echo "<div id='errores'></div>";
//aqui parte Resumen Fecha y TM
$ruttm = getTM();
$liquidaciones = getLiquidaciones($mes);
echo "<br><div class = 'col-xs-10  col-xs-offset-1 text-center well well-md'>";
echo "<h3 align='center'>Resumen Liquidaciones</h3>\n\t<div class='table-responsive'>\n\t  <table id='t01' class='table table-hover table-bordered table-condensed'>\n\t   <thead><tr class='info'>\n        <th>Tecn&oacute;logo</th>\n        <th>Honorario bruto</th> \n\t\t<th>Retenci&oacute;n</th> \n\t\t<th>Honorario l&iacute;quido</th> \n       </tr></thead><tbody>";
foreach ($ruttm as $tm) {
    if (isset($liquidaciones[$tm['Rut']][0])) {
        echo "<tr  ><th>";
        echo $liquidaciones[$tm['Rut']][0];
        echo "</th><th>";
        echo "\$" . number_format($liquidaciones[$tm['Rut']][1]);
        echo "</th><th>";
        echo "\$" . number_format($liquidaciones[$tm['Rut']][1] * 0.1);
        echo "</th><th>";
        echo "\$" . number_format($liquidaciones[$tm['Rut']][1] * 0.9);
        echo "</th></tr>";
    }
}
echo "</table></div></div>";