Example #1
0
  public final void populateDivisionColumn() throws SQLException {
    Sql sql = sqlhand.als_mysoftsql();
    if (sql == null) return;

    List<GroovyRowResult> tlist = null;
    String sqlstm =
        "select distinct stock_cat from stockmasterdetails where item_type='Service Item' and nominal_code like '5%' order by stock_cat";

    try {
      tlist = sql.rows(sqlstm);
      sql.close();
    } catch (SQLException e) {
    }

    if (tlist.size() == 0) return;

    Listbox newlb = lbhand.makeVWListbox(division_holder, blankish_lb_headers, division_lbid, 20);
    newlb.addEventListener("onSelect", new divisionOnClick());

    String[] strarray = new String[1];
    String tp_division = luhand.getRec_Origid("TP_DIVISIONS"); // hardcoded

    // debugLabel.setValue("getrec_origid: " + tp_division);

    for (GroovyRowResult ilist : tlist) {
      strarray[0] =
          luhand.matchLookup_ReturnStr("TP_DIVISIONS", (String) ilist.get("stock_cat"), 1);
      // strarray[0] = (String)ilist.get("stock_cat");
      lbhand.insertListItems(newlb, strarray, "true", "");
    }
  } // end of populateDivisionColumn()
Example #2
0
  // Populate division column - refer to mysoft.stockmasterdetails.stock_cat
  // nominal_code=glcode=5xxxxx = services we sell
  // istock_cat = as in stockmasterdetails.stock_cat
  public final void populateSectionColumn(String istock_cat) {
    Sql sql = sqlhand.als_mysoftsql();
    if (sql == null) return;

    String sqlstm =
        "select distinct groupcode from stockmasterdetails where item_type='Service Item' and nominal_code like '5%' "
            + "and stock_cat='"
            + istock_cat
            + "' order by groupcode";

    List<GroovyRowResult> tlist = null;

    try {
      tlist = sql.rows(sqlstm);
      sql.close();
    } catch (SQLException e) {
    }

    if (tlist == null) return;

    selected_category = istock_cat; // save for later usage

    if (tlist.size() == 0) return;

    Listbox newlb = lbhand.makeVWListbox(section_holder, blankish_lb_headers, section_lbid, 20);
    newlb.addEventListener("onSelect", new sectionOnClick());

    String[] strarray = new String[1];

    for (GroovyRowResult ilist : tlist) {
      strarray[0] = (String) ilist.get("groupcode");
      lbhand.insertListItems(newlb, strarray, "true", "");
    }
  } // end of populateSectionColumn()
Example #3
0
 private void doCheckRights() {
   UserWorkspace workspace = getUserWorkspace();
   //        String role = getUserWorkspace().getUserSession().getEmployeeRole();
   //        if (((getUserWorkspace().getUserSession().getOrganizationid() == 1176)
   //                || (getUserWorkspace().getUserSession().getOrganizationid() == 1413))
   //                &&
   // ((getUserWorkspace().getUserSession().getJobPositionCode().equals("Assistant Manager"))
   //                ||
   // (getUserWorkspace().getUserSession().getJobPositionCode().equals("Analyst"))
   //                || (getUserWorkspace().getUserSession().getJobPositionCode().equals("POH
   // Assistant Manager")))) {
   if (getUserWorkspace().getUserSession().getEmployeeRole().contains(1532)) {
     label_prioritas.setVisible(true);
     radiogroup_Prioritas.setVisible(true);
     label_dampak.setVisible(true);
     radiogroup_Dampak.setVisible(true);
     label_pelaksana.setVisible(true);
     listbox_NamaPelaksana.setVisible(true);
     label_target.setVisible(true);
     intbox_target.setVisible(true);
     label_hari.setVisible(true);
   } else {
     label_prioritas.setVisible(false);
     radiogroup_Prioritas.setVisible(false);
     label_dampak.setVisible(false);
     radiogroup_Dampak.setVisible(false);
     label_pelaksana.setVisible(false);
     listbox_NamaPelaksana.setVisible(false);
     label_target.setVisible(false);
     intbox_target.setVisible(false);
     label_hari.setVisible(false);
   }
 }
Example #4
0
 /* enables or disables fields depending on whether a sub category is being added */
 protected void setSubCatAddMode(boolean adding) {
   showSubCatAddFields(adding);
   disableInputFields(adding);
   lbxItems.setDisabled(adding);
   lbxSubCatItems.setDisabled(adding);
   //        btnAddSubCat.setDisabled(adding);
   //        btnRemoveSubCat.setDisabled(adding || subCatUnremovable());
 }
Example #5
0
 /**
  * *********************************************************** Search
  * ***********************************************************
  */
 @Listen("onClick = #searchBtn")
 public void search() {
   String searchTerm = searchBox.getValue();
   List<Node> nodes = nodeDao.matchByLabel("%" + searchTerm + "%");
   ListModelList<Node> nodeModel = new ListModelList<Node>(nodes);
   nodeList.setModel(nodeModel);
   nodeList.setItemRenderer(new NodeRenderer());
   footer.setLabel(nodes.size() + " nodes found.");
 }
Example #6
0
 /** Sorts the items. If with group, each group is sorted independently. */
 @SuppressWarnings("unchecked")
 private static void sort0(Listbox box, Comparator cmpr) {
   if (box.hasGroup())
     for (Listgroup g : box.getGroups()) {
       int index = g.getIndex() + 1;
       Components.sort(box.getItems(), index, index + g.getItemCount(), cmpr);
     }
   else Components.sort(box.getItems(), cmpr);
 }
Example #7
0
    public void onEvent(Event event) throws UiException, SQLException {
      Listbox thelb = (Listbox) division_holder.getFellowIfAny(division_lbid);
      String iwhat = thelb.getSelectedItem().getLabel();
      String iname = luhand.matchLookup_ReturnStr("TP_DIVISIONS", iwhat, 2); // get name by disptext
      populateSectionColumn(iname);

      // remove prev tests lb if any
      if (tests_holder.getFellowIfAny(tests_lbid) != null) {
        Listbox prevlb = (Listbox) tests_holder.getFellowIfAny(tests_lbid);
        prevlb.setParent(null);
      }
    }
 public void onClick$deleteBtn(Event event) {
   Window canvasBoardWindow =
       (Window) zkpaintWindow.getFellow("canvasInc").getFellow("canvasBoardWindow");
   Canvas cvs1 = (Canvas) canvasBoardWindow.getFellow("cvs1");
   int size = shapeListBox.getItemCount();
   System.out.println(size);
   for (int i = size - 1; i > -1; i--) {
     if (!shapeListBox.getItemAtIndex(i).isSelected()) continue;
     System.out.println(i);
     cvs1.remove(i);
     ((ListModelList) shapeListBox.getModel()).remove(i);
   }
 }
Example #9
0
 private void doWriteComponentsToBeanVer(TVerifikasi tVerifikasi) {
   if (listbox_NamaPelaksana.getSelectedItem() != null) {
     Listitem itempelaksana = listbox_NamaPelaksana.getSelectedItem();
     ListModelList lml = (ListModelList) listbox_NamaPelaksana.getListModel();
     VHrEmployeePelaksana vHrEmployeePelaksana =
         (VHrEmployeePelaksana) lml.get(itempelaksana.getIndex());
     if (!vHrEmployeePelaksana.getEmployee_name().equalsIgnoreCase("Silakan pilih")) {
       tVerifikasi.setNik_pelaksana(vHrEmployeePelaksana.getEmployee_no());
     }
     if (!vHrEmployeePelaksana.getEmployee_no().equalsIgnoreCase("555")) {
       tVerifikasi.setNik_pelaksana(vHrEmployeePelaksana.getEmployee_no());
     }
   }
 }
Example #10
0
 /* enable or disable fields depending on whether we are in browse/edit or add mode */
 public void setAddMode(boolean adding, String selectedTab) {
   lbxItems.setDisabled(adding);
   if (selectedTab.equals("tabCategories")) {
     lbxSubCatItems.setDisabled(adding);
     btnAddSubCat.setDisabled(adding);
     btnRemoveSubCat.setDisabled(adding);
     disableInputFields(!adding);
     disableSubCatButtons(adding);
     _sb.setCategoryMembers(null);
   }
   if (adding) clearTextFields();
   txtName.setText("");
   lblMembers.setText("Members (0)");
 }
Example #11
0
 /* returns the value of the first item in the listbox, if any */
 private String getFirstListboxItem() {
   Option[] items = (Option[]) lbxItems.getItems();
   if ((items != null) && items.length > 0) {
     Option item = items[0];
     if (item != null) return (String) item.getValue();
   }
   return null;
 }
Example #12
0
 /**
  * Sets the sort direction. This does not sort the data, it only serves as an indicator as to how
  * the list is sorted. (unless the listbox has "autosort" attribute)
  *
  * <p>If you use {@link #sort(boolean)} to sort list items, the sort direction is maintained
  * automatically. If you want to sort it in customized way, you have to set the sort direction
  * manually.
  *
  * @param sortDir one of "ascending", "descending" and "natural"
  */
 public void setSortDirection(String sortDir) throws WrongValueException {
   if (sortDir == null
       || (!"ascending".equals(sortDir)
           && !"descending".equals(sortDir)
           && !"natural".equals(sortDir)))
     throw new WrongValueException("Unknown sort direction: " + sortDir);
   if (!Objects.equals(_sortDir, sortDir)) {
     _sortDir = sortDir;
     if (!"natural".equals(sortDir) && !_ignoreSort) {
       Listbox listbox = getListbox();
       if (listbox != null && listbox.isAutosort()) {
         doSort("ascending".equals(sortDir));
       }
     }
     smartUpdate("sortDirection", _sortDir); // don't use null because sel.js assumes it
   }
 }
Example #13
0
 private void fixDirection(Listbox listbox, boolean ascending) {
   _ignoreSort = true;
   // maintain
   for (Iterator it = listbox.getListhead().getChildren().iterator(); it.hasNext(); ) {
     final Listheader hd = (Listheader) it.next();
     hd.setSortDirection(hd != this ? "natural" : ascending ? "ascending" : "descending");
   }
   _ignoreSort = false;
 }
Example #14
0
 protected void populateGUI(String id, nonHumanMgt.SelType type) {
   switch (type) {
     case resource:
       populateGUI(_sb.getSelectedNonHumanResource(), id);
       break;
     case category:
       populateGUI(_orgDataSet.getNonHumanCategory(id));
       break;
   }
   lbxItems.setSelected(id);
 }
Example #15
0
  @Listen("onClick = #addBtn")
  public void add() throws InterruptedException {
    Node node = nodeList.getSelectedItem().getValue();
    node = nodeDao.loadById(node.getId());
    AbstractQuestionRelation p = (AbstractQuestionRelation) getParent();
    node.getGroups().addAll((p.getQuestion().getAvailableGroups()));
    nodeDao.save(node);

    // update interface
    p.refreshWholePage();
  }
Example #16
0
  /* sets or hides fields depending on which tab is shown */
  public void setVisibleComponents(nonHumanMgt.SelType sType) {
    boolean catTab = (sType == nonHumanMgt.SelType.category);

    // these only appear on the resources tab
    cbbCategory.setVisible(!catTab);
    lblSubCategory.setVisible(!catTab);
    cbbSubCategory.setVisible(!catTab);

    // these only appear on the categories tab
    lblMembers.setVisible(catTab);
    cbbMembers.setVisible(catTab);
    lbxSubCatItems.setVisible(catTab);
    btnAddSubCat.setVisible(catTab);
    btnRemoveSubCat.setVisible(catTab);

    // nullify lists
    if (catTab) {
      cbbCategory.setItems(null);
      cbbSubCategory.setItems(null);
    } else lbxSubCatItems.setItems(null);
  }
Example #17
0
  public void onCreate$window_Permohonan(Event event) throws Exception {

    if (logger.isDebugEnabled()) {
      logger.debug("--> " + event.toString());
    }

    doCheckRights();

    Map<String, Object> args = getCreationArgsMap(event);

    if (args.containsKey("tPermohonan")) {
      TPermohonan tPermohonan = (TPermohonan) args.get("tPermohonan");
      settPermohonan(tPermohonan);
    } else {
      settPermohonan(null);
    }

    if (args.containsKey("permohonanBaruCtrl")) {
      permohonanBaruCtrl = (PermohonanBaruCtrl) args.get("permohonanBaruCtrl");
    } else {
      permohonanBaruCtrl = null;
    }

    if (args.containsKey("listbox_DaftarPermohonan")) {
      listbox_DaftarPermohonan = (Listbox) args.get("listbox_DaftarPermohonan");
    } else {
      listbox_DaftarPermohonan = null;
    }
    if (getPelaksanaanGangguanService().getEmployeeName() != null) {
      ListModelList lmlNamaPelaksana =
          new ListModelList(getPelaksanaanGangguanService().getEmployeeName());
      VHrEmployeePelaksana pelaksana = new VHrEmployeePelaksana();
      pelaksana.setEmployee_name("Silakan pilih");
      pelaksana.setEmployee_no("555");
      lmlNamaPelaksana.add(0, pelaksana);
      listbox_NamaPelaksana.setModel(lmlNamaPelaksana);
      listbox_NamaPelaksana.setItemRenderer(new PelaksanaListModelItemRenderer());
    }
    doShowDialog(gettPermohonan(), gettVerifikasi());
  }
Example #18
0
 private boolean isValidatedFlow() throws InterruptedException {
   if (textbox_DetailPermohonan.getValue().length() < 1) {
     Messagebox.show("Silakan isi deskripsi");
     return false;
   }
   //        String role = getUserWorkspace().getUserSession().getEmployeeRole();
   if (getUserWorkspace().getUserSession().getEmployeeRole().contains(1532)) {
     if (listbox_NamaPelaksana.getSelectedItem() == null) {
       Messagebox.show("Silakan pilih nama pelaksana");
       return false;
     }
     if (listbox_NamaPelaksana.getSelectedItem().getLabel().equalsIgnoreCase("Silakan pilih")) {
       Messagebox.show("Silakan pilih nama pelaksana");
       return false;
     }
     if (intbox_target.getValue() == null) {
       Messagebox.show("Silakan isikan target selesai");
       return false;
     }
   }
   if (radio_readonly.isSelected()) {
     if (getUploadMedia() == null) {
       Messagebox.show("Type permohonan Read Only -> silakan lampirkan file");
       return false;
     }
   } else if (radio_readwrite.isSelected()) {
     if (getUploadMedia() == null) {
       Messagebox.show("Type permohonan Read Write -> silakan lampirkan file");
       return false;
     }
   } else if (radio_aplikasi.isSelected()) {
     return true;
   } else if (radio_lainlain.isSelected()) {
     return true;
   }
   return true;
 }
Example #19
0
  /**/ boolean doSort(boolean ascending) {
    final Comparator cmpr = ascending ? _sortAsc : _sortDsc;
    if (cmpr == null) return false;

    final Listbox box = getListbox();
    if (box == null) return false;

    // comparator might be zscript
    Scopes.beforeInterpret(this);
    try {
      final ListModel model = box.getModel();
      boolean isPagingMold = box.inPagingMold();
      int activePg = isPagingMold ? box.getPaginal().getActivePage() : 0;
      if (model != null) { // live data
        if (model instanceof GroupsSortableModel) {
          sortGroupsModel(box, (GroupsSortableModel) model, cmpr, ascending);
        } else {
          if (!(model instanceof Sortable))
            throw new UiException(
                GroupsSortableModel.class
                    + " or "
                    + Sortable.class
                    + " must be implemented in "
                    + model.getClass().getName());
          sortListModel((Sortable) model, cmpr, ascending);
        }
      } else { // not live data
        sort0(box, cmpr);
      }
      if (isPagingMold) box.getPaginal().setActivePage(activePg);
      // Because of maintaining the number of the visible item, we cause
      // the wrong active page when dynamically add/remove the item (i.e. sorting).
      // Therefore, we have to reset the correct active page.
    } finally {
      Scopes.afterInterpret();
    }

    _ignoreSort = true;
    // maintain
    for (Iterator it = box.getListhead().getChildren().iterator(); it.hasNext(); ) {
      final Listheader hd = (Listheader) it.next();
      hd.setSortDirection(hd != this ? "natural" : ascending ? "ascending" : "descending");
    }
    _ignoreSort = false;

    // sometimes the items at client side are out of date
    box.invalidate();

    return true;
  }
