Location: PHPKode > projects > NOLA > invitemlstcomp.php
<? include('includes/main.php'); ?>
<? //invitemlstprice.php
     echo texttitle('Item List - Composite');
     if ($itemcode||$order) {
          if ($itemcode<>"All"&&$itemcode<>"") $itemstr=' and item.itemcode='.sqlprep($itemcode);
          if ($order=="i") {
               $orderstr = ' order by item.itemcode';
          } elseif ($order=="ci") {
               $orderstr = ' order by item.categoryid, item.itemcode';
          };
          $recordSet = &$conn->Execute('select distinct compositeitemid.itemcodeid, item.itemcode, item.description from compositeitemid, item where item.companyid='.sqlprep($active_company).' and item.id=compositeitemid.itemcodeid and item.cancel=0'.$itemstr.$orderstr);
          if ($recordSet->EOF) die(texterror('No matching items found.'));
          echo '<table border="1">';
          while (!$recordSet->EOF) {
               echo '<th colspan="6">Item '.$recordSet->fields[1].' - '.$recordSet->fields[2].'</th></tr>';
               echo '<tr><th>Sub Item Code</th><th>Sub Item Name</th><th>Category</th><th>Quantity</th><th>Unit Size</th></tr>';
               $recordSet2 = &$conn->Execute('select distinct item.id, item.itemcode, item.description, itemcategory.name, compositeitemid.quantity, unitname.unitname from item,itemcategory,unitname,compositeitemid where compositeitemid.subitemcodeid=item.id and itemcategory.id=item.categoryid and compositeitemid.itemcodeid='.sqlprep($recordSet->fields[0]).' and item.stockunitnameid=unitname.id and compositeitemid.quantity>0 order by item.itemcode');
               while (!$recordSet2->EOF) {
                    echo '<tr><td><b>'.$recordSet2->fields[1].'</b></td><td>'.$recordSet2->fields[2].'</td><td>'.$recordSet2->fields[3].'</td><td>'.$recordSet2->fields[4].'</td><td>'.$recordSet2->fields[5].'</td></tr>';
                    $recordSet2->MoveNext();
               };
               $recordSet->MoveNext();
               echo '<tr><td colspan="6">&nbsp;</td></tr>';
          };
          echo '</table>';
     } else {
          echo '<form action="invitemlstcomp.php" method="post"><table>';
          echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">Item Code:</td><td><input type="text" length="30" maxlength="20" name="itemcode" value="All"'.INC_TEXTBOX.'><a href="javascript:doNothing()" onclick="top.newWin = window.open(\'lookupitemcomposite.php?name=itemcode\',\'cal\',\'dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes\')"><img src="'.IMAGE_ITEM_LOOKUP.'" border="0" alt="Item Lookup"></a></td></tr>';
          echo '<tr><td align="'.TABLE_LEFT_SIDE_ALIGN.'">Sort By:</td><td><select name="order"'.INC_TEXTBOX.'>';
          echo '<option value="i">Item Code';
          echo '<option value="ci">Category, Item Code';
          echo '</select></td></tr>';
          echo '</table><input type="submit" value="Create Report"></form>';
     };
?>
<? include('includes/footer.php'); ?>
Return current item: NOLA