Last active
December 27, 2015 17:19
-
-
Save ChrisGehm/7360980 to your computer and use it in GitHub Desktop.
tabla.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//lista indexada por período y cliente | |
if ($periodo!="" AND $busca!="") | |
{ | |
$s = 0;//inicializo $s = 0 para el acumulador | |
///////////// | |
$busca=$_POST['buscar']; | |
$periodo=$_POST['periodo']; | |
$sqldoinicial = 0; | |
$sql = "SELECT ROUND(SUM(Debe-Haber),2) AS Saldo | |
FROM fondos_terceros | |
WHERE Denominacion = '".$busca."' AND MONTH(Fecha) = '".$periodo."'-1"; | |
$result=mysql_query("$sql",$conexion) or die(mysql_error()); | |
while($f=mysql_fetch_array($result)) | |
{ | |
setlocale(LC_MONETARY, 'it_IT'); | |
$saldoinicial=$f['Saldo']; | |
echo '<td>'.$f['Saldo'].'</td>'; | |
} | |
//////////// | |
$busqueda=mysql_query("SELECT Id, date_format(fondos_terceros.Fecha,'%d/%m/%Y') As Fecha, clientes.Grupo, fondos_terceros.Denominacion, fondos_terceros.Concepto, fondos_terceros.Debe, fondos_terceros.Haber, (Debe-Haber) As Saldo, fondos_terceros.Observaciones | |
FROM Fondos_Terceros, clientes | |
WHERE fondos_terceros.Denominacion LIKE '%".$busca."%' AND fondos_terceros.Denominacion = clientes.Denominacion AND MONTH(Fecha) = '".$periodo."' AND fondos_terceros.Activo = 1 | |
ORDER BY DATE_FORMAT(Fecha,'%m/%d')"); | |
?> | |
<!--Genero Tabla --> | |
<table class="a" width="900" border="0" id="a"> | |
<tr> | |
<td>Fecha</td> | |
<td>Grupo</td> | |
<td>Cliente</td> | |
<td>Concepto</td> | |
<td>Debe</td> | |
<td>Haber</td> | |
<td>Saldo</td> | |
<td>Observaciones</td> | |
<td></td> | |
<td></td> | |
</tr> | |
<?php | |
$editar= "cajaterceros/formeditarfondosterceros.php?id="; | |
$borrar= "cajaterceros/borrarfondosterceros.php?id="; | |
while($f=mysql_fetch_array($busqueda)) | |
{ | |
setlocale(LC_MONETARY, 'it_IT'); | |
$debeformato = $f['Debe']; | |
$debefinal = number_format($debeformato, 2,',', '.' ); //formato moneda 1.000,00 | |
$haberformato = $f['Haber']; | |
$haberfinal = number_format($haberformato, 2,',', '.' ); //formato moneda 1.000,00 | |
$saldoformato = $f['Saldo']; | |
$saldofinal = number_format($saldoformato, 2,',', '.' ); //formato moneda 1.000,00 | |
$saldoinicial= $f['Saldo'] + $saldoinicial; //acumulo saldo y después lo muestro | |
$sformato = $saldoinicial; | |
$sfinal = number_format($sformato, 2,',', '.' ); //formato moneda 1.000,00 | |
echo '<tr>'; | |
echo '<td>'.$f['Fecha'].'</td>'; | |
echo '<td>'.$f['Grupo'].'</td>'; | |
echo '<td>'.$f['Denominacion'].'</td>'; | |
echo '<td>'.$f['Concepto'].'</td>'; | |
echo '<td>'.$debefinal.'</td>'; | |
echo '<td>'.$haberfinal.'</td>'; | |
echo '<td>'.$sfinal.'</td>';//muestra saldo acumulado | |
echo '<td>'.$f['Observaciones'].'</td>'; | |
echo '<td><a href="/'.$editar.''.$f['Id'].'">Editar</a></td>'; | |
echo '<td><a href="/'.$borrar.''.$f['Id'].'">Borrar</a></td>'; | |
} | |
} | |
?> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment