Fixes issue 23159: Replace A_Asset_Post stored procedure by a Java process
authorMikel Irurita <mikel.irurita@openbravo.com>
Tue, 26 Feb 2013 09:54:17 +0100
changeset 19836 79424448942a
parent 19835 cf93a9fc7d1e
child 19837 d292f59ef8c5
Fixes issue 23159: Replace A_Asset_Post stored procedure by a Java process
src-db/database/model/tables/A_ASSET.xml
src-db/database/model/tables/A_ASSET_GROUP.xml
src-db/database/sourcedata/AD_CALLOUT.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_MODEL_OBJECT.xml
src-db/database/sourcedata/AD_PROCESS.xml
src/org/openbravo/erpCommon/ad_callouts/SL_Depreciate.java
src/org/openbravo/erpCommon/ad_process/assets/AssetLinearDepreciationMethodProcess.java
--- a/src-db/database/model/tables/A_ASSET.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/model/tables/A_ASSET.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -245,6 +245,14 @@
         <default><![CDATA[N]]></default>
         <onCreateDefault/>
       </column>
+      <column name="IS30DAYMONTH" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[Y]]></default>
+        <onCreateDefault><![CDATA['Y']]></onCreateDefault>
+      </column>
+      <column name="PROCESS_ASSET" primaryKey="false" required="true" type="VARCHAR" size="60" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="A_ASSET_GROUP" name="A_ASSET_A_ASSET_GROUP">
         <reference local="A_ASSET_GROUP_ID" foreign="A_ASSET_GROUP_ID"/>
       </foreign-key>
