org.compiere.acct: fix db connection
This commit is contained in:
parent
a0884d2c93
commit
5542d14a95
|
@ -1469,9 +1469,11 @@ public abstract class Doc
|
||||||
|
|
||||||
// Get Acct
|
// Get Acct
|
||||||
int Account_ID = 0;
|
int Account_ID = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
if (para_1 == -1) // GL Accounts
|
if (para_1 == -1) // GL Accounts
|
||||||
pstmt.setInt (1, as.getC_AcctSchema_ID());
|
pstmt.setInt (1, as.getC_AcctSchema_ID());
|
||||||
else
|
else
|
||||||
|
@ -1479,17 +1481,19 @@ public abstract class Doc
|
||||||
pstmt.setInt (1, para_1);
|
pstmt.setInt (1, para_1);
|
||||||
pstmt.setInt (2, as.getC_AcctSchema_ID());
|
pstmt.setInt (2, as.getC_AcctSchema_ID());
|
||||||
}
|
}
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
Account_ID = rs.getInt(1);
|
Account_ID = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "AcctType=" + AcctType + " - SQL=" + sql, e);
|
log.log(Level.SEVERE, "AcctType=" + AcctType + " - SQL=" + sql, e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
// No account
|
// No account
|
||||||
if (Account_ID == 0)
|
if (Account_ID == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -710,34 +710,26 @@ public class Doc_Allocation extends Doc
|
||||||
+ " AND PostingType='A'";
|
+ " AND PostingType='A'";
|
||||||
//AND C_Currency_ID=102
|
//AND C_Currency_ID=102
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, getTrxName());
|
pstmt = DB.prepareStatement(sql, getTrxName());
|
||||||
pstmt.setInt(1, invoice.getC_Invoice_ID());
|
pstmt.setInt(1, invoice.getC_Invoice_ID());
|
||||||
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
invoiceSource = rs.getBigDecimal(1);
|
invoiceSource = rs.getBigDecimal(1);
|
||||||
invoiceAccounted = rs.getBigDecimal(2);
|
invoiceAccounted = rs.getBigDecimal(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;
|
|
||||||
}
|
}
|
||||||
// Requires that Invoice is Posted
|
// Requires that Invoice is Posted
|
||||||
if (invoiceSource == null || invoiceAccounted == null)
|
if (invoiceSource == null || invoiceAccounted == null)
|
||||||
|
@ -859,31 +851,23 @@ public class Doc_Allocation extends Doc
|
||||||
+ " AND C_AcctSchema_ID=?"
|
+ " AND C_AcctSchema_ID=?"
|
||||||
+ " AND Line_ID IS NULL"; // header lines like tax or total
|
+ " AND Line_ID IS NULL"; // header lines like tax or total
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, getTrxName());
|
pstmt = DB.prepareStatement(sql, getTrxName());
|
||||||
pstmt.setInt(1, line.getC_Invoice_ID());
|
pstmt.setInt(1, line.getC_Invoice_ID());
|
||||||
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
tax.addInvoiceFact (new MFactAcct(getCtx(), rs, fact.get_TrxName()));
|
tax.addInvoiceFact (new MFactAcct(getCtx(), rs, fact.get_TrxName()));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
// Invoice Not posted
|
// Invoice Not posted
|
||||||
if (tax.getLineCount() == 0)
|
if (tax.getLineCount() == 0)
|
||||||
|
|
|
@ -85,11 +85,13 @@ public class Doc_Invoice extends Doc
|
||||||
String sql = "SELECT it.C_Tax_ID, t.Name, t.Rate, it.TaxBaseAmt, it.TaxAmt, t.IsSalesTax "
|
String sql = "SELECT it.C_Tax_ID, t.Name, t.Rate, it.TaxBaseAmt, it.TaxAmt, t.IsSalesTax "
|
||||||
+ "FROM C_Tax t, C_InvoiceTax it "
|
+ "FROM C_Tax t, C_InvoiceTax it "
|
||||||
+ "WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Invoice_ID=?";
|
+ "WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Invoice_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, getTrxName());
|
pstmt = DB.prepareStatement(sql, getTrxName());
|
||||||
pstmt.setInt(1, get_ID());
|
pstmt.setInt(1, get_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
//
|
//
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -105,15 +107,16 @@ public class Doc_Invoice extends Doc
|
||||||
log.fine(taxLine.toString());
|
log.fine(taxLine.toString());
|
||||||
list.add(taxLine);
|
list.add(taxLine);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Return Array
|
// Return Array
|
||||||
DocTax[] tl = new DocTax[list.size()];
|
DocTax[] tl = new DocTax[list.size()];
|
||||||
|
|
|
@ -237,11 +237,13 @@ public class Doc_Order extends Doc
|
||||||
String sql = "SELECT it.C_Tax_ID, t.Name, t.Rate, it.TaxBaseAmt, it.TaxAmt, t.IsSalesTax "
|
String sql = "SELECT it.C_Tax_ID, t.Name, t.Rate, it.TaxBaseAmt, it.TaxAmt, t.IsSalesTax "
|
||||||
+ "FROM C_Tax t, C_OrderTax it "
|
+ "FROM C_Tax t, C_OrderTax it "
|
||||||
+ "WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Order_ID=?";
|
+ "WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Order_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, getTrxName());
|
pstmt = DB.prepareStatement(sql, getTrxName());
|
||||||
pstmt.setInt(1, get_ID());
|
pstmt.setInt(1, get_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
//
|
//
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -256,14 +258,15 @@ public class Doc_Order extends Doc
|
||||||
taxBaseAmt, amount, salesTax);
|
taxBaseAmt, amount, salesTax);
|
||||||
list.add(taxLine);
|
list.add(taxLine);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
// Return Array
|
// Return Array
|
||||||
DocTax[] tl = new DocTax[list.size()];
|
DocTax[] tl = new DocTax[list.size()];
|
||||||
|
|
|
@ -228,9 +228,6 @@ public class Doc_ProjectIssue extends Doc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log.warning("Not found for S_TimeExpenseLine_ID=" + m_issue.getS_TimeExpenseLine_ID());
|
log.warning("Not found for S_TimeExpenseLine_ID=" + m_issue.getS_TimeExpenseLine_ID());
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -446,21 +446,25 @@ public final class FactLine extends X_Fact_Acct
|
||||||
int C_Location_ID = 0;
|
int C_Location_ID = 0;
|
||||||
String sql = "SELECT w.C_Location_ID FROM M_Warehouse w, M_Locator l "
|
String sql = "SELECT w.C_Location_ID FROM M_Warehouse w, M_Locator l "
|
||||||
+ "WHERE w.M_Warehouse_ID=l.M_Warehouse_ID AND l.M_Locator_ID=?";
|
+ "WHERE w.M_Warehouse_ID=l.M_Warehouse_ID AND l.M_Locator_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, M_Locator_ID);
|
pstmt.setInt(1, M_Locator_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
C_Location_ID = rs.getInt(1);
|
C_Location_ID = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (C_Location_ID != 0)
|
if (C_Location_ID != 0)
|
||||||
setLocation (C_Location_ID, isFrom);
|
setLocation (C_Location_ID, isFrom);
|
||||||
} // setLocationFromLocator
|
} // setLocationFromLocator
|
||||||
|
@ -476,21 +480,25 @@ public final class FactLine extends X_Fact_Acct
|
||||||
return;
|
return;
|
||||||
int C_Location_ID = 0;
|
int C_Location_ID = 0;
|
||||||
String sql = "SELECT C_Location_ID FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?";
|
String sql = "SELECT C_Location_ID FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, C_BPartner_Location_ID);
|
pstmt.setInt(1, C_BPartner_Location_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
C_Location_ID = rs.getInt(1);
|
C_Location_ID = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (C_Location_ID != 0)
|
if (C_Location_ID != 0)
|
||||||
setLocation (C_Location_ID, isFrom);
|
setLocation (C_Location_ID, isFrom);
|
||||||
} // setLocationFromBPartner
|
} // setLocationFromBPartner
|
||||||
|
@ -506,21 +514,25 @@ public final class FactLine extends X_Fact_Acct
|
||||||
return;
|
return;
|
||||||
int C_Location_ID = 0;
|
int C_Location_ID = 0;
|
||||||
String sql = "SELECT C_Location_ID FROM AD_OrgInfo WHERE AD_Org_ID=?";
|
String sql = "SELECT C_Location_ID FROM AD_OrgInfo WHERE AD_Org_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, AD_Org_ID);
|
pstmt.setInt(1, AD_Org_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
C_Location_ID = rs.getInt(1);
|
C_Location_ID = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (C_Location_ID != 0)
|
if (C_Location_ID != 0)
|
||||||
setLocation (C_Location_ID, isFrom);
|
setLocation (C_Location_ID, isFrom);
|
||||||
} // setLocationFromOrg
|
} // setLocationFromOrg
|
||||||
|
@ -691,12 +703,14 @@ public final class FactLine extends X_Fact_Acct
|
||||||
if (getM_Locator_ID() != 0)
|
if (getM_Locator_ID() != 0)
|
||||||
{
|
{
|
||||||
String sql = "SELECT AD_Org_ID FROM M_Locator WHERE M_Locator_ID=? AND AD_Client_ID=?";
|
String sql = "SELECT AD_Org_ID FROM M_Locator WHERE M_Locator_ID=? AND AD_Client_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getM_Locator_ID());
|
pstmt.setInt(1, getM_Locator_ID());
|
||||||
pstmt.setInt(2, getAD_Client_ID());
|
pstmt.setInt(2, getAD_Client_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
setAD_Org_ID (rs.getInt(1));
|
setAD_Org_ID (rs.getInt(1));
|
||||||
|
@ -704,13 +718,15 @@ public final class FactLine extends X_Fact_Acct
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log.log(Level.SEVERE, "AD_Org_ID - Did not find M_Locator_ID=" + getM_Locator_ID());
|
log.log(Level.SEVERE, "AD_Org_ID - Did not find M_Locator_ID=" + getM_Locator_ID());
|
||||||
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;
|
||||||
|
}
|
||||||
} // M_Locator_ID != 0
|
} // M_Locator_ID != 0
|
||||||
|
|
||||||
// Prio 2 - get from doc line - if exists (document context overwrites)
|
// Prio 2 - get from doc line - if exists (document context overwrites)
|
||||||
|
@ -930,24 +946,28 @@ public final class FactLine extends X_Fact_Acct
|
||||||
+ "WHERE ga.C_BP_Group_ID=p.C_BP_Group_ID"
|
+ "WHERE ga.C_BP_Group_ID=p.C_BP_Group_ID"
|
||||||
+ " AND ga.UnearnedRevenue_Acct=vc.C_ValidCombination_ID"
|
+ " AND ga.UnearnedRevenue_Acct=vc.C_ValidCombination_ID"
|
||||||
+ " AND ga.C_AcctSchema_ID=? AND p.C_BPartner_ID=?";
|
+ " AND ga.C_AcctSchema_ID=? AND p.C_BPartner_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getC_AcctSchema_ID());
|
pstmt.setInt(1, getC_AcctSchema_ID());
|
||||||
pstmt.setInt(2, C_BPartner_ID);
|
pstmt.setInt(2, C_BPartner_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
UnearnedRevenue_Acct = rs.getInt(1);
|
UnearnedRevenue_Acct = rs.getInt(1);
|
||||||
new_Account_ID = rs.getInt(2);
|
new_Account_ID = rs.getInt(2);
|
||||||
}
|
}
|
||||||
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 (new_Account_ID == 0)
|
if (new_Account_ID == 0)
|
||||||
{
|
{
|
||||||
log.severe ("UnearnedRevenue_Acct not found");
|
log.severe ("UnearnedRevenue_Acct not found");
|
||||||
|
@ -992,15 +1012,17 @@ public final class FactLine extends X_Fact_Acct
|
||||||
+ "FROM Fact_Acct "
|
+ "FROM Fact_Acct "
|
||||||
+ "WHERE C_AcctSchema_ID=? AND AD_Table_ID=? AND Record_ID=?"
|
+ "WHERE C_AcctSchema_ID=? AND AD_Table_ID=? AND Record_ID=?"
|
||||||
+ " AND Line_ID=? AND Account_ID=?";
|
+ " AND Line_ID=? AND Account_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getC_AcctSchema_ID());
|
pstmt.setInt(1, getC_AcctSchema_ID());
|
||||||
pstmt.setInt(2, AD_Table_ID);
|
pstmt.setInt(2, AD_Table_ID);
|
||||||
pstmt.setInt(3, Record_ID);
|
pstmt.setInt(3, Record_ID);
|
||||||
pstmt.setInt(4, Line_ID);
|
pstmt.setInt(4, Line_ID);
|
||||||
pstmt.setInt(5, m_acct.getAccount_ID());
|
pstmt.setInt(5, m_acct.getAccount_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
MFactAcct fact = new MFactAcct(getCtx(), rs, get_TrxName());
|
MFactAcct fact = new MFactAcct(getCtx(), rs, get_TrxName());
|
||||||
|
@ -1046,13 +1068,15 @@ public final class FactLine extends X_Fact_Acct
|
||||||
.append(",Record_ID=").append(Record_ID)
|
.append(",Record_ID=").append(Record_ID)
|
||||||
.append(",Line_ID=").append(Line_ID)
|
.append(",Line_ID=").append(Line_ID)
|
||||||
.append(", Account_ID=").append(m_acct.getAccount_ID()).toString());
|
.append(", Account_ID=").append(m_acct.getAccount_ID()).toString());
|
||||||
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;
|
||||||
|
}
|
||||||
return success;
|
return success;
|
||||||
} // updateReverseLine
|
} // updateReverseLine
|
||||||
|
|
||||||
|
|
|
@ -86,11 +86,13 @@ public class Matcher
|
||||||
// Not existing Inv Matches
|
// Not existing Inv Matches
|
||||||
+ " AND NOT EXISTS (SELECT * FROM M_MatchInv mi "
|
+ " AND NOT EXISTS (SELECT * FROM M_MatchInv mi "
|
||||||
+ "WHERE mi.C_InvoiceLine_ID=m1.C_InvoiceLine_ID AND mi.M_InOutLine_ID=m2.M_InOutLine_ID)";
|
+ "WHERE mi.C_InvoiceLine_ID=m1.C_InvoiceLine_ID AND mi.M_InOutLine_ID=m2.M_InOutLine_ID)";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_AD_Client_ID);
|
pstmt.setInt(1, m_AD_Client_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
BigDecimal qty1 = rs.getBigDecimal(8);
|
BigDecimal qty1 = rs.getBigDecimal(8);
|
||||||
|
@ -115,13 +117,15 @@ public class Matcher
|
||||||
M_Product_ID, DateTrx, Qty))
|
M_Product_ID, DateTrx, Qty))
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "match", e);
|
log.log(Level.SEVERE, "match", e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
log.fine("Matcher.match - Client_ID=" + m_AD_Client_ID
|
log.fine("Matcher.match - Client_ID=" + m_AD_Client_ID
|
||||||
+ ", Records created=" + counter);
|
+ ", Records created=" + counter);
|
||||||
return counter;
|
return counter;
|
||||||
|
|
Loading…
Reference in New Issue