- dimensions_list($name, $selected_id, $no_option, $showname, false, $showclosed, $showtype);
- echo "</td>\n";
-}
-
-function dimensions_list_row($label, $name, $selected_id, $no_option=false, $showname=null,
- $showclosed=false, $showtype=0)
-{
- echo "<tr>\n";
- dimensions_list_cells($label, $name, $selected_id, $no_option, $showname,
- $showclosed, $showtype);
- echo "</tr>\n";
-}
-
-//---------------------------------------------------------------------------------------------------
-
-function stock_items_list($name, $selected_id, $all_option=false, $submit_on_change=false, $extra="")
-{
- global $all_items, $no_item_list;
-
- if ($selected_id == null)
- $selected_id = (!isset($_POST[$name]) ? "" : $_POST[$name]);
-
- if ($no_item_list)
- {
- global $search_button;
- $edit_name = $name."_edit";
- $edit_button = $name."_button";
-
- $val = (isset($_POST[$edit_name]) && $_POST[$edit_name] != "" ? $_POST[$edit_name] : "");
-
- if (isset($_POST[$edit_button]))
- {
- $selected_id = $_POST[$name] = "";
- }
-
- if ($selected_id != "")
- {
- $val = DEFVAL;
- $sql = "SELECT stock_id, ".TB_PREF."stock_master.description, ".TB_PREF."stock_category.description
- FROM ".TB_PREF."stock_master,".TB_PREF."stock_category WHERE ".TB_PREF."stock_master.category_id=".TB_PREF."stock_category.category_id
- AND stock_id='$selected_id'";
- $result = db_query($sql);
- }
- else
- {
- if ($val != "" && $val != DEFVAL)
- {
- $sql = "SELECT stock_id, ".TB_PREF."stock_master.description, ".TB_PREF."stock_category.description
- FROM ".TB_PREF."stock_master,".TB_PREF."stock_category WHERE "
- .TB_PREF."stock_master.category_id=".TB_PREF."stock_category.category_id AND
- (stock_id LIKE '%{$val}%' OR ".TB_PREF."stock_category.description LIKE '%{$val}%' OR "
- .TB_PREF."stock_master.description LIKE '%{$val}%')";
- $result = db_query($sql);
- }
- else
- $result = false;
- }
-
- echo "<input type='text' name='$edit_name' size='8' maxlength='50' value='$val' onblur='this.form.$edit_button.click();'> ";
-
- echo sprintf($search_button, $edit_button);
- }
- else
- {
- $sql = "SELECT stock_id, ".TB_PREF."stock_master.description, ".TB_PREF."stock_category.description
- FROM ".TB_PREF."stock_master,".TB_PREF."stock_category WHERE ".TB_PREF."stock_master.category_id=".TB_PREF."stock_category.category_id";
- $result = db_query($sql);
- }
-
- if ($submit_on_change==true)
- echo "<select name='$name' onchange='this.form.submit();'>";
- else if ($extra != "")
- echo "<select name='$name' $extra>";
- else
- echo "<select name='$name'>";
-
- if (($all_option == true))
- {
- if ($selected_id == $all_items)
- {
- echo "<option selected value='$all_items'>" . _("All Items") . "</option>\n";
- }
- else
- {
- echo "<option value='$all_items'>" . _("All Items") . "</option>\n";
- }
- if ($selected_id == "")
- {
- $selected_id = $all_items;
- }
- }
-
- while ($row = db_fetch_row($result))
- {
- if ($selected_id == $row[0])
- {
- echo "<option selected value='" . $row[0] . "'>";
- }
- else
- {
- echo "<option value='" . $row[0] . "'>";
- }
- echo (user_show_codes()?$row[0] . " - ":"") . $row[2] . " - " . $row[1] . "</option>\n";
-
- // if no initial selection - set the first item
- // do we want to do this for all lists ???? probably
- if ($selected_id == "")
- {
- $selected_id = $row[0];
- $_POST[$name] = $selected_id;
- }
- }
- echo "</select>";
- db_free_result($result);
-}
-
-function stock_items_list_cells($label, $name, $selected_id, $all_option=false, $submit_on_change=false, $extra="")
-{
- if ($label != null)
- echo "<td>$label</td>\n";
- echo "<td nowrap>";
- stock_items_list($name, $selected_id, $all_option, $submit_on_change, $extra);