--- a/src-db/database/model/tables/A_ASSET_GROUP.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/model/tables/A_ASSET_GROUP.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -77,6 +77,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="IS30DAYMONTH" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[Y]]></default>
+        <onCreateDefault><![CDATA['Y']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="A_ASSET_GROUP_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/src-db/database/sourcedata/AD_CALLOUT.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_CALLOUT.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -1,14 +1,5 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
-<!--100--><AD_CALLOUT>
-<!--100-->  <AD_CALLOUT_ID><![CDATA[100]]></AD_CALLOUT_ID>
-<!--100-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--100-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--100-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--100-->  <NAME><![CDATA[A_Asset_Post0]]></NAME>
-<!--100-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--100--></AD_CALLOUT>
-
 <!--102--><AD_CALLOUT>
 <!--102-->  <AD_CALLOUT_ID><![CDATA[102]]></AD_CALLOUT_ID>
 <!--102-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -148982,7 +148982,6 @@
 <!--801177-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--801177-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--801177-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
-<!--801177-->  <AD_CALLOUT_ID><![CDATA[100]]></AD_CALLOUT_ID>
 <!--801177-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--801177-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--801177-->  <POSITION><![CDATA[52]]></POSITION>
@@ -222687,6 +222686,44 @@
 <!--11F755DE7007411FA9D61421815A71E1-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--11F755DE7007411FA9D61421815A71E1--></AD_COLUMN>
 
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C--><AD_COLUMN>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_COLUMN_ID><![CDATA[123ECC9DA80E47D6BBE8D3C8E9ACC59C]]></AD_COLUMN_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <NAME><![CDATA[Process_Asset]]></NAME>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <DESCRIPTION><![CDATA[A confirmation that the associated documents or requests are processed.]]></DESCRIPTION>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <HELP><![CDATA[The Processed checkbox indicates that a document has been processed.]]></HELP>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <COLUMNNAME><![CDATA[Process_Asset]]></COLUMNNAME>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_TABLE_ID><![CDATA[539]]></AD_TABLE_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_REFERENCE_VALUE_ID><![CDATA[800042]]></AD_REFERENCE_VALUE_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <SEQNO><![CDATA[410]]></SEQNO>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_ELEMENT_ID><![CDATA[1047]]></AD_ELEMENT_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_PROCESS_ID><![CDATA[85601427EAEE401FA0250FF0A6DD62EF]]></AD_PROCESS_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <POSITION><![CDATA[66]]></POSITION>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--123ECC9DA80E47D6BBE8D3C8E9ACC59C--></AD_COLUMN>
+
 <!--12D57FF1727C4142B92FE30883E69C3A--><AD_COLUMN>
 <!--12D57FF1727C4142B92FE30883E69C3A-->  <AD_COLUMN_ID><![CDATA[12D57FF1727C4142B92FE30883E69C3A]]></AD_COLUMN_ID>
 <!--12D57FF1727C4142B92FE30883E69C3A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -227542,6 +227579,42 @@
 <!--2B5F702BA50F4C2ABB8E14B77F8BE893-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--2B5F702BA50F4C2ABB8E14B77F8BE893--></AD_COLUMN>
 
+<!--2B73F68086B54FDAB6D5682A3CAAE548--><AD_COLUMN>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_COLUMN_ID><![CDATA[2B73F68086B54FDAB6D5682A3CAAE548]]></AD_COLUMN_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <NAME><![CDATA[Every Month is 30 Days]]></NAME>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <DESCRIPTION><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></DESCRIPTION>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <HELP><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></HELP>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <COLUMNNAME><![CDATA[Is30DayMonth]]></COLUMNNAME>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_TABLE_ID><![CDATA[542]]></AD_TABLE_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <DEFAULTVALUE><![CDATA[Y]]></DEFAULTVALUE>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <SEQNO><![CDATA[81]]></SEQNO>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_ELEMENT_ID><![CDATA[D8028ED62BC34DAFBD15048D0AB458BB]]></AD_ELEMENT_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <POSITION><![CDATA[20]]></POSITION>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--2B73F68086B54FDAB6D5682A3CAAE548-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--2B73F68086B54FDAB6D5682A3CAAE548--></AD_COLUMN>
+
 <!--2B75F38C92694C8C9AEA6874C58DE200--><AD_COLUMN>
 <!--2B75F38C92694C8C9AEA6874C58DE200-->  <AD_COLUMN_ID><![CDATA[2B75F38C92694C8C9AEA6874C58DE200]]></AD_COLUMN_ID>
 <!--2B75F38C92694C8C9AEA6874C58DE200-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -311062,6 +311135,42 @@
 <!--E644E732A207448EAB7CBE80D616AB6F-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--E644E732A207448EAB7CBE80D616AB6F--></AD_COLUMN>
 
+<!--E65B23843227486A99BAC4C2074C258C--><AD_COLUMN>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_COLUMN_ID><![CDATA[E65B23843227486A99BAC4C2074C258C]]></AD_COLUMN_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E65B23843227486A99BAC4C2074C258C-->  <NAME><![CDATA[Every Month is 30 Days]]></NAME>
+<!--E65B23843227486A99BAC4C2074C258C-->  <DESCRIPTION><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></DESCRIPTION>
+<!--E65B23843227486A99BAC4C2074C258C-->  <HELP><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></HELP>
+<!--E65B23843227486A99BAC4C2074C258C-->  <COLUMNNAME><![CDATA[Is30DayMonth]]></COLUMNNAME>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_TABLE_ID><![CDATA[539]]></AD_TABLE_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--E65B23843227486A99BAC4C2074C258C-->  <DEFAULTVALUE><![CDATA[Y]]></DEFAULTVALUE>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--E65B23843227486A99BAC4C2074C258C-->  <SEQNO><![CDATA[390]]></SEQNO>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_ELEMENT_ID><![CDATA[D8028ED62BC34DAFBD15048D0AB458BB]]></AD_ELEMENT_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--E65B23843227486A99BAC4C2074C258C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--E65B23843227486A99BAC4C2074C258C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E65B23843227486A99BAC4C2074C258C-->  <POSITION><![CDATA[62]]></POSITION>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--E65B23843227486A99BAC4C2074C258C-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--E65B23843227486A99BAC4C2074C258C-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--E65B23843227486A99BAC4C2074C258C-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--E65B23843227486A99BAC4C2074C258C--></AD_COLUMN>
+
 <!--E65F829C8E0B420A8B6D42A1A2DC9195--><AD_COLUMN>
 <!--E65F829C8E0B420A8B6D42A1A2DC9195-->  <AD_COLUMN_ID><![CDATA[E65F829C8E0B420A8B6D42A1A2DC9195]]></AD_COLUMN_ID>
 <!--E65F829C8E0B420A8B6D42A1A2DC9195-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -30608,6 +30608,20 @@
 <!--D6B8F4BF589745C2BFC0E41C36E47FDF-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--D6B8F4BF589745C2BFC0E41C36E47FDF--></AD_ELEMENT>
 
+<!--D8028ED62BC34DAFBD15048D0AB458BB--><AD_ELEMENT>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <AD_ELEMENT_ID><![CDATA[D8028ED62BC34DAFBD15048D0AB458BB]]></AD_ELEMENT_ID>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <COLUMNNAME><![CDATA[Is30DayMonth]]></COLUMNNAME>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <NAME><![CDATA[Every Month is 30 Days]]></NAME>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <PRINTNAME><![CDATA[Every Month is 30 Days]]></PRINTNAME>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <DESCRIPTION><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></DESCRIPTION>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <HELP><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></HELP>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D8028ED62BC34DAFBD15048D0AB458BB-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--D8028ED62BC34DAFBD15048D0AB458BB--></AD_ELEMENT>
+
 <!--D83B9497015D4097989560C2348969BE--><AD_ELEMENT>
 <!--D83B9497015D4097989560C2348969BE-->  <AD_ELEMENT_ID><![CDATA[D83B9497015D4097989560C2348969BE]]></AD_ELEMENT_ID>
 <!--D83B9497015D4097989560C2348969BE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -122093,7 +122093,7 @@
 <!--801542-->  <AD_FIELD_ID><![CDATA[801542]]></AD_FIELD_ID>
 <!--801542-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--801542-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--801542-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--801542-->  <ISACTIVE><![CDATA[N]]></ISACTIVE>
 <!--801542-->  <NAME><![CDATA[Create Amortization]]></NAME>
 <!--801542-->  <DESCRIPTION><![CDATA[Create Amortization]]></DESCRIPTION>
 <!--801542-->  <HELP><![CDATA[Create Amortization]]></HELP>
@@ -183109,6 +183109,35 @@
 <!--1FD883541D6147F2A0A85578B3059C35-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--1FD883541D6147F2A0A85578B3059C35--></AD_FIELD>
 
+<!--1FDBA66A997C4CA68B43A69C18DD2F55--><AD_FIELD>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <AD_FIELD_ID><![CDATA[1FDBA66A997C4CA68B43A69C18DD2F55]]></AD_FIELD_ID>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <NAME><![CDATA[Every Month is 30 Days]]></NAME>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <DESCRIPTION><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></DESCRIPTION>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <HELP><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></HELP>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <AD_TAB_ID><![CDATA[800078]]></AD_TAB_ID>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <AD_COLUMN_ID><![CDATA[E65B23843227486A99BAC4C2074C258C]]></AD_COLUMN_ID>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <DISPLAYLOGIC><![CDATA[@IsDepreciated@='Y' & @Amortizationcalctype@='TI' & (@Assetschedule@='YE' | @Assetschedule@='MO')]]></DISPLAYLOGIC>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <SEQNO><![CDATA[155]]></SEQNO>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--1FDBA66A997C4CA68B43A69C18DD2F55--></AD_FIELD>
+
 <!--1FDCBB4CB99E4F268395F71CA08DA589--><AD_FIELD>
 <!--1FDCBB4CB99E4F268395F71CA08DA589-->  <AD_FIELD_ID><![CDATA[1FDCBB4CB99E4F268395F71CA08DA589]]></AD_FIELD_ID>
 <!--1FDCBB4CB99E4F268395F71CA08DA589-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -226353,6 +226382,35 @@
 <!--838F6E0317FA40C48442ECB864AB542E-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--838F6E0317FA40C48442ECB864AB542E--></AD_FIELD>
 
+<!--8391231E7A9F4E6294D8B5853185EB83--><AD_FIELD>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <AD_FIELD_ID><![CDATA[8391231E7A9F4E6294D8B5853185EB83]]></AD_FIELD_ID>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <NAME><![CDATA[Generate Amortization Plan]]></NAME>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <DESCRIPTION><![CDATA[Generate Amortization Plan]]></DESCRIPTION>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <HELP><![CDATA[This process will generate the amortization plan based on the depreciation method selected in the asset.]]></HELP>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <AD_TAB_ID><![CDATA[800078]]></AD_TAB_ID>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <AD_COLUMN_ID><![CDATA[123ECC9DA80E47D6BBE8D3C8E9ACC59C]]></AD_COLUMN_ID>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <DISPLAYLOGIC><![CDATA[@IsDepreciated@='Y']]></DISPLAYLOGIC>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <SEQNO><![CDATA[320]]></SEQNO>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--8391231E7A9F4E6294D8B5853185EB83-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--8391231E7A9F4E6294D8B5853185EB83--></AD_FIELD>
+
 <!--8391DD88AF67E827E040007F01016D35--><AD_FIELD>
 <!--8391DD88AF67E827E040007F01016D35-->  <AD_FIELD_ID><![CDATA[8391DD88AF67E827E040007F01016D35]]></AD_FIELD_ID>
 <!--8391DD88AF67E827E040007F01016D35-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -250633,6 +250691,35 @@
 <!--B49468B2715F4E4BA03EF28576E90D27-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--B49468B2715F4E4BA03EF28576E90D27--></AD_FIELD>
 
+<!--B4AF107652F4486E95840FD882F63464--><AD_FIELD>
+<!--B4AF107652F4486E95840FD882F63464-->  <AD_FIELD_ID><![CDATA[B4AF107652F4486E95840FD882F63464]]></AD_FIELD_ID>
+<!--B4AF107652F4486E95840FD882F63464-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B4AF107652F4486E95840FD882F63464-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B4AF107652F4486E95840FD882F63464-->  <NAME><![CDATA[Every Month is 30 Days]]></NAME>
+<!--B4AF107652F4486E95840FD882F63464-->  <DESCRIPTION><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></DESCRIPTION>
+<!--B4AF107652F4486E95840FD882F63464-->  <HELP><![CDATA[When calculating the amortization plan every month will be considered as a 30 day month.]]></HELP>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--B4AF107652F4486E95840FD882F63464-->  <AD_TAB_ID><![CDATA[452]]></AD_TAB_ID>
+<!--B4AF107652F4486E95840FD882F63464-->  <AD_COLUMN_ID><![CDATA[2B73F68086B54FDAB6D5682A3CAAE548]]></AD_COLUMN_ID>
+<!--B4AF107652F4486E95840FD882F63464-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--B4AF107652F4486E95840FD882F63464-->  <DISPLAYLOGIC><![CDATA[@IsDepreciated@='Y' & @Amortizationcalctype@='TI' & (@Assetschedule@='YE' | @Assetschedule@='MO')]]></DISPLAYLOGIC>
+<!--B4AF107652F4486E95840FD882F63464-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--B4AF107652F4486E95840FD882F63464-->  <SEQNO><![CDATA[140]]></SEQNO>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--B4AF107652F4486E95840FD882F63464-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--B4AF107652F4486E95840FD882F63464-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--B4AF107652F4486E95840FD882F63464-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--B4AF107652F4486E95840FD882F63464-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--B4AF107652F4486E95840FD882F63464-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--B4AF107652F4486E95840FD882F63464-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--B4AF107652F4486E95840FD882F63464--></AD_FIELD>
+
 <!--B4B8ECFAA73A420280E2A9C8B6CADF26--><AD_FIELD>
 <!--B4B8ECFAA73A420280E2A9C8B6CADF26-->  <AD_FIELD_ID><![CDATA[B4B8ECFAA73A420280E2A9C8B6CADF26]]></AD_FIELD_ID>
 <!--B4B8ECFAA73A420280E2A9C8B6CADF26-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -15102,6 +15102,17 @@
 <!--15CDE4BE875A46608CEB541331D2CFE7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--15CDE4BE875A46608CEB541331D2CFE7--></AD_MESSAGE>
 
+<!--162CE9D031904006B69A7C40B5C1E55E--><AD_MESSAGE>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <AD_MESSAGE_ID><![CDATA[162CE9D031904006B69A7C40B5C1E55E]]></AD_MESSAGE_ID>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <VALUE><![CDATA[ASSET_USABLE_LIFE_MONTHS]]></VALUE>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <MSGTEXT><![CDATA[Usable Life - Months]]></MSGTEXT>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--162CE9D031904006B69A7C40B5C1E55E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--162CE9D031904006B69A7C40B5C1E55E--></AD_MESSAGE>
+
 <!--164937FDAAF344F1A958007F98DD53FC--><AD_MESSAGE>
 <!--164937FDAAF344F1A958007F98DD53FC-->  <AD_MESSAGE_ID><![CDATA[164937FDAAF344F1A958007F98DD53FC]]></AD_MESSAGE_ID>
 <!--164937FDAAF344F1A958007F98DD53FC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -15389,6 +15400,17 @@
 <!--1CF066F6A68F419CA5241635305B9B77-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--1CF066F6A68F419CA5241635305B9B77--></AD_MESSAGE>
 
+<!--1D5D2925CB05481485FA38B582B0DD28--><AD_MESSAGE>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <AD_MESSAGE_ID><![CDATA[1D5D2925CB05481485FA38B582B0DD28]]></AD_MESSAGE_ID>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <VALUE><![CDATA[ASSET_DEPRECIATION_AMOUNT]]></VALUE>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <MSGTEXT><![CDATA[Depreciation Amount]]></MSGTEXT>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--1D5D2925CB05481485FA38B582B0DD28-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--1D5D2925CB05481485FA38B582B0DD28--></AD_MESSAGE>
+
 <!--1D9A15F68BC447C68725A544F8ED1719--><AD_MESSAGE>
 <!--1D9A15F68BC447C68725A544F8ED1719-->  <AD_MESSAGE_ID><![CDATA[1D9A15F68BC447C68725A544F8ED1719]]></AD_MESSAGE_ID>
 <!--1D9A15F68BC447C68725A544F8ED1719-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -16320,6 +16342,17 @@
 <!--37F3E24F755145D0A02DCAFFBE71E458-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--37F3E24F755145D0A02DCAFFBE71E458--></AD_MESSAGE>
 
+<!--3825F09ED9394245B85E9C7CDB878F59--><AD_MESSAGE>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <AD_MESSAGE_ID><![CDATA[3825F09ED9394245B85E9C7CDB878F59]]></AD_MESSAGE_ID>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <VALUE><![CDATA[ASSET_FULLY_DEPRECIATED]]></VALUE>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <MSGTEXT><![CDATA[Asset is fully depreciated]]></MSGTEXT>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--3825F09ED9394245B85E9C7CDB878F59-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--3825F09ED9394245B85E9C7CDB878F59--></AD_MESSAGE>
+
 <!--38E1FA87C7734186B03CF30F020247F9--><AD_MESSAGE>
 <!--38E1FA87C7734186B03CF30F020247F9-->  <AD_MESSAGE_ID><![CDATA[38E1FA87C7734186B03CF30F020247F9]]></AD_MESSAGE_ID>
 <!--38E1FA87C7734186B03CF30F020247F9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -18799,6 +18832,17 @@
 <!--8B03AFC7AAEC4EEBB7364F2BB9A80C99-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8B03AFC7AAEC4EEBB7364F2BB9A80C99--></AD_MESSAGE>
 
+<!--8B0BCE32498B440CA11D5CC1523F7A1E--><AD_MESSAGE>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <AD_MESSAGE_ID><![CDATA[8B0BCE32498B440CA11D5CC1523F7A1E]]></AD_MESSAGE_ID>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <VALUE><![CDATA[ASSET_MANDATORY_POSSITIVE]]></VALUE>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <MSGTEXT><![CDATA[%s field cannot be empty, zero or negative.]]></MSGTEXT>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8B0BCE32498B440CA11D5CC1523F7A1E--></AD_MESSAGE>
+
 <!--8B634715472A4D33A1850ADDF76972CB--><AD_MESSAGE>
 <!--8B634715472A4D33A1850ADDF76972CB-->  <AD_MESSAGE_ID><![CDATA[8B634715472A4D33A1850ADDF76972CB]]></AD_MESSAGE_ID>
 <!--8B634715472A4D33A1850ADDF76972CB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -18945,6 +18989,17 @@
 <!--8F3E26D7655C42718BD12468136EA296-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--8F3E26D7655C42718BD12468136EA296--></AD_MESSAGE>
 
+<!--8F2EC1874B364DF1A771756411EE0FD8--><AD_MESSAGE>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <AD_MESSAGE_ID><![CDATA[8F2EC1874B364DF1A771756411EE0FD8]]></AD_MESSAGE_ID>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <VALUE><![CDATA[ASSET_CURRENCY_MANDATORY]]></VALUE>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <MSGTEXT><![CDATA[Currency field cannot be empty]]></MSGTEXT>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--8F2EC1874B364DF1A771756411EE0FD8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8F2EC1874B364DF1A771756411EE0FD8--></AD_MESSAGE>
+
 <!--90227390063C4D1BA7187A2F12C6A55A--><AD_MESSAGE>
 <!--90227390063C4D1BA7187A2F12C6A55A-->  <AD_MESSAGE_ID><![CDATA[90227390063C4D1BA7187A2F12C6A55A]]></AD_MESSAGE_ID>
 <!--90227390063C4D1BA7187A2F12C6A55A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -19144,6 +19199,17 @@
 <!--9549E1F434DA40DDBE250F282E838E70-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--9549E1F434DA40DDBE250F282E838E70--></AD_MESSAGE>
 
+<!--962016E6A29E48B2AA948C17368C6E2D--><AD_MESSAGE>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <AD_MESSAGE_ID><![CDATA[962016E6A29E48B2AA948C17368C6E2D]]></AD_MESSAGE_ID>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <VALUE><![CDATA[ASSET_MANDATORY_STARTDATE]]></VALUE>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <MSGTEXT><![CDATA[The start date field is mandatory]]></MSGTEXT>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--962016E6A29E48B2AA948C17368C6E2D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--962016E6A29E48B2AA948C17368C6E2D--></AD_MESSAGE>
+
 <!--964970901F024B758E76DA42A008349E--><AD_MESSAGE>
 <!--964970901F024B758E76DA42A008349E-->  <AD_MESSAGE_ID><![CDATA[964970901F024B758E76DA42A008349E]]></AD_MESSAGE_ID>
 <!--964970901F024B758E76DA42A008349E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -20800,6 +20866,17 @@
 <!--C9CF4255155E4E7C88BA8C2ACA27602E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--C9CF4255155E4E7C88BA8C2ACA27602E--></AD_MESSAGE>
 
+<!--C9EC78E52F074B1B8540985C2BEC2EE4--><AD_MESSAGE>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <AD_MESSAGE_ID><![CDATA[C9EC78E52F074B1B8540985C2BEC2EE4]]></AD_MESSAGE_ID>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <VALUE><![CDATA[ASSET_ANNUAL_DEPRECIATION]]></VALUE>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <MSGTEXT><![CDATA[Annual Depreciation]]></MSGTEXT>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--C9EC78E52F074B1B8540985C2BEC2EE4--></AD_MESSAGE>
+
 <!--CA348A3EB0E34DD1B6BACC25FDD7BECC--><AD_MESSAGE>
 <!--CA348A3EB0E34DD1B6BACC25FDD7BECC-->  <AD_MESSAGE_ID><![CDATA[CA348A3EB0E34DD1B6BACC25FDD7BECC]]></AD_MESSAGE_ID>
 <!--CA348A3EB0E34DD1B6BACC25FDD7BECC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -21086,6 +21163,17 @@
 <!--D4CC612B2C4649C29400F220FE577656-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--D4CC612B2C4649C29400F220FE577656--></AD_MESSAGE>
 
+<!--D5274238436B46D29AB9F56DDE94D66D--><AD_MESSAGE>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <AD_MESSAGE_ID><![CDATA[D5274238436B46D29AB9F56DDE94D66D]]></AD_MESSAGE_ID>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <VALUE><![CDATA[ASSET_USABLE_LIFE_YEARS]]></VALUE>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <MSGTEXT><![CDATA[Usable Life - Years]]></MSGTEXT>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--D5274238436B46D29AB9F56DDE94D66D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D5274238436B46D29AB9F56DDE94D66D--></AD_MESSAGE>
+
 <!--D58A82FD33BA4CE98D3059C140B24491--><AD_MESSAGE>
 <!--D58A82FD33BA4CE98D3059C140B24491-->  <AD_MESSAGE_ID><![CDATA[D58A82FD33BA4CE98D3059C140B24491]]></AD_MESSAGE_ID>
 <!--D58A82FD33BA4CE98D3059C140B24491-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -3819,6 +3819,18 @@
 <!--85EBAA271E76A71BE040007F010174ED-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
 <!--85EBAA271E76A71BE040007F010174ED--></AD_MODEL_OBJECT>
 
+<!--893D5EA2377748B69FE201A7E50B692C--><AD_MODEL_OBJECT>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <AD_MODEL_OBJECT_ID><![CDATA[893D5EA2377748B69FE201A7E50B692C]]></AD_MODEL_OBJECT_ID>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <ACTION><![CDATA[P]]></ACTION>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_process.assets.AssetLinearDepreciationMethodProcess]]></CLASSNAME>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <AD_PROCESS_ID><![CDATA[85601427EAEE401FA0250FF0A6DD62EF]]></AD_PROCESS_ID>
+<!--893D5EA2377748B69FE201A7E50B692C-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--893D5EA2377748B69FE201A7E50B692C--></AD_MODEL_OBJECT>
+
 <!--8993A79B45F8457CB56FC27F084FF5C6--><AD_MODEL_OBJECT>
 <!--8993A79B45F8457CB56FC27F084FF5C6-->  <AD_MODEL_OBJECT_ID><![CDATA[8993A79B45F8457CB56FC27F084FF5C6]]></AD_MODEL_OBJECT_ID>
 <!--8993A79B45F8457CB56FC27F084FF5C6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_PROCESS.xml	Fri Mar 01 13:03:17 2013 +0100
