<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

include_once( "../include/class.SQLString.php" );
include_once("auth.php");

## mysql verbindung aufbauen
db_connect($db_host, $db_user, $db_pass);
## /mysql verbindung aufbauen

# anbieterliste erstellen
$id = safe_query( "select anbieter from anbieter where gesperrt='0' order by number", TRUE );
$i = 0;
while ($werte = db_fetch_array($id))
	{
	 $anbieter = $werte["anbieter"];
	 $id2 = safe_query( "select count(kunde) as anzahlkunden from kunden where anbieter = ? ", TRUE, new SQLString( $anbieter ) );
	 $werte2 = db_fetch_array($id2);
	 $anzahlkunden = $werte2["anzahlkunden"];
	 if ($i == 0)
		{
		 $i++;
		 $anbieterliste[] = "<option value=\"$anbieter\" selected>$anbieter ($anzahlkunden ".ltext("anku_users").")</option>";
		}
	 else
		{
		 $anbieterliste[] = "<option value=\"$anbieter\">$anbieter ($anzahlkunden ".ltext("anku_users").")</option>";
		}
	}
# /anbieterliste erstellen

$id = safe_query( "select anbieter from anbieter where gesperrt='1'", TRUE );
$anzahlganbieter = db_num_rows($id);

$id = safe_query( "select anbieter from anbieter", TRUE );
$anzahlanbieter = db_num_rows($id);

?>

<HTML>
<HEAD>
<META content="text/html; charset=<? echo $lang_html_charset; ?>" http-equiv=Content-Type>
<LINK href="<?=$strSkinName?>/style.css" rel=stylesheet type=text/css>
</HEAD>

<BODY bgColor=#ffffff bottomMargin=0 leftMargin=0 topMargin=0 MARGINHEIGHT="0" MARGINWIDTH="0">
<? include("../fehler.inc.php"); ?>
<BR>
<table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">

<tr>
<td  colspan=2 class="titel-3"><? echo ltext("anku_cell_title1"); ?></td>
</tr>

<? if ($anzahlanbieter > 0) { ?>
<form method="post" action="anbieter_kundenzuordnung2.php">
<tr>
<td><? echo ltext("anku_cell_sourceres1"); ?></td>
<td>
<select name="quellanbieter">
<?
for ($i = 0; $i < count($anbieterliste); $i++)
{
	if(!strstr($anbieterliste[$i],'res0')){
		echo $anbieterliste[$i];
	}	
}
?>
</select>
</td>
</tr>

<tr>
<td><? echo ltext("anku_cell_targetres1"); ?></td>
<td>
              <select name="zielanbieter">
                <?
for ($i = 0; $i < count($anbieterliste); $i++)
	{
	 echo "$anbieterliste[$i]";
	}
?>
              </select>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<script>
function doChange()
{
document.forms[0].submit();
}
</script>

<? echo std_button(ltext("anku_button1"), "javascript:doChange()"); ?></td>
</tr>
</form>

<tr>
<td  colspan=2 class="titel-3"><? echo ltext("anku_cell_title2"); ?></td>
</tr>

<form method="post" action="anbieter_kundenzuordnung2.php">
<tr>
<td><? echo ltext("anku_cell_user"); ?></td>
<td>
<input type="text" name="kunde" value="<? echo $user_prefix; ?>" size="10" maxlength="8">
</td>
</tr>

<tr>
<td><? echo ltext("anku_cell_targetres2"); ?></td>
<td>
<select name="zielanbieter">
                <?
for ($i = 0; $i < count($anbieterliste); $i++)
	{
	 echo "$anbieterliste[$i]";
	}
?>
              </select>
</td>
</tr>
<tr>
<td colspan=2 align=center>
<script>
function doChange2()
{
document.forms[1].submit();
}
</script>
<? echo std_button(ltext("anku_button2"), "javascript:doChange2()"); ?>
</td>
</tr>
</form>

<? }  else { ?>

<tr><td colspan=2><? echo ltext("anku_descr3"); ?></td></tr>
<? } ?>
</TABLE>
</BODY>
</HTML>

<?
db_close();
?>