Example #20
0
  private void doSimpan() throws InterruptedException {

    TPermohonan tPermohonan = gettPermohonan();
    Mttr mttr = new Mttr();
    doWriteComponentsToBean(tPermohonan, mttr);

    try {
      String uploadeFileName = null;
      if (getUploadMedia() != null) {
        uploadeFileName = getUploadMedia().getName();
      }
      getPermohonanService()
          .simpanAllTPermohonan(
              uploadeFileName,
              tPermohonan,
              mttr,
              getUserWorkspace().getUserSession().getEmployeeRole());
      TVerifikasi tVerifikasi =
          getPermohonanService()
              .getTVerifikasiByTIdossVerifikasiId(gettPermohonan().getT_idoss_permohonan_id());
      doWriteComponentsToBeanVer(tVerifikasi);
      getVerifikasiService().saveOrUpdateTVerifikasi(tVerifikasi);

    } catch (DataAccessException e) {
      String message = e.getMessage();
      String title = Labels.getLabel("message_Error");
      MultiLineMessageBox.doSetTemplate();
      MultiLineMessageBox.show(message, title, MultiLineMessageBox.OK, "ERROR", true);
    }

    ListModelList lml = (ListModelList) listbox_DaftarPermohonan.getListModel();

    // Check if the object is new or updated
    // -1 means that the obj is not in the list, so it's new.
    if (lml.indexOf(tPermohonan) == -1) {
      lml.add(tPermohonan);
    } else {
      lml.set(lml.indexOf(tPermohonan), tPermohonan);
    }
    lml.sort(new TPermohonanComparator(), true);
  }
Example #21
0
  /**
   * Ungroups and sorts the items ({@link Listitem}) based on the ascending. If the corresponding
   * comparator is not set, it returns false and does nothing.
   *
   * @param ascending whether to use {@link #getSortAscending}. If the corresponding comparator is
   *     not set, it returns false and does nothing.
   * @since 6.5.0
   */
  public void ungroup(boolean ascending) {
    final Comparator<?> cmpr = ascending ? _sortAsc : _sortDsc;
    if (cmpr != null) {

      final Listbox listbox = getListbox();
      if (listbox.getModel() == null) {

        // comparator might be zscript
        Scopes.beforeInterpret(this);
        try {
          final List<Listitem> items = listbox.getItems();
          if (listbox.hasGroup()) {
            for (Listgroup group : new ArrayList<Listgroup>(listbox.getGroups()))
              group.detach(); // Listgroupfoot is removed
            // automatically, if any.
          }

          Comparator<?> cmprx;
          if (cmpr instanceof GroupComparator) {
            cmprx = new GroupToComparator((GroupComparator) cmpr);
          } else {
            cmprx = cmpr;
          }

          final List<Listitem> children = new LinkedList<Listitem>(items);
          items.clear();
          sortCollection(children, cmprx);
          for (Component c : children) listbox.appendChild(c);
        } finally {
          Scopes.afterInterpret();
        }
      }
      fixDirection(listbox, ascending);

      // sometimes the items at client side are out of date
      listbox.invalidate();
    }
  }
Example #22
0
 public void onEvent(Event event) throws UiException, SQLException {
   Listbox thelb = (Listbox) section_holder.getFellowIfAny(section_lbid);
   String iwhat = thelb.getSelectedItem().getLabel();
   selected_groupcode = iwhat; // save for later usage
   populateTestParametersColumn(selected_category, iwhat);
 }
