}
private PreparedStatement buildSQLr() {
PreparedStatement result;
JDBQuery query = new JDBQuery(Common.selectedHostID, Common.sessionID);
query.clear();
query.addText(JUtility.substSchemaName(schemaName, "select * from {schema}APP_MATERIAL"));
query.addParamtoSQL("material=", jTextFieldMaterial.getText());
query.addParamtoSQL("inspection_id=", textFieldInspectionID.getText());
if (jTextFieldDescription.getText().equals("") == false)
{
query.addParamtoSQL("upper(description) LIKE ", "%" + jTextFieldDescription.getText().toUpperCase() + "%");
}
query.addParamtoSQL("base_uom=", ((JDBUom) jComboBoxBaseUOM.getSelectedItem()).getInternalUom());
query.addParamtoSQL("material_type=", ((JDBMaterialType) jComboBoxMaterialType.getSelectedItem()).getType());
query.addParamtoSQL("shelf_life_uom=", ((JShelfLifeUom) jComboBoxShelfLifeUOM.getSelectedItem()).getUom());
query.addParamtoSQL("shelf_life_rule=", ((JShelfLifeRoundingRule) jComboBoxRoundingRule.getSelectedItem()).getRule());
query.addParamtoSQL("default_batch_status=", ((String) jComboBoxDefaultBatchStatus.getSelectedItem()).toString());
Integer i;
try
{
i = Integer.valueOf(jTextFieldShelfLife.getText());
query.addParamtoSQL("shelf_life=", i);
}
catch (Exception e)
{
}
query.appendSort(jComboBoxSortBy.getSelectedItem().toString(), jToggleButtonSequence.isSelected());
query.applyRestriction(false, "none", 0);
query.bindParams();
result = query.getPreparedStatement();
return result;
}