package org.compiere.apps.search: fix db connection
This commit is contained in:
parent
5126b0bf02
commit
3178d74907
|
|
@ -1038,9 +1038,11 @@ public final class Find extends CDialog
|
||||||
String retString = " M_Product_Category_ID IN (";
|
String retString = " M_Product_Category_ID IN (";
|
||||||
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
|
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
|
||||||
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
|
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
|
||||||
|
Statement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
Statement stmt = DB.createStatement();
|
stmt = DB.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
rs = stmt.executeQuery(sql);
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
if(rs.getInt(1)==productCategoryId) {
|
if(rs.getInt(1)==productCategoryId) {
|
||||||
subTreeRootParentId = rs.getInt(2);
|
subTreeRootParentId = rs.getInt(2);
|
||||||
|
|
@ -1049,8 +1051,6 @@ public final class Find extends CDialog
|
||||||
}
|
}
|
||||||
retString += getSubCategoriesString(productCategoryId, categories, subTreeRootParentId);
|
retString += getSubCategoriesString(productCategoryId, categories, subTreeRootParentId);
|
||||||
retString += ") ";
|
retString += ") ";
|
||||||
rs.close();
|
|
||||||
stmt.close();
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
retString = "";
|
retString = "";
|
||||||
|
|
@ -1058,6 +1058,10 @@ public final class Find extends CDialog
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
retString = "";
|
retString = "";
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, stmt);
|
||||||
|
rs = null; stmt = null;
|
||||||
|
}
|
||||||
return retString;
|
return retString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1318,19 +1322,23 @@ public final class Find extends CDialog
|
||||||
|
|
||||||
// Execute Qusery
|
// Execute Qusery
|
||||||
m_total = 999999;
|
m_total = 999999;
|
||||||
|
Statement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Statement stmt = DB.createStatement();
|
stmt = DB.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(finalSQL);
|
rs = stmt.executeQuery(finalSQL);
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
m_total = rs.getInt(1);
|
m_total = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
stmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, finalSQL, e);
|
log.log(Level.SEVERE, finalSQL, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, stmt);
|
||||||
|
rs = null; stmt = null;
|
||||||
|
}
|
||||||
MRole role = MRole.getDefault();
|
MRole role = MRole.getDefault();
|
||||||
// No Records
|
// No Records
|
||||||
if (m_total == 0 && alertZeroRecords)
|
if (m_total == 0 && alertZeroRecords)
|
||||||
|
|
|
||||||
|
|
@ -204,11 +204,13 @@ public class InfoGeneral extends Info
|
||||||
+ "ORDER BY c.IsIdentifier DESC, c.SeqNo";
|
+ "ORDER BY c.IsIdentifier DESC, c.SeqNo";
|
||||||
int AD_Table_ID = 0;
|
int AD_Table_ID = 0;
|
||||||
String tableName = null;
|
String tableName = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString(1, p_tableName);
|
pstmt.setString(1, p_tableName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
m_queryColumns.add(rs.getString(1));
|
m_queryColumns.add(rs.getString(1));
|
||||||
|
|
@ -232,6 +234,10 @@ public class InfoGeneral extends Info
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
// Miminum check
|
// Miminum check
|
||||||
if (m_queryColumns.size() == 0)
|
if (m_queryColumns.size() == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -267,9 +273,9 @@ public class InfoGeneral extends Info
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Table_ID);
|
pstmt.setInt(1, AD_Table_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
String columnName = rs.getString(1);
|
String columnName = rs.getString(1);
|
||||||
|
|
@ -330,14 +336,16 @@ public class InfoGeneral extends Info
|
||||||
else
|
else
|
||||||
log.finest("Not Added Column=" + columnName);
|
log.finest("Not Added Column=" + columnName);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (list.size() == 0)
|
if (list.size() == 0)
|
||||||
{
|
{
|
||||||
ADialog.error(p_WindowNo, this, "Error", "No Info Columns");
|
ADialog.error(p_WindowNo, this, "Error", "No Info Columns");
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,7 @@ public class InfoPAttribute extends CDialog
|
||||||
{
|
{
|
||||||
int row = 0;
|
int row = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
String sql = MRole.getDefault().addAccessSQL(
|
String sql = MRole.getDefault().addAccessSQL(
|
||||||
"SELECT M_Attribute_ID, Name, Description, AttributeValueType, IsInstanceAttribute "
|
"SELECT M_Attribute_ID, Name, Description, AttributeValueType, IsInstanceAttribute "
|
||||||
+ "FROM M_Attribute "
|
+ "FROM M_Attribute "
|
||||||
|
|
@ -143,7 +144,7 @@ public class InfoPAttribute extends CDialog
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
boolean instanceLine = false;
|
boolean instanceLine = false;
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
|
@ -195,23 +196,14 @@ public class InfoPAttribute extends CDialog
|
||||||
else
|
else
|
||||||
m_productEditorsTo.add(fieldTo);
|
m_productEditorsTo.add(fieldTo);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally {
|
||||||
{
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null)
|
rs = null; pstmt = null;
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
} // addProductAttributes
|
} // addProductAttributes
|
||||||
|
|
@ -227,6 +219,7 @@ public class InfoPAttribute extends CDialog
|
||||||
list.add(new KeyNamePair(-1, ""));
|
list.add(new KeyNamePair(-1, ""));
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
String sql = MRole.getDefault().addAccessSQL(
|
String sql = MRole.getDefault().addAccessSQL(
|
||||||
"SELECT M_AttributeValue_ID, Value, Name "
|
"SELECT M_AttributeValue_ID, Value, Name "
|
||||||
+ "FROM M_AttributeValue "
|
+ "FROM M_AttributeValue "
|
||||||
|
|
@ -237,26 +230,17 @@ public class InfoPAttribute extends CDialog
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, M_Attribute_ID);
|
pstmt.setInt(1, M_Attribute_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new KeyNamePair(rs.getInt(1), rs.getString(3)));
|
list.add(new KeyNamePair(rs.getInt(1), rs.getString(3)));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally {
|
||||||
{
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null)
|
rs = null; pstmt = null;
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
KeyNamePair[] retValue = new KeyNamePair[list.size()];
|
KeyNamePair[] retValue = new KeyNamePair[list.size()];
|
||||||
list.toArray(retValue);
|
list.toArray(retValue);
|
||||||
|
|
@ -276,29 +260,21 @@ public class InfoPAttribute extends CDialog
|
||||||
"SELECT M_Lot_ID, Name FROM M_Lot WHERE IsActive='Y' ORDER BY 2",
|
"SELECT M_Lot_ID, Name FROM M_Lot WHERE IsActive='Y' ORDER BY 2",
|
||||||
"M_Lot", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
"M_Lot", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));
|
list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally {
|
||||||
{
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null)
|
rs = null; pstmt = null;
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
// Create List
|
// Create List
|
||||||
KeyNamePair[] items = new KeyNamePair[list.size()];
|
KeyNamePair[] items = new KeyNamePair[list.size()];
|
||||||
|
|
|
||||||
|
|
@ -196,20 +196,7 @@ public class InfoSchedule extends CDialog
|
||||||
if (m_mAssignment.getS_Resource_ID() != 0)
|
if (m_mAssignment.getS_Resource_ID() != 0)
|
||||||
{
|
{
|
||||||
String sql = "SELECT S_ResourceType_ID FROM S_Resource WHERE S_Resource_ID=?";
|
String sql = "SELECT S_ResourceType_ID FROM S_Resource WHERE S_Resource_ID=?";
|
||||||
try
|
S_ResourceType_ID = DB.getSQLValue(null, sql, m_mAssignment.getS_Resource_ID());
|
||||||
{
|
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
|
||||||
pstmt.setInt(1, m_mAssignment.getS_Resource_ID());
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
if (rs.next())
|
|
||||||
S_ResourceType_ID = rs.getInt(1);
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, sql, e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get Resource Types
|
// Get Resource Types
|
||||||
|
|
@ -217,10 +204,12 @@ public class InfoSchedule extends CDialog
|
||||||
"SELECT S_ResourceType_ID, Name FROM S_ResourceType WHERE IsActive='Y' ORDER BY 2",
|
"SELECT S_ResourceType_ID, Name FROM S_ResourceType WHERE IsActive='Y' ORDER BY 2",
|
||||||
"S_ResourceType", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
"S_ResourceType", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||||
KeyNamePair defaultValue = null;
|
KeyNamePair defaultValue = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||||
|
|
@ -228,13 +217,15 @@ public class InfoSchedule extends CDialog
|
||||||
defaultValue = pp;
|
defaultValue = pp;
|
||||||
fieldResourceType.addItem(pp);
|
fieldResourceType.addItem(pp);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (defaultValue != null)
|
if (defaultValue != null)
|
||||||
fieldResourceType.setSelectedItem(defaultValue);
|
fieldResourceType.setSelectedItem(defaultValue);
|
||||||
} // fillResourceType
|
} // fillResourceType
|
||||||
|
|
@ -256,11 +247,13 @@ public class InfoSchedule extends CDialog
|
||||||
m_loading = true;
|
m_loading = true;
|
||||||
fieldResource.removeAllItems();
|
fieldResource.removeAllItems();
|
||||||
String sql = "SELECT S_Resource_ID, Name FROM S_Resource WHERE S_ResourceType_ID=? ORDER BY 2";
|
String sql = "SELECT S_Resource_ID, Name FROM S_Resource WHERE S_ResourceType_ID=? ORDER BY 2";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, S_ResourceType_ID);
|
pstmt.setInt(1, S_ResourceType_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||||
|
|
@ -268,13 +261,15 @@ public class InfoSchedule extends CDialog
|
||||||
defaultValue = pp;
|
defaultValue = pp;
|
||||||
fieldResource.addItem(pp);
|
fieldResource.addItem(pp);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (defaultValue != null)
|
if (defaultValue != null)
|
||||||
fieldResource.setSelectedItem(defaultValue);
|
fieldResource.setSelectedItem(defaultValue);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -236,11 +236,13 @@ public class InvoiceHistory extends CDialog
|
||||||
{
|
{
|
||||||
log.fine(sql + "; Parameter=" + parameter);
|
log.fine(sql + "; Parameter=" + parameter);
|
||||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, parameter);
|
pstmt.setInt(1, parameter);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Vector<Object> line = new Vector<Object>(6);
|
Vector<Object> line = new Vector<Object>(6);
|
||||||
|
|
@ -264,13 +266,15 @@ public class InvoiceHistory extends CDialog
|
||||||
line.add(rs.getString(7)); // Org/Warehouse
|
line.add(rs.getString(7)); // Org/Warehouse
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
log.fine("#" + data.size());
|
log.fine("#" + data.size());
|
||||||
return data;
|
return data;
|
||||||
} // fillTable
|
} // fillTable
|
||||||
|
|
@ -282,20 +286,9 @@ public class InvoiceHistory extends CDialog
|
||||||
private void fillLabel (String sql, int parameter)
|
private void fillLabel (String sql, int parameter)
|
||||||
{
|
{
|
||||||
log.fine(sql + "; Parameter=" + parameter);
|
log.fine(sql + "; Parameter=" + parameter);
|
||||||
try
|
String retValue = DB.getSQLValueString(null, sql, parameter);
|
||||||
{
|
if (retValue != null)
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
label.setText(retValue);
|
||||||
pstmt.setInt(1, parameter);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
if (rs.next())
|
|
||||||
label.setText(rs.getString(1));
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, sql, e);
|
|
||||||
}
|
|
||||||
} // fillLabel
|
} // fillLabel
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -467,11 +460,13 @@ public class InvoiceHistory extends CDialog
|
||||||
parameter = m_C_BPartner_ID;
|
parameter = m_C_BPartner_ID;
|
||||||
}
|
}
|
||||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, parameter);
|
pstmt.setInt(1, parameter);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Vector<Object> line = new Vector<Object>(6);
|
Vector<Object> line = new Vector<Object>(6);
|
||||||
|
|
@ -484,13 +479,15 @@ public class InvoiceHistory extends CDialog
|
||||||
line.add(rs.getString(6)); // Warehouse
|
line.add(rs.getString(6)); // Warehouse
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
log.fine("#" + data.size());
|
log.fine("#" + data.size());
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
|
|
@ -551,15 +548,17 @@ public class InvoiceHistory extends CDialog
|
||||||
|
|
||||||
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
Vector<Vector<Object>> data = new Vector<Vector<Object>>();
|
||||||
double qty = 0;
|
double qty = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
if (m_M_Warehouse_ID != 0)
|
if (m_M_Warehouse_ID != 0)
|
||||||
pstmt.setInt(2, m_M_Warehouse_ID);
|
pstmt.setInt(2, m_M_Warehouse_ID);
|
||||||
if (m_M_AttributeSetInstance_ID > 0)
|
if (m_M_AttributeSetInstance_ID > 0)
|
||||||
pstmt.setInt(3, m_M_AttributeSetInstance_ID);
|
pstmt.setInt(3, m_M_AttributeSetInstance_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Vector<Object> line = new Vector<Object>(9);
|
Vector<Object> line = new Vector<Object>(9);
|
||||||
|
|
@ -579,13 +578,15 @@ public class InvoiceHistory extends CDialog
|
||||||
line.add(rs.getString(6)); // Warehouse
|
line.add(rs.getString(6)); // Warehouse
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Orders
|
// Orders
|
||||||
sql = "SELECT o.DatePromised, ol.QtyReserved,"
|
sql = "SELECT o.DatePromised, ol.QtyReserved,"
|
||||||
|
|
@ -606,13 +607,13 @@ public class InvoiceHistory extends CDialog
|
||||||
sql += " ORDER BY o.DatePromised";
|
sql += " ORDER BY o.DatePromised";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
if (m_M_Warehouse_ID != 0)
|
if (m_M_Warehouse_ID != 0)
|
||||||
pstmt.setInt(2, m_M_Warehouse_ID);
|
pstmt.setInt(2, m_M_Warehouse_ID);
|
||||||
if (m_M_AttributeSetInstance_ID > 0)
|
if (m_M_AttributeSetInstance_ID > 0)
|
||||||
pstmt.setInt(3, m_M_AttributeSetInstance_ID);
|
pstmt.setInt(3, m_M_AttributeSetInstance_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Vector<Object> line = new Vector<Object>(9);
|
Vector<Object> line = new Vector<Object>(9);
|
||||||
|
|
@ -644,13 +645,15 @@ public class InvoiceHistory extends CDialog
|
||||||
line.add(rs.getString(8)); // Warehouse
|
line.add(rs.getString(8)); // Warehouse
|
||||||
data.add(line);
|
data.add(line);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Table
|
// Table
|
||||||
MiniTable table = null;
|
MiniTable table = null;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue