Location: PHPKode > projects > NOLA > lookupitemcomposite.php
<? require_once('includes/main.php'); ?>
<script language="JavaScript" src="js/lookup.js">
</script>
<?
	if ($category||$desc||$MANY_ITEMS_COMPOSITE) {
		if ($category) $catstr=' and item.categoryid='.sqlprep($category);
		if ($desc) $descstr=' and item.description like '.sqlprep('%'.$desc.'%');
		$recordSet = &$conn->Execute('select item.id, item.itemcode, item.description, itemcategory.name from item, itemcategory where item.categoryid=itemcategory.id and item.compositeyesno=1 and item.companyid='.sqlprep($active_company).$catstr.$descstr.' order by itemcategory.name, item.description');
		if ($recordSet->EOF) die(texterror('No composite items found.'));
		echo texttitle('Select Item');
		echo '<form name="mainform"><select name="'.$name.'"'.INC_TEXTBOX.'>';
		while (!$recordSet->EOF) {
			echo '<option value="'.$recordSet->fields[1].'">'.$recordSet->fields[3].' - '.$recordSet->fields[2].' - '.$recordSet->fields[1]."\n";
			$recordSet->MoveNext();
		};
		echo '</select><input type="button" onClick="setField('.sqlprep($name).')" value="Select">';
	} else {
		$recordSet = &$conn->Execute('select distinct itemcategory.id, itemcategory.name from item, itemcategory where item.companyid='.sqlprep($active_company).' and item.categoryid=itemcategory.id and item.compositeyesno=1 order by itemcategory.name');
		if ($recordSet->EOF) die(texterror('No composite items found.'));
		echo texttitle('Composite Item Search');
		echo '<form name="mainform" action="lookupitemcomposite.php" method="post"><input type="hidden" name="name" value="'.$name.'">';
		echo '<font size="-1">Description:</font><br><input type="text" name="desc" size="20"'.INC_TEXTBOX.'><br><br>';
		echo '<font size="-1">Category:</font><br><select name="category"'.INC_TEXTBOX.'><option value="0" selected>';
		while (!$recordSet->EOF) {
			echo '<option value="'.$recordSet->fields[0].'">'.$recordSet->fields[1]."\n";
			$recordSet->MoveNext();
		};
		echo '</select><br><input type="submit" value="Select"></form>';
	};
?>
<? require_once('includes/footer.php');?>
Return current item: NOLA