IDEMPIERE-3947 Fixed Asset bugs and enhancements
This commit is contained in:
parent
bf2b531267
commit
f014fae2a9
|
@ -0,0 +1,93 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:01 PM SGT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213700,0,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53116,'C_AcctSchema_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2018-10-11 20:40:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-10-11 20:40:59','YYYY-MM-DD HH24:MI:SS'),100,181,'N','N','D','N','N','N','Y','c62177d9-97f4-4c03-bc74-05a9f5609c95','Y',0,'N','N','C')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:16 PM SGT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='CAcctSchema_ADepreciationWorkf', FKConstraintType='C',Updated=TO_DATE('2018-10-11 20:41:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213700
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:16 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Workfile ADD C_AcctSchema_ID NUMBER(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:17 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Workfile ADD CONSTRAINT CAcctSchema_ADepreciationWorkf FOREIGN KEY (C_AcctSchema_ID) REFERENCES c_acctschema(c_acctschema_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:13 PM SGT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213701,0,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53115,'C_AcctSchema_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2018-10-11 20:46:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-10-11 20:46:12','YYYY-MM-DD HH24:MI:SS'),100,181,'N','N','D','N','N','N','Y','b0851cce-d266-461b-a47c-4cf19ad6b3af','Y',0,'N','N','C')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:18 PM SGT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='CAcctSchema_ADepreciationExp', FKConstraintType='C',Updated=TO_DATE('2018-10-11 20:46:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213701
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:18 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Exp ADD C_AcctSchema_ID NUMBER(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:18 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Exp ADD CONSTRAINT CAcctSchema_ADepreciationExp FOREIGN KEY (C_AcctSchema_ID) REFERENCES c_acctschema(c_acctschema_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:55:01 PM SGT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205838,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53322,213701,'Y',0,260,0,'N','N','N','N',0,0,'Y',TO_DATE('2018-10-11 20:55:01','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-10-11 20:55:01','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','010b6a0d-e47f-4a41-a6f7-0368373a9e62','Y',260,1,1,1,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:57:59 PM SGT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205839,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53162,213700,'Y',0,240,0,'N','N','N','N',0,0,'Y',TO_DATE('2018-10-11 20:57:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-10-11 20:57:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','266fd230-5a9e-4d4e-83d5-9a5a62c6b753','Y',230,1,1,1,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:01:33 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-23 12:01:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59384
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:01:41 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-23 12:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59385
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:01:47 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-23 12:01:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59386
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:02:02 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-23 12:02:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59387
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:02:10 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-23 12:02:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59388
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:02:16 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-10-23 12:02:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59389
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:06:01 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_DATE('2018-10-23 12:06:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59463
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:06:31 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_DATE('2018-10-23 12:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59464
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:07:20 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_DATE('2018-10-23 12:07:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59475
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:09:27 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_DATE('2018-10-23 12:09:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59469
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:09:45 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_DATE('2018-10-23 12:09:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59470
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:09:55 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_DATE('2018-10-23 12:09:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59478
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201904101655_IDEMPIERE-3947.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,90 @@
|
||||||
|
-- Oct 11, 2018 8:41:01 PM SGT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213700,0,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53116,'C_AcctSchema_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2018-10-11 20:40:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-10-11 20:40:59','YYYY-MM-DD HH24:MI:SS'),100,181,'N','N','D','N','N','N','Y','c62177d9-97f4-4c03-bc74-05a9f5609c95','Y',0,'N','N','C')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:16 PM SGT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='CAcctSchema_ADepreciationWorkf', FKConstraintType='C',Updated=TO_TIMESTAMP('2018-10-11 20:41:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213700
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:16 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Workfile ADD COLUMN C_AcctSchema_ID NUMERIC(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:41:17 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Workfile ADD CONSTRAINT CAcctSchema_ADepreciationWorkf FOREIGN KEY (C_AcctSchema_ID) REFERENCES c_acctschema(c_acctschema_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:13 PM SGT
|
||||||
|
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213701,0,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53115,'C_AcctSchema_ID',22,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2018-10-11 20:46:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-10-11 20:46:12','YYYY-MM-DD HH24:MI:SS'),100,181,'N','N','D','N','N','N','Y','b0851cce-d266-461b-a47c-4cf19ad6b3af','Y',0,'N','N','C')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:18 PM SGT
|
||||||
|
UPDATE AD_Column SET FKConstraintName='CAcctSchema_ADepreciationExp', FKConstraintType='C',Updated=TO_TIMESTAMP('2018-10-11 20:46:18','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213701
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:18 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Exp ADD COLUMN C_AcctSchema_ID NUMERIC(10) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:46:18 PM SGT
|
||||||
|
ALTER TABLE A_Depreciation_Exp ADD CONSTRAINT CAcctSchema_ADepreciationExp FOREIGN KEY (C_AcctSchema_ID) REFERENCES c_acctschema(c_acctschema_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:55:01 PM SGT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205838,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53322,213701,'Y',0,260,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-10-11 20:55:01','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-10-11 20:55:01','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','010b6a0d-e47f-4a41-a6f7-0368373a9e62','Y',260,1,1,1,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 11, 2018 8:57:59 PM SGT
|
||||||
|
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205839,'Accounting Schema','Rules for accounting','An Accounting Schema defines the rules used in accounting such as costing method, currency and calendar',53162,213700,'Y',0,240,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-10-11 20:57:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-10-11 20:57:59','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','266fd230-5a9e-4d4e-83d5-9a5a62c6b753','Y',230,1,1,1,'N','N','N')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:01:33 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-23 12:01:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59384
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:01:41 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-23 12:01:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59385
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:01:47 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-23 12:01:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59386
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:02:02 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-23 12:02:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59387
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:02:10 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-23 12:02:10','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59388
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:02:16 PM SGT
|
||||||
|
UPDATE AD_Field SET IsActive='N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-10-23 12:02:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59389
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:06:01 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2018-10-23 12:06:01','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59463
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:06:31 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2018-10-23 12:06:31','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59464
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:07:20 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2018-10-23 12:07:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59475
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:09:27 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2018-10-23 12:09:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59469
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:09:45 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2018-10-23 12:09:45','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59470
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Oct 23, 2018 12:09:55 PM SGT
|
||||||
|
UPDATE AD_Column SET IsActive='N', IsToolbarButton='N',Updated=TO_TIMESTAMP('2018-10-23 12:09:55','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=59478
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201904101655_IDEMPIERE-3947.sql') FROM dual
|
||||||
|
;
|
|
@ -62,10 +62,10 @@ public class Doc_AssetAddition extends Doc
|
||||||
return facts;
|
return facts;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
BigDecimal assetValueAmt = assetAdd.getAssetValueAmt();
|
BigDecimal assetValueAmt = assetAdd.getAssetSourceAmt();
|
||||||
FactLine[] fls = FactUtil.createSimpleOperation(fact, null,
|
FactLine[] fls = FactUtil.createSimpleOperation(fact, null,
|
||||||
getA_Asset_Acct(), getP_Asset_Acct(as),
|
getA_Asset_Acct(as), getP_Asset_Acct(as),
|
||||||
as.getC_Currency_ID(),
|
getC_Currency_ID(),
|
||||||
assetValueAmt,
|
assetValueAmt,
|
||||||
false);
|
false);
|
||||||
// Set BPartner and C_Project dimension for "Imobilizari in curs / Property Being"
|
// Set BPartner and C_Project dimension for "Imobilizari in curs / Property Being"
|
||||||
|
@ -142,11 +142,11 @@ public class Doc_AssetAddition extends Doc
|
||||||
return MAccount.get(getCtx(), acct_id);
|
return MAccount.get(getCtx(), acct_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MAccount getA_Asset_Acct()
|
private MAccount getA_Asset_Acct(MAcctSchema as)
|
||||||
{
|
{
|
||||||
MAssetAddition assetAdd = getAssetAddition();
|
MAssetAddition assetAdd = getAssetAddition();
|
||||||
int acct_id = MAssetAcct
|
int acct_id = MAssetAcct
|
||||||
.forA_Asset_ID(getCtx(), assetAdd.getA_Asset_ID(), assetAdd.getPostingType(), assetAdd.getDateAcct(), null)
|
.forA_Asset_ID(getCtx(), as.get_ID(), assetAdd.getA_Asset_ID(), assetAdd.getPostingType(), assetAdd.getDateAcct(), null)
|
||||||
.getA_Asset_Acct();
|
.getA_Asset_Acct();
|
||||||
return MAccount.get(getCtx(), acct_id);
|
return MAccount.get(getCtx(), acct_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
||||||
import org.compiere.model.MAccount;
|
import org.compiere.model.MAccount;
|
||||||
import org.compiere.model.MAcctSchema;
|
import org.compiere.model.MAcctSchema;
|
||||||
import org.compiere.model.MAssetAcct;
|
import org.compiere.model.MAssetAcct;
|
||||||
|
import org.compiere.model.MAssetChange;
|
||||||
import org.compiere.model.MAssetDisposed;
|
import org.compiere.model.MAssetDisposed;
|
||||||
import org.compiere.model.MDocType;
|
import org.compiere.model.MDocType;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -49,24 +50,25 @@ public class Doc_AssetDisposed extends Doc
|
||||||
ArrayList<Fact> facts = new ArrayList<Fact>();
|
ArrayList<Fact> facts = new ArrayList<Fact>();
|
||||||
Fact fact = new Fact(this, as, assetDisp.getPostingType());
|
Fact fact = new Fact(this, as, assetDisp.getPostingType());
|
||||||
facts.add(fact);
|
facts.add(fact);
|
||||||
|
MAssetChange ac = MAssetChange.get(getCtx(), assetDisp.getA_Asset_ID(), MAssetChange.CHANGETYPE_Disposal,getTrxName(), as.getC_AcctSchema_ID());
|
||||||
//
|
//
|
||||||
fact.createLine(null, getAccount(MAssetAcct.COLUMNNAME_A_Asset_Acct)
|
fact.createLine(null, getAccount(MAssetAcct.COLUMNNAME_A_Asset_Acct, as)
|
||||||
, as.getC_Currency_ID()
|
, ac.getC_AcctSchema().getC_Currency_ID()
|
||||||
, Env.ZERO, assetDisp.getA_Disposal_Amt());
|
, Env.ZERO, ac.getAssetValueAmt());
|
||||||
fact.createLine(null, getAccount(MAssetAcct.COLUMNNAME_A_Accumdepreciation_Acct)
|
fact.createLine(null, getAccount(MAssetAcct.COLUMNNAME_A_Accumdepreciation_Acct, as)
|
||||||
, as.getC_Currency_ID()
|
, ac.getC_AcctSchema().getC_Currency_ID()
|
||||||
, assetDisp.getA_Accumulated_Depr_Delta(), Env.ZERO);
|
, ac.getAssetAccumDepreciationAmt(), Env.ZERO);
|
||||||
fact.createLine(null, getAccount(MAssetAcct.COLUMNNAME_A_Disposal_Loss_Acct)
|
fact.createLine(null, getAccount(MAssetAcct.COLUMNNAME_A_Disposal_Loss_Acct, as)
|
||||||
, as.getC_Currency_ID()
|
, ac.getC_AcctSchema().getC_Currency_ID()
|
||||||
, assetDisp.getExpense(), Env.ZERO);
|
, ac.getAssetBookValueAmt(), Env.ZERO);
|
||||||
//
|
//
|
||||||
return facts;
|
return facts;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MAccount getAccount(String accountName)
|
private MAccount getAccount(String accountName, MAcctSchema as)
|
||||||
{
|
{
|
||||||
MAssetDisposed assetDisp = (MAssetDisposed)getPO();
|
MAssetDisposed assetDisp = (MAssetDisposed)getPO();
|
||||||
MAssetAcct assetAcct = MAssetAcct.forA_Asset_ID(getCtx(), assetDisp.getA_Asset_ID(), assetDisp.getPostingType(), assetDisp.getDateAcct(),null);
|
MAssetAcct assetAcct = MAssetAcct.forA_Asset_ID(getCtx(), as.get_ID(), assetDisp.getA_Asset_ID(), assetDisp.getPostingType(), assetDisp.getDateAcct(),null);
|
||||||
int account_id = (Integer)assetAcct.get_Value(accountName);
|
int account_id = (Integer)assetAcct.get_Value(accountName);
|
||||||
return MAccount.get(getCtx(), account_id);
|
return MAccount.get(getCtx(), account_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class Doc_AssetReval extends Doc
|
||||||
|
|
||||||
public ArrayList<Fact> createFacts(MAcctSchema as)
|
public ArrayList<Fact> createFacts(MAcctSchema as)
|
||||||
{
|
{
|
||||||
MAssetAcct assetAcct = getAssetAcct();
|
MAssetAcct assetAcct = getAssetAcct(as);
|
||||||
MAssetReval assetRe = getAssetReval();
|
MAssetReval assetRe = getAssetReval();
|
||||||
|
|
||||||
ArrayList<Fact> facts = new ArrayList<Fact>();
|
ArrayList<Fact> facts = new ArrayList<Fact>();
|
||||||
|
@ -67,9 +67,9 @@ public class Doc_AssetReval extends Doc
|
||||||
return POSTINGTYPE_Actual;
|
return POSTINGTYPE_Actual;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MAssetAcct getAssetAcct()
|
private MAssetAcct getAssetAcct(MAcctSchema as)
|
||||||
{
|
{
|
||||||
return MAssetAcct.forA_Asset_ID(getCtx(), getA_Asset_ID(), getPostingType() , getDateAcct(), null);
|
return MAssetAcct.forA_Asset_ID(getCtx(),as.get_ID(), getA_Asset_ID(), getPostingType() , getDateAcct(), null);
|
||||||
}
|
}
|
||||||
private MAssetReval getAssetReval()
|
private MAssetReval getAssetReval()
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,33 +41,6 @@ public interface I_A_Asset_Addition
|
||||||
|
|
||||||
/** Load Meta Data */
|
/** Load Meta Data */
|
||||||
|
|
||||||
/** Column name A_Accumulated_Depr */
|
|
||||||
public static final String COLUMNNAME_A_Accumulated_Depr = "A_Accumulated_Depr";
|
|
||||||
|
|
||||||
/** Set Accumulated Depreciation */
|
|
||||||
public void setA_Accumulated_Depr (BigDecimal A_Accumulated_Depr);
|
|
||||||
|
|
||||||
/** Get Accumulated Depreciation */
|
|
||||||
public BigDecimal getA_Accumulated_Depr();
|
|
||||||
|
|
||||||
/** Column name A_Accumulated_Depr_Adjust */
|
|
||||||
public static final String COLUMNNAME_A_Accumulated_Depr_Adjust = "A_Accumulated_Depr_Adjust";
|
|
||||||
|
|
||||||
/** Set Adjust Accumulated Depreciation */
|
|
||||||
public void setA_Accumulated_Depr_Adjust (boolean A_Accumulated_Depr_Adjust);
|
|
||||||
|
|
||||||
/** Get Adjust Accumulated Depreciation */
|
|
||||||
public boolean isA_Accumulated_Depr_Adjust();
|
|
||||||
|
|
||||||
/** Column name A_Accumulated_Depr_F */
|
|
||||||
public static final String COLUMNNAME_A_Accumulated_Depr_F = "A_Accumulated_Depr_F";
|
|
||||||
|
|
||||||
/** Set Accumulated Depreciation (fiscal) */
|
|
||||||
public void setA_Accumulated_Depr_F (BigDecimal A_Accumulated_Depr_F);
|
|
||||||
|
|
||||||
/** Get Accumulated Depreciation (fiscal) */
|
|
||||||
public BigDecimal getA_Accumulated_Depr_F();
|
|
||||||
|
|
||||||
/** Column name A_Asset_Addition_ID */
|
/** Column name A_Asset_Addition_ID */
|
||||||
public static final String COLUMNNAME_A_Asset_Addition_ID = "A_Asset_Addition_ID";
|
public static final String COLUMNNAME_A_Asset_Addition_ID = "A_Asset_Addition_ID";
|
||||||
|
|
||||||
|
@ -158,15 +131,6 @@ public interface I_A_Asset_Addition
|
||||||
/** Get Life periods (min) */
|
/** Get Life periods (min) */
|
||||||
public int getA_Life_Period_Min();
|
public int getA_Life_Period_Min();
|
||||||
|
|
||||||
/** Column name A_Period_Start */
|
|
||||||
public static final String COLUMNNAME_A_Period_Start = "A_Period_Start";
|
|
||||||
|
|
||||||
/** Set A_Period_Start */
|
|
||||||
public void setA_Period_Start (int A_Period_Start);
|
|
||||||
|
|
||||||
/** Get A_Period_Start */
|
|
||||||
public int getA_Period_Start();
|
|
||||||
|
|
||||||
/** Column name A_QTY_Current */
|
/** Column name A_QTY_Current */
|
||||||
public static final String COLUMNNAME_A_QTY_Current = "A_QTY_Current";
|
public static final String COLUMNNAME_A_QTY_Current = "A_QTY_Current";
|
||||||
|
|
||||||
|
@ -385,28 +349,6 @@ public interface I_A_Asset_Addition
|
||||||
*/
|
*/
|
||||||
public Timestamp getDateDoc();
|
public Timestamp getDateDoc();
|
||||||
|
|
||||||
/** Column name DeltaUseLifeYears */
|
|
||||||
public static final String COLUMNNAME_DeltaUseLifeYears = "DeltaUseLifeYears";
|
|
||||||
|
|
||||||
/** Set Delta Use Life Years */
|
|
||||||
public void setDeltaUseLifeYears (int DeltaUseLifeYears);
|
|
||||||
|
|
||||||
/** Get Delta Use Life Years */
|
|
||||||
public int getDeltaUseLifeYears();
|
|
||||||
|
|
||||||
/** Column name DeltaUseLifeYears_F */
|
|
||||||
public static final String COLUMNNAME_DeltaUseLifeYears_F = "DeltaUseLifeYears_F";
|
|
||||||
|
|
||||||
/** Set Delta Use Life Years (fiscal).
|
|
||||||
* Delta Use Life Years (fiscal)
|
|
||||||
*/
|
|
||||||
public void setDeltaUseLifeYears_F (int DeltaUseLifeYears_F);
|
|
||||||
|
|
||||||
/** Get Delta Use Life Years (fiscal).
|
|
||||||
* Delta Use Life Years (fiscal)
|
|
||||||
*/
|
|
||||||
public int getDeltaUseLifeYears_F();
|
|
||||||
|
|
||||||
/** Column name Description */
|
/** Column name Description */
|
||||||
public static final String COLUMNNAME_Description = "Description";
|
public static final String COLUMNNAME_Description = "Description";
|
||||||
|
|
||||||
|
|
|
@ -229,6 +229,21 @@ public interface I_A_Depreciation_Exp
|
||||||
/** Get Asset Period */
|
/** Get Asset Period */
|
||||||
public int getA_Period();
|
public int getA_Period();
|
||||||
|
|
||||||
|
/** Column name C_AcctSchema_ID */
|
||||||
|
public static final String COLUMNNAME_C_AcctSchema_ID = "C_AcctSchema_ID";
|
||||||
|
|
||||||
|
/** Set Accounting Schema.
|
||||||
|
* Rules for accounting
|
||||||
|
*/
|
||||||
|
public void setC_AcctSchema_ID (int C_AcctSchema_ID);
|
||||||
|
|
||||||
|
/** Get Accounting Schema.
|
||||||
|
* Rules for accounting
|
||||||
|
*/
|
||||||
|
public int getC_AcctSchema_ID();
|
||||||
|
|
||||||
|
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
|
||||||
|
|
||||||
/** Column name CR_Account_ID */
|
/** Column name CR_Account_ID */
|
||||||
public static final String COLUMNNAME_CR_Account_ID = "CR_Account_ID";
|
public static final String COLUMNNAME_CR_Account_ID = "CR_Account_ID";
|
||||||
|
|
||||||
|
|
|
@ -357,6 +357,21 @@ public interface I_A_Depreciation_Workfile
|
||||||
/** Get Third contribution */
|
/** Get Third contribution */
|
||||||
public BigDecimal getA_Valoare_Tert();
|
public BigDecimal getA_Valoare_Tert();
|
||||||
|
|
||||||
|
/** Column name C_AcctSchema_ID */
|
||||||
|
public static final String COLUMNNAME_C_AcctSchema_ID = "C_AcctSchema_ID";
|
||||||
|
|
||||||
|
/** Set Accounting Schema.
|
||||||
|
* Rules for accounting
|
||||||
|
*/
|
||||||
|
public void setC_AcctSchema_ID (int C_AcctSchema_ID);
|
||||||
|
|
||||||
|
/** Get Accounting Schema.
|
||||||
|
* Rules for accounting
|
||||||
|
*/
|
||||||
|
public int getC_AcctSchema_ID();
|
||||||
|
|
||||||
|
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException;
|
||||||
|
|
||||||
/** Column name Created */
|
/** Column name Created */
|
||||||
public static final String COLUMNNAME_Created = "Created";
|
public static final String COLUMNNAME_Created = "Created";
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,8 @@ public class MAsset extends X_A_Asset
|
||||||
setIsOwned(true);
|
setIsOwned(true);
|
||||||
setIsInPosession(true);
|
setIsInPosession(true);
|
||||||
setA_Asset_CreateDate(inoutLine.getM_InOut().getMovementDate());
|
setA_Asset_CreateDate(inoutLine.getM_InOut().getMovementDate());
|
||||||
|
//Fixed Asset should created in Organization as per the PO, MR, invoice and the asset addition document was recorded in.
|
||||||
|
setAD_Org_ID(invoiceLine.getAD_Org_ID());
|
||||||
// Asset Group:
|
// Asset Group:
|
||||||
int A_Asset_Group_ID = invoiceLine.getA_Asset_Group_ID();
|
int A_Asset_Group_ID = invoiceLine.getA_Asset_Group_ID();
|
||||||
MProduct product = MProduct.get(getCtx(), invoiceLine.getM_Product_ID());
|
MProduct product = MProduct.get(getCtx(), invoiceLine.getM_Product_ID());
|
||||||
|
@ -410,22 +411,25 @@ public class MAsset extends X_A_Asset
|
||||||
// for each asset group acounting create an asset accounting and a workfile too
|
// for each asset group acounting create an asset accounting and a workfile too
|
||||||
for (MAssetGroupAcct assetgrpacct : MAssetGroupAcct.forA_Asset_Group_ID(getCtx(), getA_Asset_Group_ID()))
|
for (MAssetGroupAcct assetgrpacct : MAssetGroupAcct.forA_Asset_Group_ID(getCtx(), getA_Asset_Group_ID()))
|
||||||
{
|
{
|
||||||
// Asset Accounting
|
if (assetgrpacct.getAD_Org_ID() == 0 || assetgrpacct.getAD_Org_ID() == getAD_Org_ID())
|
||||||
MAssetAcct assetacct = new MAssetAcct(this, assetgrpacct);
|
{
|
||||||
assetacct.setAD_Org_ID(getAD_Org_ID()); //added by @win
|
// Asset Accounting
|
||||||
assetacct.saveEx();
|
MAssetAcct assetacct = new MAssetAcct(this, assetgrpacct);
|
||||||
|
assetacct.setAD_Org_ID(getAD_Org_ID()); //added by @win
|
||||||
// Asset Depreciation Workfile
|
assetacct.saveEx();
|
||||||
MDepreciationWorkfile assetwk = new MDepreciationWorkfile(this, assetacct.getPostingType(), assetgrpacct);
|
|
||||||
assetwk.setAD_Org_ID(getAD_Org_ID()); //added by @win
|
// Asset Depreciation Workfile
|
||||||
assetwk.setUseLifeYears(0);
|
MDepreciationWorkfile assetwk = new MDepreciationWorkfile(this, assetacct.getPostingType(), assetgrpacct);
|
||||||
assetwk.setUseLifeMonths(0);
|
assetwk.setAD_Org_ID(getAD_Org_ID()); //added by @win
|
||||||
assetwk.setUseLifeYears_F(0);
|
assetwk.setUseLifeYears(assetgrpacct.getUseLifeYears());
|
||||||
assetwk.setUseLifeMonths_F(0);
|
assetwk.setUseLifeMonths(assetgrpacct.getUseLifeMonths());
|
||||||
assetwk.saveEx();
|
assetwk.setUseLifeYears_F(assetgrpacct.getUseLifeYears_F());
|
||||||
|
assetwk.setUseLifeMonths_F(assetgrpacct.getUseLifeMonths_F());
|
||||||
// Change Log
|
assetwk.saveEx();
|
||||||
MAssetChange.createAndSave(getCtx(), "CRT", new PO[]{this, assetwk, assetacct}, null);
|
|
||||||
|
// Change Log
|
||||||
|
MAssetChange.createAndSave(getCtx(), "CRT", new PO[]{this, assetwk, assetacct}, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,13 +74,14 @@ public class MAssetAcct extends X_A_Asset_Acct
|
||||||
* @param dateAcct check ValidFrom
|
* @param dateAcct check ValidFrom
|
||||||
* @return asset accounting for the given asset
|
* @return asset accounting for the given asset
|
||||||
*/
|
*/
|
||||||
public static MAssetAcct forA_Asset_ID (Properties ctx, int A_Asset_ID, String postingType, Timestamp dateAcct, String trxName)
|
public static MAssetAcct forA_Asset_ID (Properties ctx, int C_AcctSchema_ID, int A_Asset_ID, String postingType, Timestamp dateAcct, String trxName)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
ArrayList<Object> params = new ArrayList<Object>();
|
ArrayList<Object> params = new ArrayList<Object>();
|
||||||
StringBuilder whereClause = new StringBuilder(COLUMNNAME_A_Asset_ID+"=? AND "+COLUMNNAME_PostingType+"=?");
|
StringBuilder whereClause = new StringBuilder(COLUMNNAME_A_Asset_ID+"=? AND "+COLUMNNAME_PostingType+"=? AND " + COLUMNNAME_C_AcctSchema_ID +"=? " );
|
||||||
params.add(A_Asset_ID);
|
params.add(A_Asset_ID);
|
||||||
params.add(postingType);
|
params.add(postingType);
|
||||||
|
params.add(C_AcctSchema_ID);
|
||||||
if (dateAcct != null)
|
if (dateAcct != null)
|
||||||
{
|
{
|
||||||
whereClause.append(" AND " + COLUMNNAME_ValidFrom).append("<=?");
|
whereClause.append(" AND " + COLUMNNAME_ValidFrom).append("<=?");
|
||||||
|
|
|
@ -122,9 +122,7 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
MAsset asset = assetAdd.createAsset();
|
MAsset asset = assetAdd.createAsset();
|
||||||
asset.dump();
|
asset.dump();
|
||||||
//@win add
|
//@win add
|
||||||
MAssetGroupAcct assetgrpacct = MAssetGroupAcct.forA_Asset_Group_ID(asset.getCtx(), asset.getA_Asset_Group_ID(), assetAdd.getPostingType());
|
|
||||||
assetAdd.setDeltaUseLifeYears(assetgrpacct.getUseLifeYears());
|
|
||||||
assetAdd.setDeltaUseLifeYears_F(assetgrpacct.getUseLifeYears_F());
|
|
||||||
} else {
|
} else {
|
||||||
assetAdd.setA_Asset_ID(match.getC_InvoiceLine().getA_Asset_ID());
|
assetAdd.setA_Asset_ID(match.getC_InvoiceLine().getA_Asset_ID());
|
||||||
assetAdd.setA_CreateAsset(false);
|
assetAdd.setA_CreateAsset(false);
|
||||||
|
@ -179,10 +177,6 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
asset.saveEx();
|
asset.saveEx();
|
||||||
asset.dump();
|
asset.dump();
|
||||||
|
|
||||||
// Copy UseLife values from asset group to workfile
|
|
||||||
MAssetGroupAcct assetgrpacct = MAssetGroupAcct.forA_Asset_Group_ID(asset.getCtx(), asset.getA_Asset_Group_ID(), assetAdd.getPostingType());
|
|
||||||
assetAdd.setDeltaUseLifeYears(assetgrpacct.getUseLifeYears());
|
|
||||||
assetAdd.setDeltaUseLifeYears_F(assetgrpacct.getUseLifeYears_F());
|
|
||||||
assetAdd.setA_Asset(asset);
|
assetAdd.setA_Asset(asset);
|
||||||
assetAdd.saveEx();
|
assetAdd.saveEx();
|
||||||
//@win add
|
//@win add
|
||||||
|
@ -262,8 +256,7 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
setSourceAmt(project.getProjectBalanceAmt());
|
setSourceAmt(project.getProjectBalanceAmt());
|
||||||
setDateDoc(new Timestamp (System.currentTimeMillis()));
|
setDateDoc(new Timestamp (System.currentTimeMillis()));
|
||||||
setA_CreateAsset(true); //added by @win as create from project will certainly for createnew
|
setA_CreateAsset(true); //added by @win as create from project will certainly for createnew
|
||||||
setDeltaUseLifeYears(I_ZERO);
|
|
||||||
setDeltaUseLifeYears_F(I_ZERO);
|
|
||||||
setC_DocType_ID();
|
setC_DocType_ID();
|
||||||
|
|
||||||
Timestamp dateAcct = new Timestamp (System.currentTimeMillis());
|
Timestamp dateAcct = new Timestamp (System.currentTimeMillis());
|
||||||
|
@ -304,14 +297,7 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
setDateDoc(ifa.getAssetServiceDate());
|
setDateDoc(ifa.getAssetServiceDate());
|
||||||
setM_Locator_ID(ifa.getM_Locator_ID());
|
setM_Locator_ID(ifa.getM_Locator_ID());
|
||||||
|
|
||||||
boolean isAccmDeprAdjust = (ifa.getA_Accumulated_Depr().compareTo(Env.ZERO) > 0) ? true : false;
|
|
||||||
setA_Accumulated_Depr_Adjust(isAccmDeprAdjust);
|
|
||||||
setA_Period_Start(ifa.getA_Current_Period());
|
|
||||||
|
|
||||||
setA_Accumulated_Depr(ifa.getA_Accumulated_Depr());
|
|
||||||
setA_Accumulated_Depr_F(ifa.getA_Accumulated_Depr_F());
|
|
||||||
setDeltaUseLifeYears((int)(ifa.getUseLifeMonths() / 12));
|
|
||||||
setDeltaUseLifeYears_F((int)(ifa.getUseLifeMonths_F() / 12));
|
|
||||||
|
|
||||||
setA_CapvsExp(MAssetAddition.A_CAPVSEXP_Capital); //added by zuhri, import must be in Capital
|
setA_CapvsExp(MAssetAddition.A_CAPVSEXP_Capital); //added by zuhri, import must be in Capital
|
||||||
setA_CreateAsset(true); //added by zuhri, import must be create asset
|
setA_CreateAsset(true); //added by zuhri, import must be create asset
|
||||||
|
@ -367,7 +353,8 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
setC_Currency_ID(mi.getC_InvoiceLine().getC_Invoice().getC_Currency_ID());
|
setC_Currency_ID(mi.getC_InvoiceLine().getC_Invoice().getC_Currency_ID());
|
||||||
setC_ConversionType_ID(mi.getC_InvoiceLine().getC_Invoice().getC_ConversionType_ID());
|
setC_ConversionType_ID(mi.getC_InvoiceLine().getC_Invoice().getC_ConversionType_ID());
|
||||||
setDateDoc(mi.getM_InOutLine().getM_InOut().getMovementDate());
|
setDateDoc(mi.getM_InOutLine().getM_InOut().getMovementDate());
|
||||||
setDateAcct(mi.getM_InOutLine().getM_InOut().getMovementDate());
|
setDateAcct(mi.getDateAcct());
|
||||||
|
setAD_Org_ID(mi.getAD_Org_ID());
|
||||||
m_cacheMatchInv.set(mi);
|
m_cacheMatchInv.set(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,7 +649,11 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
MDepreciationWorkfile assetwk = MDepreciationWorkfile.get(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
|
MDepreciationWorkfile assetwk = MDepreciationWorkfile.get(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
|
||||||
if (assetwk == null)
|
if (assetwk == null)
|
||||||
{
|
{
|
||||||
assetwk = new MDepreciationWorkfile(asset, getPostingType(), null);
|
|
||||||
|
for (MAssetGroupAcct assetgrpacct : MAssetGroupAcct.forA_Asset_Group_ID(getCtx(), asset.getA_Asset_Group_ID(), getPostingType()))
|
||||||
|
{
|
||||||
|
assetwk = new MDepreciationWorkfile(asset, getPostingType(), assetgrpacct);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("workfile: " + assetwk);
|
if (log.isLoggable(Level.FINE)) log.fine("workfile: " + assetwk);
|
||||||
//
|
//
|
||||||
|
@ -674,20 +665,53 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
//
|
//
|
||||||
// Do we have entries that are not processed and before this date:
|
for (MDepreciationWorkfile assetworkFile : MDepreciationWorkfile.forA_Asset_ID(getCtx(), getA_Asset_ID(), get_TrxName()))
|
||||||
if (this.getA_CapvsExp().equals(A_CAPVSEXP_Capital)) {
|
{
|
||||||
//@win modification to asset value and use life should be restricted to Capital
|
assetworkFile.setDateAcct(getDateAcct());
|
||||||
MDepreciationExp.checkExistsNotProcessedEntries(assetwk.getCtx(), assetwk.getA_Asset_ID(), getDateAcct(), assetwk.getPostingType(), assetwk.get_TrxName());
|
if (assetworkFile.getC_AcctSchema().getC_Currency_ID() != getC_Currency_ID())
|
||||||
//
|
{
|
||||||
if (this.getA_Salvage_Value().signum() > 0) {
|
BigDecimal convertedAssetCost = MConversionRate.convert(getCtx(), getAssetSourceAmt(),
|
||||||
assetwk.setA_Salvage_Value(this.getA_Salvage_Value());
|
getC_Currency_ID(), assetworkFile.getC_AcctSchema().getC_Currency_ID() ,
|
||||||
}
|
getDateAcct(), getC_ConversionType_ID(),
|
||||||
assetwk.adjustCost(getAssetValueAmt(), getA_QTY_Current(), isA_CreateAsset()); // reset if isA_CreateAsset
|
getAD_Client_ID(), getAD_Org_ID());
|
||||||
assetwk.adjustUseLife(getDeltaUseLifeYears(), getDeltaUseLifeYears_F(), isA_CreateAsset()); // reset if isA_CreateAsset
|
assetworkFile.adjustCost(convertedAssetCost, getA_QTY_Current(), isA_CreateAsset()); // reset if isA_CreateAsset
|
||||||
assetwk.setDateAcct(getDateAcct());
|
} else {
|
||||||
assetwk.setProcessed(true);
|
assetworkFile.adjustCost(getAssetSourceAmt(), getA_QTY_Current(), isA_CreateAsset()); // reset if isA_CreateAsset
|
||||||
assetwk.saveEx();
|
|
||||||
}
|
}
|
||||||
|
// Do we have entries that are not processed and before this date:
|
||||||
|
if (this.getA_CapvsExp().equals(A_CAPVSEXP_Capital)) {
|
||||||
|
//@win modification to asset value and use life should be restricted to Capital
|
||||||
|
MDepreciationExp.checkExistsNotProcessedEntries(assetworkFile.getCtx(), assetworkFile.getA_Asset_ID(), getDateAcct(), assetworkFile.getPostingType(), assetworkFile.get_TrxName());
|
||||||
|
//
|
||||||
|
if (this.getA_Salvage_Value().signum() > 0) {
|
||||||
|
if (assetworkFile.getC_AcctSchema().getC_Currency_ID() != getC_Currency_ID())
|
||||||
|
{
|
||||||
|
BigDecimal salvageValue = MConversionRate.convert(getCtx(), this.getA_Salvage_Value(),
|
||||||
|
getC_Currency_ID(), assetworkFile.getC_AcctSchema().getC_Currency_ID() ,
|
||||||
|
getDateAcct(), getC_ConversionType_ID(),
|
||||||
|
getAD_Client_ID(), getAD_Org_ID());
|
||||||
|
assetworkFile.setA_Salvage_Value(salvageValue);
|
||||||
|
} else{
|
||||||
|
assetworkFile.setA_Salvage_Value(this.getA_Salvage_Value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assetworkFile.setDateAcct(getDateAcct());
|
||||||
|
assetworkFile.setProcessed(true);
|
||||||
|
assetworkFile.saveEx();
|
||||||
|
}
|
||||||
|
//@win set initial depreciation period = 1
|
||||||
|
if (isA_CreateAsset())
|
||||||
|
{
|
||||||
|
assetworkFile.setA_Current_Period(1);
|
||||||
|
assetworkFile.saveEx();
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Rebuild depreciation:
|
||||||
|
assetworkFile.buildDepreciation();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MAssetChange.createAddition(this, assetwk);
|
MAssetChange.createAddition(this, assetwk);
|
||||||
|
|
||||||
// Setting locator if is CreateAsset
|
// Setting locator if is CreateAsset
|
||||||
|
@ -707,24 +731,7 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
asset.changeStatus(MAsset.A_ASSET_STATUS_Activated, getDateAcct());
|
asset.changeStatus(MAsset.A_ASSET_STATUS_Activated, getDateAcct());
|
||||||
asset.saveEx();
|
asset.saveEx();
|
||||||
|
|
||||||
//@win set initial depreciation period = 1
|
|
||||||
if (isA_CreateAsset() && !isA_Accumulated_Depr_Adjust())
|
|
||||||
{
|
|
||||||
assetwk.setA_Current_Period(1);
|
|
||||||
assetwk.saveEx();
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
if (isA_Accumulated_Depr_Adjust())
|
|
||||||
{
|
|
||||||
if (isA_CreateAsset() && isA_Accumulated_Depr_Adjust())
|
|
||||||
{
|
|
||||||
assetwk.setA_Current_Period(getA_Period_Start());
|
|
||||||
assetwk.setA_Accumulated_Depr(getA_Accumulated_Depr());
|
|
||||||
assetwk.setA_Accumulated_Depr_F(getA_Accumulated_Depr_F());
|
|
||||||
assetwk.saveEx();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accumulated depreciation (if any):
|
// Accumulated depreciation (if any):
|
||||||
/*
|
/*
|
||||||
|
@ -752,8 +759,6 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Rebuild depreciation:
|
|
||||||
assetwk.buildDepreciation();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
updateSourceDocument(false);
|
updateSourceDocument(false);
|
||||||
|
@ -827,7 +832,6 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
|
|
||||||
// adjust the asset value
|
// adjust the asset value
|
||||||
assetwk.adjustCost(getAssetValueAmt().negate(), getA_QTY_Current().negate(), false);
|
assetwk.adjustCost(getAssetValueAmt().negate(), getA_QTY_Current().negate(), false);
|
||||||
assetwk.adjustUseLife(0 - getDeltaUseLifeYears(), 0 - getDeltaUseLifeYears_F(), false);
|
|
||||||
assetwk.saveEx();
|
assetwk.saveEx();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -1130,9 +1134,7 @@ public class MAssetAddition extends X_A_Asset_Addition
|
||||||
|
|
||||||
public boolean hasZeroValues()
|
public boolean hasZeroValues()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
getDeltaUseLifeYears() <= 0 || getDeltaUseLifeYears_F() <= 0
|
|
||||||
|| getDeltaUseLifeYears() != getDeltaUseLifeYears_F() ||
|
|
||||||
getAssetValueAmt().signum() <= 0
|
getAssetValueAmt().signum() <= 0
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,4 +147,36 @@ public class MAssetChange extends X_A_Asset_Change
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Leaving: po=" + po);
|
if (log.isLoggable(Level.FINE)) log.fine("Leaving: po=" + po);
|
||||||
}
|
}
|
||||||
/** ARHIPAC: TEO: END ------------------------------------------------------------------ */
|
/** ARHIPAC: TEO: END ------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param A_Asset_ID
|
||||||
|
* @param postingType
|
||||||
|
* @param trxName
|
||||||
|
* @param Account Schema
|
||||||
|
* @return assetChange
|
||||||
|
* @see #get(Properties, int, String, String)
|
||||||
|
*/
|
||||||
|
public static MAssetChange get (Properties ctx, int A_Asset_ID, String changeType, String trxName, int C_AcctSchema_ID)
|
||||||
|
{
|
||||||
|
if (A_Asset_ID <= 0 || changeType == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
final String whereClause = COLUMNNAME_A_Asset_ID+"=? AND "
|
||||||
|
+COLUMNNAME_ChangeType+"=? AND "
|
||||||
|
+COLUMNNAME_C_AcctSchema_ID + "=?" ;
|
||||||
|
|
||||||
|
|
||||||
|
MAssetChange ac = new Query(ctx, MAssetChange.Table_Name, whereClause, trxName)
|
||||||
|
.setParameters(new Object[]{A_Asset_ID, changeType,C_AcctSchema_ID})
|
||||||
|
.firstOnly();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ac;
|
||||||
|
}
|
||||||
} // MAssetChange
|
} // MAssetChange
|
|
@ -414,11 +414,40 @@ implements DocAction
|
||||||
|
|
||||||
private void createDisposal()
|
private void createDisposal()
|
||||||
{
|
{
|
||||||
MDepreciationWorkfile assetwk = MDepreciationWorkfile.get(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
|
for (MDepreciationWorkfile assetwk : MDepreciationWorkfile.forA_Asset_ID(getCtx(), getA_Asset_ID(), get_TrxName()))
|
||||||
assetwk.adjustCost(getA_Disposal_Amt().negate(), Env.ZERO, false);
|
{
|
||||||
assetwk.adjustAccumulatedDepr(getA_Accumulated_Depr_Delta().negate(), getA_Accumulated_Depr_Delta().negate(), false);
|
BigDecimal disposalAmt = Env.ZERO;
|
||||||
assetwk.saveEx();
|
BigDecimal accumDeprAmt = Env.ZERO;
|
||||||
assetwk.buildDepreciation();
|
if (assetwk.getC_AcctSchema().getC_Currency_ID() != getC_Currency_ID())
|
||||||
|
{
|
||||||
|
disposalAmt = assetwk.getA_Asset_Cost();
|
||||||
|
accumDeprAmt = assetwk.getA_Accumulated_Depr();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
disposalAmt = getA_Disposal_Amt();
|
||||||
|
accumDeprAmt = getA_Accumulated_Depr_Delta();
|
||||||
|
}
|
||||||
|
|
||||||
|
MAssetChange change = new MAssetChange (getCtx(), 0, get_TrxName());
|
||||||
|
change.setAD_Org_ID(getAD_Org_ID());
|
||||||
|
change.setA_Asset_ID(getA_Asset_ID());
|
||||||
|
change.setChangeType(MAssetChange.CHANGETYPE_Disposal);
|
||||||
|
change.setTextDetails(MRefList.getListDescription (getCtx(),"A_Update_Type" , MAssetChange.CHANGETYPE_Disposal));
|
||||||
|
change.setPostingType(assetwk.getPostingType());
|
||||||
|
change.setAssetValueAmt(disposalAmt);
|
||||||
|
change.setAssetBookValueAmt(assetwk.getA_Asset_Remaining());
|
||||||
|
change.setAssetAccumDepreciationAmt(accumDeprAmt);
|
||||||
|
change.setA_QTY_Current(assetwk.getA_QTY_Current());
|
||||||
|
change.setC_AcctSchema_ID(assetwk.getC_AcctSchema_ID());
|
||||||
|
change.setAssetDisposalDate(getA_Disposed_Date());
|
||||||
|
change.setIsDisposed(true);
|
||||||
|
change.saveEx(get_TrxName());
|
||||||
|
|
||||||
|
assetwk.adjustCost(disposalAmt.negate(), Env.ZERO, false);
|
||||||
|
assetwk.adjustAccumulatedDepr(accumDeprAmt.negate(), accumDeprAmt.negate(), false);
|
||||||
|
assetwk.saveEx();
|
||||||
|
assetwk.buildDepreciation();
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Delete not processed expense entries
|
// Delete not processed expense entries
|
||||||
List<MDepreciationExp> list = MDepreciationExp.getNotProcessedEntries(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
|
List<MDepreciationExp> list = MDepreciationExp.getNotProcessedEntries(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
|
||||||
|
|
|
@ -35,12 +35,12 @@ public class MAssetGroupAcct extends X_A_Asset_Group_Acct
|
||||||
/**
|
/**
|
||||||
* Get Asset Group Accountings for given group
|
* Get Asset Group Accountings for given group
|
||||||
*/
|
*/
|
||||||
public static MAssetGroupAcct forA_Asset_Group_ID(Properties ctx, int A_Asset_Group_ID, String postingType)
|
public static List<MAssetGroupAcct> forA_Asset_Group_ID(Properties ctx, int A_Asset_Group_ID, String postingType)
|
||||||
{
|
{
|
||||||
final String whereClause = COLUMNNAME_A_Asset_Group_ID+"=? AND "+COLUMNNAME_PostingType+"=?";
|
final String whereClause = COLUMNNAME_A_Asset_Group_ID+"=? AND "+COLUMNNAME_PostingType+"=?";
|
||||||
return new Query(ctx, Table_Name, whereClause, null)
|
return new Query(ctx, Table_Name, whereClause, null)
|
||||||
.setParameters(new Object[]{A_Asset_Group_ID, postingType})
|
.setParameters(new Object[]{A_Asset_Group_ID, postingType})
|
||||||
.firstOnly();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,4 +138,17 @@ public class MAssetGroupAcct extends X_A_Asset_Group_Acct
|
||||||
return false;
|
return false;
|
||||||
return is_ValueChanged(index);
|
return is_ValueChanged(index);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get Asset Group Accountings for given group
|
||||||
|
*/
|
||||||
|
public static MAssetGroupAcct forA_Asset_Group_ID(Properties ctx, int A_Asset_Group_ID, String postingType,
|
||||||
|
int C_AcctSchema_ID) {
|
||||||
|
final String whereClause = COLUMNNAME_A_Asset_Group_ID+"=? AND "+COLUMNNAME_PostingType+"=? AND " + COLUMNNAME_C_AcctSchema_ID +"=? " ;
|
||||||
|
return new Query(ctx, Table_Name, whereClause, null)
|
||||||
|
.setParameters(new Object[]{A_Asset_Group_ID, postingType, C_AcctSchema_ID})
|
||||||
|
.firstOnly();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // MAssetGroupAcct
|
} // MAssetGroupAcct
|
||||||
|
|
|
@ -142,7 +142,7 @@ implements DocAction
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the accounts have changed in the meantime
|
// Check if the accounts have changed in the meantime
|
||||||
MAssetAcct assetAcct = MAssetAcct.forA_Asset_ID(getCtx(), getA_Asset_ID(), getPostingType(), getDateAcct(), get_TrxName());
|
MAssetAcct assetAcct = MAssetAcct.forA_Asset_ID(getCtx(), getC_AcctSchema_ID(), getA_Asset_ID(), getPostingType(), getDateAcct(), get_TrxName());
|
||||||
if (assetAcct.getA_Asset_Acct() != getA_Asset_Acct()
|
if (assetAcct.getA_Asset_Acct() != getA_Asset_Acct()
|
||||||
|| assetAcct.getA_Accumdepreciation_Acct() != getA_Accumdepreciation_Acct()
|
|| assetAcct.getA_Accumdepreciation_Acct() != getA_Accumdepreciation_Acct()
|
||||||
|| assetAcct.getA_Depreciation_Acct() != getA_Depreciation_Acct()
|
|| assetAcct.getA_Depreciation_Acct() != getA_Depreciation_Acct()
|
||||||
|
@ -154,7 +154,7 @@ implements DocAction
|
||||||
}
|
}
|
||||||
//Check that at least one account is changed
|
//Check that at least one account is changed
|
||||||
{
|
{
|
||||||
MAssetAcct acct = MAssetAcct.forA_Asset_ID(getCtx(), getA_Asset_ID(), getPostingType(), getDateAcct(), get_TrxName());
|
MAssetAcct acct = MAssetAcct.forA_Asset_ID(getCtx(), getC_AcctSchema_ID(), getA_Asset_ID(), getPostingType(), getDateAcct(), get_TrxName());
|
||||||
if (acct.getA_Asset_Acct() == getA_Asset_New_Acct()
|
if (acct.getA_Asset_Acct() == getA_Asset_New_Acct()
|
||||||
&& acct.getA_Accumdepreciation_Acct() == getA_Accumdepreciation_New_Acct()
|
&& acct.getA_Accumdepreciation_Acct() == getA_Accumdepreciation_New_Acct()
|
||||||
&& acct.getA_Depreciation_Acct() == getA_Depreciation_New_Acct()
|
&& acct.getA_Depreciation_Acct() == getA_Depreciation_New_Acct()
|
||||||
|
@ -205,7 +205,7 @@ implements DocAction
|
||||||
|
|
||||||
|
|
||||||
// create new MAssetAcct
|
// create new MAssetAcct
|
||||||
MAssetAcct assetAcctPrev = MAssetAcct.forA_Asset_ID(getCtx(), getA_Asset_ID(), getPostingType(), getDateAcct(), get_TrxName());
|
MAssetAcct assetAcctPrev = MAssetAcct.forA_Asset_ID(getCtx(), getC_AcctSchema_ID(), getA_Asset_ID(), getPostingType(), getDateAcct(), get_TrxName());
|
||||||
MAssetAcct assetAcct = new MAssetAcct(getCtx(), 0, get_TrxName());
|
MAssetAcct assetAcct = new MAssetAcct(getCtx(), 0, get_TrxName());
|
||||||
PO.copyValues(assetAcctPrev, assetAcct);
|
PO.copyValues(assetAcctPrev, assetAcct);
|
||||||
assetAcct.setA_Asset_Acct(getA_Asset_New_Acct());
|
assetAcct.setA_Asset_Acct(getA_Asset_New_Acct());
|
||||||
|
|
|
@ -72,7 +72,7 @@ implements DocAction
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!isProcessed() && (newRecord || is_ValueChanged(COLUMNNAME_DateAcct)))
|
if (!isProcessed() && (newRecord || is_ValueChanged(COLUMNNAME_DateAcct) || is_ValueChanged(COLUMNNAME_C_AcctSchema_ID)))
|
||||||
{
|
{
|
||||||
selectLines();
|
selectLines();
|
||||||
}
|
}
|
||||||
|
@ -126,10 +126,11 @@ implements DocAction
|
||||||
+ " WHERE "
|
+ " WHERE "
|
||||||
+ MDepreciationExp.COLUMNNAME_A_Depreciation_Entry_ID + " IS NULL"
|
+ MDepreciationExp.COLUMNNAME_A_Depreciation_Entry_ID + " IS NULL"
|
||||||
+ " AND TRUNC("+MDepreciationExp.COLUMNNAME_DateAcct+",'MONTH') = ?"
|
+ " AND TRUNC("+MDepreciationExp.COLUMNNAME_DateAcct+",'MONTH') = ?"
|
||||||
+ " AND AD_Client_ID=? AND AD_Org_ID=?";
|
+ " AND AD_Client_ID=? AND AD_Org_ID=?"
|
||||||
|
+ " AND " + MDepreciationExp.COLUMNNAME_C_AcctSchema_ID +"=?" ;
|
||||||
;
|
;
|
||||||
Timestamp dateAcct = TimeUtil.trunc(getDateAcct(), TimeUtil.TRUNC_MONTH);
|
Timestamp dateAcct = TimeUtil.trunc(getDateAcct(), TimeUtil.TRUNC_MONTH);
|
||||||
int no = DB.executeUpdateEx(sql, new Object[]{get_ID(), dateAcct, getAD_Client_ID(), getAD_Org_ID()}, get_TrxName());
|
int no = DB.executeUpdateEx(sql, new Object[]{get_ID(), dateAcct, getAD_Client_ID(), getAD_Org_ID(), getC_AcctSchema_ID()}, get_TrxName());
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Updated #" + no);
|
if (log.isLoggable(Level.FINE)) log.fine("Updated #" + no);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,8 +141,9 @@ implements DocAction
|
||||||
{
|
{
|
||||||
final String trxName = get_TrxName();
|
final String trxName = get_TrxName();
|
||||||
final List<Object> params = new ArrayList<Object>();
|
final List<Object> params = new ArrayList<Object>();
|
||||||
String whereClause = MDepreciationExp.COLUMNNAME_A_Depreciation_Entry_ID+"=?";
|
String whereClause = MDepreciationExp.COLUMNNAME_A_Depreciation_Entry_ID+"=? AND " + MDepreciationExp.COLUMNNAME_C_AcctSchema_ID + "=?" ;
|
||||||
params.add(get_ID());
|
params.add(get_ID());
|
||||||
|
params.add(getC_AcctSchema_ID());
|
||||||
|
|
||||||
if (onlyNotProcessed)
|
if (onlyNotProcessed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,6 +92,7 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
depexp.setA_Period(A_Period);
|
depexp.setA_Period(A_Period);
|
||||||
depexp.setIsDepreciated(true);
|
depexp.setIsDepreciated(true);
|
||||||
depexp.setDateAcct(DateAcct);
|
depexp.setDateAcct(DateAcct);
|
||||||
|
depexp.setC_AcctSchema_ID(assetwk.getC_AcctSchema_ID());
|
||||||
//
|
//
|
||||||
depexp.updateFrom(assetwk);
|
depexp.updateFrom(assetwk);
|
||||||
//
|
//
|
||||||
|
@ -114,11 +115,6 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
setA_Asset_Remaining_F(wk.getA_Asset_Remaining_F());
|
setA_Asset_Remaining_F(wk.getA_Asset_Remaining_F());
|
||||||
}
|
}
|
||||||
|
|
||||||
private MDepreciationWorkfile getA_Depreciation_Workfile()
|
|
||||||
{
|
|
||||||
return MDepreciationWorkfile.get(getCtx(), getA_Asset_ID(), getPostingType(), get_TrxName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create Depreciation Entries
|
/** Create Depreciation Entries
|
||||||
* Produce record:
|
* Produce record:
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -171,7 +167,7 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
MDepreciationWorkfile assetwk = getA_Depreciation_Workfile();
|
MDepreciationWorkfile assetwk = MDepreciationWorkfile.get(getCtx(), getA_Asset_ID(), getPostingType(),get_TrxName(), getC_AcctSchema_ID());
|
||||||
if (assetwk == null)
|
if (assetwk == null)
|
||||||
{
|
{
|
||||||
throw new AssetException("@NotFound@ @A_Depreciation_Workfile_ID@");
|
throw new AssetException("@NotFound@ @A_Depreciation_Workfile_ID@");
|
||||||
|
@ -188,8 +184,12 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
throw new AssetNotActiveException(assetwk.getAsset().get_ID());
|
throw new AssetNotActiveException(assetwk.getAsset().get_ID());
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
setDateAcct(assetwk.getDateAcct());
|
|
||||||
assetwk.adjustAccumulatedDepr(getExpense(), getExpense_F(), false);
|
assetwk.adjustAccumulatedDepr(getExpense(), getExpense_F(), false);
|
||||||
|
// Update workfile - Remaining asset cost
|
||||||
|
assetwk.setA_Current_Period();
|
||||||
|
assetwk.saveEx();
|
||||||
|
//adjust to the last day of the month in before save assetwk.
|
||||||
|
setDateAcct(assetwk.getDateAcct());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -201,9 +201,7 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
saveEx();
|
saveEx();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update workfile
|
|
||||||
assetwk.setA_Current_Period();
|
|
||||||
assetwk.saveEx();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,10 +209,13 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
{
|
{
|
||||||
if (isProcessed())
|
if (isProcessed())
|
||||||
{
|
{
|
||||||
// TODO : check if we can reverse it (check period, check dateacct etc)
|
Collection<MDepreciationWorkfile> workFiles = MDepreciationWorkfile.forA_Asset_ID(getCtx(), getA_Asset_ID(), get_TrxName());
|
||||||
MDepreciationWorkfile assetwk = getA_Depreciation_Workfile();
|
for(MDepreciationWorkfile assetwk : workFiles) {
|
||||||
assetwk.adjustAccumulatedDepr(getA_Accumulated_Depr().negate(), getA_Accumulated_Depr_F().negate(), false);
|
// TODO : check if we can reverse it (check period, check dateacct etc)
|
||||||
assetwk.saveEx();
|
//MDepreciationWorkfile assetwk = getA_Depreciation_Workfile();
|
||||||
|
assetwk.adjustAccumulatedDepr(getA_Accumulated_Depr().negate(), getA_Accumulated_Depr_F().negate(), false);
|
||||||
|
assetwk.saveEx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Try to delete postings
|
// Try to delete postings
|
||||||
if (isPosted())
|
if (isPosted())
|
||||||
|
@ -236,9 +237,12 @@ public class MDepreciationExp extends X_A_Depreciation_Exp
|
||||||
// If it was processed, we need to update workfile's current period
|
// If it was processed, we need to update workfile's current period
|
||||||
if (isProcessed())
|
if (isProcessed())
|
||||||
{
|
{
|
||||||
MDepreciationWorkfile wk = getA_Depreciation_Workfile();
|
Collection<MDepreciationWorkfile> workFiles = MDepreciationWorkfile.forA_Asset_ID(getCtx(), getA_Asset_ID(), get_TrxName());
|
||||||
wk.setA_Current_Period();
|
for(MDepreciationWorkfile wk : workFiles) {
|
||||||
wk.saveEx();
|
//MDepreciationWorkfile wk = getA_Depreciation_Workfile();
|
||||||
|
wk.setA_Current_Period();
|
||||||
|
wk.saveEx();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -205,9 +205,13 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collection<MDepreciationWorkfile> workFiles = MDepreciationWorkfile.forA_Asset_ID(getCtx(), getA_Asset_ID(), get_TrxName());
|
||||||
|
for(MDepreciationWorkfile assetwk : workFiles) {
|
||||||
// check if is fully depreciated
|
// check if is fully depreciated
|
||||||
BigDecimal remainingAmt_C = getRemainingCost(null, false);
|
BigDecimal remainingAmt_C = assetwk.getA_Depreciation_Workfile_ID() == getA_Depreciation_Workfile_ID()
|
||||||
BigDecimal remainingAmt_F = getRemainingCost(null, true);
|
? getRemainingCost(null, false) : assetwk.getRemainingCost(null, false);
|
||||||
|
BigDecimal remainingAmt_F = assetwk.getA_Depreciation_Workfile_ID() == getA_Depreciation_Workfile_ID()
|
||||||
|
? getRemainingCost(null, true) : assetwk.getRemainingCost(null, true);
|
||||||
if(remainingAmt_C.signum() == 0 && remainingAmt_F.signum() == 0)
|
if(remainingAmt_C.signum() == 0 && remainingAmt_F.signum() == 0)
|
||||||
{
|
{
|
||||||
//if A_Asset_Cost is 0 have a voided addition, in this case asset is not full depreciated
|
//if A_Asset_Cost is 0 have a voided addition, in this case asset is not full depreciated
|
||||||
|
@ -215,11 +219,14 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//
|
}
|
||||||
return true;
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,6 +235,7 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
public MDepreciationWorkfile(MAsset asset, String postingType, MAssetGroupAcct assetgrpacct)
|
public MDepreciationWorkfile(MAsset asset, String postingType, MAssetGroupAcct assetgrpacct)
|
||||||
{
|
{
|
||||||
this(asset.getCtx(), 0, asset.get_TrxName());
|
this(asset.getCtx(), 0, asset.get_TrxName());
|
||||||
|
setC_AcctSchema_ID(assetgrpacct.getC_AcctSchema_ID());
|
||||||
setA_Asset_ID(asset.getA_Asset_ID());
|
setA_Asset_ID(asset.getA_Asset_ID());
|
||||||
setAD_Org_ID(asset.getAD_Org_ID()); //@win added
|
setAD_Org_ID(asset.getAD_Org_ID()); //@win added
|
||||||
setA_Asset_Cost(asset.getA_Asset_Cost());
|
setA_Asset_Cost(asset.getA_Asset_Cost());
|
||||||
|
@ -239,10 +247,6 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
setPostingType(postingType);
|
setPostingType(postingType);
|
||||||
//
|
//
|
||||||
// Copy UseLife values from asset group to workfile
|
// Copy UseLife values from asset group to workfile
|
||||||
if (assetgrpacct == null)
|
|
||||||
{
|
|
||||||
assetgrpacct = MAssetGroupAcct.forA_Asset_Group_ID(asset.getCtx(), asset.getA_Asset_Group_ID(), postingType);
|
|
||||||
}
|
|
||||||
UseLifeImpl.copyValues(this, assetgrpacct);
|
UseLifeImpl.copyValues(this, assetgrpacct);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -291,14 +295,16 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get/load workfile from cache (if trxName is null)
|
*
|
||||||
* @param ctx
|
* @param ctx
|
||||||
* @param A_Asset_ID
|
* @param A_Asset_ID
|
||||||
* @param postingType
|
* @param postingType
|
||||||
* @param trxName
|
* @param trxName
|
||||||
|
* @param Account Schema
|
||||||
* @return workfile
|
* @return workfile
|
||||||
|
* @see #get(Properties, int, String, String)
|
||||||
*/
|
*/
|
||||||
public static MDepreciationWorkfile get (Properties ctx, int A_Asset_ID, String postingType, String trxName)
|
public static MDepreciationWorkfile get (Properties ctx, int A_Asset_ID, String postingType, String trxName, int C_AcctSchema_ID)
|
||||||
{
|
{
|
||||||
if (A_Asset_ID <= 0 || postingType == null)
|
if (A_Asset_ID <= 0 || postingType == null)
|
||||||
{
|
{
|
||||||
|
@ -320,9 +326,11 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
*/
|
*/
|
||||||
final String whereClause = COLUMNNAME_A_Asset_ID+"=?"
|
final String whereClause = COLUMNNAME_A_Asset_ID+"=?"
|
||||||
+" AND "+COLUMNNAME_PostingType+"=? ";
|
+" AND "+COLUMNNAME_PostingType+"=? AND " + COLUMNNAME_C_AcctSchema_ID + "=?" ;
|
||||||
|
|
||||||
|
int acctSchemaId = C_AcctSchema_ID==0 ? MClient.get(ctx).getAcctSchema().get_ID() : C_AcctSchema_ID;
|
||||||
MDepreciationWorkfile wk = new Query(ctx, MDepreciationWorkfile.Table_Name, whereClause, trxName)
|
MDepreciationWorkfile wk = new Query(ctx, MDepreciationWorkfile.Table_Name, whereClause, trxName)
|
||||||
.setParameters(new Object[]{A_Asset_ID, postingType})
|
.setParameters(new Object[]{A_Asset_ID, postingType,acctSchemaId})
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,6 +340,19 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
}
|
}
|
||||||
return wk;
|
return wk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get/load workfile from cache (if trxName is null)
|
||||||
|
* @param ctx
|
||||||
|
* @param A_Asset_ID
|
||||||
|
* @param postingType
|
||||||
|
* @param trxName
|
||||||
|
* @return workfile
|
||||||
|
*/
|
||||||
|
public static MDepreciationWorkfile get (Properties ctx, int A_Asset_ID, String postingType, String trxName)
|
||||||
|
{
|
||||||
|
return get(ctx, A_Asset_ID, postingType, trxName, 0);
|
||||||
|
}
|
||||||
/** Static cache: Asset/PostingType -> Workfile */
|
/** Static cache: Asset/PostingType -> Workfile */
|
||||||
private static CCache<MultiKey, MDepreciationWorkfile>
|
private static CCache<MultiKey, MDepreciationWorkfile>
|
||||||
s_cacheAsset = new CCache<MultiKey, MDepreciationWorkfile>(Table_Name, Table_Name+"_Asset", 10);
|
s_cacheAsset = new CCache<MultiKey, MDepreciationWorkfile>(Table_Name, Table_Name+"_Asset", 10);
|
||||||
|
@ -362,7 +383,7 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
*/
|
*/
|
||||||
public MAssetAcct getA_AssetAcct(Timestamp dateAcct, String trxName)
|
public MAssetAcct getA_AssetAcct(Timestamp dateAcct, String trxName)
|
||||||
{
|
{
|
||||||
return MAssetAcct.forA_Asset_ID(getCtx(), getA_Asset_ID(), getPostingType(), dateAcct, trxName);
|
return MAssetAcct.forA_Asset_ID(getCtx(), getC_AcctSchema_ID(), getA_Asset_ID(), getPostingType(), dateAcct, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the current cost of FAs. It is calculated as the difference between acquisition value and the value that you (A_Salvage_Value)
|
/** Returns the current cost of FAs. It is calculated as the difference between acquisition value and the value that you (A_Salvage_Value)
|
||||||
|
@ -562,10 +583,11 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
String whereClause = MDepreciationExp.COLUMNNAME_A_Asset_ID+"=?"
|
String whereClause = MDepreciationExp.COLUMNNAME_A_Asset_ID+"=?"
|
||||||
+" AND "+MDepreciationExp.COLUMNNAME_PostingType+"=?"
|
+" AND "+MDepreciationExp.COLUMNNAME_PostingType+"=?"
|
||||||
+" AND "+MDepreciationExp.COLUMNNAME_Processed+"=? AND IsActive=?"
|
+" AND "+MDepreciationExp.COLUMNNAME_Processed+"=? AND IsActive=?"
|
||||||
|
+" AND "+MDepreciationExp.COLUMNNAME_C_AcctSchema_ID+"=?"
|
||||||
;
|
;
|
||||||
//
|
//
|
||||||
MDepreciationExp depexp = new Query(getCtx(), MDepreciationExp.Table_Name, whereClause, get_TrxName())
|
MDepreciationExp depexp = new Query(getCtx(), MDepreciationExp.Table_Name, whereClause, get_TrxName())
|
||||||
.setParameters(new Object[]{getA_Asset_ID(), getPostingType(), true, true})
|
.setParameters(new Object[]{getA_Asset_ID(), getPostingType(), true, true, getC_AcctSchema_ID()})
|
||||||
.setOrderBy(MDepreciationExp.COLUMNNAME_A_Period+" DESC"
|
.setOrderBy(MDepreciationExp.COLUMNNAME_A_Period+" DESC"
|
||||||
+","+MDepreciationExp.COLUMNNAME_DateAcct+" DESC")
|
+","+MDepreciationExp.COLUMNNAME_DateAcct+" DESC")
|
||||||
.first();
|
.first();
|
||||||
|
@ -701,8 +723,9 @@ public class MDepreciationWorkfile extends X_A_Depreciation_Workfile
|
||||||
+" AND "+MDepreciationExp.COLUMNNAME_A_Period+">=?"
|
+" AND "+MDepreciationExp.COLUMNNAME_A_Period+">=?"
|
||||||
+" AND "+MDepreciationExp.COLUMNNAME_A_Asset_ID+"=?"
|
+" AND "+MDepreciationExp.COLUMNNAME_A_Asset_ID+"=?"
|
||||||
+" AND "+MDepreciationExp.COLUMNNAME_PostingType+"=?"
|
+" AND "+MDepreciationExp.COLUMNNAME_PostingType+"=?"
|
||||||
|
+" AND "+MDepreciationExp.COLUMNNAME_C_AcctSchema_ID+"=?"
|
||||||
;
|
;
|
||||||
Object[] params = new Object[]{false, A_Current_Period, getA_Asset_ID(), getPostingType()};
|
Object[] params = new Object[]{false, A_Current_Period, getA_Asset_ID(), getPostingType(), getC_AcctSchema_ID()};
|
||||||
int no = DB.executeUpdateEx(sql, params, trxName);
|
int no = DB.executeUpdateEx(sql, params, trxName);
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("sql=" + sql + "\nDeleted #" + no);
|
if (log.isLoggable(Level.FINE)) log.fine("sql=" + sql + "\nDeleted #" + no);
|
||||||
} // truncDepreciation
|
} // truncDepreciation
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class X_A_Asset_Addition extends PO implements I_A_Asset_Addition, I_Pers
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20190106L;
|
private static final long serialVersionUID = 20190409L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_A_Asset_Addition (Properties ctx, int A_Asset_Addition_ID, String trxName)
|
public X_A_Asset_Addition (Properties ctx, int A_Asset_Addition_ID, String trxName)
|
||||||
|
@ -41,20 +41,12 @@ public class X_A_Asset_Addition extends PO implements I_A_Asset_Addition, I_Pers
|
||||||
super (ctx, A_Asset_Addition_ID, trxName);
|
super (ctx, A_Asset_Addition_ID, trxName);
|
||||||
/** if (A_Asset_Addition_ID == 0)
|
/** if (A_Asset_Addition_ID == 0)
|
||||||
{
|
{
|
||||||
setA_Accumulated_Depr (Env.ZERO);
|
|
||||||
// 0
|
|
||||||
setA_Accumulated_Depr_Adjust (false);
|
|
||||||
// N
|
|
||||||
setA_Accumulated_Depr_F (Env.ZERO);
|
|
||||||
// 0
|
|
||||||
setA_Asset_Addition_ID (0);
|
setA_Asset_Addition_ID (0);
|
||||||
setA_Asset_ID (0);
|
setA_Asset_ID (0);
|
||||||
setA_CapvsExp (null);
|
setA_CapvsExp (null);
|
||||||
// 'Cap'
|
// 'Cap'
|
||||||
setA_CreateAsset (false);
|
setA_CreateAsset (false);
|
||||||
// 'N'
|
// 'N'
|
||||||
setA_Period_Start (0);
|
|
||||||
// 0
|
|
||||||
setA_QTY_Current (Env.ZERO);
|
setA_QTY_Current (Env.ZERO);
|
||||||
// 0
|
// 0
|
||||||
setA_SourceType (null);
|
setA_SourceType (null);
|
||||||
|
@ -66,10 +58,6 @@ public class X_A_Asset_Addition extends PO implements I_A_Asset_Addition, I_Pers
|
||||||
setC_Currency_ID (0);
|
setC_Currency_ID (0);
|
||||||
setDateDoc (new Timestamp( System.currentTimeMillis() ));
|
setDateDoc (new Timestamp( System.currentTimeMillis() ));
|
||||||
// @#Date@
|
// @#Date@
|
||||||
setDeltaUseLifeYears (0);
|
|
||||||
// 0
|
|
||||||
setDeltaUseLifeYears_F (0);
|
|
||||||
// 0
|
|
||||||
setDocStatus (null);
|
setDocStatus (null);
|
||||||
// 'DR'
|
// 'DR'
|
||||||
setIsApproved (false);
|
setIsApproved (false);
|
||||||
|
@ -111,61 +99,6 @@ public class X_A_Asset_Addition extends PO implements I_A_Asset_Addition, I_Pers
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set Accumulated Depreciation.
|
|
||||||
@param A_Accumulated_Depr Accumulated Depreciation */
|
|
||||||
public void setA_Accumulated_Depr (BigDecimal A_Accumulated_Depr)
|
|
||||||
{
|
|
||||||
set_Value (COLUMNNAME_A_Accumulated_Depr, A_Accumulated_Depr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get Accumulated Depreciation.
|
|
||||||
@return Accumulated Depreciation */
|
|
||||||
public BigDecimal getA_Accumulated_Depr ()
|
|
||||||
{
|
|
||||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Accumulated_Depr);
|
|
||||||
if (bd == null)
|
|
||||||
return Env.ZERO;
|
|
||||||
return bd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set Adjust Accumulated Depreciation.
|
|
||||||
@param A_Accumulated_Depr_Adjust Adjust Accumulated Depreciation */
|
|
||||||
public void setA_Accumulated_Depr_Adjust (boolean A_Accumulated_Depr_Adjust)
|
|
||||||
{
|
|
||||||
set_Value (COLUMNNAME_A_Accumulated_Depr_Adjust, Boolean.valueOf(A_Accumulated_Depr_Adjust));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get Adjust Accumulated Depreciation.
|
|
||||||
@return Adjust Accumulated Depreciation */
|
|
||||||
public boolean isA_Accumulated_Depr_Adjust ()
|
|
||||||
{
|
|
||||||
Object oo = get_Value(COLUMNNAME_A_Accumulated_Depr_Adjust);
|
|
||||||
if (oo != null)
|
|
||||||
{
|
|
||||||
if (oo instanceof Boolean)
|
|
||||||
return ((Boolean)oo).booleanValue();
|
|
||||||
return "Y".equals(oo);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set Accumulated Depreciation (fiscal).
|
|
||||||
@param A_Accumulated_Depr_F Accumulated Depreciation (fiscal) */
|
|
||||||
public void setA_Accumulated_Depr_F (BigDecimal A_Accumulated_Depr_F)
|
|
||||||
{
|
|
||||||
set_Value (COLUMNNAME_A_Accumulated_Depr_F, A_Accumulated_Depr_F);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get Accumulated Depreciation (fiscal).
|
|
||||||
@return Accumulated Depreciation (fiscal) */
|
|
||||||
public BigDecimal getA_Accumulated_Depr_F ()
|
|
||||||
{
|
|
||||||
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_A_Accumulated_Depr_F);
|
|
||||||
if (bd == null)
|
|
||||||
return Env.ZERO;
|
|
||||||
return bd;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set Asset Addition.
|
/** Set Asset Addition.
|
||||||
@param A_Asset_Addition_ID Asset Addition */
|
@param A_Asset_Addition_ID Asset Addition */
|
||||||
public void setA_Asset_Addition_ID (int A_Asset_Addition_ID)
|
public void setA_Asset_Addition_ID (int A_Asset_Addition_ID)
|
||||||
|
@ -302,23 +235,6 @@ public class X_A_Asset_Addition extends PO implements I_A_Asset_Addition, I_Pers
|
||||||
return ii.intValue();
|
return ii.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set A_Period_Start.
|
|
||||||
@param A_Period_Start A_Period_Start */
|
|
||||||
public void setA_Period_Start (int A_Period_Start)
|
|
||||||
{
|
|
||||||
set_Value (COLUMNNAME_A_Period_Start, Integer.valueOf(A_Period_Start));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get A_Period_Start.
|
|
||||||
@return A_Period_Start */
|
|
||||||
public int getA_Period_Start ()
|
|
||||||
{
|
|
||||||
Integer ii = (Integer)get_Value(COLUMNNAME_A_Period_Start);
|
|
||||||
if (ii == null)
|
|
||||||
return 0;
|
|
||||||
return ii.intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set Current Qty.
|
/** Set Current Qty.
|
||||||
@param A_QTY_Current Current Qty */
|
@param A_QTY_Current Current Qty */
|
||||||
public void setA_QTY_Current (BigDecimal A_QTY_Current)
|
public void setA_QTY_Current (BigDecimal A_QTY_Current)
|
||||||
|
@ -684,43 +600,6 @@ public class X_A_Asset_Addition extends PO implements I_A_Asset_Addition, I_Pers
|
||||||
return (Timestamp)get_Value(COLUMNNAME_DateDoc);
|
return (Timestamp)get_Value(COLUMNNAME_DateDoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set Delta Use Life Years.
|
|
||||||
@param DeltaUseLifeYears Delta Use Life Years */
|
|
||||||
public void setDeltaUseLifeYears (int DeltaUseLifeYears)
|
|
||||||
{
|
|
||||||
set_Value (COLUMNNAME_DeltaUseLifeYears, Integer.valueOf(DeltaUseLifeYears));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get Delta Use Life Years.
|
|
||||||
@return Delta Use Life Years */
|
|
||||||
public int getDeltaUseLifeYears ()
|
|
||||||
{
|
|
||||||
Integer ii = (Integer)get_Value(COLUMNNAME_DeltaUseLifeYears);
|
|
||||||
if (ii == null)
|
|
||||||
return 0;
|
|
||||||
return ii.intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set Delta Use Life Years (fiscal).
|
|
||||||
@param DeltaUseLifeYears_F
|
|
||||||
Delta Use Life Years (fiscal)
|
|
||||||
*/
|
|
||||||
public void setDeltaUseLifeYears_F (int DeltaUseLifeYears_F)
|
|
||||||
{
|
|
||||||
set_Value (COLUMNNAME_DeltaUseLifeYears_F, Integer.valueOf(DeltaUseLifeYears_F));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get Delta Use Life Years (fiscal).
|
|
||||||
@return Delta Use Life Years (fiscal)
|
|
||||||
*/
|
|
||||||
public int getDeltaUseLifeYears_F ()
|
|
||||||
{
|
|
||||||
Integer ii = (Integer)get_Value(COLUMNNAME_DeltaUseLifeYears_F);
|
|
||||||
if (ii == null)
|
|
||||||
return 0;
|
|
||||||
return ii.intValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set Description.
|
/** Set Description.
|
||||||
@param Description
|
@param Description
|
||||||
Optional short description of the record
|
Optional short description of the record
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class X_A_Depreciation_Exp extends PO implements I_A_Depreciation_Exp, I_
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20190106L;
|
private static final long serialVersionUID = 20190409L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_A_Depreciation_Exp (Properties ctx, int A_Depreciation_Exp_ID, String trxName)
|
public X_A_Depreciation_Exp (Properties ctx, int A_Depreciation_Exp_ID, String trxName)
|
||||||
|
@ -438,6 +438,34 @@ public class X_A_Depreciation_Exp extends PO implements I_A_Depreciation_Exp, I_
|
||||||
return ii.intValue();
|
return ii.intValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException
|
||||||
|
{
|
||||||
|
return (org.compiere.model.I_C_AcctSchema)MTable.get(getCtx(), org.compiere.model.I_C_AcctSchema.Table_Name)
|
||||||
|
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
|
||||||
|
|
||||||
|
/** Set Accounting Schema.
|
||||||
|
@param C_AcctSchema_ID
|
||||||
|
Rules for accounting
|
||||||
|
*/
|
||||||
|
public void setC_AcctSchema_ID (int C_AcctSchema_ID)
|
||||||
|
{
|
||||||
|
if (C_AcctSchema_ID < 1)
|
||||||
|
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, null);
|
||||||
|
else
|
||||||
|
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Accounting Schema.
|
||||||
|
@return Rules for accounting
|
||||||
|
*/
|
||||||
|
public int getC_AcctSchema_ID ()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
public I_C_ValidCombination getCR_Account() throws RuntimeException
|
public I_C_ValidCombination getCR_Account() throws RuntimeException
|
||||||
{
|
{
|
||||||
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
|
return (I_C_ValidCombination)MTable.get(getCtx(), I_C_ValidCombination.Table_Name)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class X_A_Depreciation_Workfile extends PO implements I_A_Depreciation_Wo
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 20190106L;
|
private static final long serialVersionUID = 20190409L;
|
||||||
|
|
||||||
/** Standard Constructor */
|
/** Standard Constructor */
|
||||||
public X_A_Depreciation_Workfile (Properties ctx, int A_Depreciation_Workfile_ID, String trxName)
|
public X_A_Depreciation_Workfile (Properties ctx, int A_Depreciation_Workfile_ID, String trxName)
|
||||||
|
@ -666,6 +666,34 @@ public class X_A_Depreciation_Workfile extends PO implements I_A_Depreciation_Wo
|
||||||
return bd;
|
return bd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public org.compiere.model.I_C_AcctSchema getC_AcctSchema() throws RuntimeException
|
||||||
|
{
|
||||||
|
return (org.compiere.model.I_C_AcctSchema)MTable.get(getCtx(), org.compiere.model.I_C_AcctSchema.Table_Name)
|
||||||
|
.getPO(getC_AcctSchema_ID(), get_TrxName()); }
|
||||||
|
|
||||||
|
/** Set Accounting Schema.
|
||||||
|
@param C_AcctSchema_ID
|
||||||
|
Rules for accounting
|
||||||
|
*/
|
||||||
|
public void setC_AcctSchema_ID (int C_AcctSchema_ID)
|
||||||
|
{
|
||||||
|
if (C_AcctSchema_ID < 1)
|
||||||
|
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, null);
|
||||||
|
else
|
||||||
|
set_ValueNoCheck (COLUMNNAME_C_AcctSchema_ID, Integer.valueOf(C_AcctSchema_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get Accounting Schema.
|
||||||
|
@return Rules for accounting
|
||||||
|
*/
|
||||||
|
public int getC_AcctSchema_ID ()
|
||||||
|
{
|
||||||
|
Integer ii = (Integer)get_Value(COLUMNNAME_C_AcctSchema_ID);
|
||||||
|
if (ii == null)
|
||||||
|
return 0;
|
||||||
|
return ii.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
/** Set Account Date.
|
/** Set Account Date.
|
||||||
@param DateAcct
|
@param DateAcct
|
||||||
Accounting Date
|
Accounting Date
|
||||||
|
|
|
@ -60,22 +60,15 @@ public class CalloutA_Asset_Addition extends CalloutEngine
|
||||||
{
|
{
|
||||||
if (isCalloutActive())
|
if (isCalloutActive())
|
||||||
return "";
|
return "";
|
||||||
//
|
//
|
||||||
String columnName = mField.getColumnName();
|
BigDecimal amtEntered = (BigDecimal) mTab.getValue(MAssetAddition.COLUMNNAME_AssetAmtEntered);
|
||||||
if (MAssetAddition.COLUMNNAME_A_Accumulated_Depr.equals(columnName))
|
mTab.setValue(MAssetAddition.COLUMNNAME_AssetSourceAmt, amtEntered);
|
||||||
{
|
MConversionRateUtil.convertBase(SetGetUtil.wrap(mTab),
|
||||||
mTab.setValue(MAssetAddition.COLUMNNAME_A_Accumulated_Depr_F, value);
|
MAssetAddition.COLUMNNAME_DateAcct,
|
||||||
}
|
MAssetAddition.COLUMNNAME_AssetSourceAmt,
|
||||||
else
|
MAssetAddition.COLUMNNAME_AssetValueAmt,
|
||||||
{
|
mField.getColumnName());
|
||||||
BigDecimal amtEntered = (BigDecimal) mTab.getValue(MAssetAddition.COLUMNNAME_AssetAmtEntered);
|
|
||||||
mTab.setValue(MAssetAddition.COLUMNNAME_AssetSourceAmt, amtEntered);
|
|
||||||
MConversionRateUtil.convertBase(SetGetUtil.wrap(mTab),
|
|
||||||
MAssetAddition.COLUMNNAME_DateAcct,
|
|
||||||
MAssetAddition.COLUMNNAME_AssetSourceAmt,
|
|
||||||
MAssetAddition.COLUMNNAME_AssetValueAmt,
|
|
||||||
mField.getColumnName());
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -91,10 +84,7 @@ public class CalloutA_Asset_Addition extends CalloutEngine
|
||||||
|
|
||||||
public String uselife(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
public String uselife(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
||||||
{
|
{
|
||||||
if (MAssetAddition.COLUMNNAME_DeltaUseLifeYears.equals(mField.getColumnName()))
|
|
||||||
{
|
|
||||||
mTab.setValue(MAssetAddition.COLUMNNAME_DeltaUseLifeYears_F, value);
|
|
||||||
}
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,10 +92,7 @@ public class CalloutA_Asset_Addition extends CalloutEngine
|
||||||
public String periodOffset(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
public String periodOffset(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
|
||||||
{
|
{
|
||||||
I_A_Asset_Addition aa = GridTabWrapper.create(mTab, I_A_Asset_Addition.class);
|
I_A_Asset_Addition aa = GridTabWrapper.create(mTab, I_A_Asset_Addition.class);
|
||||||
if (!aa.isA_Accumulated_Depr_Adjust())
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
int periods = TimeUtil.getMonthsBetween(aa.getDateDoc(), aa.getDateAcct());
|
int periods = TimeUtil.getMonthsBetween(aa.getDateDoc(), aa.getDateAcct());
|
||||||
if (periods <= 0)
|
if (periods <= 0)
|
||||||
|
@ -113,16 +100,7 @@ public class CalloutA_Asset_Addition extends CalloutEngine
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
int uselifeMonths = aa.getDeltaUseLifeYears() * 12;
|
|
||||||
if (uselifeMonths == 0)
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
double monthlyExpenseSL = aa.getAssetValueAmt().doubleValue() / uselifeMonths * periods;
|
|
||||||
|
|
||||||
aa.setA_Period_Start(periods + 1);
|
|
||||||
aa.setA_Accumulated_Depr(BigDecimal.valueOf(monthlyExpenseSL));
|
|
||||||
aa.setA_Accumulated_Depr_F(BigDecimal.valueOf(monthlyExpenseSL));
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class CalloutA_Asset_Transfer extends CalloutEngine
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
MAssetAcct acct = MAssetAcct.forA_Asset_ID(ctx, model.getA_Asset_ID(), model.getPostingType(), model.getDateAcct(), null);
|
MAssetAcct acct = MAssetAcct.forA_Asset_ID(ctx,model.getC_AcctSchema_ID(), model.getA_Asset_ID(), model.getPostingType(), model.getDateAcct(), null);
|
||||||
if (acct == null)
|
if (acct == null)
|
||||||
{
|
{
|
||||||
return "@NotFound@ @A_Asset_Acct_ID@";
|
return "@NotFound@ @A_Asset_Acct_ID@";
|
||||||
|
|
|
@ -20,10 +20,10 @@ package org.idempiere.fa.process;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.model.MAssetAddition;
|
||||||
|
import org.compiere.model.MProduct;
|
||||||
import org.compiere.model.MProductCategory;
|
import org.compiere.model.MProductCategory;
|
||||||
import org.compiere.model.MProject;
|
import org.compiere.model.MProject;
|
||||||
import org.compiere.model.MProduct;
|
|
||||||
import org.compiere.model.MAssetAddition;
|
|
||||||
import org.compiere.process.DocAction;
|
import org.compiere.process.DocAction;
|
||||||
import org.compiere.process.ProcessInfoParameter;
|
import org.compiere.process.ProcessInfoParameter;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
|
@ -42,11 +42,7 @@ public class ProjectCreateAsset extends SvrProcess
|
||||||
|
|
||||||
/** Product */
|
/** Product */
|
||||||
private int m_Product_ID = 0;
|
private int m_Product_ID = 0;
|
||||||
|
|
||||||
/** Use Life Years */
|
|
||||||
private int m_UseLifeYears = 0;
|
|
||||||
|
|
||||||
|
|
||||||
/** DateTrx for create asset */
|
/** DateTrx for create asset */
|
||||||
private Timestamp m_DateTrx = null;
|
private Timestamp m_DateTrx = null;
|
||||||
|
|
||||||
|
@ -70,7 +66,7 @@ public class ProjectCreateAsset extends SvrProcess
|
||||||
m_Product_ID = para[i].getParameterAsInt();
|
m_Product_ID = para[i].getParameterAsInt();
|
||||||
}
|
}
|
||||||
else if (para[i].getParameterName().equalsIgnoreCase("UseLifeYears")) {
|
else if (para[i].getParameterName().equalsIgnoreCase("UseLifeYears")) {
|
||||||
m_UseLifeYears = para[i].getParameterAsInt();
|
;
|
||||||
}
|
}
|
||||||
else if (para[i].getParameterName().equalsIgnoreCase("DateTrx")) {
|
else if (para[i].getParameterName().equalsIgnoreCase("DateTrx")) {
|
||||||
m_DateTrx = (Timestamp)para[i].getParameter();
|
m_DateTrx = (Timestamp)para[i].getParameter();
|
||||||
|
@ -106,10 +102,7 @@ public class ProjectCreateAsset extends SvrProcess
|
||||||
assetAdd.setDateAcct(m_DateTrx);
|
assetAdd.setDateAcct(m_DateTrx);
|
||||||
assetAdd.setDateDoc(m_DateTrx);
|
assetAdd.setDateDoc(m_DateTrx);
|
||||||
assetAdd.setM_Product_ID(m_Product_ID);
|
assetAdd.setM_Product_ID(m_Product_ID);
|
||||||
if(m_UseLifeYears > 0) {
|
|
||||||
assetAdd.setDeltaUseLifeYears(m_UseLifeYears);
|
|
||||||
assetAdd.setDeltaUseLifeYears_F(m_UseLifeYears);
|
|
||||||
}
|
|
||||||
assetAdd.saveEx();
|
assetAdd.saveEx();
|
||||||
if (!assetAdd.processIt(DocAction.ACTION_Complete)) {
|
if (!assetAdd.processIt(DocAction.ACTION_Complete)) {
|
||||||
return "Error Process Asset Addition";
|
return "Error Process Asset Addition";
|
||||||
|
|
Loading…
Reference in New Issue