+++ b/src-db/database/sourcedata/AD_PROCESS.xml	Tue Feb 26 09:54:17 2013 +0100
@@ -6080,6 +6080,28 @@
 <!--7EDBFEC35BDA4FF4AF05ED516CDAFB90-->  <PREVENTCONCURRENT><![CDATA[N]]></PREVENTCONCURRENT>
 <!--7EDBFEC35BDA4FF4AF05ED516CDAFB90--></AD_PROCESS>
 
+<!--85601427EAEE401FA0250FF0A6DD62EF--><AD_PROCESS>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <AD_PROCESS_ID><![CDATA[85601427EAEE401FA0250FF0A6DD62EF]]></AD_PROCESS_ID>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <VALUE><![CDATA[Generate Amortization Plan]]></VALUE>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <NAME><![CDATA[Generate Amortization Plan]]></NAME>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <DESCRIPTION><![CDATA[Generate Amortization Plan]]></DESCRIPTION>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <HELP><![CDATA[This process will generate the amortization plan based on the depreciation method selected in the asset.]]></HELP>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ACCESSLEVEL><![CDATA[1]]></ACCESSLEVEL>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISUSERSTARTABLE><![CDATA[N]]></ISUSERSTARTABLE>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISREPORT><![CDATA[N]]></ISREPORT>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISDIRECTPRINT><![CDATA[N]]></ISDIRECTPRINT>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISBACKGROUND><![CDATA[N]]></ISBACKGROUND>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISJASPER><![CDATA[N]]></ISJASPER>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISEXTERNALSERVICE><![CDATA[N]]></ISEXTERNALSERVICE>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <UIPATTERN><![CDATA[S]]></UIPATTERN>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <ISADVANCEDFEATURE><![CDATA[N]]></ISADVANCEDFEATURE>
+<!--85601427EAEE401FA0250FF0A6DD62EF-->  <PREVENTCONCURRENT><![CDATA[N]]></PREVENTCONCURRENT>
+<!--85601427EAEE401FA0250FF0A6DD62EF--></AD_PROCESS>
+
 <!--970EAD9B846648A7AB1F0CCA5058356C--><AD_PROCESS>
 <!--970EAD9B846648A7AB1F0CCA5058356C-->  <AD_PROCESS_ID><![CDATA[970EAD9B846648A7AB1F0CCA5058356C]]></AD_PROCESS_ID>
 <!--970EAD9B846648A7AB1F0CCA5058356C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Depreciate.java	Fri Mar 01 13:03:17 2013 +0100
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Depreciate.java	Tue Feb 26 09:54:17 2013 +0100
@@ -43,6 +43,7 @@
         info.addResult("inpassetschedule", assetGroup.getAmortize());
         info.addResult("inpuselifemonths", assetGroup.getUsableLifeMonths());
         info.addResult("inpuselifeyears", assetGroup.getUsableLifeYears());
