* [ 2319233 ] Hardcoded Compiere schema name in some FA classes

* Change to use model class instead of sql insert
This commit is contained in:
Heng Sin Low 2008-11-21 04:18:25 +00:00
parent 57d003181c
commit 4f9898a90b
6 changed files with 139 additions and 172 deletions

View File

@ -111,7 +111,7 @@ public class BuildDepForecastFile extends SvrProcess
+" A_DEPRECIATION_FORECAST.AD_CLIENT_ID, A_DEPRECIATION_FORECAST.AD_ORG_ID, A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE,"
+" A_DEPRECIATION_FORECAST.CREATEDBY, A_DEPRECIATION_FORECAST.UPDATEDBY, A_DEPRECIATION_FORECAST.POSTINGTYPE as v_PostingType,"
+" A_DEPRECIATION_WORKFILE.A_DEPRECIATION_WORKFILE_ID, A_DEPRECIATION_FORECAST.DATEDOC, A_DEPRECIATION_WORKFILE.A_ASSET_COST"
+" FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET, COMPIERE.A_DEPRECIATION_FORECAST "
+" FROM A_DEPRECIATION_WORKFILE, A_ASSET, A_DEPRECIATION_FORECAST "
+" WHERE A_ASSET.A_ASSET_ID = A_DEPRECIATION_WORKFILE.A_ASSET_ID AND A_ASSET.ISOWNED = 'Y' AND A_DEPRECIATION_FORECAST.A_START_ASSET_ID <= A_ASSET.A_ASSET_ID"
+" AND A_DEPRECIATION_FORECAST.A_END_ASSET_ID >= A_ASSET.A_ASSET_ID AND A_ASSET.ISFULLYDEPRECIATED = 'N' AND A_ASSET.ISDEPRECIATED = 'Y'"
+" AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = ? ";

View File

@ -21,6 +21,7 @@ import java.util.Calendar;
import java.util.GregorianCalendar;
import org.compiere.model.X_A_Depreciation;
import org.compiere.model.X_A_Depreciation_Build;
import org.compiere.model.X_A_Depreciation_Convention;
import org.compiere.model.X_A_Depreciation_Exp;
import org.compiere.model.X_A_Depreciation_Forecast;
@ -87,7 +88,7 @@ public class BuildDepWorkFile extends SvrProcess
//}
X_A_Depreciation_Forecast DepBuild = new X_A_Depreciation_Forecast (getCtx(), p_Depreciation_Build_ID, null);
X_A_Depreciation_Build DepBuild = new X_A_Depreciation_Build (getCtx(), p_Depreciation_Build_ID, null);
String sql = null;
sql = "DELETE FROM A_DEPRECIATION_EXP WHERE PostingType"
+ " = '" + DepBuild.getPostingType() + "' and A_Asset_ID"
@ -119,7 +120,7 @@ public class BuildDepWorkFile extends SvrProcess
+ " A_DEPRECIATION_BUILD.CREATEDBY, A_DEPRECIATION_BUILD.UPDATEDBY, A_DEPRECIATION_BUILD.POSTINGTYPE as v_PostingType, "
+ " A_DEPRECIATION_BUILD.DATEACCT, A_DEPRECIATION_BUILD.C_PERIOD_ID, A_DEPRECIATION_WORKFILE.A_DEPRECIATION_WORKFILE_ID, "
+ " A_DEPRECIATION_BUILD.DATEDOC "
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET, COMPIERE.A_DEPRECIATION_BUILD "
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET, A_DEPRECIATION_BUILD "
+ " WHERE A_ASSET.A_ASSET_ID = A_DEPRECIATION_WORKFILE.A_ASSET_ID AND A_ASSET.ISOWNED = 'Y' AND "
+ " A_DEPRECIATION_BUILD.DATEACCT >= A_ASSET.ASSETSERVICEDATE AND A_DEPRECIATION_BUILD.A_START_ASSET_ID <= A_ASSET.A_ASSET_ID "
+ " AND A_DEPRECIATION_BUILD.A_END_ASSET_ID >= A_ASSET.A_ASSET_ID AND A_ASSET.ISFULLYDEPRECIATED = 'N' AND A_ASSET.ISDEPRECIATED = 'Y' "

View File