Example #23
0
  /**
   * Groups and sorts the items ({@link Listitem}) based on {@link #getSortAscending}. If the
   * corresponding comparator is not set, it returns false and does nothing.
   *
   * @param ascending whether to use {@link #getSortAscending}. If the corresponding comparator is
   *     not set, it returns false and does nothing.
   * @return whether the rows are grouped.
   * @since 6.5.0
   */
  public boolean group(boolean ascending) {
    final String dir = getSortDirection();
    if (ascending) {
      if ("ascending".equals(dir)) return false;
    } else {
      if ("descending".equals(dir)) return false;
    }
    final Comparator<?> cmpr = ascending ? _sortAsc : _sortDsc;
    if (cmpr == null) return false;

    final Listbox listbox = getListbox();
    if (listbox == null) return false;

    // comparator might be zscript
    Scopes.beforeInterpret(this);
    try {
      final ListModel model = listbox.getModel();
      int index = listbox.getListhead().getChildren().indexOf(this);
      if (model != null) { // live data
        if (!(model instanceof GroupsSortableModel))
          throw new UiException(
              GroupsSortableModel.class + " must be implemented in " + model.getClass().getName());
        groupGroupsModel((GroupsSortableModel) model, cmpr, ascending, index);
      } else { // not live data
        final List<Listitem> items = listbox.getItems();
        if (items.isEmpty()) return false; // Avoid listbox with null group	
        if (listbox.hasGroup()) {
          for (Listgroup group : new ArrayList<Listgroup>(listbox.getGroups()))
            group.detach(); // Groupfoot is removed automatically, if any.
        }

        Comparator<?> cmprx;
        if (cmpr instanceof GroupComparator) {
          cmprx = new GroupToComparator((GroupComparator) cmpr);
        } else {
          cmprx = cmpr;
        }

        final List<Listitem> children = new LinkedList<Listitem>(items);
        items.clear();
        sortCollection(children, cmprx);

        Listitem previous = null;
        for (Listitem item : children) {
          if (previous == null || compare(cmprx, previous, item) != 0) {
            // new group
            final List<Listcell> cells = item.getChildren();
            if (cells.size() < index)
              throw new IndexOutOfBoundsException("Index: " + index + " but size: " + cells.size());
            Listgroup group;
            Listcell cell = cells.get(index);
            if (cell.getLabel() != null) {
              group = new Listgroup(cell.getLabel());
            } else {
              Component cc = cell.getFirstChild();
              if (cc instanceof Label) {
                String val = ((Label) cc).getValue();
                group = new Listgroup(val);
              } else {
                group = new Listgroup(Messages.get(MZul.GRID_OTHER));
              }
            }
            listbox.appendChild(group);
          }
          listbox.appendChild(item);
          previous = item;
        }

        if (cmprx != cmpr) sort0(listbox, cmpr); // need to sort each group
      }
    } finally {
      Scopes.afterInterpret();
    }

    fixDirection(listbox, ascending);

    // sometimes the items at client side are out of date
    listbox.invalidate();

    return true;
  }
Example #24
0
 @SuppressWarnings("unchecked")
 private void sortGroupsModel(
     Listbox box, GroupsSortableModel model, Comparator cmpr, boolean ascending) {
   model.sort(cmpr, ascending, box.getListhead().getChildren().indexOf(this));
 }
Example #25
0
 public void clearFieldsAfterRemove() {
   clearTextFields();
   lbxItems.setSelected(getFirstListboxItem());
 }