+        info.addResult("inpis30daymonth", assetGroup.isEveryMonthIs30Days() ? "Y" : "N");
       } finally {
         OBContext.restorePreviousMode();
       }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_process/assets/AssetLinearDepreciationMethodProcess.java	Tue Feb 26 09:54:17 2013 +0100
@@ -0,0 +1,735 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License. 
+ * The Original Code is Openbravo ERP. 
+ * The Initial Developer of the Original Code is Openbravo SLU 
+ * All portions are Copyright (C) 2013 Openbravo SLU 
+ * All Rights Reserved. 
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.erpCommon.ad_process.assets;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Query;
+import org.hibernate.criterion.Restrictions;
+import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.provider.OBProvider;
+import org.openbravo.dal.core.DalUtil;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.dal.service.OBQuery;
+import org.openbravo.erpCommon.utility.OBDateUtils;
+import org.openbravo.erpCommon.utility.OBError;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.openbravo.model.common.currency.Currency;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.financialmgmt.accounting.Costcenter;
+import org.openbravo.model.financialmgmt.accounting.UserDimension1;
+import org.openbravo.model.financialmgmt.accounting.UserDimension2;
+import org.openbravo.model.financialmgmt.assetmgmt.Amortization;
+import org.openbravo.model.financialmgmt.assetmgmt.AmortizationLine;
+import org.openbravo.model.financialmgmt.assetmgmt.Asset;
+import org.openbravo.model.marketing.Campaign;
+import org.openbravo.model.materialmgmt.cost.ABCActivity;
+import org.openbravo.model.project.Project;
+import org.openbravo.scheduling.ProcessBundle;
+import org.openbravo.service.db.DalBaseProcess;
+import org.openbravo.service.db.DbUtility;
+
+public class AssetLinearDepreciationMethodProcess extends DalBaseProcess {
+  static Logger log4j = Logger.getLogger(AssetLinearDepreciationMethodProcess.class);
+  private static final String LINEAR = "LI";
+  private static final String TIME = "TI";
+  private static final String PERCENTAGE = "PE";
+  private static final String MONTH = "MO";
+  private static final String YEAR = "YE";
+  private static final BigDecimal HUNDRED = new BigDecimal("100");
+  private static final BigDecimal THIRTY = new BigDecimal("30");
+  private static final BigDecimal YEARDAYS = new BigDecimal("365");
+  private final static MathContext mc = new MathContext(32, RoundingMode.HALF_UP);
+
+  @Override
+  public void doExecute(ProcessBundle bundle) throws Exception {
+    OBError msg = new OBError();
+    try {
+      final String strAssetId = (String) bundle.getParams().get("A_Asset_ID");
+      final Asset asset = (Asset) OBDal.getInstance().getProxy(Asset.ENTITY_NAME, strAssetId);
+      msg = generateAmortizationPlan(asset);
+
+    } catch (final Exception e) {
+      OBDal.getInstance().rollbackAndClose();
+      log4j.error("Exception found in AssetLinearDepreciationMethodProcess process: ", e);
+
+      Throwable ex = DbUtility.getUnderlyingSQLException(e);
+      String message = OBMessageUtils.translateError(ex.getMessage()).getMessage();
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(message);
+
+    } finally {
+      bundle.setResult(msg);
+    }
+  }
+
+  public OBError generateAmortizationPlan(Asset asset) throws Exception {
+    OBError msg = new OBError();
+    msg.setType("Success");
+    msg.setTitle(OBMessageUtils.messageBD("Success"));
+
+    // =========== Read asset properties ===========
+    Date startDate = asset.getDepreciationStartDate();
+    if (startDate == null) {
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(OBMessageUtils.messageBD("ASSET_MANDATORY_STARTDATE"));
+      return msg;
+    }
+
+    log4j.debug("A_ASSET_POST: " + asset.getName() + " - " + asset.getDocumentNo());
+
+    Calendar calStart = Calendar.getInstance();
+    calStart.setTime(startDate);
+    calStart.set(Calendar.HOUR, 0);
+    calStart.set(Calendar.MINUTE, 0);
+    calStart.set(Calendar.SECOND, 0);
+    startDate = calStart.getTime();
+
+    // End date is calculated based on depreciation type
+    Calendar calRealEnd = Calendar.getInstance();
+    calRealEnd.setTime(startDate);
+    String depreciationType = asset.getDepreciationType(); // Linear
+    String calculateType = asset.getCalculateType(); // Time or Percentage
+    String amortizationFrequency = asset.getAmortize(); // Monthly or Yearly
+    BigDecimal uselifeMonths = asset.getUsableLifeMonths() == null ? BigDecimal.ZERO
+        : new BigDecimal(asset.getUsableLifeMonths());
+    boolean is30DayMonth = asset.isEveryMonthIs30Days();
+    boolean is365DayYear = asset.isEveryMonthIs30Days();
+    BigDecimal uselifeYears = asset.getUsableLifeYears() == null ? BigDecimal.ZERO
+        : new BigDecimal(asset.getUsableLifeYears());
+    BigDecimal annualDepreciation = asset.getAnnualDepreciation() == null ? BigDecimal.ZERO : asset
+        .getAnnualDepreciation();
+    BigDecimal depreciationAmount = asset.getDepreciationAmt() == null ? BigDecimal.ZERO : asset
+        .getDepreciationAmt();
+    BigDecimal previouslyDepreciatedAmount = asset.getPreviouslyDepreciatedAmt() == null ? BigDecimal.ZERO
+        : asset.getPreviouslyDepreciatedAmt();
+
+    BigDecimal totalPeriods = BigDecimal.ZERO; // Total amortization lines (records in the tab)
+    BigDecimal amountPerPeriod = BigDecimal.ZERO; // Amount to depreciate per period (month or year)
+
+    List<AmortizationLine> amortizationLineList = asset.getFinancialMgmtAmortizationLineList();
+    BigDecimal alreadyAmortizedPeriods = new BigDecimal(amortizationLineList.size());
+    // When recalculating the amortization the asset can be partially amortized
+    BigDecimal alreadyAmortizedAmount = BigDecimal.ZERO;
+    Calendar maxAmortizationDateCal = (Calendar) calStart.clone();
+    for (AmortizationLine al : amortizationLineList) {
+      alreadyAmortizedAmount = alreadyAmortizedAmount.add(al.getAmortizationAmount());
+      Date amortizationEndDate = al.getAmortization().getEndingDate();
+      if (amortizationEndDate.compareTo(maxAmortizationDateCal.getTime()) > 0) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(amortizationEndDate);
+        // Add one because you want to new the next day
+        cal.add(Calendar.DATE, 1);
+        maxAmortizationDateCal = cal;
+      }
+    }
+
+    // Total amount to be depreciated (including already depreciated amount)
+    BigDecimal amount = depreciationAmount.subtract(previouslyDepreciatedAmount);
+    // Pending amount to be depreciated
+    BigDecimal pendingAmountToAmortize = amount.subtract(alreadyAmortizedAmount);
+    BigDecimal totalDays = BigDecimal.ZERO;
+
+    boolean isMonthly = false;
+    boolean isYearly = false;
+    boolean isPercentage = false;
+
+    // =========== Validations ===========
+    if (amount.compareTo(BigDecimal.ZERO) <= 0) {
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(String.format(OBMessageUtils.messageBD("ASSET_MANDATORY_POSSITIVE"),
+          OBMessageUtils.messageBD("ASSET_DEPRECIATION_AMOUNT")));
+      return msg;
+    }
+    if (pendingAmountToAmortize.compareTo(BigDecimal.ZERO) == 0) {
+      msg.setType("Warning");
+      msg.setTitle("");
+      msg.setMessage(OBMessageUtils.messageBD("ASSET_FULLY_DEPRECIATED"));
+      return msg;
+    }
+    if (LINEAR.equals(depreciationType) && PERCENTAGE.equals(calculateType)
+        && annualDepreciation.compareTo(BigDecimal.ZERO) <= 0) {
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(String.format(OBMessageUtils.messageBD("ASSET_MANDATORY_POSSITIVE"),
+          OBMessageUtils.messageBD("ASSET_ANNUAL_DEPRECIATION")));
+      return msg;
+    }
+    if (TIME.equals(calculateType) && MONTH.equals(amortizationFrequency)
+        && uselifeMonths.compareTo(BigDecimal.ZERO) <= 0) {
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(String.format(OBMessageUtils.messageBD("ASSET_MANDATORY_POSSITIVE"),
+          OBMessageUtils.messageBD("ASSET_USABLE_LIFE_MONTHS")));
+      return msg;
+    }
+    if (TIME.equals(calculateType) && YEAR.equals(amortizationFrequency)
+        && uselifeYears.compareTo(BigDecimal.ZERO) <= 0) {
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(String.format(OBMessageUtils.messageBD("ASSET_MANDATORY_POSSITIVE"),
+          OBMessageUtils.messageBD("ASSET_USABLE_LIFE_YEARS")));
+      return msg;
+    }
+    if (asset.getCurrency() == null) {
+      msg.setType("Error");
+      msg.setTitle(OBMessageUtils.messageBD("Error"));
+      msg.setMessage(OBMessageUtils.messageBD("ASSET_CURRENCY_MANDATORY"));
+      return msg;
+    }
+    int stdPrecision = 2;
+    try {
+      OBContext.setAdminMode(true);
+      stdPrecision = asset.getCurrency().getStandardPrecision().intValue();
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+
+    // =========== Calculate amount to amortize per period ===========
+    if (LINEAR.equals(depreciationType)) {
+      if (PERCENTAGE.equals(calculateType)) {
+        isPercentage = true;
+        totalPeriods = HUNDRED.divide(annualDepreciation, RoundingMode.CEILING);
+        // If the depreciation start date is not the first day of the period increment by 1 the
+        // number of periods
+        totalPeriods = (calStart.get(Calendar.DAY_OF_MONTH) == 1 && calStart.get(Calendar.MONTH) == 0) ? totalPeriods
+            : totalPeriods.add(BigDecimal.ONE);
+        amountPerPeriod = amount.multiply(annualDepreciation, mc).divide(HUNDRED, mc);
+
+      } else if (TIME.equals(calculateType)) {
+        if (MONTH.equals(amortizationFrequency)) {
+          // Calculate real end date
+          // From: 01/01/2013, 2 months, calRealdEnd = 01/03/2012
+          calRealEnd.add(Calendar.MONTH, uselifeMonths.intValue());
+          isMonthly = true;
+          // If the depreciation start date is not the first day of the period increment by 1 the
+          // number of periods
+          totalPeriods = (calStart.get(Calendar.DAY_OF_MONTH) == 1) ? uselifeMonths : uselifeMonths
+              .add(BigDecimal.ONE);
+
+          if (is30DayMonth) {
+            // Calculate total days proportional to months of 30 days
+            if (alreadyAmortizedPeriods.compareTo(BigDecimal.ZERO) > 0) {
+              // totalDays = calculateNumberOfDaysIn30DayMonths(maxAmortizationDateCal, calRealEnd);
+              totalDays = getDaysBetweenProportionalPeriods(maxAmortizationDateCal, calRealEnd,
+                  isYearly, isMonthly);
+            } else {
+              totalDays = uselifeMonths.multiply(THIRTY, mc);
+            }
+          } else {
+            // Calculate total natural days
+            totalDays = new BigDecimal(FIN_Utility.getDaysBetween(maxAmortizationDateCal.getTime(),
+                calRealEnd.getTime()));
+          }
+
+          if (totalDays.compareTo(BigDecimal.ZERO) == 0) {
+            return msg;
+          }
+
+          // From: 01/01/2013, 2 months, calRealdEnd = 01/03/2012
+          // Decrease by one. Last day should be the last day (included) of the range (28/02/2013)
+          calRealEnd.add(Calendar.DATE, -1);
+
+        } else if (YEAR.equals(amortizationFrequency)) {
+          // Calculate real end date
+          // From: 01/01/2013, 1 year, calRealdEnd = 01/01/2014
+          calRealEnd.add(Calendar.YEAR, uselifeYears.intValue());
+          isYearly = true;
+          // If the depreciation start date is not the first day of the period increment by 1 the
+          // number of periods
+          totalPeriods = (calStart.get(Calendar.DAY_OF_MONTH) == 1 && calStart.get(Calendar.MONTH) == 0) ? uselifeYears
+              : uselifeYears.add(BigDecimal.ONE);
+          amountPerPeriod = amount.divide(uselifeYears, mc);
+
+          if (is365DayYear) {
+            // Calculate total days proportional to years of 365 days
+            if (alreadyAmortizedPeriods.compareTo(BigDecimal.ZERO) > 0) {
+              totalDays = getDaysBetweenProportionalPeriods(maxAmortizationDateCal, calRealEnd,
+                  isYearly, isMonthly);
+            } else {
+              totalDays = uselifeYears.multiply(YEARDAYS, mc);
+            }
+          } else {
+            // Calculate total natural days
+            totalDays = new BigDecimal(FIN_Utility.getDaysBetween(maxAmortizationDateCal.getTime(),
+                calRealEnd.getTime()));
+          }
+
+          if (totalDays.compareTo(BigDecimal.ZERO) == 0) {
+            return msg;
+          }
+
+          // Decrease by one. Last day should be the last day (included) of the range (31/12/2013)
+          // From: 01/01/2013, 1 year, calRealdEnd = 01/01/2014
+          calRealEnd.add(Calendar.DATE, -1);
+
+        } else {
+          msg.setType("Error");
+          msg.setTitle(OBMessageUtils.messageBD("Error"));
+          msg.setMessage("Unsupported amortization frequency: " + amortizationFrequency);
+          return msg;
+        }
+      } else {
+        msg.setType("Error");
+        msg.setTitle(OBMessageUtils.messageBD("Error"));
+        msg.setMessage("Unsupported amortization calculation type: " + calculateType);
+        return msg;
+      }
+    }
+
+    // Calendar auxiliary variables
+    Calendar calAux = Calendar.getInstance();
+    calAux.setTime(startDate);
+    // First and last period (month or year) day. For example, 2 month, starting on 17/01/12.
+    // period 1: calFirstDayOfPeriod = 01/01/12, calLastDayOfPeriod = 31/01/12.
+    // period 2: calFirstDayOfPeriod = 01/02/12, calLastDayOfPeriod = 29/01/12.
+    // period 3: calFirstDayOfPeriod = 01/03/12, calLastDayOfPeriod = 31/03/12.
+    Calendar calLastDayOfPeriod = Calendar.getInstance(); // Last period (month or year) day.
+    Calendar calFirstDayOfPeriod = (Calendar) calStart.clone(); // First period (month or year) day.
+    calFirstDayOfPeriod.set(Calendar.DAY_OF_MONTH, 1);
+    if (YEAR.equals(amortizationFrequency)) {
+      calFirstDayOfPeriod.set(Calendar.MONTH, 0);
+    }
+
+    int currentYear = calStart.get(Calendar.YEAR);
+    int currentMonth = calStart.get(Calendar.MONTH);
+    int currentMonthDay = calStart.get(Calendar.DAY_OF_MONTH);
+    int currentYearDay = calAux.get(Calendar.DAY_OF_YEAR);
+    int lastDayOfMonth = calStart.getActualMaximum(Calendar.DAY_OF_MONTH);
+    int lastDayOfYear = calStart.getActualMaximum(Calendar.DAY_OF_YEAR);
+
+    BigDecimal totalizedAmount = BigDecimal.ZERO;
+    BigDecimal totalizedPercentage = BigDecimal.ZERO;
+    BigDecimal proportionalAmount = BigDecimal.ZERO;
+    BigDecimal contDays = BigDecimal.ZERO;
+    int contPeriods = 0;
+    boolean endOfRange = false;
+    int maxDaysOfRange = 0;
+    Long seqNoAsset = null;
+
+    // Loop till full amount is depreciated
+    for (; !calAux.after(calRealEnd) || (isPercentage && totalizedAmount.compareTo(amount) < 0); calAux
+        .add(Calendar.DATE, 1)) {
+      contDays = contDays.add(BigDecimal.ONE);
+      if (currentYear != calAux.get(Calendar.YEAR)) {
+        currentYear = calAux.get(Calendar.YEAR);
+        lastDayOfYear = calAux.getActualMaximum(Calendar.DAY_OF_YEAR);
+      }
+      if (currentMonth != calAux.get(Calendar.MONTH)) {
+        currentMonth = calAux.get(Calendar.MONTH);
+        lastDayOfMonth = calAux.getActualMaximum(Calendar.DAY_OF_MONTH);
+      }
+
+      currentMonthDay = calAux.get(Calendar.DAY_OF_MONTH);
+      currentYearDay = calAux.get(Calendar.DAY_OF_YEAR);
+
+      // Month
+      if (isMonthly && currentMonthDay == lastDayOfMonth) {
+        endOfRange = true;
+        maxDaysOfRange = lastDayOfMonth;
+      }
+      // Percentage or Year
+      if ((isPercentage || isYearly) && currentYearDay == lastDayOfYear) {
+        endOfRange = true;
+        maxDaysOfRange = lastDayOfYear;
+      }
+
+      // Last day of range (last iteration in the loop)
+      if (!isPercentage && calAux.compareTo(calRealEnd) == 0) {
+        endOfRange = true;
+        // Month
+        if (isMonthly) {
+          maxDaysOfRange = lastDayOfMonth;
+        }
+        // Percentage or Year
+        if (isPercentage || isYearly) {
+          maxDaysOfRange = lastDayOfYear;
+        }
+      }
+
+      if (endOfRange) {
+        contPeriods += 1;
+        calLastDayOfPeriod = (Calendar) calAux.clone();
+        calLastDayOfPeriod.set(Calendar.DAY_OF_MONTH,
+            calAux.getActualMaximum(Calendar.DAY_OF_MONTH));
+        if (isYearly) {
+          calLastDayOfPeriod.set(Calendar.MONTH, calAux.getActualMaximum(Calendar.MONTH));
+        }
+
+        AmortizationLine amortizationLine = getAmortizationLine(asset,
+            calFirstDayOfPeriod.getTime(), calLastDayOfPeriod.getTime());
+
+        if (amortizationLine != null) {
+          // Recalculate percentage because the amount could have been changed
+          BigDecimal proportionaldPercentage = amortizationLine.getAmortizationAmount()
+              .multiply(HUNDRED).divide(amount, stdPrecision, RoundingMode.HALF_UP);
+          totalizedAmount = totalizedAmount.add(amortizationLine.getAmortizationAmount());
+          totalizedPercentage = totalizedPercentage.add(proportionaldPercentage);
+          amortizationLine.setAmortizationPercentage(proportionaldPercentage);
+          OBDal.getInstance().save(amortizationLine);
+
+        } else {
+          // Calculate the proportional amount for current period (amortization line)
+          if (isPercentage) {
+            proportionalAmount = contDays.multiply(amountPerPeriod, mc).divide(
+                new BigDecimal(maxDaysOfRange), mc);
+          } else {
+            if (isMonthly && is30DayMonth) {
+              contDays = contDays.multiply(THIRTY, mc).divide(new BigDecimal(maxDaysOfRange), mc);
+            }
+            if (isYearly && is365DayYear) {
+              contDays = contDays.multiply(YEARDAYS, mc).divide(new BigDecimal(maxDaysOfRange), mc);
+            }
+            proportionalAmount = contDays.multiply(pendingAmountToAmortize, mc).divide(totalDays,
+                mc);
+
+          }
+
+          // Calculate percentage
+          BigDecimal proportionaldPercentage = proportionalAmount.multiply(HUNDRED)
+              .divide(amount, mc).setScale(stdPrecision, RoundingMode.HALF_UP);
+
+          // Round the amount after using it for percentage calculation
+          proportionalAmount = proportionalAmount.setScale(stdPrecision, RoundingMode.HALF_UP);
+
+          // Last period. Adjust for avoiding rounding issues.
+          if (new BigDecimal(contPeriods).compareTo(totalPeriods) == 0
+              || totalizedAmount.add(proportionalAmount).compareTo(amount) > 0) {
+            proportionalAmount = amount.subtract(totalizedAmount);
+            proportionaldPercentage = HUNDRED.subtract(totalizedPercentage);
+          }
+
+          log4j.debug(OBDateUtils.formatDate(calFirstDayOfPeriod.getTime()) + " to "
+              + OBDateUtils.formatDate(calLastDayOfPeriod.getTime()) + "  " + proportionalAmount
+              + "  " + proportionaldPercentage);
+
+          // Accumulate amount and percentage
+          totalizedAmount = totalizedAmount.add(proportionalAmount);
+          totalizedPercentage = totalizedPercentage.add(proportionaldPercentage);
+
+          // Search for not processed amortization (calFirstDayOfPeriod - calLastDayOfPeriod)
+          Amortization amortization = getAmortization(asset.getOrganization(),
+              calFirstDayOfPeriod.getTime(), calLastDayOfPeriod.getTime(), asset.getProject());
+          if (amortization == null) {
+            amortization = createNewAmortization(asset.getOrganization(),
+                OBDateUtils.formatDate(calLastDayOfPeriod.getTime()), null /* description */,
+                calFirstDayOfPeriod.getTime(), calLastDayOfPeriod.getTime(), asset.getCurrency(),
+                asset.getProject(), null /* campaign */, null /* activity */, null /* user1 */,
+                null /* user2 */);
+          }
+
+          // Calculate asset sequence number.
+          // Asset 1
+          // January lineno = 10, seqnoasset = 10
+          // February lineno = 10, seqnoasset = 20
+          if (seqNoAsset == null) {
+            seqNoAsset = getMaxSeqNoAsset(asset) + 10L;
+          }
+
+          // Calculate amortization line number because the amortization can already exists.
+          Long lineNo = getMaxLineNo(amortization) + 10L;
+
+          // Create the amortization line
+          amortizationLine = createNewAmortizationLine(amortization, lineNo, seqNoAsset, asset,
+              proportionaldPercentage, proportionalAmount, asset.getCurrency(), asset.getProject(),
+              null /* campaign */, null /* activity */, null /* user1 */, null /* user2 */, null /* costcenter */);
+
+          seqNoAsset += 10L;
+        }
+
+        // Initialize new range
+        contDays = BigDecimal.ZERO;
+        calFirstDayOfPeriod = (Calendar) calAux.clone();
+        calFirstDayOfPeriod.add(Calendar.DAY_OF_MONTH, 1);
+        endOfRange = false;
+      }
+    }
+
+    asset.setProcessed("Y");
+    asset.setProcessAsset("Y");
+    asset.setDepreciatedPlan(amount);
+    OBDal.getInstance().save(asset);
+
+    OBDal.getInstance().flush();
+    return msg;
+  }
+
+  /**
+   * Get the amortization period matching given start/end date, organization and project. The
+   * amortization period must be not processed.
+   * 
+   * @param org
+   *          Organization.
+   * @param startDate
+   *          Start date.
+   * @param endDate
+   *          End date.
+   * @return amortization period matching given start/end date, organization and project.
+   */
+  private Amortization getAmortization(Organization org, Date startDate, Date endDate,
+      Project project) {
+    OBCriteria<Amortization> obc = OBDal.getInstance().createCriteria(Amortization.class);
+    obc.add(Restrictions.eq(Amortization.PROPERTY_ORGANIZATION, org));
+    obc.add(Restrictions.eq(Amortization.PROPERTY_STARTINGDATE, startDate));
+    obc.add(Restrictions.eq(Amortization.PROPERTY_ENDINGDATE, endDate));
+    obc.add(Restrictions.eq(Amortization.PROPERTY_PROCESSED, "N"));
+    if (project != null) {
+      obc.add(Restrictions.eq(Amortization.PROPERTY_PROJECT, project));
+    } else {
+      obc.add(Restrictions.isNull(Amortization.PROPERTY_PROJECT));
+    }
+    obc.setFilterOnReadableOrganization(false);
+    List<Amortization> amortizationList = obc.list();
+    if (amortizationList.size() == 0) {
+      return null;
+    } else if (amortizationList.size() > 1) {
+      // FIXME do not hardcode the message
+      throw new OBException("More than one amortization exist from " + startDate.toString()
+          + " to " + endDate.toString() + " for " + org.getName() + " organization");
+    }
+    return amortizationList.get(0);
+  }
+
+  /**
+   * Get the amortization line associated to the given asset and included in the amortization for
+   * the given period range.
+   * 
+   * @param asset
+   *          Asset.
+   * @param startDate
+   *          Start date.
+   * @param endDate
+   *          End date.
+   * @return Amortization line associated to the given asset and included in the amortization for
+   *         the given period range.
+   * @throws OBException
+   *           If more than one amortization line exists for the given period.
+   */
+  private AmortizationLine getAmortizationLine(Asset asset, Date startDate, Date endDate)
+      throws OBException {
+    StringBuilder whereClause = new StringBuilder();
+    final List<Object> parameters = new ArrayList<Object>();
+    whereClause.append(" as aml join aml.amortization as am ");
+    whereClause.append(" where aml.asset.id = ? ");
+    whereClause.append("       and am.startingDate = ?");
+    whereClause.append("       and am.endingDate = ?");
+    final OBQuery<AmortizationLine> obq = OBDal.getInstance().createQuery(AmortizationLine.class,
+        whereClause.toString());
+    obq.setFilterOnReadableOrganization(false);
+    parameters.add(asset.getId());
+    parameters.add(startDate);
+    parameters.add(endDate);
+    obq.setParameters(parameters);
+    List<AmortizationLine> amortizationLineList = obq.list();
+    if (amortizationLineList.size() == 0) {
+      return null;
+    } else if (amortizationLineList.size() > 1) {
+      // FIXME do not hardcode the message
+      throw new OBException("More than one amortization line exist from " + startDate.toString()
+          + " to " + endDate.toString() + " for " + asset.getName() + " asset");
+    }
+    return amortizationLineList.get(0);
+  }
+
+  /**
+   * Create a new amortization.
+   * 
+   * @return Amortization
+   */
+  private Amortization createNewAmortization(Organization organization, String name,
+      String description, Date startDate, Date endDate, Currency currency, Project project,
+      Campaign campaign, ABCActivity activity, UserDimension1 user1, UserDimension2 user2) {
+    Amortization am = OBProvider.getInstance().get(Amortization.class);
+    am.setOrganization(organization);
+    am.setName(name);
+    am.setDescription(description);
+    am.setStartingDate(startDate);
+    am.setEndingDate(endDate);
+    am.setAccountingDate(endDate);
+    am.setCurrency(currency);
+    am.setProject(project);
+    am.setSalesCampaign(campaign);
+    am.setActivity(activity);
+    am.setStDimension(user1);
+    am.setNdDimension(user2);
+
+    OBDal.getInstance().save(am);
+    return am;
+  }
+
+  /**
+   * Create a new amortization line.
+   * 
+   * @return Amortization line.
+   */
+  private AmortizationLine createNewAmortizationLine(Amortization amortization, Long lineNo,
+      Long assetSeqNo, Asset asset, BigDecimal amortizationPercentage,
+      BigDecimal amortizationAmount, Currency currency, Project project, Campaign campaign,
+      ABCActivity activity, UserDimension1 user1, UserDimension2 user2, Costcenter costCenter) {
+    AmortizationLine aml = OBProvider.getInstance().get(AmortizationLine.class);
+    aml.setOrganization(amortization.getOrganization());
+    aml.setAmortization(amortization);
+    aml.setLineNo(lineNo);
+    aml.setSEQNoAsset(assetSeqNo);
+    aml.setAsset(asset);
+    aml.setAmortizationPercentage(amortizationPercentage);
+    aml.setAmortizationAmount(amortizationAmount);
+    aml.setCurrency(currency);
+    aml.setProject(project);
+    aml.setStDimension(user1);
+    aml.setNdDimension(user2);
+    aml.setCostcenter(costCenter);
+
+    OBDal.getInstance().save(aml);
+    return aml;
+  }
+
+  /**
+   * Calculate total days between given dates being the months of 30 days and years of 365 (no
+   * leap-years).
+   * 
+   * @param startDate
+   *          Start date.
+   * @param endDate
+   *          End date.
+   * @param isYearly
+   *          Is yearly amortization.
+   * @param isMonthly
+   *          Is monthly amortization.
+   * @return total days between given dates being the months of 30 days and years of 365 (no
+   *         leap-years). The result can have decimals.
+   */
+  private BigDecimal getDaysBetweenProportionalPeriods(Calendar startDate, Calendar _endDate,
+      boolean isYearly, boolean isMonthly) {
+    Calendar calAux = (Calendar) startDate.clone();
+    Calendar endDate = (Calendar) _endDate.clone();
+    endDate.add(Calendar.DATE, -1);
+    int currentYear = startDate.get(Calendar.YEAR);
+    int currentMonth = startDate.get(Calendar.MONTH);
+    int currentMonthDay = startDate.get(Calendar.DAY_OF_MONTH);
+    int currentYearDay = startDate.get(Calendar.DAY_OF_YEAR);
+    int lastDayOfMonth = startDate.getActualMaximum(Calendar.DAY_OF_MONTH);
+    int lastDayOfYear = startDate.getActualMaximum(Calendar.DAY_OF_YEAR);
+    BigDecimal totalDays = BigDecimal.ZERO;
+    boolean endOfRange = false;
+    for (; !calAux.after(endDate); calAux.add(Calendar.DATE, 1)) {
+      if (currentYear != calAux.get(Calendar.YEAR)) {
+        currentYear = calAux.get(Calendar.YEAR);
+        lastDayOfYear = calAux.getActualMaximum(Calendar.DAY_OF_YEAR);
+      }
+      if (currentMonth != calAux.get(Calendar.MONTH)) {
+        currentMonth = calAux.get(Calendar.MONTH);
+        lastDayOfMonth = calAux.getActualMaximum(Calendar.DAY_OF_MONTH);
+      }
+
+      currentMonthDay = calAux.get(Calendar.DAY_OF_MONTH);
+      currentYearDay = calAux.get(Calendar.DAY_OF_YEAR);
+
+      // Month
+      if (isMonthly && currentMonthDay == lastDayOfMonth) {
+        endOfRange = true;
+      }
+      // Year
+      if (isYearly && currentYearDay == lastDayOfYear) {
+        endOfRange = true;
+      }
+
+      // Last day of range (last iteration in the loop)
+      if (calAux.compareTo(endDate) == 0) {
+        endOfRange = true;
+      }
+
+      if (endOfRange) {
+        BigDecimal proportionalDays = BigDecimal.ZERO;
+        if (isMonthly) {
+          proportionalDays = THIRTY.multiply(new BigDecimal(currentMonthDay), mc).divide(
+              new BigDecimal(lastDayOfMonth), mc);
+
+        } else if (isYearly) {
+          proportionalDays = YEARDAYS.multiply(new BigDecimal(currentYearDay), mc).divide(
+              new BigDecimal(lastDayOfYear), mc);
+        }
+
+        totalDays = totalDays.add(proportionalDays);
+        endOfRange = false;
+      }
+    }
+
+    return totalDays;
+  }
+
+  /**
+   * Get max asset sequence number in amortization lines related to the given asset.
+   * 
+   * @param asset
+   *          Asset.
+   * @return Max asset sequence number in amortization lines related to the given asset. 0 if there
+   *         is no amortization line related to the given asset.
+   */
+  private Long getMaxSeqNoAsset(Asset asset) {
+    StringBuilder hql = new StringBuilder();
+    hql.append(" select coalesce(max(al.sEQNoAsset), 0) as maxSeqNoAsset ");
+    hql.append(" from FinancialMgmtAmortizationLine as al where al.asset.id = ? ");
+    Query query = OBDal.getInstance().getSession().createQuery(hql.toString());
+    query.setString(0, (String) DalUtil.getId(asset));
+    for (Object obj : query.list()) {
+      if (obj != null) {
+        return (Long) obj;
+      }
+    }
+    return 0l;
+  }
+
+  /**
+   * Get max asset sequence number in amortization lines that belong to the given amortization.
+   * 
+   * @param amortization
+   *          Amortization.
+   * @return max asset sequence number in amortization lines that belong to the given amortization.
+   *         0 if there is no amortization line related to the given amortization.
+   */
+  private Long getMaxLineNo(Amortization amortization) {
+    StringBuilder hql = new StringBuilder();
+    hql.append(" select coalesce(max(al.lineNo), 0) as maxSeqNoAsset ");
+    hql.append(" from FinancialMgmtAmortizationLine as al where al.amortization.id = ? ");
+    Query query = OBDal.getInstance().getSession().createQuery(hql.toString());
+    query.setString(0, (String) DalUtil.getId(amortization));
+    for (Object obj : query.list()) {
+      if (obj != null) {
+        return (Long) obj;
+      }
+    }
+    return 0l;
+  }
+
+}