@ -70,7 +70,7 @@ public class Conventions {
StringBuffer sqlB = new StringBuffer ("SELECT A_ASSET.ASSETSERVICEDATE, A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET"
+ " WHERE A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
@ -126,7 +126,7 @@ public class Conventions {
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET"
+ " WHERE A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
@ -188,7 +188,7 @@ public class Conventions {
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET"
+ " WHERE A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
@ -266,7 +266,7 @@ public class Conventions {
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET"
+ " WHERE A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
@ -327,7 +327,7 @@ public class Conventions {
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET"
+ " WHERE A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");

View File

@ -113,7 +113,7 @@ public class Depreciation {
StringBuffer sqlB = new StringBuffer ("SELECT A.A_ASSET_COST, A.A_SALVAGE_VALUE, A.A_LIFE_PERIOD, A.A_ASSET_LIFE_YEARS, A.DATEACCT,"
+ " D.ASSETSERVICEDATE, C.CONVENTIONTYPE "
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE A, COMPIERE.A_ASSET_ACCT B,COMPIERE.A_ASSET D,COMPIERE.A_DEPRECIATION_CONVENTION C "
+ " FROM A_DEPRECIATION_WORKFILE A, A_ASSET_ACCT B,A_ASSET D,A_DEPRECIATION_CONVENTION C "
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND B.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_PERIOD_POSTED+1 >= A_PERIOD_START AND A_PERIOD_POSTED+1 <= A_PERIOD_END "
@ -247,7 +247,7 @@ public class Depreciation {
StringBuffer sqlB = new StringBuffer ("SELECT A.A_ASSET_COST, A.A_SALVAGE_VALUE, A.A_LIFE_PERIOD, A.A_ASSET_LIFE_YEARS, A.DATEACCT,"
+ " D.ASSETSERVICEDATE, C.CONVENTIONTYPE "
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE A, COMPIERE.A_ASSET_ACCT B,COMPIERE.A_ASSET D,COMPIERE.A_DEPRECIATION_CONVENTION C "
+ " FROM A_DEPRECIATION_WORKFILE A, A_ASSET_ACCT B,A_ASSET D,A_DEPRECIATION_CONVENTION C "
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND B.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_PERIOD_POSTED+1 >= A_PERIOD_START AND A_PERIOD_POSTED+1 <= A_PERIOD_END "
@ -380,7 +380,7 @@ public class Depreciation {
StringBuffer sqlB = new StringBuffer ("SELECT A.A_ASSET_COST, A.A_SALVAGE_VALUE, A.A_LIFE_PERIOD, A.A_ASSET_LIFE_YEARS, A.DATEACCT,"
+ " D.ASSETSERVICEDATE, C.CONVENTIONTYPE, A_DEPRECIATION_VARIABLE_PERC "
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE A, COMPIERE.A_ASSET_ACCT B,COMPIERE.A_ASSET D,COMPIERE.A_DEPRECIATION_CONVENTION C "
+ " FROM A_DEPRECIATION_WORKFILE A, A_ASSET_ACCT B,A_ASSET D,A_DEPRECIATION_CONVENTION C "
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND B.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_PERIOD_POSTED+1 >= A_PERIOD_START AND A_PERIOD_POSTED+1 <= A_PERIOD_END "
@ -502,7 +502,7 @@ public class Depreciation {
StringBuffer sqlB = new StringBuffer ("SELECT B.A_ASSET_COST, B.A_SALVAGE_VALUE, B.A_LIFE_PERIOD, "
+ " A_ASSET_LIFE_YEARS, A_ASSET_LIFE_CURRENT_YEAR,A_ACCUMULATED_DEPR, A_DEPRECIATION_MANUAL_AMOUNT, "
+ " A_ASSET_SPREAD_ID, A_DEPRECIATION_MANUAL_PERIOD, A.AD_Client_ID "
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE B, COMPIERE.A_ASSET_ACCT A "
+ " FROM A_DEPRECIATION_WORKFILE B, A_ASSET_ACCT A "
+ " WHERE B.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND B.POSTINGTYPE = '"+p_POSTINGTYPE
@ -641,7 +641,7 @@ public class Depreciation {
BigDecimal A_Period_Exp = new BigDecimal(0.0);
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_ASSET_COST, "
+ " A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET_ACCT"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET_ACCT"
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_ASSET_ACCT.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '"+p_POSTINGTYPE
@ -678,7 +678,7 @@ public class Depreciation {
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_ASSET_COST, "
+ " A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD"
+ " A_ASSET.LIFEUSEUNITS, A_ASSET.USEUNITS, A_DEPRECIATION_WORKFILE.A_ACCUMULATED_DEPR"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET_ACCT"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET_ACCT"
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_ASSET_ACCT.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '"+p_POSTINGTYPE
@ -716,7 +716,7 @@ public class Depreciation {
+ " A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD, "
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_CURRENT_YEAR, A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, "
+ " A_ASSET.ASSETSERVICEDATE, A_DEPRECIATION_BUILD.DATEACCT"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE, COMPIERE.A_ASSET_ACCT, COMPIERE.A_ASSET, A_DEPRECIATION_BUILD"
+ " FROM A_DEPRECIATION_WORKFILE, A_ASSET_ACCT, A_ASSET, A_DEPRECIATION_BUILD"
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_ASSET_ACCT.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_ASSET.A_ASSET_ID = " + p_A_ASSET_ID
@ -766,7 +766,7 @@ public class Depreciation {
int v_Dep_Per = 0;
StringBuffer sqlB = new StringBuffer ("SELECT A.A_ASSET_COST, A.A_SALVAGE_VALUE, A.A_LIFE_PERIOD,"
+ " B.A_DEPRECIATION_TABLE_HEADER_ID, A.AD_Client_ID, C.A_TERM, C.A_Depreciation_Table_Code "
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE A, COMPIERE.A_ASSET_ACCT B, A_Depreciation_Table_Header C"
+ " FROM A_DEPRECIATION_WORKFILE A, A_ASSET_ACCT B, A_Depreciation_Table_Header C"
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND B.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A.POSTINGTYPE = '"+p_POSTINGTYPE

View File

@ -65,7 +65,7 @@ public class DepreciationAdj {
BigDecimal A_Dep_Adj = new BigDecimal(0.0);
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD, A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE"
+ " FROM A_DEPRECIATION_WORKFILE"
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE +"'");
@ -112,7 +112,7 @@ public class DepreciationAdj {
BigDecimal A_Dep_Adj = new BigDecimal(0.0);
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD, A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED"
+ " FROM COMPIERE.A_DEPRECIATION_WORKFILE"
+ " FROM A_DEPRECIATION_WORKFILE"
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE +"'");

View File

@ -21,11 +21,11 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import org.compiere.model.MAccount;
import org.compiere.model.MAssetChange;
import org.compiere.model.MJournal;
import org.compiere.model.MJournalBatch;
import org.compiere.model.MJournalLine;
import org.compiere.model.MXIFAJournal;
import org.compiere.model.X_AD_Sequence;
import org.compiere.model.X_I_FAJournal;
import org.compiere.process.ProcessInfoParameter;
import org.compiere.process.SvrProcess;
@ -178,39 +178,22 @@ public class ImportFAJournal2 extends SvrProcess
{
X_I_FAJournal FAInsert = new X_I_FAJournal (getCtx (), 0, get_TrxName());
if (v_FirstTime == 0){
if (v_FirstTime == 0)
{
v_C_BatchNo = DB.getDocumentNo(rs.getInt("C_DOCTYPE_ID"), get_TrxName(), true, FAInsert);
int v_sequence = 0;
String sql3 = "SELECT AD_SEQUENCE_ID"
+ " FROM AD_Sequence "
+ " WHERE Name = 'DocumentNo_GL_JournalBatch' "
+ " AND IsActive = 'Y' "
+ " AND IsTableID = 'N' "
+ " AND IsAutoSequence = 'Y' "
+ " AND AD_Client_ID = ? ";
v_sequence = DB.getSQLValue(get_TrxName(), sql3, m_AD_Client_ID);
X_AD_Sequence Sequence = new X_AD_Sequence (getCtx(), v_sequence, get_TrxName());
if (Sequence.getCurrentNextSys() != -1 & m_AD_Client_ID < 1000000){
v_C_BatchNo = String.valueOf(Sequence.getCurrentNextSys() + 1);
Sequence.setCurrentNextSys(Sequence.getCurrentNextSys() + 1);
}
else{
v_C_BatchNo = String.valueOf(Sequence.getCurrentNext() + 1);
Sequence.setCurrentNext( Sequence.getCurrentNext() + 1);
}
Sequence.save();
v_FirstTime = 1;
}
String v_Line_Description = rs.getString("DESCRIPTION") + " - FA # " + rs.getInt("A_ASSET_ID");
if (rs.getBigDecimal("EXPENSE").compareTo(new BigDecimal("0.0"))== 1){
if (rs.getBigDecimal("EXPENSE").compareTo(new BigDecimal("0.0"))== 1)
{
v_AMTSOURCEDR = rs.getBigDecimal("EXPENSE") ;
v_AMTSOURCECR = Env.ZERO;
}
else{
else
{
v_AMTSOURCECR = (rs.getBigDecimal("EXPENSE").multiply(new BigDecimal("-1.0")));
v_AMTSOURCEDR = Env.ZERO;
}
@ -246,7 +229,8 @@ public class ImportFAJournal2 extends SvrProcess
+ " WHERE A_DEPRECIATION_ENTRY_ID = " + rs.getInt("A_DEPRECIATION_ENTRY_ID"));
no = DB.executeUpdate (sql4,get_TrxName());
}
}catch (Exception e)
}
catch (Exception e)
{
log.info("ImportFAJournal2"+ e);
}
@ -256,7 +240,6 @@ public class ImportFAJournal2 extends SvrProcess
rs = null; pstmt = null;
}
// Set IsActive, Created/Updated
sql = new StringBuffer ("UPDATE I_FAJournal "
+ "SET IsActive = COALESCE (IsActive, 'Y'),"
@ -884,7 +867,8 @@ public class ImportFAJournal2 extends SvrProcess
String impgetIsDepreciated = imp.getIsDepreciated();
//impgetIsDepreciated = impgetIsDepreciated + "STOP";
if(impgetIsDepreciated.equals("Y")){
if(impgetIsDepreciated.equals("Y"))
{
cs = DB.prepareCall("{call AD_Sequence_Next(?,?,?)}");
cs.setString(1, "A_Asset_Change");
cs.setInt(2,imp.getAD_Client_ID());
@ -892,63 +876,45 @@ public class ImportFAJournal2 extends SvrProcess
cs.execute();
//java.util.Date jdate = new java.util.Date();
//java.sql.Date sqlDate = new java.sql.Date(jdate.getTime());
MAssetChange assetChange = new MAssetChange (getCtx(), 0, get_TrxName());
assetChange.setA_Asset_Change_ID(cs.getInt(3));
assetChange.set_ValueOfColumn("AD_CLIENT_ID", imp.getAD_Client_ID());
assetChange.setAD_Org_ID(imp.getAD_OrgDoc_ID());
assetChange.set_ValueOfColumn("CREATEDBY", getAD_User_ID());
assetChange.set_ValueOfColumn("UPDATEDBY", getAD_User_ID());
assetChange.setChangeType("DEP");
assetChange.setChangeAmt(imp.getAmtAcctTotal());
assetChange.setA_Asset_ID(imp.getA_Asset_ID());
assetChange.setTextDetails(imp.getDescription());
assetChange.setC_ValidCombination_ID(imp.getC_ValidCombination_ID());
assetChange.setDateAcct(imp.getDateAcct());
assetChange.setPostingType(imp.getPostingType());
assetChange.saveEx();
sql = new StringBuffer ("INSERT INTO A_ASSET_CHANGE "
+"(A_ASSET_CHANGE_ID,AD_CLIENT_ID,AD_ORG_ID,CREATEDBY,"
+"UPDATEDBY,CHANGETYPE, CHANGEAMT, A_ASSET_ID, TEXTDETAILS,"
+"C_VALIDCOMBINATION_ID, DATEACCT, POSTINGTYPE)"
+"VALUES(?,?,?,?,?,?,?,?,?,?,?,? )");
pstmt = DB.prepareStatement(sql.toString(),get_TrxName());
pstmt.setInt(1,cs.getInt(3));
pstmt.setInt(2,imp.getAD_Client_ID());
pstmt.setInt(3,imp.getAD_OrgDoc_ID());
pstmt.setInt(4,getAD_User_ID());
pstmt.setInt(5,getAD_User_ID());
pstmt.setString(6,"DEP");
pstmt.setBigDecimal(7,imp.getAmtAcctTotal());
pstmt.setInt(8,imp.getA_Asset_ID());
pstmt.setString(9,imp.getDescription());
pstmt.setInt(10,imp.getC_ValidCombination_ID());
pstmt.setTimestamp(11,imp.getDateAcct());
pstmt.setString(12,imp.getPostingType());
no = pstmt.executeUpdate();
log.info("doIt - SET Change Log Update =" + no );
}
else if(impgetIsDepreciated.equals("B")){
else if(impgetIsDepreciated.equals("B"))
{
cs = DB.prepareCall("{call AD_Sequence_Next(?,?,?)}");
cs.setString(1, "A_Asset_Change");
cs.setInt(2,imp.getAD_Client_ID());
cs.registerOutParameter(3, java.sql.Types.INTEGER);
cs.execute();
MAssetChange assetChange = new MAssetChange (getCtx(), 0, get_TrxName());
assetChange.setA_Asset_Change_ID(cs.getInt(3));
assetChange.set_ValueOfColumn("AD_CLIENT_ID", imp.getAD_Client_ID());
assetChange.setAD_Org_ID(imp.getAD_OrgDoc_ID());
assetChange.set_ValueOfColumn("CREATEDBY", getAD_User_ID());
assetChange.set_ValueOfColumn("UPDATEDBY", getAD_User_ID());
assetChange.setChangeType("BUD");
assetChange.setChangeAmt(imp.getAmtAcctTotal());
assetChange.setA_Asset_ID(imp.getA_Asset_ID());
assetChange.setTextDetails(imp.getDescription());
assetChange.setC_ValidCombination_ID(imp.getC_ValidCombination_ID());
assetChange.setDateAcct(imp.getDateAcct());
assetChange.setPostingType(imp.getPostingType());
assetChange.saveEx();
//java.util.Date jdate = new java.util.Date();
//java.sql.Date sqlDate = new java.sql.Date(jdate.getTime());
sql = new StringBuffer ("INSERT INTO A_ASSET_CHANGE "
+"(A_ASSET_CHANGE_ID,AD_CLIENT_ID,AD_ORG_ID,CREATEDBY,"
+"UPDATEDBY,CHANGETYPE, CHANGEAMT, A_ASSET_ID, TEXTDETAILS,"
+"C_VALIDCOMBINATION_ID, DATEACCT, POSTINGTYPE)"
+"VALUES(?,?,?,?,?,?,?,?,?,?,?,? )");
pstmt = DB.prepareStatement(sql.toString(),get_TrxName());
pstmt.setInt(1,cs.getInt(3));
pstmt.setInt(2,imp.getAD_Client_ID());
pstmt.setInt(3,imp.getAD_OrgDoc_ID());
pstmt.setInt(4,getAD_User_ID());
pstmt.setInt(5,getAD_User_ID());
pstmt.setString(6,"BUD");
pstmt.setBigDecimal(7,imp.getAmtAcctTotal());
pstmt.setInt(8,imp.getA_Asset_ID());
pstmt.setString(9,imp.getDescription());
pstmt.setInt(10,imp.getC_ValidCombination_ID());
pstmt.setTimestamp(11,imp.getDateAcct());
pstmt.setString(12,imp.getPostingType());
no = pstmt.executeUpdate();
log.info("doIt - SET Change Log Update =" + no );
}
@ -959,7 +925,7 @@ public class ImportFAJournal2 extends SvrProcess
}
catch (Exception e)
{
log.info("doIt"+ e);
log.severe("doIt"+ e);
}
// clean up
finally
@ -985,7 +951,7 @@ public class ImportFAJournal2 extends SvrProcess
sql3 = "SELECT A_ASSET.A_ASSET_ID, A_ASSET.ISFULLYDEPRECIATED, A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED, "
+ "A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD "
+ "FROM COMPIERE.A_DEPRECIATION_WORKFILE,COMPIERE.A_ASSET "
+ "FROM A_DEPRECIATION_WORKFILE,A_ASSET "
+ "WHERE A_ASSET.A_ASSET_ID = A_DEPRECIATION_WORKFILE.A_ASSET_ID "
+ "AND A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED = A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD ";