les dejo codigo completo
la consulta :
Código PHP:
SELECT * FROM reserva_dat,clientes WHERE clientes.usuario = %s AND reserva_dat.alojamiento_id = clientes.id_alojar AND reserva_dat.estado_reserva='R' $buscar ORDER BY reserva_dat.reservas_id DESC
el armado de lo que se muestra
Código PHP:
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr class="titulo_busqueda">
<td width="138" height="35" align="center" bgcolor="#267EAC" class="">Localizador</td>
<td width="153" height="35" align="center" bgcolor="#267EAC" class="">fecha reserva </td>
<td width="150" height="35" align="center" bgcolor="#267EAC" class="">Monto Total</td>
<td width="138" height="35" align="center" bgcolor="#267EAC" class="">Comision</td>
<td width="75" height="35" align="center" bgcolor="#267EAC" class="">Total Hotel</td>
<td width="75" align="center" bgcolor="#267EAC" class="">Forma de Pago</td>
<td width="100" height="35" align="center" bgcolor="#267EAC" class="">DEBITO</td>
<td width="86" height="35" align="center" bgcolor="#267EAC" class="">CREDITO</td>
<td width="50" height="35" align="center" bgcolor="#267EAC" class="">Saldo</td>
</tr>
<?php $i =0; $debito = 0; $credito=0; do {?>
<tr class="<?php if ($i % 2 == 0) {echo "fila_color_1";} else {echo "fila_color_2";}?>" >
<td width="138" height="40" align="center" valign="middle" class="texto_comun"><div align="center"><?php echo $row_Recordset1['Localizador']; ?></div></td>
<td width="153" height="40" align="center" valign="middle" class="texto_comun"><?php echo $row_Recordset1['fecha_reserva']; ?></td>
<td width="150" height="40" align="center" valign="middle" class="nombre_aloja_CELES"><div align="center">$<?php echo $row_Recordset1['costo_total']; ?></div></td>
<td width="138" height="40" align="center" valign="middle" class=""><div align="center" class="menu_lateral"><strong>$
<?php $comision =($row_Recordset1['costo_total'] * $row_Recordset1['comision']/100);
echo $comision ; ?>
(<?php echo $row_Recordset1['comision']; ?>%)</strong></div></td>
<td width="75" height="40" align="center" valign="middle" style="padding-left:30px"><div align="center" class="nombre_aloja_rec">$
<?php $totalahotel =($row_Recordset1['costo_total'] - $comision); echo $totalahotel;?>
</div></td>
<td width="75" height="40" align="center" valign="middle" style="padding-left:30px"><span class="nombre_aloja_rec">
<?php if ($row_Recordset1['metodo_pago']=="C") {echo "Anticipado";} if ($row_Recordset1['metodo_pago']=="S") {echo "Fraccionado";} if ($row_Recordset1['metodo_pago']=="G") {echo "en Hotel";} ?>
</span></td>
<td width="100" height="40" align="center" valign="middle" class="texto_comun"><span class="nombre_aloja_rec">
<?php if ($row_Recordset1['metodo_pago']=="C") { echo "-";} if ($row_Recordset1['metodo_pago']=="S") { echo "-";} if ($row_Recordset1['metodo_pago']=="G") {$debito = $comision; echo "<span class= texto_rojo >-".$debito."</span>"; } ?></span></td>
<td width="86" height="40" align="center" valign="middle" class="nombre_aloja_CELES"><span class="nombre_aloja_rec">
<?php if ($row_Recordset1['metodo_pago']=="C") { $credito = $totalahotel; echo $credito;} if ($row_Recordset1['metodo_pago']=="S") {if ($row_Recordset1['comision']==$row_Recordset1['sena']){echo "-";} else {$credito =$row_Recordset1['monto_pago']- $comision ; echo $credito;}} if ($row_Recordset1['metodo_pago']=="G") {echo "-"; } ?>
</span></td>
<td width="50" align="center" valign="middle" class="nombre_aloja_CELES"><span class="nombre_aloja_rec">
<?php $saldo = $saldo + $credito - $debito ; echo $saldo; ?>
</span></a></td>
</tr>
<?php $i=$i+1; } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<tr class="linea_inferior">
<td width="138" height="25" class="texto_comun"> </td>
<td width="153" height="25" class="texto_comun"> </td>
<td width="150" height="25" class="texto_comun"> </td>
<td width="138" height="25" class="texto_comun"> </td>
<td width="75" height="25" class="texto_comun"> </td>
<td width="75" height="25" class="texto_comun"> </td>
<td width="100" height="39" class="texto_comun"> </td>
<td height="39" colspan="2" class="nombre_aloja_CELES"><input name="num" type="hidden" id="num" value="<?php echo $num; ?>" />
<input name="reserva_id" type="hidden" id="reserva_id" value="<?php echo $row_Recordset2['reservas_id']; ?>" /></td>
</tr>
<tr>
<td colspan="9"> </td>
</tr>
</table>