<?
include_once("dblibsec.inc");
include("clublibsec.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 "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">



<html>

<head>

	<title>Gestione Magazzino</title>

	<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\">

</head>



<body bgcolor=\"#FFFFFF\" link=\"#504C43\" alink=\"#000000\" vlink=\"#504C43\" text=\"#000000\">";

include ("langselect.php");

   include("Header.php"); 


 








	echo"<p><a href=\"Admin_faiordine.php?form[ID_Cliente]=$form[ID_Cliente]\">Cataloghi Cliente $form[Ragione_Sociale]</a> | 
<a href=\"clgestord.php?form[Ragione_Sociale]=$form[Ragione_Sociale]\">$lang0005</a> 

 
			<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></p>"; 
		}
include ("config18.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);
 mysql_connect("$hhost","$login","$pass") or die ("Problem connecting to DataBase"); 
$query = "SELECT * FROM sd_cataloghi "; 
$result = mysql_db_query("$dbname", $query); 
if ($result) {
while ($r = mysql_fetch_array($result)) {
$Idcat = $r["Idcat"];
$agggr = $r["agggr"];

  
echo "<table width=200 align=center  border=1 cellspacing=0 cellpadding=1><form method=\"post\" action=\"artshow.php?form[Ragione_Sociale]=$form[Ragione_Sociale]\">
<input type=\"hidden\" name=\"connect\" value=\"$agggr\">

<tr><td align=center bgcolor=#D9DAE7><input name=\"submit\" type=\"submit\" value=\"$agggr\"></td></tr>

</form></table>";
} 
 
} 
echo"
</table>";

		?>
		
</body>
</html>
