<?
$rez=include("setup.php");
if (! $rez) //if can't find setup.php or not chmod'ed 
 {
  echo "<font color=red>Check Your setup.php file !</font>";
	exit;
 }


while  ($elements=each($cadd_ses) ):
  $loginis=$elements["key"];


// --------------------- show current -----------------
	$sql = "SELECT * FROM product where ID=$loginis";	
        $result = mysql_query($sql) or  die (mysql_error(). " : ".mysql_errno());
        $row=mysql_fetch_object($result);

?>
<body onload="window.print();">
<br><hr noshade color=red><br>
<table width=420 border=0 cellpadding=2 cellspacing=4>
<tr>
	<td>Name of product</td>
	<td><?=$row->Name?></td>
</tr>
<tr>
	<td>Description of product</td>
	<td><?=$row->Description?></td>
</tr>
<tr>
	<td>Price with VAT </td>
	<td><?=$row->Price?></td>
</tr>   
<tr>
	<td>Price without VAT </td>
	<td><?=$row->PriceWithoutVat?></td>
</tr>
<tr>
	<td>Arriving date</td>
	<td>
       <? 
           echo convert_date($row->ArrivingDate);
       ?>
       </td>
</tr>
<tr>
	<td>Product quantity </td>
	<td><?=$row->Count?></td>
</tr>
<tr>
	<td>Category</td>
	<td>
<?
          $query1="select CategoryName from category where ID=$row->CategoryID";
          $result1=mysql_query($query1)or die (mysql_error(). " : ".mysql_errno());     
          $row1=mysql_fetch_object($result1);
               print "$row1->CategoryName";


?>
        </td>
</tr>
<tr>
	<td>Discount procent</td>
<?

echo "<td>$row->DiscountProcent";
echo "</td>";
 ?>

</tr>

       <?
       if ($row->DiscountProcent !=0)
       {
       ?>

<tr>
	<td>Discount from date</td>
	<td>
       <? 
           echo convert_date($row->DiscountFromDate);
       ?>
       </td>
</tr>
<tr>
	<td>Discount till date </td>
	<td><? 
           echo convert_date($row->DiscountTillDate);
       ?>
       </td>

</tr>

       <?
       }
       ?>
<tr>
	<td>Name of warranty service company</td>
	<td>
<?
          $query1="select Address,NameOfCompany from garant where ID=$row->GarantID";
          $result1=mysql_query($query1)or die (mysql_error(). " : ".mysql_errno());     
          $row1=mysql_fetch_object($result1);
               print "$row1->NameOfCompany";
?>
        </td>
</tr>
<tr>
	<td>Address of warranty service company</td>
	<td>
<?
               print "$row1->Address";
?>
        </td>
</tr>
<tr>
	<td>Warranty period </td>
    <td bgColor=white>
     <?
	  echo "$row->TermOfGarant months";
     ?>
	</SELECT> </td>
</tr>
<tr>
	<td>Send warranty coupon to warranty service company<br></td>
	<td>
        <? 
           echo "$row->SendGarant";
        ?>
        </td>
</tr>
<tr>
	<td>Fee to continue warranty</td>
	<td><?=$row->SumOfContinue;?></td>
</tr>
<tr>
	<td>Warranty period to continue warranty service</td>
    <td bgColor=white>
     <?
	  echo "$row->TermOfContinue";
              if ($row->TermOfContinue!="no")
                     echo " months";
     ?>
   </td>
</tr>


<?
 if ($row->Photo != "nothing")
       {
?>
<tr><td>Picture</td>
<td>
<?
   echo "<img src='$dir_to_upload/$row->Photo'>";
?>
</td>
</tr>

<?
       }
 else
 {
       echo "<tr><td>No picture</td></tr>";
 }
?>
</table>


<?
endwhile;
?>