<?
include ("langselect.php");
include ("Config2db.php");

include_once("dblib.inc");

include("clublib.inc");

		$form["Data_Ordine"] = date("Y.m.d");
		$form["Data_Scadenza"] = "0000-00-00";
		
		// recupero i dati del cliente
		$form = array_merge ($form, getRow($customers_table, "Ragione_Sociale", $form['Ragione_Sociale']));

$result = orderInsert($form['ID_Cliente'], $form['Protocollo'], $form['Cat_Ogg'], $form['Oggetto'], $form['Data_Ordine'], $form['Data_Scadenza'], $form['Tipo_Pagamento'], $form['Prezzo'], $form['Iva'], $form['Ragione_Sociale'], $form['Cognome'], $form['Nome'], $form['PI'], $form['CF'], $form['Indirizzo'], $form['Citta'], $form['CAP'], $form['Provincia'], $form['Telefono'], $form['Fax'], $form['E_mail'], $form['Status']);
		if (! $result ){

			die (" Error: ".mysql_error());

		} else 
			{

			echo "$lang0003, 
$form[Ragione_Sociale] <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=$form[Ragione_Sociale]\">$lang0004</a> | 
<a href=\"clgestord.php?Ragione_Sociale=$form[Ragione_Sociale]\">$lang0005</a> |
<a href=mailto:$emailwebm>$lang0006</a> | 
<a href=\"gestpag.php?Ragione_Sociale=$form[Ragione_Sociale]\">$lang0007</a></p>
<p>$lang0143</p>
			<table width=250 height=50 border=1 align=center cellpadding=1 cellspacing=0>
			<td align=center>$lang0011 $form[Oggetto]</td> 
            <td align=center>$lang0010 $form[Protocollo]</td>
			<td align=center>$lang0015  $form[Data_Ordine]</td>
			</table>
			<p>$lang0144</p>"; 
		}
include ("config.php");				
mysql_connect("$hhost","$login","$pass") or die ("Problem connecting to DataBase"); 
$query = "SELECT * FROM $connect where oggnom='$oggnom' "; 
$result = mysql_db_query("$dbname", $query); 
if ($result) {
while ($r = mysql_fetch_array($result)) {

$quant = $r["quant"];
$oggnom = $r["oggnom"];


}
		
}
$tot =	$quant - $form['Protocollo'];
$query = "update $connect  set 
quant='$tot' where 
oggnom='$oggnom'";
$result = mysql_db_query("$dbname", $query);


		?>
		
</body>
</html>