Example #26
0
  // Populate division column - refer to mysoft.stockmasterdetails.stock_cat
  // nominal_code=glcode=5xxxxx = services we sell
  // istock_cat = as in stockmasterdetails.stock_cat
  // 27/03/2012: uses showType to determine which one to show,
  // 1=default,2=stock-pricing,3=testpackage
  // 07/03/2013: pricing_lb_headers add "Subcon" column = stockmasterdetails.newfield4
  public final void populateTestParametersColumn(String istock_cat, String igroupcode)
      throws SQLException {
    Object[] testparameters_lb_headers = {
      new listboxHeaderObj("mysoftcode", false),
      new listboxHeaderObj("Test", true),
      new listboxHeaderObj("Method", true),
    };

    Object[] pricing_lb_headers = {
      new listboxHeaderObj("mysoftcode", false),
      new listboxHeaderObj("Stock.Code", true),
      new listboxHeaderObj("Test", true),
      new listboxHeaderObj("Method", true),
      new listboxHeaderObj("Cost", true),
      new listboxHeaderObj("Selling", true),
      new listboxHeaderObj("Subcon", true),
    };

    Object[] testpackages_lb_headers = {
      new listboxHeaderObj("mysoftcode", false),
      new listboxHeaderObj("Stock.Code", true),
      new listboxHeaderObj("Test", true),
      new listboxHeaderObj("Method", true),
      new listboxHeaderObj("S.Price", true),
      new listboxHeaderObj("LOR", true),
      new listboxHeaderObj("Bill", true),
      new listboxHeaderObj("Units", true),
    };

    Object[] whichheader = null;
    String sqlstm = "";
    // NumberFormat nf = NumberFormat.getCurrencyInstance();
    DecimalFormat nf = new DecimalFormat("####.00");
    String costprice, sellingprice;

    switch (showType) {
      case 1:
        whichheader = testparameters_lb_headers;
        // 30/9/2010: put a filter to knockout p-p2-%METALS items
        sqlstm =
            "select id,description,description2 from stockmasterdetails where item_type='Service Item' and nominal_code like '5%' "
                + "and stock_cat='"
                + istock_cat
                + "' "
                + "and groupcode='"
                + igroupcode
                + "' "
                + "and stock_code not like 'p-p2-%METALS' "
                + "order by description";
        break;
      case 2:
        whichheader = pricing_lb_headers;
        sqlstm =
            "select id,stock_code,description,description2,cost_price,selling_price,newfield4 "
                + "from stockmasterdetails where item_type='Service Item' and nominal_code like '5%' "
                + "and stock_cat='"
                + istock_cat
                + "' "
                + "and groupcode='"
                + igroupcode
                + "' "
                + "order by description";
        break;
      case 3:
        whichheader = testpackages_lb_headers;
        sqlstm =
            "select id,stock_code,description,description2,newfield8,newfield9,newfield10,selling_price "
                + "from stockmasterdetails where item_type='Service Item' and nominal_code like '5%' "
                + "and stock_cat='"
                + istock_cat
                + "' "
                + "and groupcode='"
                + igroupcode
                + "' "
                + "order by description";
        break;
    }

    Listbox newlb = lbhand.makeVWListbox(tests_holder, whichheader, tests_lbid, 15);

    Sql sql = sqlhand.als_mysoftsql();
    if (sql == null) return;
    List<GroovyRowResult> tlist = sql.rows(sqlstm);
    sql.close();

    String lor, bill, units;

    if (tlist.size() == 0) return;
    if (testOnClicker != null) newlb.addEventListener("onSelect", testOnClicker);

    for (GroovyRowResult ilist : tlist) {
      ArrayList kabom = new ArrayList();

      switch (showType) {
        case 1:
          kabom.add(String.valueOf(ilist.get("id")));
          kabom.add(kiboo.checkNullString((String) ilist.get("description")));
          kabom.add(kiboo.checkNullString((String) ilist.get("description2")));
          break;

        case 2:
          kabom.add(ilist.get("id").toString());
          kabom.add(kiboo.checkNullString((String) ilist.get("stock_code")));

          kabom.add(
              lbhand.trimListitemLabel(
                  kiboo.checkNullString((String) ilist.get("description")), 35));
          kabom.add(
              lbhand.trimListitemLabel(
                  kiboo.checkNullString((String) ilist.get("description2")), 35));

          costprice = nf.format((Double) ilist.get("cost_price"));
          kabom.add(costprice);

          sellingprice = nf.format((Double) ilist.get("selling_price"));
          kabom.add(sellingprice);
          kabom.add(kiboo.checkNullString((String) ilist.get("newfield4")));
          break;

        case 3:
          kabom.add(ilist.get("id").toString());
          kabom.add(kiboo.checkNullString((String) ilist.get("stock_code")));
          kabom.add(kiboo.checkNullString_RetWat((String) ilist.get("description"), "---"));
          // methodme = trimListitemLabel(ilist.get("description2"), 30);
          kabom.add(kiboo.checkNullString_RetWat((String) ilist.get("description2"), "---"));

          kabom.add(nf.format(ilist.get("selling_price")));

          lor = kiboo.checkNullString((String) ilist.get("newfield8"));
          bill = kiboo.checkNullString((String) ilist.get("newfield9"));
          units = kiboo.checkNullString((String) ilist.get("newfield10"));

          lor = (lor.equals("")) ? "----" : lor;
          bill = (bill.equals("")) ? "---" : bill;
          units = (units.equals("")) ? "----" : units;

          kabom.add(lor);
          kabom.add(bill);
          kabom.add(units);
          break;
      }

      String[] strarray = kiboo.convertArrayListToStringArray(kabom);
      lbhand.insertListItems(newlb, strarray, "true", "");
    }

    if (testOnDoubleClicker != null) lbhand.setDoubleClick_ListItems(newlb, testOnDoubleClicker);
  } // end of populateTestParametersColumn()