<?php
session_start();
if ($first_name>=1){
echo "Prego effettuare il login <a href=\"/contenuti.php\"> Qui<br>
&copy;Bloghosteria.com<br>
</a>";
}
 elseif  ( empty( $first_name ) ) {
?> Prego effettuare il login <a href="/contenuti.php"> Qui<br>
&copy;Bloghosteria.com<br>
</a>
<?php
} elseif ($first_name==$_SESSION['first_name']) { 
 include ("langselect.php");
 include ("config.php");
 echo "Salve, 
". $_SESSION['last_name'] ." <a href=logout.php> Logout</a> 
<style type=\"text/css\">

a:link, a:visited {
	color: #009933; text-decoration: none;
	font-weight: bold;
}

a:hover {
	color: #ff6600;	text-decoration: none;
	font-weight: bold;	
}
</style>
<p><a href=\"sample.php?last_name=$Ragione_Sociale\">$lang0004</a> | 
<a href=\"clgestord.php?Ragione_Sociale=$last_name\">$lang0005</a> |
<a href=mailto:$emailwebm>$lang0006</a> | 
<a href=\"gestpag.php?Ragione_Sociale=$last_name\">$lang0007</a></p>
<p> 
<div align=center>";
  		
mysql_connect("$hhost","$login","$pass") or die ("Problem connecting to DataBase");
$query = "SELECT * FROM sd_ordini WHERE Ragione_Sociale = '$Ragione_Sociale' and Tipo_Pagamento='nd' ";
$result = mysql_db_query("$dbname", $query); 
if ($result) { 
echo "<p><strong><font color=#000000 >$lang0082</font></strong></p>
<table width=514 height=29 border=1 cellpadding=1 cellspacing=0>
  <tr>
    <td width=82><div align=center>$lang0084</div></td>
    <td width=87><div align=center>$lang0011</div></td>
    <td width=57><div align=center>$lang0010</div></td>
    <td width=77><div align=center>$lang0049</div></td>
    <td width=58><div align=center>$lang0083</div></td>
";

while ($r = mysql_fetch_array($result)) {
$ID_Ordine = $r["ID_Ordine"];
$Oggetto = $r["Oggetto"];
$Protocollo = $r["Protocollo"];
$Prezzo = $r["Prezzo"];
$Iva = $r["Iva"];



$tax =$tax + $Prezzo * $Iva / 100 * $Protocollo ;
$Imponibile = $Imponibile + $Prezzo * $Protocollo ;
$Totale = $Imponibile + $tax ;



echo " <tr><td width=82><div align=center>$ID_Ordine </div></td>
    <td width=87><div align=center>$Oggetto</div></td>
    <td width=57><div align=center>$Protocollo</div></td>
    <td width=77><div align=center>&euro; $Prezzo i.e.</div></td>
	<td width=57><div align=center>$Iva %</div></td>";

  
 
} 

}else { 
 echo"$lang0085"; 
} 
echo"</table>";
echo"<p></p><table width=300 border=1 cellspacing=0 cellpadding=1>
  <tr>
    <td>$lang0086</td>
    <td>$lang0083</td>
    <td>$lang0078</td>
  </tr>
  <tr>
    <td>$Imponibile</td>
    <td>$tax</td>
    <td>$Totale</td>
  </tr>
</table>";
echo " <p></p><p></p><p>$lang0087</p>
<form name=formpag method=post action=confpag.php>
<input name=Ragione_Sociale type=hidden value=\"$Ragione_Sociale\">
<input name=ImpPag type=hidden value=$Totale>
<input name=Ordini type=hidden value=";
$query = "SELECT * FROM sd_ordini WHERE Ragione_Sociale = '$Ragione_Sociale' and Tipo_Pagamento='nd' ";
$result = mysql_db_query("$dbname", $query); 
if ($result) {
while ($r = mysql_fetch_array($result)) {
$ID_Ordine = $r["ID_Ordine"];
echo "-$ID_Ordine-";
}
}
echo"><table width=466 border=0 cellspacing=0 cellpadding=0>
  <tr>
    <td width=171><input name=pagam type=radio value=crtcc>
    $lang0088</td>
    <td width=131><input name=pagam type=radio value=bonif checked>
    $lang0089</td>
    <td width=138><input name=pagam type=radio value=contras>
    $lang0090</td>
	 <td width=101 border=0 cellspacing=0 cellpadding=0><div align=center>
	   <input type=submit name=Submit value=$lang0056>
	   </div></td>
  </tr>
</table>";

} else {
echo "Prego effettuare il login <a href=\"contenuti.php\"> Qui<br>
&copy;Bloghosteria.com<br>
</a>";
}   
?>
