<?
session_start();
$us= $HTTP_SESSION_VARS['uid'];
//echo "user=$us<br>";
?>
<HTML>
<LINK REL="stylesheet" TYPE="text/css" HREF="menu.css">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Menu - Produklist rezult</title>
</head>
<body class="body1">
<?
include("menu.ini");
$i=1;
do {
$prod_id="prod_id_$i";
$prod_name="prod_name_$i";
$prod_type="prod_type_$i";
$prod_price="prod_price_$i";
$markt="markt_$i";
$menge="menge_$i";
$sector="sector_$i";
$sel="sel_$i";
$const="const_$i";
//echo "prod_type=$_POST[$prod_type]<P>";
//echo "prod_id=$_POST[$prod_id]<P>";
$strsql_t = "select typ_id from prod_type where (typ_name='$_POST[$prod_type]' and user_id='$us');";
$result_t = mysql_query($strsql_t, $connection);
$t=0;
while ( $row_t = mysql_fetch_row($result_t) )
{
$t+=1;
$_POST[$prod_type]=$row_t[0];
// echo "prod_type new=$_POST[$prod_type]<P>";
}
$strsql_m = "select markt_id from markt where (markt_name='$_POST[$markt]' and user_id='$us');";
$result_m = mysql_query($strsql_m, $connection);
$m=0;
while ( $row_m = mysql_fetch_row($result_m) )
{
$m+=1;
$_POST[$markt]=$row_m[0];
}
$strsql = "UPDATE product set prod_name='$_POST[$prod_name]', prod_type='$_POST[$prod_type]', prod_price='$_POST[$prod_price]', markt='$_POST[$markt]',menge='$_POST[$menge]' ,sector='$_POST[$sector]', sel='$_POST[$sel]', const='$_POST[$const]' where (prod_id='$_POST[$prod_id]');";
//echo "$strsql <P>";
$result = mysql_query($strsql);
$i=$i+1;
}
while ($_POST[$prod_id]!='');
/*
echo "<TABLE border=1 CELLSPACING=0 CELLPADDING=5 class=prod><TR class=table><TD>ID</TD><TD>Name</TD><TD>Type</TD><TD>Price</TD></TD><TD>Menge</TD><TD>Markt</TD><TD>Immer</TD><TR>";
$strsql1 = "select p.prod_name,t.typ_name,p.prod_price, p.menge,p.markt, p.prod_id, p.const from product p, prod_type t where (t.typ_id=p.prod_type) ORDER BY prod_type;";
$result1 = mysql_query($strsql1, $connection);
$i=0;
while ( $row = mysql_fetch_row($result1) )
{
$i+=1;
echo "<TR><TD>$row[5]</TD><TD>$row[0]</TD><TD>$row[1]</TD><TD>$row[2]</TD><TD>$row[3]</TD><TD>$row[4]</TD><TD>$row[6] </TD><TR>";
}
echo "</TABLE><P><P><P> ";
?>
</TABLE>
*/
$summa=0;
echo "<TABLE BORDER=0 ALIGN=center CELLSPACING=0 CELLPADDING=5 class=prod><TR>";
$strsql_m = "select distinct markt_name, markt_id from markt where user_id='$us';";
// echo "markt=$strsql_m <br>";
$result_m = mysql_query($strsql_m, $connection);
$m=0;
while ( $row_m = mysql_fetch_row($result_m) )
{
$m+=1;
$strsql_meng = "select prod_name from product where ((sel='Yes') and (markt='$row_m[1]') and user_id='$us') ORDER BY prod_type;";
// echo "prod=$strsql_meng <br>";
$result_meng = mysql_query($strsql_meng, $connection);
$num_rows = mysql_num_rows($result_meng);
// echo "num_rows=$num_rows <br>";
if ($num_rows!=0)
{
$summa_l=0;
echo "<TD VALIGN=top align=left>";
echo "<TABLE border=0 CELLSPACING=0 CELLPADDING=2><tr><td colspan=2>$row_m[0]</td></tr><TR><TD><font color=800080><B>ÐÑодÑкÑ</font></B></TD><TD><B><font color=800080>ÐолиÑеÑÑво</font></B></TD><TR>";
$strsql1 = "select prod_name,prod_type,prod_price, menge,markt, prod_id, sector from product where ((sel='Yes') and (markt='$row_m[1]') and user_id='$us') ORDER BY sector;";
//echo "str= $strsql1 <br>";
$result1 = mysql_query($strsql1, $connection);
$i=0;
while ( $row = mysql_fetch_row($result1) )
{
$i+=1;
echo "<TR><TD><font size=-1>$row[0]</TD><TD align=right><font size=-1>$row[3]</TD><TR>";
$summa_l=$summa_l+$row[2]*$row[3];
}
echo "</TABLE><P>Summa=$summa_l<P></TD><TD VALIGN=top align=right> ";
$summa=$summa+$summa_l;
echo "</td>";
}
}
echo "</tr></table>";
echo "<center><B>SUMMA $summa</B></center>";
?>
<p><center><A HREF=start.php>Ðа пеÑвÑÑ ÑÑÑаниÑÑ</a></center>