<? 
session_start();
require_once('../connect/connect.php'); 
include_once('../lib/lib.php');
require('pdk.php');


$r=mysql_query("SELECT * FROM akk WHERE id_akk='".$_SESSION['ID_P'][1]."'");
$rr=mysql_fetch_array($r);

$title='История платежей';
$titl=$title;

require ('top.php'); 
?>



<TABLE width="100%" style="BORDER-COLLAPSE: collapse" cellpadding="3" cellspacing="3" border="1" bordercolor="#E2E2E2">
	<tr>
	<td>N платежа</td>
	<td>Дата</td>
	<td>Приход</td>
	<td>Расход</td>
	<td>Примечание</td>
	</tr>	
		<?
$s=0;		
$s2=0;		
$r1=mysql_query("SELECT * FROM plateg WHERE id_akk='".$_SESSION['ID_P'][1]."' ORDER BY data");
while($rr1=mysql_fetch_array($r1))
{
echo '<tr>';
echo '<td>';
echo $rr1['id_plateg'];
echo '<td width="100">';
echo '<font color=gray>'.date("d.m.y", strtotime($rr1['data'])).'</font>';
echo '<td width="100">';
if($rr1['typ']==1)
	{
	echo '<font color=green>'.$rr1['summa'].'</font>';
	$s=$s+$rr1['summa'];
	}
echo '<td width="100">';
if($rr1['typ']==2)
	{
	$s=$s-$rr1['summa'];
	echo '<font color=red>'.$rr1['summa'].'</font>';
	}
echo '<td>';
if($rr1['typ']==1)
	echo '<font color=green>'.$rr1['opis'].'</font>';
	else
	echo '<font color=red>'.$rr1['opis'].'</font>';
}

		?>
	<tr>
	<td></td>
	<td><font size=+1>итого:</font></td>
	<td><? echo '<font size=+1>'.$s.'</font>'; ?></td>
	<td></td>
	
	</tr>	
</TABLE>
<?
require('bottom.php');
?>