* [ 2319233 ] Hardcoded Compiere schema name in some FA classes
* Change to use model class instead of sql insert
This commit is contained in:
parent
57d003181c
commit
4f9898a90b
|
@ -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.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_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"
|
+" 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"
|
+" 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_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 = ? ";
|
+" AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = ? ";
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import org.compiere.model.X_A_Depreciation;
|
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_Convention;
|
||||||
import org.compiere.model.X_A_Depreciation_Exp;
|
import org.compiere.model.X_A_Depreciation_Exp;
|
||||||
import org.compiere.model.X_A_Depreciation_Forecast;
|
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;
|
String sql = null;
|
||||||
sql = "DELETE FROM A_DEPRECIATION_EXP WHERE PostingType"
|
sql = "DELETE FROM A_DEPRECIATION_EXP WHERE PostingType"
|
||||||
+ " = '" + DepBuild.getPostingType() + "' and A_Asset_ID"
|
+ " = '" + 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.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.DATEACCT, A_DEPRECIATION_BUILD.C_PERIOD_ID, A_DEPRECIATION_WORKFILE.A_DEPRECIATION_WORKFILE_ID, "
|
||||||
+ " A_DEPRECIATION_BUILD.DATEDOC "
|
+ " 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 "
|
+ " 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 "
|
+ " 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' "
|
+ " AND A_DEPRECIATION_BUILD.A_END_ASSET_ID >= A_ASSET.A_ASSET_ID AND A_ASSET.ISFULLYDEPRECIATED = 'N' AND A_ASSET.ISDEPRECIATED = 'Y' "
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class Conventions {
|
||||||
StringBuffer sqlB = new StringBuffer ("SELECT A_ASSET.ASSETSERVICEDATE, A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
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.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
|
+ " 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
|
+ " 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.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
||||||
|
@ -126,7 +126,7 @@ public class Conventions {
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
|
+ " 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
|
+ " 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.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
||||||
|
@ -188,7 +188,7 @@ public class Conventions {
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
|
+ " 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
|
+ " 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.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
||||||
|
@ -266,7 +266,7 @@ public class Conventions {
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
|
+ " 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
|
+ " 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.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
||||||
|
@ -327,7 +327,7 @@ public class Conventions {
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
+ " A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD,"
|
||||||
+ " A_DEPRECIATION_WORKFILE.DATEACCT"
|
+ " 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
|
+ " 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.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE+"'");
|
||||||
|
|
|
@ -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,"
|
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 "
|
+ " 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
|
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND B.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 "
|
+ " 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,"
|
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 "
|
+ " 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
|
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND B.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 "
|
+ " 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,"
|
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 "
|
+ " 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
|
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND B.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 "
|
+ " 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, "
|
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_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 "
|
+ " 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
|
+ " WHERE B.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A.A_ASSET_ID = " + p_A_ASSET_ID
|
+ " AND A.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND B.POSTINGTYPE = '"+p_POSTINGTYPE
|
+ " AND B.POSTINGTYPE = '"+p_POSTINGTYPE
|
||||||
|
@ -641,7 +641,7 @@ public class Depreciation {
|
||||||
BigDecimal A_Period_Exp = new BigDecimal(0.0);
|
BigDecimal A_Period_Exp = new BigDecimal(0.0);
|
||||||
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_ASSET_COST, "
|
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_ASSET_COST, "
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD"
|
+ " 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
|
+ " 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_ACCT.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '"+p_POSTINGTYPE
|
+ " 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, "
|
StringBuffer sqlB = new StringBuffer ("SELECT A_DEPRECIATION_WORKFILE.A_ASSET_COST, "
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD"
|
+ " A_DEPRECIATION_WORKFILE.A_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD"
|
||||||
+ " A_ASSET.LIFEUSEUNITS, A_ASSET.USEUNITS, A_DEPRECIATION_WORKFILE.A_ACCUMULATED_DEPR"
|
+ " 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
|
+ " 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_ACCT.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '"+p_POSTINGTYPE
|
+ " 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_SALVAGE_VALUE, A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD, "
|
||||||
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_CURRENT_YEAR, A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, "
|
+ " A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_CURRENT_YEAR, A_DEPRECIATION_WORKFILE.A_ASSET_LIFE_YEARS, "
|
||||||
+ " A_ASSET.ASSETSERVICEDATE, A_DEPRECIATION_BUILD.DATEACCT"
|
+ " 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
|
+ " 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_ACCT.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_ASSET.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;
|
int v_Dep_Per = 0;
|
||||||
StringBuffer sqlB = new StringBuffer ("SELECT A.A_ASSET_COST, A.A_SALVAGE_VALUE, A.A_LIFE_PERIOD,"
|
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 "
|
+ " 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
|
+ " WHERE A.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND B.A_ASSET_ID = " + p_A_ASSET_ID
|
+ " AND B.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A.POSTINGTYPE = '"+p_POSTINGTYPE
|
+ " AND A.POSTINGTYPE = '"+p_POSTINGTYPE
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class DepreciationAdj {
|
||||||
BigDecimal A_Dep_Adj = new BigDecimal(0.0);
|
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"
|
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
|
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE +"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE +"'");
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ public class DepreciationAdj {
|
||||||
BigDecimal A_Dep_Adj = new BigDecimal(0.0);
|
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"
|
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
|
+ " WHERE A_DEPRECIATION_WORKFILE.A_ASSET_ID = " + p_A_ASSET_ID
|
||||||
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE +"'");
|
+ " AND A_DEPRECIATION_WORKFILE.POSTINGTYPE = '" + p_POSTINGTYPE +"'");
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@ import java.sql.SQLException;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
|
||||||
import org.compiere.model.MAccount;
|
import org.compiere.model.MAccount;
|
||||||
|
import org.compiere.model.MAssetChange;
|
||||||
import org.compiere.model.MJournal;
|
import org.compiere.model.MJournal;
|
||||||
import org.compiere.model.MJournalBatch;
|
import org.compiere.model.MJournalBatch;
|
||||||
import org.compiere.model.MJournalLine;
|
import org.compiere.model.MJournalLine;
|
||||||
import org.compiere.model.MXIFAJournal;
|
import org.compiere.model.MXIFAJournal;
|
||||||
import org.compiere.model.X_AD_Sequence;
|
|
||||||
import org.compiere.model.X_I_FAJournal;
|
import org.compiere.model.X_I_FAJournal;
|
||||||
import org.compiere.process.ProcessInfoParameter;
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
|
@ -178,84 +178,67 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
{
|
{
|
||||||
|
|
||||||
X_I_FAJournal FAInsert = new X_I_FAJournal (getCtx (), 0, get_TrxName());
|
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;
|
v_FirstTime = 1;
|
||||||
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");
|
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;
|
v_AMTSOURCEDR = rs.getBigDecimal("EXPENSE") ;
|
||||||
}
|
v_AMTSOURCECR = Env.ZERO;
|
||||||
else{
|
}
|
||||||
v_AMTSOURCECR = (rs.getBigDecimal("EXPENSE").multiply(new BigDecimal("-1.0")));
|
else
|
||||||
v_AMTSOURCEDR = Env.ZERO;
|
{
|
||||||
}
|
v_AMTSOURCECR = (rs.getBigDecimal("EXPENSE").multiply(new BigDecimal("-1.0")));
|
||||||
|
v_AMTSOURCEDR = Env.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
FAInsert.setI_IsImported(false);
|
FAInsert.setI_IsImported(false);
|
||||||
FAInsert.setProcessed(false);
|
FAInsert.setProcessed(false);
|
||||||
FAInsert.setBatchDocumentNo(v_C_BatchNo);
|
FAInsert.setBatchDocumentNo(v_C_BatchNo);
|
||||||
FAInsert.setBatchDescription (rs.getString("DESCRIPTION"));
|
FAInsert.setBatchDescription (rs.getString("DESCRIPTION"));
|
||||||
FAInsert.setPostingType(rs.getString("POSTINGTYPE"));
|
FAInsert.setPostingType(rs.getString("POSTINGTYPE"));
|
||||||
FAInsert.setC_AcctSchema_ID(rs.getInt("C_ACCTSCHEMA_ID"));
|
FAInsert.setC_AcctSchema_ID(rs.getInt("C_ACCTSCHEMA_ID"));
|
||||||
FAInsert.setC_DocType_ID( rs.getInt("C_DOCTYPE_ID"));
|
FAInsert.setC_DocType_ID( rs.getInt("C_DOCTYPE_ID"));
|
||||||
FAInsert.setGL_Category_ID(rs.getInt("GL_CATEGORY_ID"));
|
FAInsert.setGL_Category_ID(rs.getInt("GL_CATEGORY_ID"));
|
||||||
FAInsert.setLine( v_ID_START);
|
FAInsert.setLine( v_ID_START);
|
||||||
FAInsert.setDateAcct (rs.getTimestamp("DATEACCT"));
|
FAInsert.setDateAcct (rs.getTimestamp("DATEACCT"));
|
||||||
FAInsert.setC_Period_ID(rs.getInt("A_Period"));
|
FAInsert.setC_Period_ID(rs.getInt("A_Period"));
|
||||||
FAInsert.setDescription ( v_Line_Description);
|
FAInsert.setDescription ( v_Line_Description);
|
||||||
FAInsert.setAmtSourceDr ( v_AMTSOURCEDR);
|
FAInsert.setAmtSourceDr ( v_AMTSOURCEDR);
|
||||||
FAInsert.setAmtSourceCr ( v_AMTSOURCECR);
|
FAInsert.setAmtSourceCr ( v_AMTSOURCECR);
|
||||||
FAInsert.setC_Currency_ID ( rs.getInt("C_CURRENCY_ID"));
|
FAInsert.setC_Currency_ID ( rs.getInt("C_CURRENCY_ID"));
|
||||||
FAInsert.setQty (Env.ZERO);
|
FAInsert.setQty (Env.ZERO);
|
||||||
FAInsert.setC_ValidCombination_ID ( rs.getInt("A_ACCOUNT_NUMBER"));
|
FAInsert.setC_ValidCombination_ID ( rs.getInt("A_ACCOUNT_NUMBER"));
|
||||||
FAInsert.setA_Asset_ID ( rs.getInt("A_ASSET_ID"));
|
FAInsert.setA_Asset_ID ( rs.getInt("A_ASSET_ID"));
|
||||||
FAInsert.setIsDepreciated ( rs.getString("ISDEPRECIATED"));
|
FAInsert.setIsDepreciated ( rs.getString("ISDEPRECIATED"));
|
||||||
|
|
||||||
v_ID_START = v_ID_START+10;
|
v_ID_START = v_ID_START+10;
|
||||||
FAInsert.save();
|
FAInsert.save();
|
||||||
|
|
||||||
String sql4 = "UPDATE A_DEPRECIATION_EXP SET PROCESSED = 'Y' "
|
String sql4 = "UPDATE A_DEPRECIATION_EXP SET PROCESSED = 'Y' "
|
||||||
+ " WHERE A_DEPRECIATION_EXP_ID = " + rs.getInt("A_DEPRECIATION_EXP_ID");
|
+ " WHERE A_DEPRECIATION_EXP_ID = " + rs.getInt("A_DEPRECIATION_EXP_ID");
|
||||||
no = DB.executeUpdate (sql4,get_TrxName());
|
no = DB.executeUpdate (sql4,get_TrxName());
|
||||||
|
|
||||||
sql4 = new String ("UPDATE A_DEPRECIATION_ENTRY SET PROCESSED = 'Y', ISACTIVE = 'N' "
|
sql4 = new String ("UPDATE A_DEPRECIATION_ENTRY SET PROCESSED = 'Y', ISACTIVE = 'N' "
|
||||||
+ " WHERE A_DEPRECIATION_ENTRY_ID = " + rs.getInt("A_DEPRECIATION_ENTRY_ID"));
|
+ " WHERE A_DEPRECIATION_ENTRY_ID = " + rs.getInt("A_DEPRECIATION_ENTRY_ID"));
|
||||||
no = DB.executeUpdate (sql4,get_TrxName());
|
no = DB.executeUpdate (sql4,get_TrxName());
|
||||||
}
|
}
|
||||||
}catch (Exception e)
|
}
|
||||||
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("ImportFAJournal2"+ e);
|
log.info("ImportFAJournal2"+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set IsActive, Created/Updated
|
// Set IsActive, Created/Updated
|
||||||
sql = new StringBuffer ("UPDATE I_FAJournal "
|
sql = new StringBuffer ("UPDATE I_FAJournal "
|
||||||
|
@ -868,88 +851,71 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
imp.setGL_JournalLine_ID(line.getGL_JournalLine_ID());
|
imp.setGL_JournalLine_ID(line.getGL_JournalLine_ID());
|
||||||
imp.setI_IsImported(true);
|
imp.setI_IsImported(true);
|
||||||
imp.setProcessed(true);
|
imp.setProcessed(true);
|
||||||
sql = new StringBuffer ("UPDATE A_DEPRECIATION_WORKFILE "
|
sql = new StringBuffer ("UPDATE A_DEPRECIATION_WORKFILE "
|
||||||
+"SET A_ACCUMULATED_DEPR = A_ACCUMULATED_DEPR + ")
|
+"SET A_ACCUMULATED_DEPR = A_ACCUMULATED_DEPR + ")
|
||||||
.append(imp.getExpenseDr()).append(" - ").append(imp.getExpenseCr())
|
.append(imp.getExpenseDr()).append(" - ").append(imp.getExpenseCr())
|
||||||
.append(", A_PERIOD_POSTED = A_CURRENT_PERIOD")
|
.append(", A_PERIOD_POSTED = A_CURRENT_PERIOD")
|
||||||
.append(", ASSETDEPRECIATIONDATE = ").append (DB.TO_DATE(imp.getDateAcct()))
|
.append(", ASSETDEPRECIATIONDATE = ").append (DB.TO_DATE(imp.getDateAcct()))
|
||||||
.append(" WHERE A_ASSET_ID = ").append(imp.getA_Asset_ID())
|
.append(" WHERE A_ASSET_ID = ").append(imp.getA_Asset_ID())
|
||||||
.append(" AND ISACTIVE = '").append(imp.getIsDepreciated())
|
.append(" AND ISACTIVE = '").append(imp.getIsDepreciated())
|
||||||
.append("' AND POSTINGTYPE = '").append(imp.getPostingType())
|
.append("' AND POSTINGTYPE = '").append(imp.getPostingType())
|
||||||
.append("'");
|
.append("'");
|
||||||
no = DB.executeUpdate(sql.toString(),get_TrxName());
|
no = DB.executeUpdate(sql.toString(),get_TrxName());
|
||||||
log.info("doIt - SET Accumulated Depreciation =" + no);
|
log.info("doIt - SET Accumulated Depreciation =" + no);
|
||||||
|
|
||||||
// Copy Expense Worktable to Import Worktable
|
// Copy Expense Worktable to Import Worktable
|
||||||
String impgetIsDepreciated = imp.getIsDepreciated();
|
String impgetIsDepreciated = imp.getIsDepreciated();
|
||||||
//impgetIsDepreciated = impgetIsDepreciated + "STOP";
|
//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 = DB.prepareCall("{call AD_Sequence_Next(?,?,?)}");
|
||||||
cs.setInt(2,imp.getAD_Client_ID());
|
cs.setString(1, "A_Asset_Change");
|
||||||
cs.registerOutParameter(3, java.sql.Types.INTEGER);
|
cs.setInt(2,imp.getAD_Client_ID());
|
||||||
cs.execute();
|
cs.registerOutParameter(3, java.sql.Types.INTEGER);
|
||||||
|
cs.execute();
|
||||||
|
|
||||||
|
|
||||||
//java.util.Date jdate = new java.util.Date();
|
MAssetChange assetChange = new MAssetChange (getCtx(), 0, get_TrxName());
|
||||||
//java.sql.Date sqlDate = new java.sql.Date(jdate.getTime());
|
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,"
|
else if(impgetIsDepreciated.equals("B"))
|
||||||
+"UPDATEDBY,CHANGETYPE, CHANGEAMT, A_ASSET_ID, TEXTDETAILS,"
|
{
|
||||||
+"C_VALIDCOMBINATION_ID, DATEACCT, POSTINGTYPE)"
|
cs = DB.prepareCall("{call AD_Sequence_Next(?,?,?)}");
|
||||||
+"VALUES(?,?,?,?,?,?,?,?,?,?,?,? )");
|
cs.setString(1, "A_Asset_Change");
|
||||||
|
cs.setInt(2,imp.getAD_Client_ID());
|
||||||
|
cs.registerOutParameter(3, java.sql.Types.INTEGER);
|
||||||
|
cs.execute();
|
||||||
|
|
||||||
pstmt = DB.prepareStatement(sql.toString(),get_TrxName());
|
MAssetChange assetChange = new MAssetChange (getCtx(), 0, get_TrxName());
|
||||||
pstmt.setInt(1,cs.getInt(3));
|
assetChange.setA_Asset_Change_ID(cs.getInt(3));
|
||||||
pstmt.setInt(2,imp.getAD_Client_ID());
|
assetChange.set_ValueOfColumn("AD_CLIENT_ID", imp.getAD_Client_ID());
|
||||||
pstmt.setInt(3,imp.getAD_OrgDoc_ID());
|
assetChange.setAD_Org_ID(imp.getAD_OrgDoc_ID());
|
||||||
pstmt.setInt(4,getAD_User_ID());
|
assetChange.set_ValueOfColumn("CREATEDBY", getAD_User_ID());
|
||||||
pstmt.setInt(5,getAD_User_ID());
|
assetChange.set_ValueOfColumn("UPDATEDBY", getAD_User_ID());
|
||||||
pstmt.setString(6,"DEP");
|
assetChange.setChangeType("BUD");
|
||||||
pstmt.setBigDecimal(7,imp.getAmtAcctTotal());
|
assetChange.setChangeAmt(imp.getAmtAcctTotal());
|
||||||
pstmt.setInt(8,imp.getA_Asset_ID());
|
assetChange.setA_Asset_ID(imp.getA_Asset_ID());
|
||||||
pstmt.setString(9,imp.getDescription());
|
assetChange.setTextDetails(imp.getDescription());
|
||||||
pstmt.setInt(10,imp.getC_ValidCombination_ID());
|
assetChange.setC_ValidCombination_ID(imp.getC_ValidCombination_ID());
|
||||||
pstmt.setTimestamp(11,imp.getDateAcct());
|
assetChange.setDateAcct(imp.getDateAcct());
|
||||||
pstmt.setString(12,imp.getPostingType());
|
assetChange.setPostingType(imp.getPostingType());
|
||||||
no = pstmt.executeUpdate();
|
assetChange.saveEx();
|
||||||
log.info("doIt - SET Change Log Update =" + no );
|
|
||||||
}
|
|
||||||
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();
|
|
||||||
|
|
||||||
|
}
|
||||||
//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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (imp.save())
|
if (imp.save())
|
||||||
|
@ -959,14 +925,14 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.info("doIt"+ e);
|
log.severe("doIt"+ e);
|
||||||
}
|
}
|
||||||
// clean up
|
// clean up
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuffer ("UPDATE I_FAJournal "
|
sql = new StringBuffer ("UPDATE I_FAJournal "
|
||||||
|
@ -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, "
|
sql3 = "SELECT A_ASSET.A_ASSET_ID, A_ASSET.ISFULLYDEPRECIATED, A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED, "
|
||||||
+ "A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD "
|
+ "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 "
|
+ "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 ";
|
+ "AND A_DEPRECIATION_WORKFILE.A_PERIOD_POSTED = A_DEPRECIATION_WORKFILE.A_LIFE_PERIOD ";
|
||||||
|
|
||||||
|
@ -1003,11 +969,11 @@ public class ImportFAJournal2 extends SvrProcess
|
||||||
{
|
{
|
||||||
log.info("Post Depreciation"+ e);
|
log.info("Post Depreciation"+ e);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null;
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue