Location: PHPKode > projects > EzyBiz > ezybiz/lookupcustomerid.php
<?php

function lookupcustomerid()
{
	global $conn;
	$recordSet = $conn->Execute('select customer.id, company.companyname from customer, company where customer.companyid=company.id and company.cancel=0 and customer.gencompanyid=' . sqlprep($_SESSION["active_company"]) . ' and customer.cancel=0 order by company.id ASC')or die("error selecting customerid " . mysql_error());
	// Display drop down menu.
	if (!$recordSet->EOF)
	{
		echo '<select name="customerid">';
		echo '<option value="">-- Default --</option>';
		while (!$recordSet->EOF)
		{
			echo '<option value="' . $recordSet->fields[0] . '"' . checkequal($default, $recordSet->fields[0], ' selected') . '>' . $recordSet->fields[1] . ' - ' . $recordSet->fields[0] . "\n";
			$recordSet->MoveNext();
		} ; //end while
		echo '</select>';
	} //end if
} 
function lookupcustomerid1()
{
	global $conn;
	$recordSet = $conn->Execute('select customer.id, company.companyname from customer, company where customer.companyid=company.id and company.cancel=0 and customer.gencompanyid=' . sqlprep($_SESSION["active_company"]) . ' and customer.cancel=0 order by company.id ASC'); 
	// Display drop down menu.
	if (!$recordSet->EOF)
	{
		echo '<select name="customerid1">';
		echo '<option value="">-- Default --</option>';
		while (!$recordSet->EOF)
		{
			echo '<option value="' . $recordSet->fields[0] . '"' . checkequal($default, $recordSet->fields[0], ' selected') . '>' . $recordSet->fields[1] . ' - ' . $recordSet->fields[0] . "\n";
			$recordSet->MoveNext();
		} ;
		echo '</select>';
	} 
} 
function lookupcustomeridname()
{
	$recordSet = &$conn->Execute('select customer.id, company.lastname from customer, company where customer.companyid=company.id and company.cancel=0 and customer.gencompanyid=' . sqlprep($_SESSION["active_company"]) . ' and customer.cancel=0 order by company.id ASC'); 
	// Display drop down menu.
	if (!$recordSet->EOF)
	{
		echo '<select name="customeridname">';
		echo '<option value="">-- Default --</option>';
		while (!$recordSet->EOF)
		{
			echo '<option value="' . $recordSet->fields[0] . '">' . $recordSet->fields[1] . ' - ' . $recordSet->fields[0] . "\n";
			$recordSet->MoveNext();
		} ;
		echo '</select>';
	} 
} 
function lookupcustomeridrego()
{
	$recordSet = &$conn->Execute('select customer.id, company.rego from customer, company where customer.companyid=company.id and company.cancel=0 and customer.gencompanyid=' . sqlprep($_SESSION["active_company"]) . ' and customer.cancel=0 order by company.id ASC');
	// Display drop down menu.
	if (!$recordSet->EOF)
	{
		echo '<select name="customeridrego">';
		echo '<option value="">-- Default --</option>';
		while (!$recordSet->EOF)
		{
			echo '<option value="' . $recordSet->fields[0] . '">' . $recordSet->fields[1] . ' - ' . $recordSet->fields[0] . "\n";
			$recordSet->MoveNext();
		} ;
		echo '</select>';
	}
}
function lookupcustomeridSEARCH($defaultchose = null,$url = null,$form = null,$customerid=null)
{
	global $conn;
	//$conn->debug = true;

	echo "<input type=\"text\" size=\"20\" name=\"customer\" value=\"".$defaultchose."\">";
	echo "<input type=\"hidden\" name=\"customerid\" value=\"".$customerid."\">";
	echo "<a href=\"#\"><img src=\"".HTTP_SERVER."/images/search.gif\" border=\"0\" onClick=\"openwin('".HTTP_SERVER."/customerSearch.php?form=$form&url=$url','Customer Search','toolbar=no,locaton=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes, copyhistory=no,width=700,height=550,screenX=0,screenY=0,top=45,left=45');\" alt=\"Customer Search\"></a>";
}
function customlookupcustomeridSEARCH($defaultchose = null,$url = null,$form = null,$customerid=null,$inputname=null,$hiddenname=null)
{
	global $conn;
	//$conn->debug = true;

	echo "<input type=\"text\" size=\"20\" name=\"$inputname\" value=\"".$defaultchose."\">";
	echo "<input type=\"hidden\" name=\"$hiddenname\" value=\"".$customerid."\">";
	echo "<a href=\"#\"><img src=\"".HTTP_SERVER."/images/search.gif\" border=\"0\" onClick=\"openwin('".HTTP_SERVER."/customerSearch.php?form=$form&url=$url";
	echo "&inputname=$inputname&hiddenname=$hiddenname";
	echo "','Customer Search','toolbar=no,locaton=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes, copyhistory=no,width=700,height=550,screenX=0,screenY=0,top=45,left=45');\" alt=\"Customer Search\"></a>";
}
function lookupcustomeridINVSEARCH($defaultchose = null,$url=null,$form=null,$showaddbutton=true)
{
	global $conn;
	//$conn->debug = true;
	$query = $conn->Execute("SELECT company.companyname FROM customer,company WHERE customer.companyid = company.id AND customer.id = $defaultchose");
	echo "<input type=\"text\" size=\"20\" name=\"customer\" value=\"".$query->fields[0]."\">";
	echo "<a href=\"#\"><img src=\"".HTTP_SERVER."/images/search.gif\" border=\"0\" onClick=\"openwin('".HTTP_SERVER."/customerSearchInv.php?form=$form&url=$url','Customer Search','toolbar=no,locaton=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes, copyhistory=no,width=700,height=550,screenX=0,screenY=0,top=45,left=45');\" alt=\"Customer Search\"></a>";
	if ($showaddbutton == true)
	{
		echo "<a href=\"#\"><img src=\"".HTTP_SERVER."/images/add.gif\" border=\"0\" onClick=\"openwin('arcustupd.php?showtemp=0','Item Search','toolbar=no,locaton=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes, copyhistory=no,width=700,height=550,screenX=0,screenY=0,top=45,left=45');\" alt=\"Add Inventory\"></a>";
	}
}
?>
Return current item: EzyBiz